mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 05:11:09 +00:00
Make weights compatible with u64 (#4192)
* Use Weight instead of u32 everywhere * Revert Weight declaration * Fix benches
This commit is contained in:
committed by
Bastian Köcher
parent
1ceebb5c3a
commit
3e3ec05e56
@@ -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::<TargetBlockFullness>::convert(Fixed64::default());
|
||||
|
||||
@@ -240,7 +240,7 @@ impl<T: Trait> Module<T> {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<Test>;
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -55,7 +55,7 @@ impl Get<u64> 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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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<u64> 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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -743,7 +743,7 @@ impl<T: Trait> Module<T> {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ impl<T: balances::Trait> WeighData<(&BalanceOf<T>,)> for WeightForSetDummy<T>
|
||||
{
|
||||
fn weigh_data(&self, target: (&BalanceOf<T>,)) -> Weight {
|
||||
let multiplier = self.0;
|
||||
(*target.0 * multiplier).saturated_into::<u32>()
|
||||
(*target.0 * multiplier).saturated_into::<Weight>()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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!(<system::Module<Runtime>>::all_extrinsics_weight(), (3 * len) as u32);
|
||||
assert_eq!(<system::Module<Runtime>>::all_extrinsics_weight(), (3 * len) as Weight);
|
||||
assert_eq!(<system::Module<Runtime>>::all_extrinsics_len(), 3 * len);
|
||||
|
||||
let _ = <system::Module<Runtime>>::finalize();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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<u64, u64> 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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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: FnOnce(&mut Vec<Perbill>) -> 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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<u64> 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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ impl<T: Trait> Time for Module<T> {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ impl<T: Trait> OnUnbalanced<NegativeImbalanceOf<T>> for Module<T> {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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<frame_system::Event> 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user