Files
pezkuwi-subxt/substrate/frame/staking/src/weights.rs
T
Gonçalo Pestana 8e120489d4 Automatic withdraw_unbonded upon unbond (#12582)
* Prevents max unbonding chunk slots from being filled when unbonding in the staking pallet

* hardcode num_slashing to unlock chunks automatically

* refactor withdraw logic to do_withdraw; idiomatic rust improvements

* a

* callable unbond() to return a DispatchWithPostInfo to dynamically update the consumed weight

* refunds overpaid fees when unbond with withdraw

* fetches real slashing spans before withdrawal call

* nits

* addresses PR comments

* Adds more testing

* fixes doc comments

* Fixes weight refunding logic for fn unbond

* generalizes  to return used weight or dispatch error

* Update frame/staking/src/pallet/mod.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/staking/src/pallet/mod.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Addresses PR comments

* Add comment to speculative num spans

* adds missing add_slashing_spans in withdraw_unbonded_kill benchmarks

* ".git/.scripts/bench-bot.sh" pallet dev pallet_staking

* fix publish

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: command-bot <>
2022-12-15 08:57:19 +00:00

902 lines
37 KiB
Rust

// This file is part of Substrate.
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Autogenerated weights for pallet_staking
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-12-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
// /home/benchbot/cargo_target_dir/production/substrate
// benchmark
// pallet
// --steps=50
// --repeat=20
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json
// --pallet=pallet_staking
// --chain=dev
// --header=./HEADER-APACHE2
// --output=./frame/staking/src/weights.rs
// --template=./.maintain/frame-weight-template.hbs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_staking.
pub trait WeightInfo {
fn bond() -> Weight;
fn bond_extra() -> Weight;
fn unbond() -> Weight;
fn withdraw_unbonded_update(s: u32, ) -> Weight;
fn withdraw_unbonded_kill(s: u32, ) -> Weight;
fn validate() -> Weight;
fn kick(k: u32, ) -> Weight;
fn nominate(n: u32, ) -> Weight;
fn chill() -> Weight;
fn set_payee() -> Weight;
fn set_controller() -> Weight;
fn set_validator_count() -> Weight;
fn force_no_eras() -> Weight;
fn force_new_era() -> Weight;
fn force_new_era_always() -> Weight;
fn set_invulnerables(v: u32, ) -> Weight;
fn force_unstake(s: u32, ) -> Weight;
fn cancel_deferred_slash(s: u32, ) -> Weight;
fn payout_stakers_dead_controller(n: u32, ) -> Weight;
fn payout_stakers_alive_staked(n: u32, ) -> Weight;
fn rebond(l: u32, ) -> Weight;
fn reap_stash(s: u32, ) -> Weight;
fn new_era(v: u32, n: u32, ) -> Weight;
fn get_npos_voters(v: u32, n: u32, ) -> Weight;
fn get_npos_targets(v: u32, ) -> Weight;
fn set_staking_configs_all_set() -> Weight;
fn set_staking_configs_all_remove() -> Weight;
fn chill_other() -> Weight;
fn force_apply_min_commission() -> Weight;
}
/// Weights for pallet_staking using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Balances Locks (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn bond() -> Weight {
// Minimum execution time: 54_402 nanoseconds.
Weight::from_ref_time(55_096_000)
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
// Storage: Staking Bonded (r:1 w:0)
// Storage: Staking Ledger (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
// Storage: VoterList ListNodes (r:3 w:3)
// Storage: VoterList ListBags (r:2 w:2)
fn bond_extra() -> Weight {
// Minimum execution time: 94_407 nanoseconds.
Weight::from_ref_time(95_209_000)
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(7))
}
// Storage: Staking Ledger (r:1 w:1)
// Storage: Staking Nominators (r:1 w:0)
// Storage: Staking MinNominatorBond (r:1 w:0)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
// Storage: VoterList ListNodes (r:3 w:3)
// Storage: Staking Bonded (r:1 w:0)
// Storage: VoterList ListBags (r:2 w:2)
fn unbond() -> Weight {
// Minimum execution time: 101_046 nanoseconds.
Weight::from_ref_time(101_504_000)
.saturating_add(T::DbWeight::get().reads(12))
.saturating_add(T::DbWeight::get().writes(8))
}
// 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)
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_update(s: u32, ) -> Weight {
// Minimum execution time: 45_452 nanoseconds.
Weight::from_ref_time(47_031_537)
// Standard Error: 491
.saturating_add(Weight::from_ref_time(67_148).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
}
// Storage: Staking Ledger (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking SlashingSpans (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: VoterList ListNodes (r:2 w:2)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList 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)
// Storage: Staking SpanSlash (r:0 w:2)
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
// Minimum execution time: 88_067 nanoseconds.
Weight::from_ref_time(93_309_587)
// Standard Error: 4_762
.saturating_add(Weight::from_ref_time(1_114_938).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(13))
.saturating_add(T::DbWeight::get().writes(12))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into())))
}
// 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:0)
// Storage: Staking Bonded (r:1 w:0)
// Storage: VoterList ListNodes (r:1 w:1)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
// Storage: Staking CounterForValidators (r:1 w:1)
fn validate() -> Weight {
// Minimum execution time: 67_308 nanoseconds.
Weight::from_ref_time(68_266_000)
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(5))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
/// The range of component `k` is `[1, 128]`.
fn kick(k: u32, ) -> Weight {
// Minimum execution time: 40_913 nanoseconds.
Weight::from_ref_time(48_140_584)
// Standard Error: 13_396
.saturating_add(Weight::from_ref_time(6_862_893).saturating_mul(k.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into())))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking MinNominatorBond (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
// Storage: Staking MaxNominatorsCount (r:1 w:0)
// Storage: Staking Validators (r:2 w:0)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking Bonded (r:1 w:0)
// Storage: VoterList ListNodes (r:2 w:2)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
// Storage: Staking CounterForNominators (r:1 w:1)
/// The range of component `n` is `[1, 16]`.
fn nominate(n: u32, ) -> Weight {
// Minimum execution time: 73_490 nanoseconds.
Weight::from_ref_time(72_520_864)
// Standard Error: 7_090
.saturating_add(Weight::from_ref_time(2_800_566).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(12))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(6))
}
// 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: VoterList ListNodes (r:2 w:2)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
fn chill() -> Weight {
// Minimum execution time: 66_293 nanoseconds.
Weight::from_ref_time(66_946_000)
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(6))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Payee (r:0 w:1)
fn set_payee() -> Weight {
// Minimum execution time: 18_134 nanoseconds.
Weight::from_ref_time(18_497_000)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:2 w:2)
fn set_controller() -> Weight {
// Minimum execution time: 26_728 nanoseconds.
Weight::from_ref_time(27_154_000)
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
// Storage: Staking ValidatorCount (r:0 w:1)
fn set_validator_count() -> Weight {
// Minimum execution time: 4_877 nanoseconds.
Weight::from_ref_time(5_028_000)
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_no_eras() -> Weight {
// Minimum execution time: 5_000 nanoseconds.
Weight::from_ref_time(5_290_000)
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era() -> Weight {
// Minimum execution time: 5_093 nanoseconds.
Weight::from_ref_time(5_378_000)
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era_always() -> Weight {
// Minimum execution time: 5_144 nanoseconds.
Weight::from_ref_time(5_454_000)
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking Invulnerables (r:0 w:1)
/// The range of component `v` is `[0, 1000]`.
fn set_invulnerables(v: u32, ) -> Weight {
// Minimum execution time: 5_190 nanoseconds.
Weight::from_ref_time(5_960_962)
// Standard Error: 41
.saturating_add(Weight::from_ref_time(10_329).saturating_mul(v.into()))
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking SlashingSpans (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: VoterList ListNodes (r:2 w:2)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList 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)
/// The range of component `s` is `[0, 100]`.
fn force_unstake(s: u32, ) -> Weight {
// Minimum execution time: 80_516 nanoseconds.
Weight::from_ref_time(86_317_884)
// Standard Error: 2_212
.saturating_add(Weight::from_ref_time(1_103_962).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(12))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into())))
}
// Storage: Staking UnappliedSlashes (r:1 w:1)
/// The range of component `s` is `[1, 1000]`.
fn cancel_deferred_slash(s: u32, ) -> Weight {
// Minimum execution time: 91_795 nanoseconds.
Weight::from_ref_time(904_524_900)
// Standard Error: 59_193
.saturating_add(Weight::from_ref_time(4_944_680).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking ErasValidatorReward (r:1 w:0)
// Storage: Staking Bonded (r:1 w:0)
// Storage: Staking Ledger (r:1 w:1)
// Storage: Staking ErasStakersClipped (r:1 w:0)
// Storage: Staking ErasRewardPoints (r:1 w:0)
// Storage: Staking ErasValidatorPrefs (r:1 w:0)
// Storage: Staking Payee (r:1 w:0)
// Storage: System Account (r:1 w:1)
/// The range of component `n` is `[0, 256]`.
fn payout_stakers_dead_controller(n: u32, ) -> Weight {
// Minimum execution time: 127_774 nanoseconds.
Weight::from_ref_time(178_857_156)
// Standard Error: 15_229
.saturating_add(Weight::from_ref_time(22_112_174).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(2))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
}
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking ErasValidatorReward (r:1 w:0)
// Storage: Staking Bonded (r:1 w:0)
// Storage: Staking Ledger (r:1 w:1)
// Storage: Staking ErasStakersClipped (r:1 w:0)
// Storage: Staking ErasRewardPoints (r:1 w:0)
// Storage: Staking ErasValidatorPrefs (r:1 w:0)
// Storage: Staking Payee (r:1 w:0)
// Storage: System Account (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
/// The range of component `n` is `[0, 256]`.
fn payout_stakers_alive_staked(n: u32, ) -> Weight {
// Minimum execution time: 161_910 nanoseconds.
Weight::from_ref_time(217_635_072)
// Standard Error: 30_726
.saturating_add(Weight::from_ref_time(31_244_329).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into())))
}
// Storage: Staking Ledger (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
// Storage: VoterList ListNodes (r:3 w:3)
// Storage: Staking Bonded (r:1 w:0)
// Storage: VoterList ListBags (r:2 w:2)
/// The range of component `l` is `[1, 32]`.
fn rebond(l: u32, ) -> Weight {
// Minimum execution time: 92_986 nanoseconds.
Weight::from_ref_time(94_880_481)
// Standard Error: 2_007
.saturating_add(Weight::from_ref_time(31_421).saturating_mul(l.into()))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(8))
}
// 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: VoterList ListNodes (r:2 w:2)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
// Storage: Staking SpanSlash (r:0 w:1)
/// The range of component `s` is `[1, 100]`.
fn reap_stash(s: u32, ) -> Weight {
// Minimum execution time: 92_750 nanoseconds.
Weight::from_ref_time(95_115_568)
// Standard Error: 2_037
.saturating_add(Weight::from_ref_time(1_086_488).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(12))
.saturating_add(T::DbWeight::get().writes(12))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into())))
}
// Storage: VoterList CounterForListNodes (r:1 w:0)
// Storage: VoterList ListBags (r:200 w:0)
// Storage: VoterList ListNodes (r:101 w:0)
// Storage: Staking Nominators (r:101 w:0)
// Storage: Staking Validators (r:2 w:0)
// Storage: Staking Bonded (r:101 w:0)
// Storage: Staking Ledger (r:101 w:0)
// Storage: Staking CounterForValidators (r:1 w:0)
// Storage: Staking ValidatorCount (r:1 w:0)
// Storage: Staking MinimumValidatorCount (r:1 w:0)
// Storage: Staking CurrentEra (r:1 w:1)
// Storage: Staking ErasStakersClipped (r:0 w:1)
// Storage: Staking ErasValidatorPrefs (r:0 w:1)
// Storage: Staking ErasStakers (r:0 w:1)
// Storage: Staking ErasTotalStake (r:0 w:1)
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
/// The range of component `v` is `[1, 10]`.
/// The range of component `n` is `[0, 100]`.
fn new_era(v: u32, n: u32, ) -> Weight {
// Minimum execution time: 506_543 nanoseconds.
Weight::from_ref_time(507_261_000)
// Standard Error: 1_766_631
.saturating_add(Weight::from_ref_time(59_139_153).saturating_mul(v.into()))
// Standard Error: 176_035
.saturating_add(Weight::from_ref_time(13_512_781).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(206))
.saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(v.into())))
.saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(v.into())))
}
// Storage: VoterList CounterForListNodes (r:1 w:0)
// Storage: VoterList ListBags (r:200 w:0)
// Storage: VoterList ListNodes (r:1500 w:0)
// Storage: Staking Nominators (r:1500 w:0)
// Storage: Staking Validators (r:500 w:0)
// Storage: Staking Bonded (r:1500 w:0)
// Storage: Staking Ledger (r:1500 w:0)
/// The range of component `v` is `[500, 1000]`.
/// The range of component `n` is `[500, 1000]`.
fn get_npos_voters(v: u32, n: u32, ) -> Weight {
// Minimum execution time: 24_155_382 nanoseconds.
Weight::from_ref_time(24_252_568_000)
// Standard Error: 319_250
.saturating_add(Weight::from_ref_time(3_596_056).saturating_mul(v.into()))
// Standard Error: 319_250
.saturating_add(Weight::from_ref_time(2_852_023).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(201))
.saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(v.into())))
.saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(n.into())))
}
// Storage: Staking CounterForValidators (r:1 w:0)
// Storage: Staking Validators (r:501 w:0)
/// The range of component `v` is `[500, 1000]`.
fn get_npos_targets(v: u32, ) -> Weight {
// Minimum execution time: 4_741_111 nanoseconds.
Weight::from_ref_time(113_360_179)
// Standard Error: 25_375
.saturating_add(Weight::from_ref_time(9_494_142).saturating_mul(v.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into())))
}
// 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)
fn set_staking_configs_all_set() -> Weight {
// Minimum execution time: 11_074 nanoseconds.
Weight::from_ref_time(11_312_000)
.saturating_add(T::DbWeight::get().writes(6))
}
// 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)
fn set_staking_configs_all_remove() -> Weight {
// Minimum execution time: 9_795 nanoseconds.
Weight::from_ref_time(10_116_000)
.saturating_add(T::DbWeight::get().writes(6))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
// Storage: Staking ChillThreshold (r:1 w:0)
// Storage: Staking MaxNominatorsCount (r:1 w:0)
// Storage: Staking CounterForNominators (r:1 w:1)
// Storage: Staking MinNominatorBond (r:1 w:0)
// Storage: Staking Validators (r:1 w:0)
// Storage: VoterList ListNodes (r:2 w:2)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
fn chill_other() -> Weight {
// Minimum execution time: 82_914 nanoseconds.
Weight::from_ref_time(83_848_000)
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(6))
}
// Storage: Staking MinCommission (r:1 w:0)
// Storage: Staking Validators (r:1 w:1)
fn force_apply_min_commission() -> Weight {
// Minimum execution time: 20_317 nanoseconds.
Weight::from_ref_time(20_639_000)
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
}
// For backwards compatibility and tests
impl WeightInfo for () {
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Balances Locks (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn bond() -> Weight {
// Minimum execution time: 54_402 nanoseconds.
Weight::from_ref_time(55_096_000)
.saturating_add(RocksDbWeight::get().reads(4))
.saturating_add(RocksDbWeight::get().writes(4))
}
// Storage: Staking Bonded (r:1 w:0)
// Storage: Staking Ledger (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
// Storage: VoterList ListNodes (r:3 w:3)
// Storage: VoterList ListBags (r:2 w:2)
fn bond_extra() -> Weight {
// Minimum execution time: 94_407 nanoseconds.
Weight::from_ref_time(95_209_000)
.saturating_add(RocksDbWeight::get().reads(8))
.saturating_add(RocksDbWeight::get().writes(7))
}
// Storage: Staking Ledger (r:1 w:1)
// Storage: Staking Nominators (r:1 w:0)
// Storage: Staking MinNominatorBond (r:1 w:0)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
// Storage: VoterList ListNodes (r:3 w:3)
// Storage: Staking Bonded (r:1 w:0)
// Storage: VoterList ListBags (r:2 w:2)
fn unbond() -> Weight {
// Minimum execution time: 101_046 nanoseconds.
Weight::from_ref_time(101_504_000)
.saturating_add(RocksDbWeight::get().reads(12))
.saturating_add(RocksDbWeight::get().writes(8))
}
// 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)
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_update(s: u32, ) -> Weight {
// Minimum execution time: 45_452 nanoseconds.
Weight::from_ref_time(47_031_537)
// Standard Error: 491
.saturating_add(Weight::from_ref_time(67_148).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(4))
.saturating_add(RocksDbWeight::get().writes(3))
}
// Storage: Staking Ledger (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking SlashingSpans (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: VoterList ListNodes (r:2 w:2)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList 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)
// Storage: Staking SpanSlash (r:0 w:2)
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
// Minimum execution time: 88_067 nanoseconds.
Weight::from_ref_time(93_309_587)
// Standard Error: 4_762
.saturating_add(Weight::from_ref_time(1_114_938).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(13))
.saturating_add(RocksDbWeight::get().writes(12))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(s.into())))
}
// 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:0)
// Storage: Staking Bonded (r:1 w:0)
// Storage: VoterList ListNodes (r:1 w:1)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
// Storage: Staking CounterForValidators (r:1 w:1)
fn validate() -> Weight {
// Minimum execution time: 67_308 nanoseconds.
Weight::from_ref_time(68_266_000)
.saturating_add(RocksDbWeight::get().reads(11))
.saturating_add(RocksDbWeight::get().writes(5))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
/// The range of component `k` is `[1, 128]`.
fn kick(k: u32, ) -> Weight {
// Minimum execution time: 40_913 nanoseconds.
Weight::from_ref_time(48_140_584)
// Standard Error: 13_396
.saturating_add(Weight::from_ref_time(6_862_893).saturating_mul(k.into()))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(k.into())))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(k.into())))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking MinNominatorBond (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
// Storage: Staking MaxNominatorsCount (r:1 w:0)
// Storage: Staking Validators (r:2 w:0)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking Bonded (r:1 w:0)
// Storage: VoterList ListNodes (r:2 w:2)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
// Storage: Staking CounterForNominators (r:1 w:1)
/// The range of component `n` is `[1, 16]`.
fn nominate(n: u32, ) -> Weight {
// Minimum execution time: 73_490 nanoseconds.
Weight::from_ref_time(72_520_864)
// Standard Error: 7_090
.saturating_add(Weight::from_ref_time(2_800_566).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(12))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(RocksDbWeight::get().writes(6))
}
// 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: VoterList ListNodes (r:2 w:2)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
fn chill() -> Weight {
// Minimum execution time: 66_293 nanoseconds.
Weight::from_ref_time(66_946_000)
.saturating_add(RocksDbWeight::get().reads(8))
.saturating_add(RocksDbWeight::get().writes(6))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Payee (r:0 w:1)
fn set_payee() -> Weight {
// Minimum execution time: 18_134 nanoseconds.
Weight::from_ref_time(18_497_000)
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:2 w:2)
fn set_controller() -> Weight {
// Minimum execution time: 26_728 nanoseconds.
Weight::from_ref_time(27_154_000)
.saturating_add(RocksDbWeight::get().reads(3))
.saturating_add(RocksDbWeight::get().writes(3))
}
// Storage: Staking ValidatorCount (r:0 w:1)
fn set_validator_count() -> Weight {
// Minimum execution time: 4_877 nanoseconds.
Weight::from_ref_time(5_028_000)
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_no_eras() -> Weight {
// Minimum execution time: 5_000 nanoseconds.
Weight::from_ref_time(5_290_000)
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era() -> Weight {
// Minimum execution time: 5_093 nanoseconds.
Weight::from_ref_time(5_378_000)
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era_always() -> Weight {
// Minimum execution time: 5_144 nanoseconds.
Weight::from_ref_time(5_454_000)
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking Invulnerables (r:0 w:1)
/// The range of component `v` is `[0, 1000]`.
fn set_invulnerables(v: u32, ) -> Weight {
// Minimum execution time: 5_190 nanoseconds.
Weight::from_ref_time(5_960_962)
// Standard Error: 41
.saturating_add(Weight::from_ref_time(10_329).saturating_mul(v.into()))
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking SlashingSpans (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: VoterList ListNodes (r:2 w:2)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList 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)
/// The range of component `s` is `[0, 100]`.
fn force_unstake(s: u32, ) -> Weight {
// Minimum execution time: 80_516 nanoseconds.
Weight::from_ref_time(86_317_884)
// Standard Error: 2_212
.saturating_add(Weight::from_ref_time(1_103_962).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(11))
.saturating_add(RocksDbWeight::get().writes(12))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(s.into())))
}
// Storage: Staking UnappliedSlashes (r:1 w:1)
/// The range of component `s` is `[1, 1000]`.
fn cancel_deferred_slash(s: u32, ) -> Weight {
// Minimum execution time: 91_795 nanoseconds.
Weight::from_ref_time(904_524_900)
// Standard Error: 59_193
.saturating_add(Weight::from_ref_time(4_944_680).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking ErasValidatorReward (r:1 w:0)
// Storage: Staking Bonded (r:1 w:0)
// Storage: Staking Ledger (r:1 w:1)
// Storage: Staking ErasStakersClipped (r:1 w:0)
// Storage: Staking ErasRewardPoints (r:1 w:0)
// Storage: Staking ErasValidatorPrefs (r:1 w:0)
// Storage: Staking Payee (r:1 w:0)
// Storage: System Account (r:1 w:1)
/// The range of component `n` is `[0, 256]`.
fn payout_stakers_dead_controller(n: u32, ) -> Weight {
// Minimum execution time: 127_774 nanoseconds.
Weight::from_ref_time(178_857_156)
// Standard Error: 15_229
.saturating_add(Weight::from_ref_time(22_112_174).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(9))
.saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(n.into())))
.saturating_add(RocksDbWeight::get().writes(2))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into())))
}
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking ErasValidatorReward (r:1 w:0)
// Storage: Staking Bonded (r:1 w:0)
// Storage: Staking Ledger (r:1 w:1)
// Storage: Staking ErasStakersClipped (r:1 w:0)
// Storage: Staking ErasRewardPoints (r:1 w:0)
// Storage: Staking ErasValidatorPrefs (r:1 w:0)
// Storage: Staking Payee (r:1 w:0)
// Storage: System Account (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
/// The range of component `n` is `[0, 256]`.
fn payout_stakers_alive_staked(n: u32, ) -> Weight {
// Minimum execution time: 161_910 nanoseconds.
Weight::from_ref_time(217_635_072)
// Standard Error: 30_726
.saturating_add(Weight::from_ref_time(31_244_329).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(10))
.saturating_add(RocksDbWeight::get().reads((5_u64).saturating_mul(n.into())))
.saturating_add(RocksDbWeight::get().writes(3))
.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(n.into())))
}
// Storage: Staking Ledger (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
// Storage: VoterList ListNodes (r:3 w:3)
// Storage: Staking Bonded (r:1 w:0)
// Storage: VoterList ListBags (r:2 w:2)
/// The range of component `l` is `[1, 32]`.
fn rebond(l: u32, ) -> Weight {
// Minimum execution time: 92_986 nanoseconds.
Weight::from_ref_time(94_880_481)
// Standard Error: 2_007
.saturating_add(Weight::from_ref_time(31_421).saturating_mul(l.into()))
.saturating_add(RocksDbWeight::get().reads(9))
.saturating_add(RocksDbWeight::get().writes(8))
}
// 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: VoterList ListNodes (r:2 w:2)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
// Storage: Staking SpanSlash (r:0 w:1)
/// The range of component `s` is `[1, 100]`.
fn reap_stash(s: u32, ) -> Weight {
// Minimum execution time: 92_750 nanoseconds.
Weight::from_ref_time(95_115_568)
// Standard Error: 2_037
.saturating_add(Weight::from_ref_time(1_086_488).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(12))
.saturating_add(RocksDbWeight::get().writes(12))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(s.into())))
}
// Storage: VoterList CounterForListNodes (r:1 w:0)
// Storage: VoterList ListBags (r:200 w:0)
// Storage: VoterList ListNodes (r:101 w:0)
// Storage: Staking Nominators (r:101 w:0)
// Storage: Staking Validators (r:2 w:0)
// Storage: Staking Bonded (r:101 w:0)
// Storage: Staking Ledger (r:101 w:0)
// Storage: Staking CounterForValidators (r:1 w:0)
// Storage: Staking ValidatorCount (r:1 w:0)
// Storage: Staking MinimumValidatorCount (r:1 w:0)
// Storage: Staking CurrentEra (r:1 w:1)
// Storage: Staking ErasStakersClipped (r:0 w:1)
// Storage: Staking ErasValidatorPrefs (r:0 w:1)
// Storage: Staking ErasStakers (r:0 w:1)
// Storage: Staking ErasTotalStake (r:0 w:1)
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
/// The range of component `v` is `[1, 10]`.
/// The range of component `n` is `[0, 100]`.
fn new_era(v: u32, n: u32, ) -> Weight {
// Minimum execution time: 506_543 nanoseconds.
Weight::from_ref_time(507_261_000)
// Standard Error: 1_766_631
.saturating_add(Weight::from_ref_time(59_139_153).saturating_mul(v.into()))
// Standard Error: 176_035
.saturating_add(Weight::from_ref_time(13_512_781).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(206))
.saturating_add(RocksDbWeight::get().reads((5_u64).saturating_mul(v.into())))
.saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(n.into())))
.saturating_add(RocksDbWeight::get().writes(3))
.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(v.into())))
}
// Storage: VoterList CounterForListNodes (r:1 w:0)
// Storage: VoterList ListBags (r:200 w:0)
// Storage: VoterList ListNodes (r:1500 w:0)
// Storage: Staking Nominators (r:1500 w:0)
// Storage: Staking Validators (r:500 w:0)
// Storage: Staking Bonded (r:1500 w:0)
// Storage: Staking Ledger (r:1500 w:0)
/// The range of component `v` is `[500, 1000]`.
/// The range of component `n` is `[500, 1000]`.
fn get_npos_voters(v: u32, n: u32, ) -> Weight {
// Minimum execution time: 24_155_382 nanoseconds.
Weight::from_ref_time(24_252_568_000)
// Standard Error: 319_250
.saturating_add(Weight::from_ref_time(3_596_056).saturating_mul(v.into()))
// Standard Error: 319_250
.saturating_add(Weight::from_ref_time(2_852_023).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(201))
.saturating_add(RocksDbWeight::get().reads((5_u64).saturating_mul(v.into())))
.saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(n.into())))
}
// Storage: Staking CounterForValidators (r:1 w:0)
// Storage: Staking Validators (r:501 w:0)
/// The range of component `v` is `[500, 1000]`.
fn get_npos_targets(v: u32, ) -> Weight {
// Minimum execution time: 4_741_111 nanoseconds.
Weight::from_ref_time(113_360_179)
// Standard Error: 25_375
.saturating_add(Weight::from_ref_time(9_494_142).saturating_mul(v.into()))
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(v.into())))
}
// 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)
fn set_staking_configs_all_set() -> Weight {
// Minimum execution time: 11_074 nanoseconds.
Weight::from_ref_time(11_312_000)
.saturating_add(RocksDbWeight::get().writes(6))
}
// 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)
fn set_staking_configs_all_remove() -> Weight {
// Minimum execution time: 9_795 nanoseconds.
Weight::from_ref_time(10_116_000)
.saturating_add(RocksDbWeight::get().writes(6))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
// Storage: Staking ChillThreshold (r:1 w:0)
// Storage: Staking MaxNominatorsCount (r:1 w:0)
// Storage: Staking CounterForNominators (r:1 w:1)
// Storage: Staking MinNominatorBond (r:1 w:0)
// Storage: Staking Validators (r:1 w:0)
// Storage: VoterList ListNodes (r:2 w:2)
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
fn chill_other() -> Weight {
// Minimum execution time: 82_914 nanoseconds.
Weight::from_ref_time(83_848_000)
.saturating_add(RocksDbWeight::get().reads(11))
.saturating_add(RocksDbWeight::get().writes(6))
}
// Storage: Staking MinCommission (r:1 w:0)
// Storage: Staking Validators (r:1 w:1)
fn force_apply_min_commission() -> Weight {
// Minimum execution time: 20_317 nanoseconds.
Weight::from_ref_time(20_639_000)
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(1))
}
}