From e95c52317d3c5f6377be80e35fa47f674299ec41 Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 19:28:33 +0100 Subject: [PATCH 01/23] update bin/node-template/runtime/src/lib.rs --- bin/node-template/runtime/src/lib.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index 780a84572d582..7f64436a5f4a2 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/bin/node-template/runtime/src/lib.rs @@ -26,7 +26,7 @@ use sp_version::RuntimeVersion; // A few exports that help ease life for downstream crates. pub use frame_support::{ construct_runtime, parameter_types, - traits::{ConstU128, ConstU32, ConstU8, KeyOwnerProofSystem, Randomness, StorageInfo}, + traits::{ConstU128, ConstU64, ConstU32, ConstU8, KeyOwnerProofSystem, Randomness, StorageInfo}, weights::{ constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, IdentityFee, Weight, @@ -139,7 +139,6 @@ parameter_types! { ::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO); pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); - pub const SS58Prefix: u8 = 42; } // Configure FRAME pallets to include in runtime. @@ -190,7 +189,7 @@ impl frame_system::Config for Runtime { /// Weight information for the extrinsics of this pallet. type SystemWeightInfo = (); /// This is used as an identifier of the chain. 42 is the generic substrate prefix. - type SS58Prefix = SS58Prefix; + type SS58Prefix = ConstU8<42>; /// The set code logic, just the default since we're not a parachain. type OnSetCode = (); type MaxConsumers = frame_support::traits::ConstU32<16>; @@ -224,15 +223,11 @@ impl pallet_grandpa::Config for Runtime { type MaxAuthorities = ConstU32<32>; } -parameter_types! { - pub const MinimumPeriod: u64 = SLOT_DURATION / 2; -} - impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - type MinimumPeriod = MinimumPeriod; + type MinimumPeriod = ConstU64; type WeightInfo = (); } From fb3d60a4abb6535d4c2926898512075c8d4c8789 Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 20:01:51 +0100 Subject: [PATCH 02/23] update frame/contracts/src/tests.rs --- frame/contracts/src/tests.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index ce59f5bb858ac..9d949eea9b948 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -234,9 +234,6 @@ impl pallet_utility::Config for Test { type WeightInfo = (); } parameter_types! { - pub const MaxValueSize: u32 = 16_384; - pub const DeletionWeightLimit: Weight = 500_000_000_000; - pub const MaxCodeSize: u32 = 2 * 1024; pub MySchedule: Schedule = { let mut schedule = >::default(); // We want stack height to be always enabled for tests so that this @@ -244,7 +241,6 @@ parameter_types! { schedule.limits.stack_height = Some(512); schedule }; - pub const TransactionByteFee: u64 = 0; pub static DepositPerByte: BalanceOf = 1; pub const DepositPerItem: BalanceOf = 2; } @@ -286,7 +282,7 @@ impl Config for Test { type WeightInfo = (); type ChainExtension = TestExtension; type DeletionQueueDepth = ConstU32<1024>; - type DeletionWeightLimit = DeletionWeightLimit; + type DeletionWeightLimit = ConstU64<500_000_000_000>; type Schedule = MySchedule; type DepositPerByte = DepositPerByte; type DepositPerItem = DepositPerItem; From 3534a608bc894397fdcce5dddbb5ad259d48e33b Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 20:18:31 +0100 Subject: [PATCH 03/23] update frame/executive/src/lib.rs --- frame/executive/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/frame/executive/src/lib.rs b/frame/executive/src/lib.rs index de1cc3b916404..68b5e910ed1fc 100644 --- a/frame/executive/src/lib.rs +++ b/frame/executive/src/lib.rs @@ -769,14 +769,11 @@ mod tests { } type Balance = u64; - parameter_types! { - pub const ExistentialDeposit: Balance = 1; - } impl pallet_balances::Config for Runtime { type Balance = Balance; type Event = Event; type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; + type ExistentialDeposit = ConstU64<1>; type AccountStore = System; type MaxLocks = (); type MaxReserves = (); From 2becd1ee907876adc48067d93e5ea54cd6460fcd Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 20:22:59 +0100 Subject: [PATCH 04/23] update frame/grandpa/src/mock.rs --- frame/grandpa/src/mock.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/frame/grandpa/src/mock.rs b/frame/grandpa/src/mock.rs index 67d5a3d7fd373..7e989bc51396a 100644 --- a/frame/grandpa/src/mock.rs +++ b/frame/grandpa/src/mock.rs @@ -172,11 +172,7 @@ pallet_staking_reward_curve::build! { parameter_types! { pub const SessionsPerEra: SessionIndex = 3; pub const BondingDuration: EraIndex = 3; - pub const SlashDeferDuration: EraIndex = 0; - pub const AttestationPeriod: u64 = 100; pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; - pub const ElectionLookahead: u64 = 0; - pub const StakingUnsignedPriority: u64 = u64::MAX / 2; pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); } @@ -198,7 +194,7 @@ impl pallet_staking::Config for Test { type Reward = (); type SessionsPerEra = SessionsPerEra; type BondingDuration = BondingDuration; - type SlashDeferDuration = SlashDeferDuration; + type SlashDeferDuration = ConstU32<0>; type SlashCancelOrigin = frame_system::EnsureRoot; type SessionInterface = Self; type UnixTime = pallet_timestamp::Pallet; From c76b8ed3af1d5d3b27a0c7611f4f7f68331c4c9c Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 20:27:41 +0100 Subject: [PATCH 05/23] update frame/im-online/src/mock.rs --- frame/im-online/src/mock.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/frame/im-online/src/mock.rs b/frame/im-online/src/mock.rs index 86904b38d834b..2459f7e748941 100644 --- a/frame/im-online/src/mock.rs +++ b/frame/im-online/src/mock.rs @@ -218,17 +218,13 @@ impl frame_support::traits::EstimateNextSessionRotation for TestNextSession } } -parameter_types! { - pub const UnsignedPriority: u64 = 1 << 20; -} - impl Config for Runtime { type AuthorityId = UintAuthorityId; type Event = Event; type ValidatorSet = Historical; type NextSessionRotation = TestNextSessionRotation; type ReportUnresponsiveness = OffenceHandler; - type UnsignedPriority = UnsignedPriority; + type UnsignedPriority = ConstU64<{ 1 << 20 }>; type WeightInfo = (); type MaxKeys = ConstU32<10_000>; type MaxPeerInHeartbeats = ConstU32<10_000>; From f974d1c526c4be1641adbb70e38ad8d32c042ff6 Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 20:30:56 +0100 Subject: [PATCH 06/23] update frame/offences/benchmarking/src/mock.rs --- frame/offences/benchmarking/src/mock.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frame/offences/benchmarking/src/mock.rs b/frame/offences/benchmarking/src/mock.rs index 74cc29586920d..79609d0df6652 100644 --- a/frame/offences/benchmarking/src/mock.rs +++ b/frame/offences/benchmarking/src/mock.rs @@ -69,9 +69,7 @@ impl frame_system::Config for Test { type OnSetCode = (); type MaxConsumers = frame_support::traits::ConstU32<16>; } -parameter_types! { - pub const ExistentialDeposit: Balance = 10; -} + impl pallet_balances::Config for Test { type MaxLocks = (); type MaxReserves = (); @@ -79,7 +77,7 @@ impl pallet_balances::Config for Test { type Balance = Balance; type Event = Event; type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; + type ExistentialDeposit = ConstU64<10>; type AccountStore = System; type WeightInfo = (); } From 8b0fa6e3d6770e469073cfe593f05d021cd538bc Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 20:33:53 +0100 Subject: [PATCH 07/23] update frame/recovery/src/mock.rs --- frame/recovery/src/mock.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/frame/recovery/src/mock.rs b/frame/recovery/src/mock.rs index 2088f9eb0937e..657ee95393419 100644 --- a/frame/recovery/src/mock.rs +++ b/frame/recovery/src/mock.rs @@ -77,10 +77,6 @@ impl frame_system::Config for Test { type MaxConsumers = ConstU32<16>; } -parameter_types! { - pub const ExistentialDeposit: u64 = 1; -} - impl pallet_balances::Config for Test { type MaxLocks = (); type MaxReserves = (); @@ -88,25 +84,19 @@ impl pallet_balances::Config for Test { type Balance = u128; type DustRemoval = (); type Event = Event; - type ExistentialDeposit = ExistentialDeposit; + type ExistentialDeposit = ConstU64<1>; type AccountStore = System; type WeightInfo = (); } -parameter_types! { - pub const ConfigDepositBase: u64 = 10; - pub const FriendDepositFactor: u64 = 1; - pub const RecoveryDeposit: u64 = 10; -} - impl Config for Test { type Event = Event; type Call = Call; type Currency = Balances; - type ConfigDepositBase = ConfigDepositBase; - type FriendDepositFactor = FriendDepositFactor; + type ConfigDepositBase = ConstU64<10>; + type FriendDepositFactor = ConstU64<1>; type MaxFriends = ConstU32<3>; - type RecoveryDeposit = RecoveryDeposit; + type RecoveryDeposit = ConstU64<10>; } pub type BalancesCall = pallet_balances::Call; From 2f588789d3fc385ccc3e2804eb005ccaa764632b Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 20:43:04 +0100 Subject: [PATCH 08/23] update frame/referenda/src/mock.rs --- frame/referenda/src/mock.rs | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/frame/referenda/src/mock.rs b/frame/referenda/src/mock.rs index fdd14fdadf04d..4b3a1e13dabd6 100644 --- a/frame/referenda/src/mock.rs +++ b/frame/referenda/src/mock.rs @@ -62,7 +62,6 @@ impl Contains for BaseFilter { } parameter_types! { - pub const BlockHashCount: u64 = 250; pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::simple_max(1_000_000); } @@ -81,7 +80,7 @@ impl frame_system::Config for Test { type Lookup = IdentityLookup; type Header = Header; type Event = Event; - type BlockHashCount = BlockHashCount; + type BlockHashCount = ConstU64<250>; type Version = (); type PalletInfo = PalletInfo; type AccountData = pallet_balances::AccountData; @@ -101,15 +100,12 @@ impl pallet_preimage::Config for Test { type BaseDeposit = (); type ByteDeposit = (); } -parameter_types! { - pub MaximumSchedulerWeight: Weight = 2_000_000_000_000; -} impl pallet_scheduler::Config for Test { type Event = Event; type Origin = Origin; type PalletsOrigin = OriginCaller; type Call = Call; - type MaximumWeight = MaximumSchedulerWeight; + type MaximumWeight = ConstU64<2_000_000_000_000>; type ScheduleOrigin = EnsureRoot; type MaxScheduledPerBlock = ConstU32<100>; type WeightInfo = (); @@ -117,26 +113,19 @@ impl pallet_scheduler::Config for Test { type PreimageProvider = Preimage; type NoPreimagePostponement = ConstU64<10>; } -parameter_types! { - pub const ExistentialDeposit: u64 = 1; - pub const MaxLocks: u32 = 10; -} impl pallet_balances::Config for Test { type MaxReserves = (); type ReserveIdentifier = [u8; 8]; - type MaxLocks = MaxLocks; + type MaxLocks = ConstU32<10>; type Balance = u64; type Event = Event; type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; + type ExistentialDeposit = ConstU64<1>; type AccountStore = System; type WeightInfo = (); } parameter_types! { pub static AlarmInterval: u64 = 1; - pub const SubmissionDeposit: u64 = 2; - pub const MaxQueued: u32 = 3; - pub const UndecidingTimeout: u64 = 20; } ord_parameter_types! { pub const One: u64 = 1; @@ -228,9 +217,9 @@ impl Config for Test { type Slash = (); type Votes = u32; type Tally = Tally; - type SubmissionDeposit = SubmissionDeposit; - type MaxQueued = MaxQueued; - type UndecidingTimeout = UndecidingTimeout; + type SubmissionDeposit = ConstU64<2>; + type MaxQueued = ConstU32<3>; + type UndecidingTimeout = ConstU64<20>; type AlarmInterval = AlarmInterval; type Tracks = TestTracksInfo; } From db6d8ea708b349a2852136bd0284cfa89b293b89 Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 20:46:09 +0100 Subject: [PATCH 09/23] update frame/session/benchmarking/src/mock.rs --- frame/session/benchmarking/src/mock.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frame/session/benchmarking/src/mock.rs b/frame/session/benchmarking/src/mock.rs index 5acc484f9ba62..78bd1a54d8eaa 100644 --- a/frame/session/benchmarking/src/mock.rs +++ b/frame/session/benchmarking/src/mock.rs @@ -73,9 +73,7 @@ impl frame_system::Config for Test { type OnSetCode = (); type MaxConsumers = ConstU32<16>; } -parameter_types! { - pub const ExistentialDeposit: Balance = 10; -} + impl pallet_balances::Config for Test { type MaxLocks = (); type MaxReserves = (); @@ -83,7 +81,7 @@ impl pallet_balances::Config for Test { type Balance = Balance; type Event = Event; type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; + type ExistentialDeposit = ConstU64<10>; type AccountStore = System; type WeightInfo = (); } From e0b39fc9ef8810326e21d78e7316a25b976bf930 Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 20:56:08 +0100 Subject: [PATCH 10/23] update frame/staking/src/mock.rs --- frame/staking/src/mock.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frame/staking/src/mock.rs b/frame/staking/src/mock.rs index 09809483ec155..67e61b0d54762 100644 --- a/frame/staking/src/mock.rs +++ b/frame/staking/src/mock.rs @@ -211,7 +211,6 @@ pallet_staking_reward_curve::build! { ); } parameter_types! { - pub const BondingDuration: EraIndex = 3; pub const RewardCurve: &'static PiecewiseLinear<'static> = &I_NPOS; pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(75); } @@ -267,7 +266,7 @@ impl crate::pallet::pallet::Config for Test { type SessionsPerEra = SessionsPerEra; type SlashDeferDuration = SlashDeferDuration; type SlashCancelOrigin = frame_system::EnsureRoot; - type BondingDuration = BondingDuration; + type BondingDuration = ConstU32<3>; type SessionInterface = Self; type EraPayout = ConvertCurve; type NextNewSession = Session; From cdc7c3bc8b4a13635f9c4eea5ed5d23fe92a94bc Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 21:04:59 +0100 Subject: [PATCH 11/23] update frame/state-trie-migration/src/lib.rs --- frame/state-trie-migration/src/lib.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/frame/state-trie-migration/src/lib.rs b/frame/state-trie-migration/src/lib.rs index 87be4099c89c8..5015c3a01abf8 100644 --- a/frame/state-trie-migration/src/lib.rs +++ b/frame/state-trie-migration/src/lib.rs @@ -980,7 +980,10 @@ mod benchmarks { mod mock { use super::*; use crate as pallet_state_trie_migration; - use frame_support::{parameter_types, traits::Hooks}; + use frame_support::{ + parameter_types, + traits::{ConstU8, ConstU32, ConstU64, Hooks} + }; use frame_system::{EnsureRoot, EnsureSigned}; use sp_core::{ storage::{ChildInfo, StateVersion}, @@ -1007,11 +1010,6 @@ mod mock { } ); - parameter_types! { - pub const BlockHashCount: u32 = 250; - pub const SS58Prefix: u8 = 42; - } - impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); @@ -1026,7 +1024,7 @@ mod mock { type Lookup = IdentityLookup; type Header = sp_runtime::generic::Header; type Event = Event; - type BlockHashCount = BlockHashCount; + type BlockHashCount = ConstU32<250>; type DbWeight = (); type Version = (); type PalletInfo = PalletInfo; @@ -1034,14 +1032,12 @@ mod mock { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; + type SS58Prefix = ConstU8<42>; type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; + type MaxConsumers = ConstU32<16>; } parameter_types! { - pub const ExistentialDeposit: u64 = 1; - pub const OffchainRepeat: u32 = 1; pub const SignedDepositPerItem: u64 = 1; pub const SignedDepositBase: u64 = 5; } @@ -1050,7 +1046,7 @@ mod mock { type Balance = u64; type Event = Event; type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; + type ExistentialDeposit = ConstU64<1>; type AccountStore = System; type MaxLocks = (); type MaxReserves = (); From 9be98853d4bb191579b814f1307a1206104fb713 Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 21:12:48 +0100 Subject: [PATCH 12/23] update frame/support/test/compile_pass/src/lib.rs --- frame/support/test/compile_pass/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frame/support/test/compile_pass/src/lib.rs b/frame/support/test/compile_pass/src/lib.rs index 0c955c749613c..7850726048546 100644 --- a/frame/support/test/compile_pass/src/lib.rs +++ b/frame/support/test/compile_pass/src/lib.rs @@ -24,7 +24,7 @@ use frame_support::{ construct_runtime, parameter_types, - traits::{ConstU16, ConstU32}, + traits::{ConstU16, ConstU32, ConstU64}, }; use sp_core::{sr25519, H256}; use sp_runtime::{ @@ -50,7 +50,6 @@ pub type BlockNumber = u64; pub type Index = u64; parameter_types! { - pub const BlockHashCount: BlockNumber = 2400; pub const Version: RuntimeVersion = VERSION; } @@ -63,7 +62,7 @@ impl frame_system::Config for Runtime { type Hashing = BlakeTwo256; type Header = Header; type Lookup = IdentityLookup; - type BlockHashCount = BlockHashCount; + type BlockHashCount = ConstU64<2400>; type Version = Version; type AccountData = (); type Origin = Origin; From 08703f9437842cb54bcf498c172e05378a29fac5 Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 21:19:31 +0100 Subject: [PATCH 13/23] frame/treasury/src/tests.rs --- frame/treasury/src/tests.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/frame/treasury/src/tests.rs b/frame/treasury/src/tests.rs index 26189f5201498..2b0ba0c173703 100644 --- a/frame/treasury/src/tests.rs +++ b/frame/treasury/src/tests.rs @@ -101,9 +101,6 @@ parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const Burn: Permill = Permill::from_percent(50); pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); - pub const BountyUpdatePeriod: u32 = 20; - pub const BountyCuratorDeposit: Permill = Permill::from_percent(50); - pub const BountyValueMinimum: u64 = 1; pub const MaxApprovals: u32 = 100; } impl Config for Test { @@ -121,7 +118,7 @@ impl Config for Test { type BurnDestination = (); // Just gets burned. type WeightInfo = (); type SpendFunds = (); - type MaxApprovals = MaxApprovals; + type MaxApprovals = ConstU32<100>; } pub fn new_test_ext() -> sp_io::TestExternalities { From a609114bd13aabdf28bf877d169e1a12f5baeb78 Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 21:26:03 +0100 Subject: [PATCH 14/23] update frame/whitelist/src/mock.rs --- frame/whitelist/src/mock.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/frame/whitelist/src/mock.rs b/frame/whitelist/src/mock.rs index 3009a6f6b5d58..634db53a09a4e 100644 --- a/frame/whitelist/src/mock.rs +++ b/frame/whitelist/src/mock.rs @@ -22,7 +22,7 @@ use crate as pallet_whitelist; use frame_support::{ - parameter_types, + construct_runtime, parameter_types, traits::{ConstU32, ConstU64, Nothing}, }; use frame_system::EnsureRoot; @@ -36,7 +36,7 @@ use sp_runtime::{ type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; -frame_support::construct_runtime!( +construct_runtime!( pub enum Test where Block = Block, NodeBlock = Block, @@ -49,7 +49,7 @@ frame_support::construct_runtime!( } ); -frame_support::parameter_types! { +parameter_types! { pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::simple_max(1024); } @@ -92,16 +92,11 @@ impl pallet_balances::Config for Test { type WeightInfo = (); } -parameter_types! { - // Taken from Polkadot as reference. - pub const PreimageMaxSize: u32 = 4096 * 1024; -} - impl pallet_preimage::Config for Test { type Event = Event; type Currency = Balances; type ManagerOrigin = EnsureRoot; - type MaxSize = PreimageMaxSize; + type MaxSize = ConstU32<{ 4096 * 1024 }>; // PreimageMaxSize Taken from Polkadot as reference. type BaseDeposit = ConstU64<1>; type ByteDeposit = ConstU64<1>; type WeightInfo = (); From fd100fd0f01dfbf9fb8ec68a622a4f2befbceb73 Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 21:26:54 +0100 Subject: [PATCH 15/23] update frame/vesting/src/mock.rs --- frame/vesting/src/mock.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frame/vesting/src/mock.rs b/frame/vesting/src/mock.rs index 8a830d72b26b8..59bebeea6188f 100644 --- a/frame/vesting/src/mock.rs +++ b/frame/vesting/src/mock.rs @@ -86,7 +86,6 @@ impl pallet_balances::Config for Test { type WeightInfo = (); } parameter_types! { - pub const MinVestedTransfer: u64 = 256 * 2; pub static ExistentialDeposit: u64 = 0; } impl Config for Test { @@ -94,7 +93,7 @@ impl Config for Test { type Currency = Balances; type Event = Event; const MAX_VESTING_SCHEDULES: u32 = 3; - type MinVestedTransfer = MinVestedTransfer; + type MinVestedTransfer = ConstU64<{ 256 * 2 }>; type WeightInfo = (); } From 7c146dedfe93c77410b4f3d53e9eca30d6b1b7b4 Mon Sep 17 00:00:00 2001 From: bizzy Date: Wed, 20 Apr 2022 21:28:57 +0100 Subject: [PATCH 16/23] update test-utils/runtime/src/lib.rs --- test-utils/runtime/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test-utils/runtime/src/lib.rs b/test-utils/runtime/src/lib.rs index 743652a0ee899..94325ae9c1ab1 100644 --- a/test-utils/runtime/src/lib.rs +++ b/test-utils/runtime/src/lib.rs @@ -553,7 +553,6 @@ impl frame_support::traits::PalletInfo for Runtime { } parameter_types! { - pub const BlockHashCount: BlockNumber = 2400; pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { read: 100, write: 1000, @@ -578,7 +577,7 @@ impl frame_system::Config for Runtime { type Lookup = IdentityLookup; type Header = Header; type Event = Event; - type BlockHashCount = BlockHashCount; + type BlockHashCount = ConstU64<2400>; type DbWeight = (); type Version = (); type PalletInfo = Self; From 247bcac52f4582e79c806d44045868a498d1c983 Mon Sep 17 00:00:00 2001 From: bizzy Date: Thu, 21 Apr 2022 08:03:38 +0100 Subject: [PATCH 17/23] update bin/node-template/runtime/src/lib.rs --- bin/node-template/runtime/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index 7f64436a5f4a2..733f6d3c9b123 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/bin/node-template/runtime/src/lib.rs @@ -133,7 +133,6 @@ const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); parameter_types! { pub const Version: RuntimeVersion = VERSION; - pub const BlockHashCount: BlockNumber = 2400; /// We allow for 2 seconds of compute with a 6 second average block time. pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights ::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO); @@ -171,7 +170,7 @@ impl frame_system::Config for Runtime { /// The ubiquitous origin type. type Origin = Origin; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). - type BlockHashCount = BlockHashCount; + type BlockHashCount = ConstU32<2400>; /// The weight of database operations that the runtime can invoke. type DbWeight = RocksDbWeight; /// Version of the runtime. From 2f7eb785676db4d7ce0deb0c5b9a2a05110a7295 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Sat, 23 Apr 2022 03:42:49 -0400 Subject: [PATCH 18/23] Update frame/grandpa/src/mock.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- frame/grandpa/src/mock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/grandpa/src/mock.rs b/frame/grandpa/src/mock.rs index 7e989bc51396a..909734c573484 100644 --- a/frame/grandpa/src/mock.rs +++ b/frame/grandpa/src/mock.rs @@ -194,7 +194,7 @@ impl pallet_staking::Config for Test { type Reward = (); type SessionsPerEra = SessionsPerEra; type BondingDuration = BondingDuration; - type SlashDeferDuration = ConstU32<0>; + type SlashDeferDuration = (); type SlashCancelOrigin = frame_system::EnsureRoot; type SessionInterface = Self; type UnixTime = pallet_timestamp::Pallet; From c54dcfdb133b3c40cfd2b87892b172ffa0f59a05 Mon Sep 17 00:00:00 2001 From: bizzy Date: Sat, 23 Apr 2022 18:11:29 +0100 Subject: [PATCH 19/23] resolve failed checks 1518659 & 1518669 --- bin/node-template/runtime/src/lib.rs | 2 +- frame/referenda/src/mock.rs | 1 - frame/state-trie-migration/src/lib.rs | 8 ++++++-- frame/vesting/src/mock.rs | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index 733f6d3c9b123..d099d4dabe40e 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/bin/node-template/runtime/src/lib.rs @@ -226,7 +226,7 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - type MinimumPeriod = ConstU64; + type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = (); } diff --git a/frame/referenda/src/mock.rs b/frame/referenda/src/mock.rs index 4b3a1e13dabd6..1b0bbba24bbe6 100644 --- a/frame/referenda/src/mock.rs +++ b/frame/referenda/src/mock.rs @@ -26,7 +26,6 @@ use frame_support::{ ConstU32, ConstU64, Contains, EqualPrivilegeOnly, OnInitialize, OriginTrait, Polling, PreimageRecipient, SortedMembers, }, - weights::Weight, }; use frame_system::{EnsureRoot, EnsureSignedBy}; use sp_core::H256; diff --git a/frame/state-trie-migration/src/lib.rs b/frame/state-trie-migration/src/lib.rs index 5015c3a01abf8..8abb6cd0ec84e 100644 --- a/frame/state-trie-migration/src/lib.rs +++ b/frame/state-trie-migration/src/lib.rs @@ -982,7 +982,7 @@ mod mock { use crate as pallet_state_trie_migration; use frame_support::{ parameter_types, - traits::{ConstU8, ConstU32, ConstU64, Hooks} + traits::{ConstU32, ConstU64, Hooks} }; use frame_system::{EnsureRoot, EnsureSigned}; use sp_core::{ @@ -1010,6 +1010,10 @@ mod mock { } ); + parameter_types! { + pub const SS58Prefix: u8 = 42; + } + impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); @@ -1032,7 +1036,7 @@ mod mock { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); - type SS58Prefix = ConstU8<42>; + type SS58Prefix = SS58Prefix; type OnSetCode = (); type MaxConsumers = ConstU32<16>; } diff --git a/frame/vesting/src/mock.rs b/frame/vesting/src/mock.rs index 59bebeea6188f..8a830d72b26b8 100644 --- a/frame/vesting/src/mock.rs +++ b/frame/vesting/src/mock.rs @@ -86,6 +86,7 @@ impl pallet_balances::Config for Test { type WeightInfo = (); } parameter_types! { + pub const MinVestedTransfer: u64 = 256 * 2; pub static ExistentialDeposit: u64 = 0; } impl Config for Test { @@ -93,7 +94,7 @@ impl Config for Test { type Currency = Balances; type Event = Event; const MAX_VESTING_SCHEDULES: u32 = 3; - type MinVestedTransfer = ConstU64<{ 256 * 2 }>; + type MinVestedTransfer = MinVestedTransfer; type WeightInfo = (); } From c93976df16b71b6e6f2021520f4f3f6b4df07d08 Mon Sep 17 00:00:00 2001 From: bizzy Date: Sat, 23 Apr 2022 20:58:23 +0100 Subject: [PATCH 20/23] resolve format check --- bin/node-template/runtime/src/lib.rs | 4 +++- frame/state-trie-migration/src/lib.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index d099d4dabe40e..47968785ac83b 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/bin/node-template/runtime/src/lib.rs @@ -26,7 +26,9 @@ use sp_version::RuntimeVersion; // A few exports that help ease life for downstream crates. pub use frame_support::{ construct_runtime, parameter_types, - traits::{ConstU128, ConstU64, ConstU32, ConstU8, KeyOwnerProofSystem, Randomness, StorageInfo}, + traits::{ + ConstU128, ConstU64, ConstU32, ConstU8, KeyOwnerProofSystem, Randomness, StorageInfo, + }, weights::{ constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, IdentityFee, Weight, diff --git a/frame/state-trie-migration/src/lib.rs b/frame/state-trie-migration/src/lib.rs index 8abb6cd0ec84e..3d66c6a66b8cf 100644 --- a/frame/state-trie-migration/src/lib.rs +++ b/frame/state-trie-migration/src/lib.rs @@ -982,7 +982,7 @@ mod mock { use crate as pallet_state_trie_migration; use frame_support::{ parameter_types, - traits::{ConstU32, ConstU64, Hooks} + traits::{ConstU32, ConstU64, Hooks}, }; use frame_system::{EnsureRoot, EnsureSigned}; use sp_core::{ From 11eea863b3c5eebf18e02a5af3afaddb8a0bf675 Mon Sep 17 00:00:00 2001 From: bizzy Date: Sat, 23 Apr 2022 22:01:03 +0100 Subject: [PATCH 21/23] backtrack to resolve compile error --- bin/node-template/runtime/src/lib.rs | 3 ++- frame/recovery/src/mock.rs | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index 47968785ac83b..8e0dcd865ff60 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/bin/node-template/runtime/src/lib.rs @@ -140,6 +140,7 @@ parameter_types! { ::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO); pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); + pub const SS58Prefix: u8 = 42; } // Configure FRAME pallets to include in runtime. @@ -190,7 +191,7 @@ impl frame_system::Config for Runtime { /// Weight information for the extrinsics of this pallet. type SystemWeightInfo = (); /// This is used as an identifier of the chain. 42 is the generic substrate prefix. - type SS58Prefix = ConstU8<42>; + type SS58Prefix = SS58Prefix; /// The set code logic, just the default since we're not a parachain. type OnSetCode = (); type MaxConsumers = frame_support::traits::ConstU32<16>; diff --git a/frame/recovery/src/mock.rs b/frame/recovery/src/mock.rs index 657ee95393419..2088f9eb0937e 100644 --- a/frame/recovery/src/mock.rs +++ b/frame/recovery/src/mock.rs @@ -77,6 +77,10 @@ impl frame_system::Config for Test { type MaxConsumers = ConstU32<16>; } +parameter_types! { + pub const ExistentialDeposit: u64 = 1; +} + impl pallet_balances::Config for Test { type MaxLocks = (); type MaxReserves = (); @@ -84,19 +88,25 @@ impl pallet_balances::Config for Test { type Balance = u128; type DustRemoval = (); type Event = Event; - type ExistentialDeposit = ConstU64<1>; + type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = (); } +parameter_types! { + pub const ConfigDepositBase: u64 = 10; + pub const FriendDepositFactor: u64 = 1; + pub const RecoveryDeposit: u64 = 10; +} + impl Config for Test { type Event = Event; type Call = Call; type Currency = Balances; - type ConfigDepositBase = ConstU64<10>; - type FriendDepositFactor = ConstU64<1>; + type ConfigDepositBase = ConfigDepositBase; + type FriendDepositFactor = FriendDepositFactor; type MaxFriends = ConstU32<3>; - type RecoveryDeposit = ConstU64<10>; + type RecoveryDeposit = RecoveryDeposit; } pub type BalancesCall = pallet_balances::Call; From 4b3d89de8f620c8f8c90f824afa016482acc336c Mon Sep 17 00:00:00 2001 From: bizzy Date: Mon, 25 Apr 2022 22:35:11 +0100 Subject: [PATCH 22/23] =?UTF-8?q?check=20--all=20--tests=20=E2=9C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/node-template/runtime/src/lib.rs | 3 ++- frame/staking/src/mock.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index 8e0dcd865ff60..6a7b56d62dd9b 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/bin/node-template/runtime/src/lib.rs @@ -134,6 +134,7 @@ pub fn native_version() -> NativeVersion { const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); parameter_types! { + pub const BlockHashCount: BlockNumber = 2400; pub const Version: RuntimeVersion = VERSION; /// We allow for 2 seconds of compute with a 6 second average block time. pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights @@ -173,7 +174,7 @@ impl frame_system::Config for Runtime { /// The ubiquitous origin type. type Origin = Origin; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). - type BlockHashCount = ConstU32<2400>; + type BlockHashCount = BlockHashCount; /// The weight of database operations that the runtime can invoke. type DbWeight = RocksDbWeight; /// Version of the runtime. diff --git a/frame/staking/src/mock.rs b/frame/staking/src/mock.rs index 67e61b0d54762..09809483ec155 100644 --- a/frame/staking/src/mock.rs +++ b/frame/staking/src/mock.rs @@ -211,6 +211,7 @@ pallet_staking_reward_curve::build! { ); } parameter_types! { + pub const BondingDuration: EraIndex = 3; pub const RewardCurve: &'static PiecewiseLinear<'static> = &I_NPOS; pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(75); } @@ -266,7 +267,7 @@ impl crate::pallet::pallet::Config for Test { type SessionsPerEra = SessionsPerEra; type SlashDeferDuration = SlashDeferDuration; type SlashCancelOrigin = frame_system::EnsureRoot; - type BondingDuration = ConstU32<3>; + type BondingDuration = BondingDuration; type SessionInterface = Self; type EraPayout = ConvertCurve; type NextNewSession = Session; From 9d221d725bc2ca283ab26adf85679c44fa591216 Mon Sep 17 00:00:00 2001 From: bizzy Date: Tue, 26 Apr 2022 00:27:49 +0100 Subject: [PATCH 23/23] =?UTF-8?q?cargo=20+nightly=20fmt=20=E2=9C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/node-template/runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index 6a7b56d62dd9b..a7a162bf74327 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/bin/node-template/runtime/src/lib.rs @@ -27,7 +27,7 @@ use sp_version::RuntimeVersion; pub use frame_support::{ construct_runtime, parameter_types, traits::{ - ConstU128, ConstU64, ConstU32, ConstU8, KeyOwnerProofSystem, Randomness, StorageInfo, + ConstU128, ConstU32, ConstU64, ConstU8, KeyOwnerProofSystem, Randomness, StorageInfo, }, weights::{ constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},