From 099e41dc9e93acef8a4531892d97e93ff534f343 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Wed, 8 Jul 2020 18:22:22 +0200 Subject: [PATCH] Companion for #6575 (Add `WeightInfo`) (#1352) * Add `WeightInfo` * fix test * fix tests * fix more tests --- polkadot/runtime/common/src/claims.rs | 3 +++ polkadot/runtime/common/src/crowdfund.rs | 3 +++ polkadot/runtime/common/src/lib.rs | 1 + polkadot/runtime/common/src/parachains.rs | 6 ++++++ polkadot/runtime/common/src/registrar.rs | 5 +++++ polkadot/runtime/common/src/slots.rs | 2 ++ polkadot/runtime/kusama/src/lib.rs | 19 +++++++++++++++++++ polkadot/runtime/parachains/src/mock.rs | 1 + polkadot/runtime/polkadot/src/lib.rs | 20 +++++++++++++++++++- polkadot/runtime/test-runtime/src/lib.rs | 9 +++++++++ polkadot/runtime/westend/src/lib.rs | 14 ++++++++++++++ 11 files changed, 82 insertions(+), 1 deletion(-) diff --git a/polkadot/runtime/common/src/claims.rs b/polkadot/runtime/common/src/claims.rs index 8d063534a8..fd8c1c1c88 100644 --- a/polkadot/runtime/common/src/claims.rs +++ b/polkadot/runtime/common/src/claims.rs @@ -690,6 +690,7 @@ mod tests { type AccountData = balances::AccountData; type OnNewAccount = (); type OnKilledAccount = Balances; + type SystemWeightInfo = (); } parameter_types! { @@ -704,6 +705,7 @@ mod tests { type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; + type WeightInfo = (); } impl vesting::Trait for Test { @@ -711,6 +713,7 @@ mod tests { type Currency = Balances; type BlockNumberToBalance = Identity; type MinVestedTransfer = MinVestedTransfer; + type WeightInfo = (); } parameter_types!{ diff --git a/polkadot/runtime/common/src/crowdfund.rs b/polkadot/runtime/common/src/crowdfund.rs index be187e1c0e..ee2b740745 100644 --- a/polkadot/runtime/common/src/crowdfund.rs +++ b/polkadot/runtime/common/src/crowdfund.rs @@ -617,6 +617,7 @@ mod tests { type AccountData = balances::AccountData; type OnNewAccount = (); type OnKilledAccount = Balances; + type SystemWeightInfo = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; @@ -627,6 +628,7 @@ mod tests { type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; + type WeightInfo = (); } parameter_types! { @@ -667,6 +669,7 @@ mod tests { type TipReportDepositBase = TipReportDepositBase; type TipReportDepositPerByte = TipReportDepositPerByte; type ModuleId = TreasuryModuleId; + type WeightInfo = (); } thread_local! { diff --git a/polkadot/runtime/common/src/lib.rs b/polkadot/runtime/common/src/lib.rs index 49a6dcced0..da6fc5fcc2 100644 --- a/polkadot/runtime/common/src/lib.rs +++ b/polkadot/runtime/common/src/lib.rs @@ -141,6 +141,7 @@ mod multiplier_tests { type AccountData = (); type OnNewAccount = (); type OnKilledAccount = (); + type SystemWeightInfo = (); } type System = system::Module; diff --git a/polkadot/runtime/common/src/parachains.rs b/polkadot/runtime/common/src/parachains.rs index 0fb600cfdb..25d93b6fde 100644 --- a/polkadot/runtime/common/src/parachains.rs +++ b/polkadot/runtime/common/src/parachains.rs @@ -1760,6 +1760,7 @@ mod tests { type AccountData = balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type SystemWeightInfo = (); } impl system::offchain::SendTransactionTypes for Test where @@ -1799,6 +1800,7 @@ mod tests { type SessionHandler = TestSessionHandler; type Keys = TestSessionKeys; type DisabledValidatorsThreshold = DisabledValidatorsThreshold; + type WeightInfo = (); } impl session::historical::Trait for Test { @@ -1813,6 +1815,7 @@ mod tests { type Moment = u64; type OnTimestampSet = (); type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); } mod time { @@ -1860,6 +1863,7 @@ mod tests { type Event = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; + type WeightInfo = (); } pallet_staking_reward_curve::build! { @@ -1915,6 +1919,7 @@ mod tests { type UnsignedPriority = StakingUnsignedPriority; type MaxIterations = (); type MinSolutionScoreBump = (); + type WeightInfo = (); } impl attestations::Trait for Test { @@ -1962,6 +1967,7 @@ mod tests { type IdentificationTuple = session::historical::IdentificationTuple; type OnOffenceHandler = Staking; type WeightSoftLimit = OffencesWeightSoftLimit; + type WeightInfo = (); } parameter_types! { diff --git a/polkadot/runtime/common/src/registrar.rs b/polkadot/runtime/common/src/registrar.rs index 60f35131dc..de152d9379 100644 --- a/polkadot/runtime/common/src/registrar.rs +++ b/polkadot/runtime/common/src/registrar.rs @@ -747,6 +747,7 @@ mod tests { type AccountData = balances::AccountData; type OnNewAccount = (); type OnKilledAccount = Balances; + type SystemWeightInfo = (); } impl system::offchain::SendTransactionTypes for Test where @@ -766,6 +767,7 @@ mod tests { type Event = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; + type WeightInfo = (); } parameter_types!{ @@ -814,6 +816,7 @@ mod tests { type ValidatorId = u64; type ValidatorIdOf = (); type DisabledValidatorsThreshold = DisabledValidatorsThreshold; + type WeightInfo = (); } parameter_types! { @@ -848,12 +851,14 @@ mod tests { type UnsignedPriority = StakingUnsignedPriority; type MaxIterations = (); type MinSolutionScoreBump = (); + type WeightInfo = (); } impl timestamp::Trait for Test { type Moment = u64; type OnTimestampSet = (); type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); } impl session::historical::Trait for Test { diff --git a/polkadot/runtime/common/src/slots.rs b/polkadot/runtime/common/src/slots.rs index 0abed1f85f..5618a680c5 100644 --- a/polkadot/runtime/common/src/slots.rs +++ b/polkadot/runtime/common/src/slots.rs @@ -933,6 +933,7 @@ mod tests { type AccountData = balances::AccountData; type OnNewAccount = (); type OnKilledAccount = Balances; + type SystemWeightInfo = (); } parameter_types! { @@ -945,6 +946,7 @@ mod tests { type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; + type WeightInfo = (); } thread_local! { diff --git a/polkadot/runtime/kusama/src/lib.rs b/polkadot/runtime/kusama/src/lib.rs index 4b238ba677..ee25e8961d 100644 --- a/polkadot/runtime/kusama/src/lib.rs +++ b/polkadot/runtime/kusama/src/lib.rs @@ -147,6 +147,7 @@ impl system::Trait for Runtime { type AccountData = balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type SystemWeightInfo = (); } impl scheduler::Trait for Runtime { @@ -156,6 +157,7 @@ impl scheduler::Trait for Runtime { type Call = Call; type MaximumWeight = MaximumBlockWeight; type ScheduleOrigin = EnsureRoot; + type WeightInfo = (); } parameter_types! { @@ -195,6 +197,7 @@ impl indices::Trait for Runtime { type Currency = Balances; type Deposit = IndexDeposit; type Event = Event; + type WeightInfo = (); } parameter_types! { @@ -215,6 +218,7 @@ impl balances::Trait for Runtime { type Event = Event; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; + type WeightInfo = (); } parameter_types! { @@ -236,6 +240,7 @@ impl timestamp::Trait for Runtime { type Moment = u64; type OnTimestampSet = Babe; type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); } parameter_types! { @@ -279,6 +284,7 @@ impl session::Trait for Runtime { type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type DisabledValidatorsThreshold = DisabledValidatorsThreshold; + type WeightInfo = (); } impl session::historical::Trait for Runtime { @@ -345,6 +351,7 @@ impl staking::Trait for Runtime { type UnsignedPriority = StakingUnsignedPriority; type MaxIterations = MaxIterations; type MinSolutionScoreBump = MinSolutionScoreBump; + type WeightInfo = (); } parameter_types! { @@ -393,6 +400,7 @@ impl democracy::Trait for Runtime { type PalletsOrigin = OriginCaller; type MaxVotes = MaxVotes; type OperationalPreimageOrigin = collective::EnsureMember; + type WeightInfo = (); } parameter_types! { @@ -407,6 +415,7 @@ impl collective::Trait for Runtime { type Event = Event; type MotionDuration = CouncilMotionDuration; type MaxProposals = CouncilMaxProposals; + type WeightInfo = (); } parameter_types! { @@ -436,6 +445,7 @@ impl elections_phragmen::Trait for Runtime { type DesiredRunnersUp = DesiredRunnersUp; type TermDuration = TermDuration; type ModuleId = ElectionsPhragmenModuleId; + type WeightInfo = (); } parameter_types! { @@ -450,6 +460,7 @@ impl collective::Trait for Runtime { type Event = Event; type MotionDuration = TechnicalMotionDuration; type MaxProposals = TechnicalMaxProposals; + type WeightInfo = (); } impl membership::Trait for Runtime { @@ -498,6 +509,7 @@ impl treasury::Trait for Runtime { type SpendPeriod = SpendPeriod; type Burn = Burn; type ModuleId = TreasuryModuleId; + type WeightInfo = (); } parameter_types! { @@ -509,6 +521,7 @@ impl offences::Trait for Runtime { type IdentificationTuple = session::historical::IdentificationTuple; type OnOffenceHandler = Staking; type WeightSoftLimit = OffencesWeightSoftLimit; + type WeightInfo = (); } impl authority_discovery::Trait for Runtime {} @@ -528,6 +541,7 @@ impl im_online::Trait for Runtime { type ReportUnresponsiveness = Offences; type SessionDuration = SessionDuration; type UnsignedPriority = ImOnlineUnsignedPriority; + type WeightInfo = (); } impl grandpa::Trait for Runtime { @@ -725,11 +739,13 @@ impl identity::Trait for Runtime { type MaxRegistrars = MaxRegistrars; type RegistrarOrigin = MoreThanHalfCouncil; type ForceOrigin = MoreThanHalfCouncil; + type WeightInfo = (); } impl utility::Trait for Runtime { type Event = Event; type Call = Call; + type WeightInfo = (); } parameter_types! { @@ -747,6 +763,7 @@ impl multisig::Trait for Runtime { type DepositBase = DepositBase; type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; + type WeightInfo = (); } parameter_types! { @@ -803,6 +820,7 @@ impl vesting::Trait for Runtime { type Currency = Balances; type BlockNumberToBalance = ConvertInto; type MinVestedTransfer = MinVestedTransfer; + type WeightInfo = (); } parameter_types! { @@ -904,6 +922,7 @@ impl proxy::Trait for Runtime { type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; type MaxProxies = MaxProxies; + type WeightInfo = (); } pub struct CustomOnRuntimeUpgrade; diff --git a/polkadot/runtime/parachains/src/mock.rs b/polkadot/runtime/parachains/src/mock.rs index fd0d8e75e2..9cc9f2329b 100644 --- a/polkadot/runtime/parachains/src/mock.rs +++ b/polkadot/runtime/parachains/src/mock.rs @@ -87,6 +87,7 @@ impl system::Trait for Test { type AccountData = balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type SystemWeightInfo = (); } impl crate::initializer::Trait for Test { diff --git a/polkadot/runtime/polkadot/src/lib.rs b/polkadot/runtime/polkadot/src/lib.rs index de34a6f061..abd9687164 100644 --- a/polkadot/runtime/polkadot/src/lib.rs +++ b/polkadot/runtime/polkadot/src/lib.rs @@ -178,6 +178,7 @@ impl system::Trait for Runtime { type AccountData = balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type SystemWeightInfo = (); } impl scheduler::Trait for Runtime { @@ -187,6 +188,7 @@ impl scheduler::Trait for Runtime { type Call = Call; type MaximumWeight = MaximumBlockWeight; type ScheduleOrigin = EnsureRoot; + type WeightInfo = (); } parameter_types! { @@ -226,6 +228,7 @@ impl indices::Trait for Runtime { type Currency = Balances; type Deposit = IndexDeposit; type Event = Event; + type WeightInfo = (); } parameter_types! { @@ -246,13 +249,13 @@ impl balances::Trait for Runtime { type Event = Event; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; + type WeightInfo = (); } parameter_types! { pub const TransactionByteFee: Balance = 10 * MILLICENTS; } - impl transaction_payment::Trait for Runtime { type Currency = Balances; type OnTransactionPayment = DealWithFees; @@ -268,6 +271,7 @@ impl timestamp::Trait for Runtime { type Moment = u64; type OnTimestampSet = Babe; type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); } parameter_types! { @@ -306,6 +310,7 @@ impl session::Trait for Runtime { type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type DisabledValidatorsThreshold = DisabledValidatorsThreshold; + type WeightInfo = (); } impl session::historical::Trait for Runtime { @@ -371,6 +376,7 @@ impl staking::Trait for Runtime { type UnsignedPriority = StakingUnsignedPriority; type MaxIterations = MaxIterations; type MinSolutionScoreBump = MinSolutionScoreBump; + type WeightInfo = (); } parameter_types! { @@ -395,6 +401,7 @@ impl identity::Trait for Runtime { type Slashed = Treasury; type ForceOrigin = MoreThanHalfCouncil; type RegistrarOrigin = MoreThanHalfCouncil; + type WeightInfo = (); } parameter_types! { @@ -461,6 +468,7 @@ impl democracy::Trait for Runtime { type Scheduler = Scheduler; type PalletsOrigin = OriginCaller; type MaxVotes = MaxVotes; + type WeightInfo = (); } parameter_types! { @@ -475,6 +483,7 @@ impl collective::Trait for Runtime { type Event = Event; type MotionDuration = CouncilMotionDuration; type MaxProposals = CouncilMaxProposals; + type WeightInfo = (); } parameter_types! { @@ -505,6 +514,7 @@ impl elections_phragmen::Trait for Runtime { type DesiredMembers = DesiredMembers; type DesiredRunnersUp = DesiredRunnersUp; type TermDuration = TermDuration; + type WeightInfo = (); } parameter_types! { @@ -519,6 +529,7 @@ impl collective::Trait for Runtime { type Event = Event; type MotionDuration = TechnicalMotionDuration; type MaxProposals = TechnicalMaxProposals; + type WeightInfo = (); } impl membership::Trait for Runtime { @@ -567,6 +578,7 @@ impl treasury::Trait for Runtime { type ProposalBondMinimum = ProposalBondMinimum; type SpendPeriod = SpendPeriod; type Burn = Burn; + type WeightInfo = (); } parameter_types! { @@ -578,6 +590,7 @@ impl offences::Trait for Runtime { type IdentificationTuple = session::historical::IdentificationTuple; type OnOffenceHandler = Staking; type WeightSoftLimit = OffencesWeightSoftLimit; + type WeightInfo = (); } impl authority_discovery::Trait for Runtime {} @@ -597,6 +610,7 @@ impl im_online::Trait for Runtime { type SessionDuration = SessionDuration; type ReportUnresponsiveness = Offences; type UnsignedPriority = ImOnlineUnsignedPriority; + type WeightInfo = (); } impl grandpa::Trait for Runtime { @@ -782,11 +796,13 @@ impl vesting::Trait for Runtime { type Currency = Balances; type BlockNumberToBalance = ConvertInto; type MinVestedTransfer = MinVestedTransfer; + type WeightInfo = (); } impl utility::Trait for Runtime { type Event = Event; type Call = Call; + type WeightInfo = (); } parameter_types! { @@ -804,6 +820,7 @@ impl multisig::Trait for Runtime { type DepositBase = DepositBase; type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; + type WeightInfo = (); } impl sudo::Trait for Runtime { @@ -909,6 +926,7 @@ impl proxy::Trait for Runtime { type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; type MaxProxies = MaxProxies; + type WeightInfo = (); } pub struct CustomOnRuntimeUpgrade; diff --git a/polkadot/runtime/test-runtime/src/lib.rs b/polkadot/runtime/test-runtime/src/lib.rs index 90b0562521..31b17002fe 100644 --- a/polkadot/runtime/test-runtime/src/lib.rs +++ b/polkadot/runtime/test-runtime/src/lib.rs @@ -155,6 +155,7 @@ impl system::Trait for Runtime { type AccountData = balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type SystemWeightInfo = (); } impl system::offchain::SendTransactionTypes for Runtime where @@ -200,6 +201,7 @@ impl indices::Trait for Runtime { type Currency = Balances; type Deposit = IndexDeposit; type Event = Event; + type WeightInfo = (); } parameter_types! { @@ -212,6 +214,7 @@ impl balances::Trait for Runtime { type Event = Event; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; + type WeightInfo = (); } parameter_types! { @@ -233,6 +236,7 @@ impl timestamp::Trait for Runtime { type Moment = u64; type OnTimestampSet = Babe; type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); } parameter_types! { @@ -274,6 +278,7 @@ impl session::Trait for Runtime { type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type DisabledValidatorsThreshold = DisabledValidatorsThreshold; + type WeightInfo = (); } impl session::historical::Trait for Runtime { @@ -329,6 +334,8 @@ impl staking::Trait for Runtime { type UnsignedPriority = StakingUnsignedPriority; type MaxIterations = MaxIterations; type MinSolutionScoreBump = MinSolutionScoreBump; + type WeightInfo = (); + } impl grandpa::Trait for Runtime { @@ -448,6 +455,7 @@ impl offences::Trait for Runtime { type IdentificationTuple = session::historical::IdentificationTuple; type OnOffenceHandler = Staking; type WeightSoftLimit = OffencesWeightSoftLimit; + type WeightInfo = (); } parameter_types! { @@ -500,6 +508,7 @@ impl vesting::Trait for Runtime { type Currency = Balances; type BlockNumberToBalance = ConvertInto; type MinVestedTransfer = MinVestedTransfer; + type WeightInfo = (); } construct_runtime! { diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index 1b8c365c28..41613bbb01 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -137,6 +137,7 @@ impl system::Trait for Runtime { type AccountData = balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type SystemWeightInfo = (); } impl scheduler::Trait for Runtime { @@ -146,6 +147,7 @@ impl scheduler::Trait for Runtime { type Call = Call; type MaximumWeight = MaximumBlockWeight; type ScheduleOrigin = EnsureRoot; + type WeightInfo = (); } parameter_types! { @@ -185,6 +187,7 @@ impl indices::Trait for Runtime { type Currency = Balances; type Deposit = IndexDeposit; type Event = Event; + type WeightInfo = (); } parameter_types! { @@ -197,6 +200,7 @@ impl balances::Trait for Runtime { type Event = Event; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; + type WeightInfo = (); } parameter_types! { @@ -218,6 +222,7 @@ impl timestamp::Trait for Runtime { type Moment = u64; type OnTimestampSet = Babe; type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); } parameter_types! { @@ -261,6 +266,7 @@ impl session::Trait for Runtime { type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type DisabledValidatorsThreshold = DisabledValidatorsThreshold; + type WeightInfo = (); } impl session::historical::Trait for Runtime { @@ -316,6 +322,7 @@ impl staking::Trait for Runtime { type UnsignedPriority = StakingUnsignedPriority; type MaxIterations = MaxIterations; type MinSolutionScoreBump = MinSolutionScoreBump; + type WeightInfo = (); } parameter_types! { @@ -339,6 +346,7 @@ impl offences::Trait for Runtime { type IdentificationTuple = session::historical::IdentificationTuple; type OnOffenceHandler = Staking; type WeightSoftLimit = OffencesWeightSoftLimit; + type WeightInfo = (); } impl authority_discovery::Trait for Runtime {} @@ -358,6 +366,7 @@ impl im_online::Trait for Runtime { type ReportUnresponsiveness = Offences; type SessionDuration = SessionDuration; type UnsignedPriority = StakingUnsignedPriority; + type WeightInfo = (); } impl grandpa::Trait for Runtime { @@ -530,11 +539,13 @@ impl identity::Trait for Runtime { type MaxRegistrars = MaxRegistrars; type RegistrarOrigin = system::EnsureRoot; type ForceOrigin = system::EnsureRoot; + type WeightInfo = (); } impl utility::Trait for Runtime { type Event = Event; type Call = Call; + type WeightInfo = (); } parameter_types! { @@ -552,6 +563,7 @@ impl multisig::Trait for Runtime { type DepositBase = DepositBase; type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; + type WeightInfo = (); } parameter_types! { @@ -580,6 +592,7 @@ impl vesting::Trait for Runtime { type Currency = Balances; type BlockNumberToBalance = ConvertInto; type MinVestedTransfer = MinVestedTransfer; + type WeightInfo = (); } impl sudo::Trait for Runtime { @@ -679,6 +692,7 @@ impl proxy::Trait for Runtime { type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; type MaxProxies = MaxProxies; + type WeightInfo = (); } construct_runtime! {