Skip to content

Commit

Permalink
Fully enable bags-list pallet in polkadot runtime (paritytech#4653)
Browse files Browse the repository at this point in the history
* Fully enable bags-list pallet in polkadot runtime

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=polkadot-dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/polkadot/src/weights/

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/

Co-authored-by: Parity Bot <admin@parity.io>
  • Loading branch information
2 people authored and Wizdave97 committed Feb 3, 2022
1 parent 020dda2 commit d4113e1
Show file tree
Hide file tree
Showing 7 changed files with 256 additions and 379 deletions.
1 change: 0 additions & 1 deletion runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ impl pallet_staking::Config for Runtime {
type NextNewSession = Session;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
// Use the nominators map to iter voters, but also keep bags-list up-to-date.
type SortedListProvider = BagsList;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
Expand Down
140 changes: 73 additions & 67 deletions runtime/kusama/src/weights/pallet_staking.rs

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,7 @@ impl pallet_staking::Config for Runtime {
type NextNewSession = Session;
type ElectionProvider = ElectionProviderMultiPhase;
type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf<Self>;
// Use the nominators map to iter voters, but also keep bags-list up-to-date.
type SortedListProvider = runtime_common::elections::UseNominatorsAndUpdateBagsList<Runtime>;
type SortedListProvider = BagsList;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
}
Expand Down
199 changes: 114 additions & 85 deletions runtime/polkadot/src/weights/pallet_staking.rs

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,6 @@ impl pallet_staking::Config for Runtime {
type NextNewSession = Session;
type ElectionProvider = ElectionProviderMultiPhase;
type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf<Self>;
// Use the nominators map to iter voters, but also keep bags-list up-to-date.
type SortedListProvider = BagsList;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
Expand Down
134 changes: 68 additions & 66 deletions runtime/westend/src/weights/pallet_staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_staking`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2021-09-17, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2022-01-04, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 128

// Executed Command:
Expand All @@ -33,7 +33,6 @@
// --header=./file_header.txt
// --output=./runtime/westend/src/weights/


#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
Expand All @@ -51,7 +50,7 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: Balances Locks (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn bond() -> Weight {
(67_211_000 as Weight)
(47_262_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
Expand All @@ -61,7 +60,7 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn bond_extra() -> Weight {
(107_863_000 as Weight)
(79_887_000 as Weight)
.saturating_add(T::DbWeight::get().reads(8 as Weight))
.saturating_add(T::DbWeight::get().writes(7 as Weight))
}
Expand All @@ -75,7 +74,7 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: Staking Bonded (r:1 w:0)
// Storage: BagsList ListBags (r:2 w:2)
fn unbond() -> Weight {
(113_462_000 as Weight)
(85_963_000 as Weight)
.saturating_add(T::DbWeight::get().reads(12 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
}
Expand All @@ -84,9 +83,9 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn withdraw_unbonded_update(s: u32, ) -> Weight {
(48_161_000 as Weight)
(35_896_000 as Weight)
// Standard Error: 0
.saturating_add((20_000 as Weight).saturating_mul(s as Weight))
.saturating_add((26_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
Expand All @@ -104,12 +103,13 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: Balances Locks (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn withdraw_unbonded_kill(_s: u32, ) -> Weight {
(95_012_000 as Weight)
(72_077_000 as Weight)
.saturating_add(T::DbWeight::get().reads(13 as Weight))
.saturating_add(T::DbWeight::get().writes(11 as Weight))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking MinValidatorBond (r:1 w:0)
// Storage: Staking MinCommission (r:1 w:0)
// Storage: Staking Validators (r:1 w:1)
// Storage: Staking MaxValidatorsCount (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
Expand All @@ -119,16 +119,16 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: BagsList CounterForListNodes (r:1 w:1)
// Storage: Staking CounterForValidators (r:1 w:1)
fn validate() -> Weight {
(65_171_000 as Weight)
.saturating_add(T::DbWeight::get().reads(11 as Weight))
(54_511_000 as Weight)
.saturating_add(T::DbWeight::get().reads(12 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
fn kick(k: u32, ) -> Weight {
(9_070_000 as Weight)
// Standard Error: 12_000
.saturating_add((15_429_000 as Weight).saturating_mul(k as Weight))
(8_643_000 as Weight)
// Standard Error: 10_000
.saturating_add((10_900_000 as Weight).saturating_mul(k as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(k as Weight)))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(k as Weight)))
Expand All @@ -139,15 +139,15 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: Staking MaxNominatorsCount (r:1 w:0)
// Storage: Staking Validators (r:2 w:0)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking CounterForNominators (r:1 w:1)
// Storage: Staking Bonded (r:1 w:0)
// Storage: BagsList ListNodes (r:2 w:2)
// Storage: BagsList ListBags (r:1 w:1)
// Storage: BagsList CounterForListNodes (r:1 w:1)
// Storage: Staking CounterForNominators (r:1 w:1)
fn nominate(n: u32, ) -> Weight {
(75_755_000 as Weight)
// Standard Error: 10_000
.saturating_add((5_153_000 as Weight).saturating_mul(n as Weight))
(59_971_000 as Weight)
// Standard Error: 12_000
.saturating_add((4_119_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(12 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
Expand All @@ -160,47 +160,47 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: BagsList ListBags (r:1 w:1)
// Storage: BagsList CounterForListNodes (r:1 w:1)
fn chill() -> Weight {
(64_425_000 as Weight)
(51_777_000 as Weight)
.saturating_add(T::DbWeight::get().reads(8 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Payee (r:0 w:1)
fn set_payee() -> Weight {
(11_264_000 as Weight)
(8_915_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:2 w:2)
fn set_controller() -> Weight {
(24_783_000 as Weight)
(19_193_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
// Storage: Staking ValidatorCount (r:0 w:1)
fn set_validator_count() -> Weight {
(2_355_000 as Weight)
(1_640_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_no_eras() -> Weight {
(2_566_000 as Weight)
(1_734_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era() -> Weight {
(2_501_000 as Weight)
(1_674_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era_always() -> Weight {
(2_542_000 as Weight)
(1_724_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Staking Invulnerables (r:0 w:1)
fn set_invulnerables(v: u32, ) -> Weight {
(2_747_000 as Weight)
(2_123_000 as Weight)
// Standard Error: 0
.saturating_add((53_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Expand All @@ -219,18 +219,18 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: Staking Payee (r:0 w:1)
// Storage: Staking SpanSlash (r:0 w:2)
fn force_unstake(s: u32, ) -> Weight {
(89_294_000 as Weight)
// Standard Error: 3_000
.saturating_add((2_136_000 as Weight).saturating_mul(s as Weight))
(66_317_000 as Weight)
// Standard Error: 2_000
.saturating_add((1_135_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(11 as Weight))
.saturating_add(T::DbWeight::get().writes(12 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
// Storage: Staking UnappliedSlashes (r:1 w:1)
fn cancel_deferred_slash(s: u32, ) -> Weight {
(2_804_887_000 as Weight)
// Standard Error: 181_000
.saturating_add((16_202_000 as Weight).saturating_mul(s as Weight))
(974_067_000 as Weight)
// Standard Error: 56_000
.saturating_add((4_968_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
Expand All @@ -245,9 +245,9 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: Staking Payee (r:2 w:0)
// Storage: System Account (r:2 w:2)
fn payout_stakers_dead_controller(n: u32, ) -> Weight {
(108_674_000 as Weight)
// Standard Error: 27_000
.saturating_add((43_449_000 as Weight).saturating_mul(n as Weight))
(86_009_000 as Weight)
// Standard Error: 28_000
.saturating_add((31_926_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(10 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Expand All @@ -265,9 +265,9 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: System Account (r:2 w:2)
// Storage: Balances Locks (r:2 w:2)
fn payout_stakers_alive_staked(n: u32, ) -> Weight {
(133_185_000 as Weight)
// Standard Error: 30_000
.saturating_add((55_519_000 as Weight).saturating_mul(n as Weight))
(103_160_000 as Weight)
// Standard Error: 33_000
.saturating_add((42_579_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(11 as Weight))
.saturating_add(T::DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
Expand All @@ -280,9 +280,9 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: Staking Bonded (r:1 w:0)
// Storage: BagsList ListBags (r:2 w:2)
fn rebond(l: u32, ) -> Weight {
(103_089_000 as Weight)
// Standard Error: 4_000
.saturating_add((73_000 as Weight).saturating_mul(l as Weight))
(76_896_000 as Weight)
// Standard Error: 3_000
.saturating_add((51_000 as Weight).saturating_mul(l as Weight))
.saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
}
Expand All @@ -298,13 +298,14 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
fn set_history_depth(e: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 64_000
.saturating_add((31_498_000 as Weight).saturating_mul(e as Weight))
.saturating_add((25_827_000 as Weight).saturating_mul(e as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
.saturating_add(T::DbWeight::get().writes((7 as Weight).saturating_mul(e as Weight)))
}
// Storage: System Account (r:1 w:1)
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:1 w:1)
// Storage: Staking SlashingSpans (r:1 w:1)
// Storage: Staking Validators (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
Expand All @@ -313,14 +314,13 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: BagsList ListBags (r:1 w:1)
// Storage: BagsList CounterForListNodes (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
// Storage: Staking Ledger (r:0 w:1)
// Storage: Staking Payee (r:0 w:1)
// Storage: Staking SpanSlash (r:0 w:1)
fn reap_stash(s: u32, ) -> Weight {
(92_220_000 as Weight)
(74_910_000 as Weight)
// Standard Error: 1_000
.saturating_add((2_132_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(11 as Weight))
.saturating_add((1_122_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(12 as Weight))
.saturating_add(T::DbWeight::get().writes(12 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
Expand All @@ -330,7 +330,9 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: Staking Bonded (r:101 w:0)
// Storage: Staking Ledger (r:101 w:0)
// Storage: Staking SlashingSpans (r:1 w:0)
// Storage: Staking Nominators (r:101 w:0)
// Storage: BagsList ListBags (r:178 w:0)
// Storage: BagsList ListNodes (r:100 w:0)
// Storage: Staking Nominators (r:100 w:0)
// Storage: System BlockWeight (r:1 w:1)
// Storage: Staking ValidatorCount (r:1 w:0)
// Storage: Staking MinimumValidatorCount (r:1 w:0)
Expand All @@ -343,13 +345,13 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
fn new_era(v: u32, n: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 802_000
.saturating_add((294_926_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 40_000
.saturating_add((49_452_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(10 as Weight))
// Standard Error: 824_000
.saturating_add((234_984_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 41_000
.saturating_add((37_717_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(187 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight)))
}
Expand All @@ -359,40 +361,40 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: Staking Bonded (r:1500 w:0)
// Storage: Staking Ledger (r:1500 w:0)
// Storage: Staking SlashingSpans (r:21 w:0)
// Storage: Staking Nominators (r:1001 w:0)
// Storage: BagsList ListBags (r:178 w:0)
// Storage: BagsList ListNodes (r:1000 w:0)
// Storage: Staking Nominators (r:1000 w:0)
// Storage: System BlockWeight (r:1 w:1)
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 106_000
.saturating_add((25_237_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 106_000
.saturating_add((31_267_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 3_621_000
.saturating_add((51_975_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(6 as Weight))
// Standard Error: 92_000
.saturating_add((23_935_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 92_000
.saturating_add((26_672_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(183 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Staking Validators (r:501 w:0)
// Storage: System BlockWeight (r:1 w:1)
fn get_npos_targets(v: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 34_000
.saturating_add((9_890_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 29_000
.saturating_add((9_594_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Staking MinCommission (r:0 w:1)
// Storage: Staking MinValidatorBond (r:0 w:1)
// Storage: Staking MaxValidatorsCount (r:0 w:1)
// Storage: Staking ChillThreshold (r:0 w:1)
// Storage: Staking MaxNominatorsCount (r:0 w:1)
// Storage: Staking MinNominatorBond (r:0 w:1)
// Storage: Staking MinCommission (r:0 w:1)
fn set_staking_configs() -> Weight {
(5_996_000 as Weight)
(4_215_000 as Weight)
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
// Storage: Staking Ledger (r:1 w:0)
Expand All @@ -406,7 +408,7 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Storage: BagsList ListBags (r:1 w:1)
// Storage: BagsList CounterForListNodes (r:1 w:1)
fn chill_other() -> Weight {
(76_657_000 as Weight)
(64_678_000 as Weight)
.saturating_add(T::DbWeight::get().reads(11 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
Expand Down
Loading

0 comments on commit d4113e1

Please sign in to comment.