From 89b62242846e34653662c3b77c4a21491ef976b9 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Mon, 3 Jan 2022 16:34:36 +0000 Subject: [PATCH 1/4] Fully enable bags-list pallet in polkadot runtime --- runtime/kusama/src/lib.rs | 1 - runtime/polkadot/src/lib.rs | 3 +- runtime/westend/src/lib.rs | 1 - .../bags-list/src/voter_bags.rs | 157 ------------------ 4 files changed, 1 insertion(+), 161 deletions(-) delete mode 100644 utils/remote-ext-tests/bags-list/src/voter_bags.rs diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 6a3710300b8e..309344ca1a89 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -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; diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index d15ffcb04f3e..c8c1cdfaa656 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -569,8 +569,7 @@ impl pallet_staking::Config for Runtime { type NextNewSession = Session; type ElectionProvider = ElectionProviderMultiPhase; type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf; - // Use the nominators map to iter voters, but also keep bags-list up-to-date. - type SortedListProvider = runtime_common::elections::UseNominatorsAndUpdateBagsList; + type SortedListProvider = BagsList; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type WeightInfo = weights::pallet_staking::WeightInfo; } diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index 91bba4262c20..6d4fe4d6158e 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -482,7 +482,6 @@ impl pallet_staking::Config for Runtime { type NextNewSession = Session; type ElectionProvider = ElectionProviderMultiPhase; type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf; - // 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; diff --git a/utils/remote-ext-tests/bags-list/src/voter_bags.rs b/utils/remote-ext-tests/bags-list/src/voter_bags.rs deleted file mode 100644 index 8730a14c4e94..000000000000 --- a/utils/remote-ext-tests/bags-list/src/voter_bags.rs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2021 Parity Technologies (UK) Ltd. -// This file is part of Polkadot. - -// Polkadot is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Polkadot is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Polkadot. If not, see . - -//! Generic remote tests for the voter bags module. - -use frame_election_provider_support::SortedListProvider; -use frame_support::traits::Get; -use pallet_election_provider_multi_phase as EPM; -use pallet_staking::{BalanceOf, MinNominatorBond, Nominators}; -use remote_externalities::{Builder, Mode, OnlineConfig}; -use sp_runtime::traits::Block as BlockT; -use sp_std::convert::TryInto; -use sp_storage::well_known_keys; - -const LOG_TARGET: &'static str = "remote-ext-tests::bags-list"; - -/// Test voter bags migration. `currency_unit` is the number of planks per the -/// the runtimes `UNITS` (i.e. number of decimal places per DOT, KSM etc) -pub(crate) async fn test_voter_bags_migration< - Runtime: pallet_staking::Config + pallet_bags_list::Config + EPM::Config, - Block: BlockT, ->( - currency_unit: u64, - ws_url: String, -) { - sp_tracing::try_init_simple(); - - let mut ext = Builder::::new() - .mode(Mode::Online(OnlineConfig { - transport: ws_url.to_string().into(), - pallets: vec!["Staking".to_string()], - at: None, - state_snapshot: None, - })) - .inject_hashed_key(well_known_keys::CODE) - .build() - .await - .unwrap(); - - ext.execute_with(|| { - // set the ss58 prefix so addresses printed below are human friendly. - sp_core::crypto::set_default_ss58_version(Runtime::SS58Prefix::get().try_into().unwrap()); - - // clear anything that may have existed before. - if ::SortedListProvider::count() != 0 { - log::warn!( - target: LOG_TARGET, - "some data already seem to exist in the bags-list pallet.." - ); - } - ::SortedListProvider::unsafe_clear(); - - // get the nominator & validator count prior to migrating; these should be invariant. - let pre_migrate_nominator_count = >::iter().count() as u32; - log::info!(target: LOG_TARGET, "Nominator count: {}", pre_migrate_nominator_count); - - // run the actual migration, - let moved = ::SortedListProvider::unsafe_regenerate( - pallet_staking::Nominators::::iter().map(|(n, _)| n), - pallet_staking::Pallet::::weight_of_fn(), - ); - log::info!(target: LOG_TARGET, "Moved {} nominators", moved); - - let voter_list_len = - ::SortedListProvider::iter().count() as u32; - let voter_list_count = ::SortedListProvider::count(); - // and confirm it is equal to the length of the `VoterList`. - assert_eq!(pre_migrate_nominator_count, voter_list_len); - assert_eq!(pre_migrate_nominator_count, voter_list_count); - - let min_nominator_bond = >::get(); - log::info!(target: LOG_TARGET, "min nominator bond is {:?}", min_nominator_bond); - - // go through every bag to track the total number of voters within bags - // and log some info about how voters are distributed within the bags. - let mut seen_in_bags = 0; - for vote_weight_thresh in ::BagThresholds::get() { - // threshold in terms of UNITS (e.g. KSM, DOT etc) - let vote_weight_thresh_as_unit = *vote_weight_thresh as f64 / currency_unit as f64; - let pretty_thresh = format!("Threshold: {}.", vote_weight_thresh_as_unit); - - let bag = match pallet_bags_list::Pallet::::list_bags_get(*vote_weight_thresh) - { - Some(bag) => bag, - None => { - log::info!(target: LOG_TARGET, "{} NO VOTERS.", pretty_thresh); - continue - }, - }; - - let voters_in_bag = bag.std_iter().count() as u32; - - // if this bag is below the min nominator bond print out all the members - let vote_weight_as_balance: BalanceOf = - (*vote_weight_thresh).try_into().map_err(|_| "should not fail").unwrap(); - if vote_weight_as_balance <= min_nominator_bond { - for id in bag.std_iter().map(|node| node.std_id().clone()) { - log::error!( - target: LOG_TARGET, - "{} Account found below min bond: {:?}.", - pretty_thresh, - id - ); - } - } - - // update our overall counter - seen_in_bags += voters_in_bag; - - // percentage of all nominators - let percent_of_voters = percent(voters_in_bag, voter_list_count); - - log::info!( - target: LOG_TARGET, - "{} Nominators: {} [%{:.3}]", - pretty_thresh, - voters_in_bag, - percent_of_voters, - ); - } - - if seen_in_bags != voter_list_count { - log::error!( - target: LOG_TARGET, - "bags list population ({}) not on par whoever is voter_list ({})", - seen_in_bags, - voter_list_count, - ) - } - - // now let's test the process of a snapshot being created.. - EPM::Pallet::::create_snapshot().unwrap(); - - log::info!( - target: LOG_TARGET, - "a snapshot has been created using the new runtime and data, with metadata {:?}", - EPM::Pallet::::snapshot_metadata(), - ); - }); -} - -fn percent(portion: u32, total: u32) -> f64 { - (portion as f64 / total as f64) * 100f64 -} From 468c9bd2a127b7d74e8c6b0632b86ea31a554723 Mon Sep 17 00:00:00 2001 From: Parity Bot Date: Tue, 4 Jan 2022 08:17:18 +0000 Subject: [PATCH 2/4] 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/ --- .../polkadot/src/weights/pallet_staking.rs | 199 ++++++++++-------- 1 file changed, 114 insertions(+), 85 deletions(-) diff --git a/runtime/polkadot/src/weights/pallet_staking.rs b/runtime/polkadot/src/weights/pallet_staking.rs index 67359e75ce90..64b602123190 100644 --- a/runtime/polkadot/src/weights/pallet_staking.rs +++ b/runtime/polkadot/src/weights/pallet_staking.rs @@ -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("polkadot-dev"), DB CACHE: 128 // Executed Command: @@ -33,7 +33,6 @@ // --header=./file_header.txt // --output=./runtime/polkadot/src/weights/ - #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] @@ -51,18 +50,19 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Balances Locks (r:1 w:1) // Storage: Staking Payee (r:0 w:1) fn bond() -> Weight { - (64_842_000 as Weight) + (46_648_000 as Weight) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } // Storage: Staking Bonded (r:1 w:0) // Storage: Staking Ledger (r:1 w:1) // Storage: Balances Locks (r:1 w:1) - // Storage: Staking Nominators (r:1 w:0) + // Storage: BagsList ListNodes (r:3 w:3) + // Storage: BagsList ListBags (r:2 w:2) fn bond_extra() -> Weight { - (63_943_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + (93_200_000 as Weight) + .saturating_add(T::DbWeight::get().reads(8 as Weight)) + .saturating_add(T::DbWeight::get().writes(7 as Weight)) } // Storage: Staking Ledger (r:1 w:1) // Storage: Staking Nominators (r:1 w:0) @@ -70,20 +70,22 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking CurrentEra (r:1 w:0) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) + // Storage: BagsList ListNodes (r:3 w:3) // Storage: Staking Bonded (r:1 w:0) + // Storage: BagsList ListBags (r:2 w:2) fn unbond() -> Weight { - (67_903_000 as Weight) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + (85_556_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:1) // Storage: Staking CurrentEra (r:1 w:0) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn withdraw_unbonded_update(s: u32, ) -> Weight { - (46_134_000 as Weight) + (35_593_000 as Weight) // Standard Error: 0 - .saturating_add((36_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((24_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)) } @@ -94,32 +96,39 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Validators (r:1 w:0) // Storage: Staking Nominators (r:1 w:1) // Storage: Staking CounterForNominators (r:1 w:1) + // Storage: BagsList ListNodes (r:2 w:2) + // Storage: BagsList ListBags (r:1 w:1) + // Storage: BagsList CounterForListNodes (r:1 w:1) // Storage: System Account (r:1 w:1) // Storage: Balances Locks (r:1 w:1) // Storage: Staking Payee (r:0 w:1) fn withdraw_unbonded_kill(_s: u32, ) -> Weight { - (67_717_000 as Weight) - .saturating_add(T::DbWeight::get().reads(9 as Weight)) - .saturating_add(T::DbWeight::get().writes(7 as Weight)) + (69_345_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) // Storage: Staking CounterForNominators (r:1 w:1) + // Storage: BagsList ListNodes (r:2 w:2) + // Storage: BagsList ListBags (r:1 w:1) + // Storage: BagsList CounterForListNodes (r:1 w:1) // Storage: Staking CounterForValidators (r:1 w:1) fn validate() -> Weight { - (36_901_000 as Weight) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + (52_887_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_945_000 as Weight) + (7_581_000 as Weight) // Standard Error: 10_000 - .saturating_add((15_330_000 as Weight).saturating_mul(k as Weight)) + .saturating_add((10_632_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))) @@ -130,64 +139,70 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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 { - (48_492_000 as Weight) + (58_419_000 as Weight) // Standard Error: 14_000 - .saturating_add((4_775_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(8 as Weight)) + .saturating_add((3_918_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(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) } // Storage: Staking Ledger (r:1 w:0) // Storage: Staking Validators (r:1 w:0) // Storage: Staking Nominators (r:1 w:1) // Storage: Staking CounterForNominators (r:1 w:1) + // Storage: BagsList ListNodes (r:2 w:2) + // Storage: BagsList ListBags (r:1 w:1) + // Storage: BagsList CounterForListNodes (r:1 w:1) fn chill() -> Weight { - (36_148_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + (50_866_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 { - (10_737_000 as Weight) + (8_781_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 { - (23_913_000 as Weight) + (18_038_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_027_000 as Weight) + (1_635_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_343_000 as Weight) + (1_735_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_369_000 as Weight) + (1_745_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_400_000 as Weight) + (1_714_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_197_000 as Weight) + (1_707_000 as Weight) // Standard Error: 0 - .saturating_add((56_000 as Weight).saturating_mul(v as Weight)) + .saturating_add((54_000 as Weight).saturating_mul(v as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Staking Bonded (r:1 w:1) @@ -195,24 +210,27 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Validators (r:1 w:0) // Storage: Staking Nominators (r:1 w:1) // Storage: Staking CounterForNominators (r:1 w:1) + // Storage: BagsList ListNodes (r:2 w:2) + // Storage: BagsList ListBags (r:1 w:1) + // Storage: BagsList CounterForListNodes (r:1 w:1) // Storage: System Account (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:2) fn force_unstake(s: u32, ) -> Weight { - (62_032_000 as Weight) - // Standard Error: 2_000 - .saturating_add((2_220_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(8 as Weight)) + (66_037_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_110_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_811_250_000 as Weight) - // Standard Error: 182_000 - .saturating_add((16_184_000 as Weight).saturating_mul(s as Weight)) + (972_390_000 as Weight) + // Standard Error: 56_000 + .saturating_add((4_972_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)) } @@ -227,9 +245,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Payee (r:2 w:0) // Storage: System Account (r:2 w:2) fn payout_stakers_dead_controller(n: u32, ) -> Weight { - (118_075_000 as Weight) - // Standard Error: 20_000 - .saturating_add((44_116_000 as Weight).saturating_mul(n as Weight)) + (80_586_000 as Weight) + // Standard Error: 31_000 + .saturating_add((32_648_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)) @@ -247,9 +265,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: System Account (r:2 w:2) // Storage: Balances Locks (r:2 w:2) fn payout_stakers_alive_staked(n: u32, ) -> Weight { - (126_296_000 as Weight) + (113_235_000 as Weight) // Standard Error: 27_000 - .saturating_add((57_142_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((44_077_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)) @@ -258,14 +276,15 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Ledger (r:1 w:1) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) - // Storage: Staking Nominators (r:1 w:0) + // Storage: BagsList ListNodes (r:3 w:3) // Storage: Staking Bonded (r:1 w:0) + // Storage: BagsList ListBags (r:2 w:2) fn rebond(l: u32, ) -> Weight { - (60_559_000 as Weight) - // Standard Error: 1_000 - .saturating_add((63_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + (77_378_000 as Weight) + // Standard Error: 4_000 + .saturating_add((40_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)) } // Storage: Staking CurrentEra (r:1 w:0) // Storage: Staking HistoryDepth (r:1 w:1) @@ -278,28 +297,31 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking ErasStartSessionIndex (r:0 w:1) fn set_history_depth(e: u32, ) -> Weight { (0 as Weight) - // Standard Error: 68_000 - .saturating_add((30_894_000 as Weight).saturating_mul(e as Weight)) + // Standard Error: 66_000 + .saturating_add((24_764_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) // Storage: Staking CounterForNominators (r:1 w:1) + // Storage: BagsList ListNodes (r:2 w:2) + // 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 { - (65_173_000 as Weight) + (73_759_000 as Weight) // Standard Error: 1_000 - .saturating_add((2_213_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(8 as Weight)) + .saturating_add((1_124_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))) } // Storage: Staking CounterForNominators (r:1 w:0) @@ -308,7 +330,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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) @@ -321,13 +345,13 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking ErasStartSessionIndex (r:0 w:1) fn new_era(v: u32, n: u32, ) -> Weight { (0 as Weight) - // Standard Error: 811_000 - .saturating_add((298_100_000 as Weight).saturating_mul(v as Weight)) - // Standard Error: 40_000 - .saturating_add((49_163_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(10 as Weight)) + // Standard Error: 746_000 + .saturating_add((229_359_000 as Weight).saturating_mul(v as Weight)) + // Standard Error: 37_000 + .saturating_add((36_336_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))) } @@ -337,19 +361,21 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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: 101_000 - .saturating_add((23_378_000 as Weight).saturating_mul(v as Weight)) - // Standard Error: 101_000 - .saturating_add((29_757_000 as Weight).saturating_mul(n as Weight)) - // Standard Error: 3_446_000 - .saturating_add((45_519_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(6 as Weight)) + // Standard Error: 88_000 + .saturating_add((22_559_000 as Weight).saturating_mul(v as Weight)) + // Standard Error: 88_000 + .saturating_add((26_204_000 as Weight).saturating_mul(n as Weight)) + // Standard Error: 2_996_000 + .saturating_add((9_344_000 as Weight).saturating_mul(s 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)) } @@ -357,20 +383,20 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: System BlockWeight (r:1 w:1) fn get_npos_targets(v: u32, ) -> Weight { (0 as Weight) - // Standard Error: 30_000 - .saturating_add((9_490_000 as Weight).saturating_mul(v as Weight)) + // Standard Error: 25_000 + .saturating_add((8_862_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_177_000 as Weight) .saturating_add(T::DbWeight::get().writes(6 as Weight)) } // Storage: Staking Ledger (r:1 w:0) @@ -380,9 +406,12 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking CounterForNominators (r:1 w:1) // Storage: Staking MinNominatorBond (r:1 w:0) // Storage: Staking Validators (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) fn chill_other() -> Weight { - (48_185_000 as Weight) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + (61_357_000 as Weight) + .saturating_add(T::DbWeight::get().reads(11 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) } } From 4107a75bbe25786940995e87b46912526fd482e8 Mon Sep 17 00:00:00 2001 From: Parity Bot Date: Tue, 4 Jan 2022 09:03:09 +0000 Subject: [PATCH 3/4] 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/ --- runtime/kusama/src/weights/pallet_staking.rs | 140 ++++++++++--------- 1 file changed, 73 insertions(+), 67 deletions(-) diff --git a/runtime/kusama/src/weights/pallet_staking.rs b/runtime/kusama/src/weights/pallet_staking.rs index 939af2665b84..800793ec52e9 100644 --- a/runtime/kusama/src/weights/pallet_staking.rs +++ b/runtime/kusama/src/weights/pallet_staking.rs @@ -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("kusama-dev"), DB CACHE: 128 // Executed Command: @@ -33,7 +33,6 @@ // --header=./file_header.txt // --output=./runtime/kusama/src/weights/ - #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] @@ -51,7 +50,7 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Balances Locks (r:1 w:1) // Storage: Staking Payee (r:0 w:1) fn bond() -> Weight { - (66_934_000 as Weight) + (47_083_000 as Weight) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } @@ -61,7 +60,7 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: BagsList ListNodes (r:3 w:3) // Storage: BagsList ListBags (r:2 w:2) fn bond_extra() -> Weight { - (106_496_000 as Weight) + (79_677_000 as Weight) .saturating_add(T::DbWeight::get().reads(8 as Weight)) .saturating_add(T::DbWeight::get().writes(7 as Weight)) } @@ -75,7 +74,7 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Bonded (r:1 w:0) // Storage: BagsList ListBags (r:2 w:2) fn unbond() -> Weight { - (115_916_000 as Weight) + (87_481_000 as Weight) .saturating_add(T::DbWeight::get().reads(12 as Weight)) .saturating_add(T::DbWeight::get().writes(8 as Weight)) } @@ -84,9 +83,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn withdraw_unbonded_update(s: u32, ) -> Weight { - (47_633_000 as Weight) + (36_547_000 as Weight) // Standard Error: 0 - .saturating_add((25_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((23_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)) } @@ -103,13 +102,16 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Storage: Balances Locks (r:1 w:1) // Storage: Staking Payee (r:0 w:1) - fn withdraw_unbonded_kill(_s: u32, ) -> Weight { - (94_253_000 as Weight) + fn withdraw_unbonded_kill(s: u32, ) -> Weight { + (72_430_000 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(s 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) @@ -119,16 +121,16 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: BagsList CounterForListNodes (r:1 w:1) // Storage: Staking CounterForValidators (r:1 w:1) fn validate() -> Weight { - (63_555_000 as Weight) - .saturating_add(T::DbWeight::get().reads(11 as Weight)) + (55_595_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_518_000 as Weight) - // Standard Error: 11_000 - .saturating_add((16_662_000 as Weight).saturating_mul(k as Weight)) + (10_034_000 as Weight) + // Standard Error: 9_000 + .saturating_add((11_481_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))) @@ -139,15 +141,15 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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 { - (74_049_000 as Weight) - // Standard Error: 16_000 - .saturating_add((5_118_000 as Weight).saturating_mul(n as Weight)) + (60_257_000 as Weight) + // Standard Error: 8_000 + .saturating_add((4_191_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)) @@ -160,49 +162,49 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: BagsList ListBags (r:1 w:1) // Storage: BagsList CounterForListNodes (r:1 w:1) fn chill() -> Weight { - (62_972_000 as Weight) + (52_552_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 { - (10_848_000 as Weight) + (8_794_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 { - (23_892_000 as Weight) + (18_992_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_279_000 as Weight) + (1_619_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_614_000 as Weight) + (1_667_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_592_000 as Weight) + (1_743_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_572_000 as Weight) + (1_677_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_700_000 as Weight) + (1_852_000 as Weight) // Standard Error: 0 - .saturating_add((57_000 as Weight).saturating_mul(v as Weight)) + .saturating_add((53_000 as Weight).saturating_mul(v as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Staking Bonded (r:1 w:1) @@ -219,18 +221,18 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Payee (r:0 w:1) // Storage: Staking SpanSlash (r:0 w:2) fn force_unstake(s: u32, ) -> Weight { - (90_113_000 as Weight) + (68_818_000 as Weight) // Standard Error: 1_000 - .saturating_add((2_230_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((1_104_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_809_466_000 as Weight) - // Standard Error: 181_000 - .saturating_add((16_204_000 as Weight).saturating_mul(s as Weight)) + (966_416_000 as Weight) + // Standard Error: 55_000 + .saturating_add((4_979_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)) } @@ -245,9 +247,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Payee (r:2 w:0) // Storage: System Account (r:2 w:2) fn payout_stakers_dead_controller(n: u32, ) -> Weight { - (113_536_000 as Weight) - // Standard Error: 16_000 - .saturating_add((45_494_000 as Weight).saturating_mul(n as Weight)) + (94_709_000 as Weight) + // Standard Error: 17_000 + .saturating_add((32_919_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)) @@ -265,9 +267,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: System Account (r:2 w:2) // Storage: Balances Locks (r:2 w:2) fn payout_stakers_alive_staked(n: u32, ) -> Weight { - (134_960_000 as Weight) - // Standard Error: 25_000 - .saturating_add((58_130_000 as Weight).saturating_mul(n as Weight)) + (123_535_000 as Weight) + // Standard Error: 28_000 + .saturating_add((44_813_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)) @@ -280,9 +282,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Bonded (r:1 w:0) // Storage: BagsList ListBags (r:2 w:2) fn rebond(l: u32, ) -> Weight { - (103_717_000 as Weight) + (78_279_000 as Weight) // Standard Error: 4_000 - .saturating_add((65_000 as Weight).saturating_mul(l as Weight)) + .saturating_add((55_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)) } @@ -297,14 +299,15 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking ErasStartSessionIndex (r:0 w:1) fn set_history_depth(e: u32, ) -> Weight { (0 as Weight) - // Standard Error: 69_000 - .saturating_add((31_059_000 as Weight).saturating_mul(e as Weight)) + // Standard Error: 66_000 + .saturating_add((26_032_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) @@ -313,14 +316,13 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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 { - (93_312_000 as Weight) + (76_424_000 as Weight) // Standard Error: 1_000 - .saturating_add((2_226_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(11 as Weight)) + .saturating_add((1_103_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))) } @@ -330,7 +332,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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:183 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) @@ -343,13 +347,13 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking ErasStartSessionIndex (r:0 w:1) fn new_era(v: u32, n: u32, ) -> Weight { (0 as Weight) - // Standard Error: 724_000 - .saturating_add((300_240_000 as Weight).saturating_mul(v as Weight)) - // Standard Error: 36_000 - .saturating_add((49_412_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(10 as Weight)) + // Standard Error: 865_000 + .saturating_add((235_921_000 as Weight).saturating_mul(v as Weight)) + // Standard Error: 43_000 + .saturating_add((37_925_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(192 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))) } @@ -359,19 +363,21 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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:183 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: 83_000 - .saturating_add((23_656_000 as Weight).saturating_mul(v as Weight)) - // Standard Error: 83_000 - .saturating_add((31_191_000 as Weight).saturating_mul(n as Weight)) - // Standard Error: 2_847_000 - .saturating_add((37_983_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(6 as Weight)) + // Standard Error: 87_000 + .saturating_add((23_516_000 as Weight).saturating_mul(v as Weight)) + // Standard Error: 87_000 + .saturating_add((27_548_000 as Weight).saturating_mul(n as Weight)) + // Standard Error: 2_968_000 + .saturating_add((21_935_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(188 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)) } @@ -379,20 +385,20 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: System BlockWeight (r:1 w:1) fn get_npos_targets(v: u32, ) -> Weight { (0 as Weight) - // Standard Error: 27_000 - .saturating_add((9_398_000 as Weight).saturating_mul(v as Weight)) + // Standard Error: 28_000 + .saturating_add((9_481_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_323_000 as Weight) .saturating_add(T::DbWeight::get().writes(6 as Weight)) } // Storage: Staking Ledger (r:1 w:0) @@ -406,7 +412,7 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: BagsList ListBags (r:1 w:1) // Storage: BagsList CounterForListNodes (r:1 w:1) fn chill_other() -> Weight { - (76_568_000 as Weight) + (64_253_000 as Weight) .saturating_add(T::DbWeight::get().reads(11 as Weight)) .saturating_add(T::DbWeight::get().writes(6 as Weight)) } From 18c5e6a3565742aaaa494c678fec4e457c840620 Mon Sep 17 00:00:00 2001 From: Parity Bot Date: Tue, 4 Jan 2022 13:45:24 +0000 Subject: [PATCH 4/4] 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/ --- runtime/westend/src/weights/pallet_staking.rs | 134 +++++++++--------- 1 file changed, 68 insertions(+), 66 deletions(-) diff --git a/runtime/westend/src/weights/pallet_staking.rs b/runtime/westend/src/weights/pallet_staking.rs index f686213c6f3a..9fe6545fe69a 100644 --- a/runtime/westend/src/weights/pallet_staking.rs +++ b/runtime/westend/src/weights/pallet_staking.rs @@ -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: @@ -33,7 +33,6 @@ // --header=./file_header.txt // --output=./runtime/westend/src/weights/ - #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] @@ -51,7 +50,7 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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)) } @@ -61,7 +60,7 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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)) } @@ -75,7 +74,7 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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)) } @@ -84,9 +83,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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)) } @@ -104,12 +103,13 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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) @@ -119,16 +119,16 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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))) @@ -139,15 +139,15 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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)) @@ -160,47 +160,47 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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)) @@ -219,18 +219,18 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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)) } @@ -245,9 +245,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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)) @@ -265,9 +265,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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)) @@ -280,9 +280,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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)) } @@ -298,13 +298,14 @@ impl pallet_staking::WeightInfo for WeightInfo { 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) @@ -313,14 +314,13 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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))) } @@ -330,7 +330,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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) @@ -343,13 +345,13 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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))) } @@ -359,19 +361,19 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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)) } @@ -379,20 +381,20 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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) @@ -406,7 +408,7 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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)) }