diff --git a/bin/node/runtime/src/impls.rs b/bin/node/runtime/src/impls.rs index de2efdae4af2e..1b9006e75e4b1 100644 --- a/bin/node/runtime/src/impls.rs +++ b/bin/node/runtime/src/impls.rs @@ -340,7 +340,7 @@ mod tests { mb, 10 * mb, Weight::max_value() / 2, - Weight::max_value() + Weight::max_value(), ].into_iter().for_each(|i| { run_with_system_weight(i, || { let next = TargetedFeeAdjustment::::convert(Fixed64::default()); diff --git a/frame/assets/src/lib.rs b/frame/assets/src/lib.rs index 6f4647ac2e4f1..314a8d456940f 100644 --- a/frame/assets/src/lib.rs +++ b/frame/assets/src/lib.rs @@ -240,7 +240,7 @@ impl Module { mod tests { use super::*; - use support::{impl_outer_origin, assert_ok, assert_noop, parameter_types}; + use support::{impl_outer_origin, assert_ok, assert_noop, parameter_types, weights::Weight}; use primitives::H256; // The testing primitives are very useful for avoiding having to work with signatures // or public keys. `u64` is used as the `AccountId` and no `Signature`s are required. @@ -257,7 +257,7 @@ mod tests { pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/aura/src/mock.rs b/frame/aura/src/mock.rs index f476fd1826ae3..c95a36e131518 100644 --- a/frame/aura/src/mock.rs +++ b/frame/aura/src/mock.rs @@ -24,7 +24,7 @@ use sr_primitives::{ traits::IdentityLookup, Perbill, testing::{Header, UintAuthorityId}, }; -use support::{impl_outer_origin, parameter_types}; +use support::{impl_outer_origin, parameter_types, weights::Weight}; use runtime_io; use primitives::H256; @@ -38,7 +38,7 @@ pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); pub const MinimumPeriod: u64 = 1; diff --git a/frame/authority-discovery/src/lib.rs b/frame/authority-discovery/src/lib.rs index b3a5ebded56f4..6c9e316252d9b 100644 --- a/frame/authority-discovery/src/lib.rs +++ b/frame/authority-discovery/src/lib.rs @@ -100,7 +100,7 @@ mod tests { testing::{Header, UintAuthorityId}, traits::{ConvertInto, IdentityLookup, OpaqueKeys}, Perbill, KeyTypeId, }; - use support::{impl_outer_origin, parameter_types}; + use support::{impl_outer_origin, parameter_types, weights::Weight}; type AuthorityDiscovery = Module; type SessionIndex = u32; @@ -144,7 +144,7 @@ mod tests { pub const Offset: BlockNumber = 0; pub const UncleGenerations: u64 = 0; pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/authorship/src/lib.rs b/frame/authorship/src/lib.rs index b4118b93a0d61..de7a07520ebbd 100644 --- a/frame/authorship/src/lib.rs +++ b/frame/authorship/src/lib.rs @@ -365,7 +365,7 @@ mod tests { use sr_primitives::{ traits::{BlakeTwo256, IdentityLookup}, testing::Header, generic::DigestItem, Perbill, }; - use support::{parameter_types, impl_outer_origin, ConsensusEngineId}; + use support::{parameter_types, impl_outer_origin, ConsensusEngineId, weights::Weight}; impl_outer_origin!{ pub enum Origin for Test {} @@ -376,7 +376,7 @@ mod tests { parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/babe/src/mock.rs b/frame/babe/src/mock.rs index d7aed7b42a3fe..847b2a75e1c26 100644 --- a/frame/babe/src/mock.rs +++ b/frame/babe/src/mock.rs @@ -23,7 +23,7 @@ use sr_primitives::{ traits::IdentityLookup, Perbill, testing::{Header, UintAuthorityId}, impl_opaque_keys, }; use sr_version::RuntimeVersion; -use support::{impl_outer_origin, parameter_types}; +use support::{impl_outer_origin, parameter_types, weights::Weight}; use runtime_io; use primitives::{H256, Blake2Hasher}; @@ -39,7 +39,7 @@ pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); pub const MinimumPeriod: u64 = 1; diff --git a/frame/balances/src/mock.rs b/frame/balances/src/mock.rs index 62eabd1cf04d9..1756c77ce20e5 100644 --- a/frame/balances/src/mock.rs +++ b/frame/balances/src/mock.rs @@ -55,7 +55,7 @@ impl Get for CreationFee { pub struct Runtime; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/collective/src/lib.rs b/frame/collective/src/lib.rs index eff8366f0707c..dec87da2465a0 100644 --- a/frame/collective/src/lib.rs +++ b/frame/collective/src/lib.rs @@ -378,7 +378,7 @@ impl< #[cfg(test)] mod tests { use super::*; - use support::{Hashable, assert_ok, assert_noop, parameter_types}; + use support::{Hashable, assert_ok, assert_noop, parameter_types, weights::Weight}; use system::{EventRecord, Phase}; use hex_literal::hex; use primitives::H256; @@ -390,7 +390,7 @@ mod tests { parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index d06565ed8ecb5..6129784d41e35 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -35,7 +35,7 @@ use sr_primitives::{ use support::{ assert_ok, assert_err, impl_outer_dispatch, impl_outer_event, impl_outer_origin, parameter_types, storage::child, StorageMap, StorageValue, traits::{Currency, Get}, - weights::{DispatchInfo, DispatchClass}, + weights::{DispatchInfo, DispatchClass, Weight}, }; use std::{cell::RefCell, sync::atomic::{AtomicUsize, Ordering}}; use primitives::storage::well_known_keys; @@ -94,7 +94,7 @@ impl Get for BlockGasLimit { pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/democracy/src/lib.rs b/frame/democracy/src/lib.rs index 3ff6c1e2ecc72..984204446100d 100644 --- a/frame/democracy/src/lib.rs +++ b/frame/democracy/src/lib.rs @@ -972,7 +972,8 @@ mod tests { use super::*; use support::{ impl_outer_origin, impl_outer_dispatch, assert_noop, assert_ok, parameter_types, - traits::Contains + traits::Contains, + weights::Weight, }; use primitives::H256; use sr_primitives::{traits::{BlakeTwo256, IdentityLookup, Bounded}, testing::Header, Perbill}; @@ -1000,7 +1001,7 @@ mod tests { pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/elections-phragmen/src/lib.rs b/frame/elections-phragmen/src/lib.rs index 4ae237e378309..338ceeba52790 100644 --- a/frame/elections-phragmen/src/lib.rs +++ b/frame/elections-phragmen/src/lib.rs @@ -743,7 +743,7 @@ impl Module { mod tests { use super::*; use std::cell::RefCell; - use support::{assert_ok, assert_noop, parameter_types}; + use support::{assert_ok, assert_noop, parameter_types, weights::Weight}; use substrate_test_utils::assert_eq_uvec; use primitives::H256; use sr_primitives::{ @@ -754,7 +754,7 @@ mod tests { parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/elections/src/mock.rs b/frame/elections/src/mock.rs index 77b13d74a139f..173a45a248586 100644 --- a/frame/elections/src/mock.rs +++ b/frame/elections/src/mock.rs @@ -21,7 +21,8 @@ use std::cell::RefCell; use support::{ StorageValue, StorageMap, parameter_types, assert_ok, - traits::{Get, ChangeMembers, Currency} + traits::{Get, ChangeMembers, Currency}, + weights::Weight, }; use primitives::H256; use sr_primitives::{ @@ -32,7 +33,7 @@ use crate as elections; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/example/src/lib.rs b/frame/example/src/lib.rs index cf22d38f6944a..a73e0d2868884 100644 --- a/frame/example/src/lib.rs +++ b/frame/example/src/lib.rs @@ -287,7 +287,7 @@ impl WeighData<(&BalanceOf,)> for WeightForSetDummy { fn weigh_data(&self, target: (&BalanceOf,)) -> Weight { let multiplier = self.0; - (*target.0 * multiplier).saturated_into::() + (*target.0 * multiplier).saturated_into::() } } @@ -665,7 +665,7 @@ mod tests { pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/executive/src/lib.rs b/frame/executive/src/lib.rs index d160bd7bdd480..d5dc5fa135f4b 100644 --- a/frame/executive/src/lib.rs +++ b/frame/executive/src/lib.rs @@ -393,7 +393,7 @@ mod tests { pub struct Runtime; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } @@ -641,7 +641,7 @@ mod tests { assert!(Executive::apply_extrinsic(x2.clone()).unwrap().is_ok()); // default weight for `TestXt` == encoded length. - assert_eq!(>::all_extrinsics_weight(), (3 * len) as u32); + assert_eq!(>::all_extrinsics_weight(), (3 * len) as Weight); assert_eq!(>::all_extrinsics_len(), 3 * len); let _ = >::finalize(); diff --git a/frame/finality-tracker/src/lib.rs b/frame/finality-tracker/src/lib.rs index 7d03f1bc7d7d7..2be496ab459a2 100644 --- a/frame/finality-tracker/src/lib.rs +++ b/frame/finality-tracker/src/lib.rs @@ -199,7 +199,7 @@ mod tests { testing::Header, Perbill, traits::{BlakeTwo256, IdentityLookup, OnFinalize, Header as HeaderT}, }; - use support::{assert_ok, impl_outer_origin, parameter_types}; + use support::{assert_ok, impl_outer_origin, parameter_types, weights::Weight}; use frame_system as system; use std::cell::RefCell; @@ -230,7 +230,7 @@ mod tests { parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/generic-asset/src/mock.rs b/frame/generic-asset/src/mock.rs index 57b13760fa03d..36dea84d66d58 100644 --- a/frame/generic-asset/src/mock.rs +++ b/frame/generic-asset/src/mock.rs @@ -26,7 +26,7 @@ use sr_primitives::{ traits::{BlakeTwo256, IdentityLookup}, }; use primitives::H256; -use support::{parameter_types, impl_outer_event, impl_outer_origin}; +use support::{parameter_types, impl_outer_event, impl_outer_origin, weights::Weight}; use super::*; @@ -41,7 +41,7 @@ impl_outer_origin! { pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/grandpa/src/mock.rs b/frame/grandpa/src/mock.rs index c6ea2075575c5..3fdf807f24ad1 100644 --- a/frame/grandpa/src/mock.rs +++ b/frame/grandpa/src/mock.rs @@ -20,7 +20,7 @@ use sr_primitives::{Perbill, DigestItem, traits::IdentityLookup, testing::{Header, UintAuthorityId}}; use runtime_io; -use support::{impl_outer_origin, impl_outer_event, parameter_types}; +use support::{impl_outer_origin, impl_outer_event, parameter_types, weights::Weight}; use primitives::H256; use codec::{Encode, Decode}; use crate::{AuthorityId, AuthorityList, GenesisConfig, Trait, Module, ConsensusLog}; @@ -43,7 +43,7 @@ impl Trait for Test { } parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/im-online/src/mock.rs b/frame/im-online/src/mock.rs index 4be33c44ed59e..650353e6f9ac3 100644 --- a/frame/im-online/src/mock.rs +++ b/frame/im-online/src/mock.rs @@ -26,7 +26,7 @@ use sr_staking_primitives::{SessionIndex, offence::ReportOffence}; use sr_primitives::testing::{Header, UintAuthorityId, TestXt}; use sr_primitives::traits::{IdentityLookup, BlakeTwo256, ConvertInto}; use primitives::H256; -use support::{impl_outer_origin, impl_outer_dispatch, parameter_types}; +use support::{impl_outer_origin, impl_outer_dispatch, parameter_types, weights::Weight}; use {runtime_io, system}; impl_outer_origin!{ @@ -96,7 +96,7 @@ pub struct Runtime; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/indices/src/mock.rs b/frame/indices/src/mock.rs index 427fd87c47e7d..43b009a54491f 100644 --- a/frame/indices/src/mock.rs +++ b/frame/indices/src/mock.rs @@ -23,7 +23,7 @@ use ref_thread_local::{ref_thread_local, RefThreadLocal}; use sr_primitives::testing::Header; use sr_primitives::Perbill; use primitives::H256; -use support::{impl_outer_origin, parameter_types}; +use support::{impl_outer_origin, parameter_types, weights::Weight}; use {runtime_io, system}; use crate::{GenesisConfig, Module, Trait, IsDeadAccount, OnNewAccount, ResolveHint}; @@ -67,7 +67,7 @@ impl ResolveHint for TestResolveHint { pub struct Runtime; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/membership/src/lib.rs b/frame/membership/src/lib.rs index 472220cffdd51..0adddc1816d18 100644 --- a/frame/membership/src/lib.rs +++ b/frame/membership/src/lib.rs @@ -194,7 +194,7 @@ mod tests { use super::*; use std::cell::RefCell; - use support::{assert_ok, assert_noop, impl_outer_origin, parameter_types}; + use support::{assert_ok, assert_noop, impl_outer_origin, parameter_types, weights::Weight}; use primitives::H256; // The testing primitives are very useful for avoiding having to work with signatures // or public keys. `u64` is used as the `AccountId` and no `Signature`s are requried. @@ -212,7 +212,7 @@ mod tests { pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/nicks/src/lib.rs b/frame/nicks/src/lib.rs index 94b7043c17c94..a82b3d15a99e7 100644 --- a/frame/nicks/src/lib.rs +++ b/frame/nicks/src/lib.rs @@ -229,7 +229,7 @@ decl_module! { mod tests { use super::*; - use support::{assert_ok, assert_noop, impl_outer_origin, parameter_types}; + use support::{assert_ok, assert_noop, impl_outer_origin, parameter_types, weights::Weight}; use primitives::H256; use system::EnsureSignedBy; // The testing primitives are very useful for avoiding having to work with signatures @@ -249,7 +249,7 @@ mod tests { pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/offences/src/mock.rs b/frame/offences/src/mock.rs index 491c9681b1cd5..dc331b3147da3 100644 --- a/frame/offences/src/mock.rs +++ b/frame/offences/src/mock.rs @@ -29,7 +29,10 @@ use sr_staking_primitives::{ use sr_primitives::testing::Header; use sr_primitives::traits::{IdentityLookup, BlakeTwo256}; use substrate_primitives::H256; -use support::{impl_outer_origin, impl_outer_event, parameter_types, StorageMap, StorageDoubleMap}; +use support::{ + impl_outer_origin, impl_outer_event, parameter_types, StorageMap, StorageDoubleMap, + weights::Weight, +}; use {runtime_io, system}; impl_outer_origin!{ @@ -65,7 +68,7 @@ pub fn with_on_offence_fractions) -> R>(f: F) -> pub struct Runtime; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/randomness-collective-flip/src/lib.rs b/frame/randomness-collective-flip/src/lib.rs index 595249b986064..ba5f0f79f4717 100644 --- a/frame/randomness-collective-flip/src/lib.rs +++ b/frame/randomness-collective-flip/src/lib.rs @@ -156,7 +156,7 @@ mod tests { use sr_primitives::{ Perbill, traits::{BlakeTwo256, OnInitialize, Header as _, IdentityLookup}, testing::Header, }; - use support::{impl_outer_origin, parameter_types, traits::Randomness}; + use support::{impl_outer_origin, parameter_types, weights::Weight, traits::Randomness}; #[derive(Clone, PartialEq, Eq)] pub struct Test; @@ -167,7 +167,7 @@ mod tests { parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/scored-pool/src/mock.rs b/frame/scored-pool/src/mock.rs index 394f486a8bec3..b2e1b29cbf22b 100644 --- a/frame/scored-pool/src/mock.rs +++ b/frame/scored-pool/src/mock.rs @@ -19,7 +19,7 @@ use super::*; use std::cell::RefCell; -use support::{impl_outer_origin, parameter_types}; +use support::{impl_outer_origin, parameter_types, weights::Weight}; use primitives::H256; // The testing primitives are very useful for avoiding having to work with signatures // or public keys. `u64` is used as the `AccountId` and no `Signature`s are requried. @@ -45,7 +45,7 @@ parameter_types! { pub const ScoreOrigin: u64 = 3; pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); diff --git a/frame/session/src/mock.rs b/frame/session/src/mock.rs index cb95a35570bc1..4a2c1d45c3adc 100644 --- a/frame/session/src/mock.rs +++ b/frame/session/src/mock.rs @@ -18,7 +18,7 @@ use super::*; use std::cell::RefCell; -use support::{impl_outer_origin, parameter_types}; +use support::{impl_outer_origin, parameter_types, weights::Weight}; use primitives::{crypto::key_types::DUMMY, H256}; use sr_primitives::{ Perbill, impl_opaque_keys, traits::{BlakeTwo256, IdentityLookup, ConvertInto}, @@ -152,7 +152,7 @@ pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const MinimumPeriod: u64 = 5; pub const AvailableBlockRatio: Perbill = Perbill::one(); diff --git a/frame/staking/src/mock.rs b/frame/staking/src/mock.rs index f6068a477307c..91cffb8b7424a 100644 --- a/frame/staking/src/mock.rs +++ b/frame/staking/src/mock.rs @@ -24,8 +24,11 @@ use sr_primitives::testing::{Header, UintAuthorityId}; use sr_staking_primitives::{SessionIndex, offence::{OffenceDetails, OnOffenceHandler}}; use primitives::{H256, crypto::key_types}; use runtime_io; -use support::{assert_ok, impl_outer_origin, parameter_types, StorageLinkedMap, StorageValue}; -use support::traits::{Currency, Get, FindAuthor}; +use support::{ + assert_ok, impl_outer_origin, parameter_types, StorageLinkedMap, StorageValue, + traits::{Currency, Get, FindAuthor}, + weights::Weight, +}; use crate::{ EraIndex, GenesisConfig, Module, Trait, StakerStatus, ValidatorPrefs, RewardDestination, Nominators, inflation @@ -114,7 +117,7 @@ impl FindAuthor for Author11 { pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/system/benches/bench.rs b/frame/system/benches/bench.rs index f42d5f6bd3035..bdf3b83a38f82 100644 --- a/frame/system/benches/bench.rs +++ b/frame/system/benches/bench.rs @@ -16,7 +16,7 @@ use criterion::{Criterion, criterion_group, criterion_main, black_box}; use frame_system as system; -use support::{decl_module, decl_event, impl_outer_origin, impl_outer_event}; +use support::{decl_module, decl_event, impl_outer_origin, impl_outer_event, weights::Weight}; use primitives::H256; use sr_primitives::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header}; @@ -52,7 +52,7 @@ impl_outer_event! { support::parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 4 * 1024 * 1024; + pub const MaximumBlockWeight: Weight = 4 * 1024 * 1024; pub const MaximumBlockLength: u32 = 4 * 1024 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); } diff --git a/frame/timestamp/src/lib.rs b/frame/timestamp/src/lib.rs index 9585f350eb86f..73f9cd71b6b1d 100644 --- a/frame/timestamp/src/lib.rs +++ b/frame/timestamp/src/lib.rs @@ -240,7 +240,7 @@ impl Time for Module { mod tests { use super::*; - use support::{impl_outer_origin, assert_ok, parameter_types}; + use support::{impl_outer_origin, assert_ok, parameter_types, weights::Weight}; use runtime_io::TestExternalities; use primitives::H256; use sr_primitives::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header}; @@ -253,7 +253,7 @@ mod tests { pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/transaction-payment/src/lib.rs b/frame/transaction-payment/src/lib.rs index c7310ac587d5a..abb7518e35aa0 100644 --- a/frame/transaction-payment/src/lib.rs +++ b/frame/transaction-payment/src/lib.rs @@ -269,7 +269,7 @@ mod tests { parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/treasury/src/lib.rs b/frame/treasury/src/lib.rs index d71f8731c43dd..30ebc6f5a3005 100644 --- a/frame/treasury/src/lib.rs +++ b/frame/treasury/src/lib.rs @@ -351,7 +351,7 @@ impl OnUnbalanced> for Module { mod tests { use super::*; - use support::{assert_noop, assert_ok, impl_outer_origin, parameter_types}; + use support::{assert_noop, assert_ok, impl_outer_origin, parameter_types, weights::Weight}; use primitives::H256; use sr_primitives::{ traits::{BlakeTwo256, OnFinalize, IdentityLookup}, testing::Header, Perbill @@ -365,7 +365,7 @@ mod tests { pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/frame/utility/src/lib.rs b/frame/utility/src/lib.rs index ae5a4bd6cbc39..2fc5194f7d944 100644 --- a/frame/utility/src/lib.rs +++ b/frame/utility/src/lib.rs @@ -63,7 +63,10 @@ decl_module! { mod tests { use super::*; - use support::{assert_ok, assert_noop, impl_outer_origin, parameter_types, impl_outer_dispatch}; + use support::{ + assert_ok, assert_noop, impl_outer_origin, parameter_types, impl_outer_dispatch, + weights::Weight + }; use primitives::H256; use sr_primitives::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header}; @@ -85,7 +88,7 @@ mod tests { pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: u32 = 1024; + pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/test/utils/runtime/src/lib.rs b/test/utils/runtime/src/lib.rs index 7dd98c56c0cf9..7761cfb9444ec 100644 --- a/test/utils/runtime/src/lib.rs +++ b/test/utils/runtime/src/lib.rs @@ -47,7 +47,7 @@ use runtime_version::RuntimeVersion; pub use primitives::{hash::H256}; #[cfg(any(feature = "std", test))] use runtime_version::NativeVersion; -use runtime_support::{impl_outer_origin, parameter_types}; +use runtime_support::{impl_outer_origin, parameter_types, weights::Weight}; use inherents::{CheckInherentsResult, InherentData}; use cfg_if::cfg_if; @@ -353,7 +353,7 @@ impl From for Event { parameter_types! { pub const BlockHashCount: BlockNumber = 250; pub const MinimumPeriod: u64 = 5; - pub const MaximumBlockWeight: u32 = 4 * 1024 * 1024; + pub const MaximumBlockWeight: Weight = 4 * 1024 * 1024; pub const MaximumBlockLength: u32 = 4 * 1024 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); }