Companion for Weight v1.5 (#5943)

* fix to latest substrate pr

* update weights

* cargo build -p polkadot-runtime-parachains

* fix xcm-builder

* fix import

* fix a bunch

* fix a bunch of weight stuff

* kusama compile

* unused

* builds

* maybe fix

* cargo test -p polkadot-runtime-parachains

* xcm simulator example

* fix tests

* xcm sim fuzz

* fix runtime tests

* remove unused

* fix integration tests

* scalar div

* update lockfile for {"substrate"}

Co-authored-by: parity-processbot <>
This commit is contained in:
Shawn Tabrizi
2022-08-31 12:59:39 +01:00
committed by GitHub
parent 138aae0a22
commit 28e94d97dd
231 changed files with 4577 additions and 4514 deletions
@@ -192,7 +192,7 @@ pub mod pallet {
}
// We didn't return early above, so we didn't do anything.
0
Weight::zero()
}
}
+4 -4
View File
@@ -50,16 +50,16 @@ pub trait WeightInfo {
pub struct TestWeightInfo;
impl WeightInfo for TestWeightInfo {
fn new_auction() -> Weight {
0
Weight::zero()
}
fn bid() -> Weight {
0
Weight::zero()
}
fn cancel_auction() -> Weight {
0
Weight::zero()
}
fn on_initialize() -> Weight {
0
Weight::zero()
}
}
+5 -5
View File
@@ -55,19 +55,19 @@ pub trait WeightInfo {
pub struct TestWeightInfo;
impl WeightInfo for TestWeightInfo {
fn claim() -> Weight {
0
Weight::zero()
}
fn mint_claim() -> Weight {
0
Weight::zero()
}
fn claim_attest() -> Weight {
0
Weight::zero()
}
fn attest() -> Weight {
0
Weight::zero()
}
fn move_claim() -> Weight {
0
Weight::zero()
}
}
@@ -90,7 +90,7 @@ pub mod crowdloan_index_migration {
/// This migration converts crowdloans to use a crowdloan index rather than the parachain id as a
/// unique identifier. This makes it easier to swap two crowdloans between parachains.
pub fn migrate<T: Config>() -> frame_support::weights::Weight {
let mut weight = 0;
let mut weight = Weight::new();
// First migrate `NextTrieIndex` counter to `NextFundIndex`.
+9 -9
View File
@@ -106,31 +106,31 @@ pub trait WeightInfo {
pub struct TestWeightInfo;
impl WeightInfo for TestWeightInfo {
fn create() -> Weight {
0
Weight::zero()
}
fn contribute() -> Weight {
0
Weight::zero()
}
fn withdraw() -> Weight {
0
Weight::zero()
}
fn refund(_k: u32) -> Weight {
0
Weight::zero()
}
fn dissolve() -> Weight {
0
Weight::zero()
}
fn edit() -> Weight {
0
Weight::zero()
}
fn add_memo() -> Weight {
0
Weight::zero()
}
fn on_initialize(_n: u32) -> Weight {
0
Weight::zero()
}
fn poke() -> Weight {
0
Weight::zero()
}
}
+9 -4
View File
@@ -60,7 +60,12 @@ where
#[cfg(test)]
mod tests {
use super::*;
use frame_support::{parameter_types, traits::FindAuthor, weights::DispatchClass, PalletId};
use frame_support::{
parameter_types,
traits::FindAuthor,
weights::{DispatchClass, Weight},
PalletId,
};
use frame_system::limits;
use primitives::v2::AccountId;
use sp_core::H256;
@@ -90,12 +95,12 @@ mod tests {
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub BlockWeights: limits::BlockWeights = limits::BlockWeights::builder()
.base_block(10)
.base_block(Weight::from_ref_time(10))
.for_class(DispatchClass::all(), |weight| {
weight.base_extrinsic = 100;
weight.base_extrinsic = Weight::from_ref_time(100);
})
.for_class(DispatchClass::non_mandatory(), |weight| {
weight.max_total = Some(1024);
weight.max_total = Some(Weight::from_ref_time(1024));
})
.build_or_panic();
pub BlockLength: limits::BlockLength = limits::BlockLength::max(2 * 1024);
@@ -25,6 +25,7 @@ use crate::{
use frame_support::{
assert_noop, assert_ok, parameter_types,
traits::{Currency, GenesisBuild, KeyOwnerProofSystem, OnFinalize, OnInitialize},
weights::Weight,
PalletId,
};
use frame_support_test::TestRandomness;
@@ -103,7 +104,7 @@ use crate::{auctions::Error as AuctionsError, crowdloan::Error as CrowdloanError
parameter_types! {
pub const BlockHashCount: u32 = 250;
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(4 * 1024 * 1024);
frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(4 * 1024 * 1024));
}
impl frame_system::Config for Test {
+1 -1
View File
@@ -69,7 +69,7 @@ pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(1);
/// by Operational extrinsics.
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 2 seconds of compute with a 6 second average block time.
pub const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND;
pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.scalar_saturating_mul(2);
const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct());
+2 -2
View File
@@ -224,10 +224,10 @@ impl frame_support::traits::EstimateNextSessionRotation<u32> for TestNextSession
}
fn estimate_current_session_progress(_now: u32) -> (Option<Permill>, Weight) {
(None, 0)
(None, Weight::zero())
}
fn estimate_next_session_rotation(_now: u32) -> (Option<u32>, Weight) {
(None, 0)
(None, Weight::zero())
}
}
@@ -65,19 +65,19 @@ pub trait WeightInfo {
pub struct TestWeightInfo;
impl WeightInfo for TestWeightInfo {
fn reserve() -> Weight {
0
Weight::zero()
}
fn register() -> Weight {
0
Weight::zero()
}
fn force_register() -> Weight {
0
Weight::zero()
}
fn deregister() -> Weight {
0
Weight::zero()
}
fn swap() -> Weight {
0
Weight::zero()
}
}
@@ -641,7 +641,7 @@ mod tests {
parameter_types! {
pub const BlockHashCount: u32 = 250;
pub BlockWeights: limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(1024));
pub BlockLength: limits::BlockLength =
limits::BlockLength::max_with_normal_ratio(4 * 1024 * 1024, NORMAL_RATIO);
}
+1 -1
View File
@@ -195,7 +195,7 @@ pub mod pallet {
/// We check that the account does not exist at this stage.
///
/// Origin must match the `ValidityOrigin`.
#[pallet::weight(200_000_000 + T::DbWeight::get().reads_writes(4, 1))]
#[pallet::weight(Weight::from_ref_time(200_000_000) + T::DbWeight::get().reads_writes(4, 1))]
pub fn create_account(
origin: OriginFor<T>,
who: T::AccountId,
@@ -51,7 +51,7 @@ pub mod slots_crowdloan_index_migration {
}
pub fn migrate<T: Config + crowdloan::Config>() -> frame_support::weights::Weight {
let mut weight = 0;
let mut weight = Weight::new();
for (para_id, mut leases) in Leases::<T>::iter() {
weight = weight.saturating_add(T::DbWeight::get().reads(2));
+5 -5
View File
@@ -49,16 +49,16 @@ pub trait WeightInfo {
pub struct TestWeightInfo;
impl WeightInfo for TestWeightInfo {
fn force_lease() -> Weight {
0
Weight::zero()
}
fn manage_lease_period_start(_c: u32, _t: u32) -> Weight {
0
Weight::zero()
}
fn clear_all_leases() -> Weight {
0
Weight::zero()
}
fn trigger_onboard() -> Weight {
0
Weight::zero()
}
}
@@ -155,7 +155,7 @@ pub mod pallet {
}
// We didn't return early above, so we didn't do anything.
0
Weight::zero()
}
}