remove the uselsss weight return type from election provider API (#9569)

* remove the uselsss weight return type from election provider API

* fix everything, should be ready for final benchmark

* simplify on_init a bit furhter

* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* remove unwraps

* fmt

* Update lock file

* whitelist block weight

* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* fix warning

Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
This commit is contained in:
Kian Paimani
2021-08-19 08:45:54 +01:00
committed by GitHub
parent 354b77fb88
commit 7a32c3504d
22 changed files with 552 additions and 556 deletions
+1 -1
View File
@@ -267,7 +267,7 @@
#![recursion_limit = "128"]
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(any(feature = "runtime-benchmarks", test))]
#[cfg(feature = "runtime-benchmarks")]
pub mod benchmarking;
#[cfg(test)]
mod mock;
-1
View File
@@ -245,7 +245,6 @@ impl OnUnbalanced<NegativeImbalanceOf<Test>> for RewardRemainderMock {
impl onchain::Config for Test {
type AccountId = AccountId;
type BlockNumber = BlockNumber;
type BlockWeights = BlockWeights;
type Accuracy = Perbill;
type DataProvider = Staking;
}
+56 -30
View File
@@ -405,7 +405,7 @@ impl<T: Config> Pallet<T> {
start_session_index: SessionIndex,
is_genesis: bool,
) -> Option<Vec<T::AccountId>> {
let (election_result, weight) = if is_genesis {
let election_result = if is_genesis {
T::GenesisElectionProvider::elect().map_err(|e| {
log!(warn, "genesis election provider failed due to {:?}", e);
Self::deposit_event(Event::StakingElectionFailed);
@@ -418,13 +418,7 @@ impl<T: Config> Pallet<T> {
}
.ok()?;
<frame_system::Pallet<T>>::register_extra_weight_unchecked(
weight,
frame_support::weights::DispatchClass::Mandatory,
);
let exposures = Self::collect_exposures(election_result);
if (exposures.len() as u32) < Self::minimum_validator_count().max(1) {
// Session will panic if we ever return an empty validator set, thus max(1) ^^.
match CurrentEra::<T>::get() {
@@ -637,25 +631,28 @@ impl<T: Config> Pallet<T> {
///
/// This will use all on-chain nominators, and all the validators will inject a self vote.
///
/// This function is self-weighing as [`DispatchClass::Mandatory`].
///
/// ### Slashing
///
/// All nominations that have been submitted before the last non-zero slash of the validator are
/// auto-chilled.
///
/// Note that this is VERY expensive. Use with care.
pub fn get_npos_voters() -> Vec<(T::AccountId, VoteWeight, Vec<T::AccountId>)> {
let weight_of = Self::slashable_balance_of_fn();
let mut all_voters = Vec::new();
let mut validator_count = 0u32;
for (validator, _) in <Validators<T>>::iter() {
// Append self vote.
let self_vote = (validator.clone(), weight_of(&validator), vec![validator.clone()]);
all_voters.push(self_vote);
validator_count.saturating_inc();
}
// Collect all slashing spans into a BTreeMap for further queries.
let slashing_spans = <SlashingSpans<T>>::iter().collect::<BTreeMap<_, _>>();
let mut nominator_count = 0u32;
for (nominator, nominations) in Nominators::<T>::iter() {
let Nominations { submitted_in, mut targets, suppressed: _ } = nominations;
@@ -669,17 +666,35 @@ impl<T: Config> Pallet<T> {
if !targets.is_empty() {
let vote_weight = weight_of(&nominator);
all_voters.push((nominator, vote_weight, targets))
all_voters.push((nominator, vote_weight, targets));
nominator_count.saturating_inc();
}
}
Self::register_weight(T::WeightInfo::get_npos_voters(
validator_count,
nominator_count,
slashing_spans.len() as u32,
));
all_voters
}
/// This is a very expensive function and result should be cached versus being called multiple
/// times.
/// Get the targets for an upcoming npos election.
///
/// This function is self-weighing as [`DispatchClass::Mandatory`].
pub fn get_npos_targets() -> Vec<T::AccountId> {
Validators::<T>::iter().map(|(v, _)| v).collect::<Vec<_>>()
let mut validator_count = 0u32;
let targets = Validators::<T>::iter()
.map(|(v, _)| {
validator_count.saturating_inc();
v
})
.collect::<Vec<_>>();
Self::register_weight(T::WeightInfo::get_npos_targets(validator_count));
targets
}
/// This function will add a nominator to the `Nominators` storage map,
@@ -731,47 +746,58 @@ impl<T: Config> Pallet<T> {
false
}
}
/// Register some amount of weight directly with the system pallet.
///
/// This is always mandatory weight.
fn register_weight(weight: Weight) {
<frame_system::Pallet<T>>::register_extra_weight_unchecked(
weight,
DispatchClass::Mandatory,
);
}
}
impl<T: Config> frame_election_provider_support::ElectionDataProvider<T::AccountId, T::BlockNumber>
for Pallet<T>
{
const MAXIMUM_VOTES_PER_VOTER: u32 = T::MAX_NOMINATIONS;
fn desired_targets() -> data_provider::Result<(u32, Weight)> {
Ok((Self::validator_count(), <T as frame_system::Config>::DbWeight::get().reads(1)))
fn desired_targets() -> data_provider::Result<u32> {
Self::register_weight(T::DbWeight::get().reads(1));
Ok(Self::validator_count())
}
fn voters(
maybe_max_len: Option<usize>,
) -> data_provider::Result<(Vec<(T::AccountId, VoteWeight, Vec<T::AccountId>)>, Weight)> {
) -> data_provider::Result<Vec<(T::AccountId, VoteWeight, Vec<T::AccountId>)>> {
let nominator_count = CounterForNominators::<T>::get();
let validator_count = CounterForValidators::<T>::get();
let voter_count = nominator_count.saturating_add(validator_count) as usize;
debug_assert!(<Nominators<T>>::iter().count() as u32 == CounterForNominators::<T>::get());
debug_assert!(<Validators<T>>::iter().count() as u32 == CounterForValidators::<T>::get());
// register the extra 2 reads
Self::register_weight(T::DbWeight::get().reads(2));
if maybe_max_len.map_or(false, |max_len| voter_count > max_len) {
return Err("Voter snapshot too big")
}
let slashing_span_count = <SlashingSpans<T>>::iter().count();
let weight = T::WeightInfo::get_npos_voters(
nominator_count,
validator_count,
slashing_span_count as u32,
);
Ok((Self::get_npos_voters(), weight))
Ok(Self::get_npos_voters())
}
fn targets(maybe_max_len: Option<usize>) -> data_provider::Result<(Vec<T::AccountId>, Weight)> {
fn targets(maybe_max_len: Option<usize>) -> data_provider::Result<Vec<T::AccountId>> {
let target_count = CounterForValidators::<T>::get() as usize;
// register the extra 1 read
Self::register_weight(T::DbWeight::get().reads(1));
if maybe_max_len.map_or(false, |max_len| target_count > max_len) {
return Err("Target snapshot too big")
}
let weight = <T as frame_system::Config>::DbWeight::get().reads(target_count as u64);
Ok((Self::get_npos_targets(), weight))
Ok(Self::get_npos_targets())
}
fn next_election_prediction(now: T::BlockNumber) -> T::BlockNumber {
@@ -807,7 +833,7 @@ impl<T: Config> frame_election_provider_support::ElectionDataProvider<T::Account
)
}
#[cfg(any(feature = "runtime-benchmarks", test))]
#[cfg(feature = "runtime-benchmarks")]
fn add_voter(voter: T::AccountId, weight: VoteWeight, targets: Vec<T::AccountId>) {
use sp_std::convert::TryFrom;
let stake = <BalanceOf<T>>::try_from(weight).unwrap_or_else(|_| {
@@ -827,7 +853,7 @@ impl<T: Config> frame_election_provider_support::ElectionDataProvider<T::Account
Self::do_add_nominator(&voter, Nominations { targets, submitted_in: 0, suppressed: false });
}
#[cfg(any(feature = "runtime-benchmarks", test))]
#[cfg(feature = "runtime-benchmarks")]
fn add_target(target: T::AccountId) {
let stake = MinValidatorBond::<T>::get() * 100u32.into();
<Bonded<T>>::insert(target.clone(), target.clone());
@@ -847,7 +873,7 @@ impl<T: Config> frame_election_provider_support::ElectionDataProvider<T::Account
);
}
#[cfg(any(feature = "runtime-benchmarks", test))]
#[cfg(feature = "runtime-benchmarks")]
fn clear() {
<Bonded<T>>::remove_all(None);
<Ledger<T>>::remove_all(None);
@@ -855,7 +881,7 @@ impl<T: Config> frame_election_provider_support::ElectionDataProvider<T::Account
<Nominators<T>>::remove_all(None);
}
#[cfg(any(feature = "runtime-benchmarks", test))]
#[cfg(feature = "runtime-benchmarks")]
fn put_snapshot(
voters: Vec<(T::AccountId, VoteWeight, Vec<T::AccountId>)>,
targets: Vec<T::AccountId>,
+2 -6
View File
@@ -1903,7 +1903,7 @@ fn bond_with_duplicate_vote_should_be_ignored_by_election_provider() {
// winners should be 21 and 31. Otherwise this election is taking duplicates into
// account.
let supports = <Test as Config>::ElectionProvider::elect().unwrap().0;
let supports = <Test as Config>::ElectionProvider::elect().unwrap();
assert_eq!(
supports,
vec![
@@ -1947,7 +1947,7 @@ fn bond_with_duplicate_vote_should_be_ignored_by_election_provider_elected() {
assert_ok!(Staking::nominate(Origin::signed(4), vec![21]));
// winners should be 21 and 11.
let supports = <Test as Config>::ElectionProvider::elect().unwrap().0;
let supports = <Test as Config>::ElectionProvider::elect().unwrap();
assert_eq!(
supports,
vec![
@@ -3826,7 +3826,6 @@ mod election_data_provider {
ExtBuilder::default().nominate(false).build_and_execute(|| {
assert!(<Validators<Test>>::iter().map(|(x, _)| x).all(|v| Staking::voters(None)
.unwrap()
.0
.into_iter()
.find(|(w, _, t)| { v == *w && t[0] == *w })
.is_some()))
@@ -3840,7 +3839,6 @@ mod election_data_provider {
assert_eq!(
<Staking as ElectionDataProvider<AccountId, BlockNumber>>::voters(None)
.unwrap()
.0
.iter()
.find(|x| x.0 == 101)
.unwrap()
@@ -3856,7 +3854,6 @@ mod election_data_provider {
assert_eq!(
<Staking as ElectionDataProvider<AccountId, BlockNumber>>::voters(None)
.unwrap()
.0
.iter()
.find(|x| x.0 == 101)
.unwrap()
@@ -3869,7 +3866,6 @@ mod election_data_provider {
assert_eq!(
<Staking as ElectionDataProvider<AccountId, BlockNumber>>::voters(None)
.unwrap()
.0
.iter()
.find(|x| x.0 == 101)
.unwrap()
+117 -119
View File
@@ -18,7 +18,7 @@
//! Autogenerated weights for pallet_staking
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2021-08-07, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2021-08-18, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128
// Executed Command:
@@ -85,7 +85,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Balances Locks (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn bond() -> Weight {
(72_423_000 as Weight)
(73_523_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
@@ -93,7 +93,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Ledger (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn bond_extra() -> Weight {
(56_157_000 as Weight)
(58_129_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
@@ -104,7 +104,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn unbond() -> Weight {
(59_039_000 as Weight)
(61_542_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -113,9 +113,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn withdraw_unbonded_update(s: u32, ) -> Weight {
(51_503_000 as Weight)
(53_160_000 as Weight)
// Standard Error: 0
.saturating_add((59_000 as Weight).saturating_mul(s as Weight))
.saturating_add((53_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))
}
@@ -130,9 +130,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Payee (r:0 w:1)
// Storage: Staking SpanSlash (r:0 w:2)
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
(84_211_000 as Weight)
// Standard Error: 4_000
.saturating_add((2_391_000 as Weight).saturating_mul(s as Weight))
(85_826_000 as Weight)
// Standard Error: 2_000
.saturating_add((2_453_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(8 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
@@ -144,16 +144,16 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Nominators (r:1 w:0)
// Storage: Staking CounterForValidators (r:1 w:1)
fn validate() -> Weight {
(34_206_000 as Weight)
(34_936_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
fn kick(k: u32, ) -> Weight {
(22_863_000 as Weight)
// Standard Error: 13_000
.saturating_add((16_208_000 as Weight).saturating_mul(k as Weight))
(23_493_000 as Weight)
// Standard Error: 17_000
.saturating_add((16_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)))
@@ -166,9 +166,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking CounterForNominators (r:1 w:1)
fn nominate(n: u32, ) -> Weight {
(41_047_000 as Weight)
// Standard Error: 10_000
.saturating_add((5_611_000 as Weight).saturating_mul(n as Weight))
(41_733_000 as Weight)
// Standard Error: 11_000
.saturating_add((5_840_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(7 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))
@@ -177,46 +177,46 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Validators (r:1 w:0)
// Storage: Staking Nominators (r:1 w:0)
fn chill() -> Weight {
(17_489_000 as Weight)
(17_901_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Payee (r:0 w:1)
fn set_payee() -> Weight {
(13_384_000 as Weight)
(13_760_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 {
(27_863_000 as Weight)
(28_388_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_468_000 as Weight)
(2_537_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_798_000 as Weight)
(2_749_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_763_000 as Weight)
(2_834_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_707_000 as Weight)
(2_800_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 {
(3_353_000 as Weight)
(3_429_000 as Weight)
// Standard Error: 0
.saturating_add((56_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
@@ -231,18 +231,18 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Payee (r:0 w:1)
// Storage: Staking SpanSlash (r:0 w:2)
fn force_unstake(s: u32, ) -> Weight {
(60_682_000 as Weight)
// Standard Error: 1_000
.saturating_add((2_384_000 as Weight).saturating_mul(s as Weight))
(61_799_000 as Weight)
// Standard Error: 2_000
.saturating_add((2_451_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(6 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 {
(3_368_335_000 as Weight)
// Standard Error: 221_000
.saturating_add((19_815_000 as Weight).saturating_mul(s as Weight))
(3_383_988_000 as Weight)
// Standard Error: 223_000
.saturating_add((19_981_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))
}
@@ -257,9 +257,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Payee (r:2 w:0)
// Storage: System Account (r:2 w:2)
fn payout_stakers_dead_controller(n: u32, ) -> Weight {
(108_594_000 as Weight)
// Standard Error: 15_000
.saturating_add((46_477_000 as Weight).saturating_mul(n as Weight))
(124_714_000 as Weight)
// Standard Error: 23_000
.saturating_add((47_575_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))
@@ -277,9 +277,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: System Account (r:2 w:2)
// Storage: Balances Locks (r:2 w:2)
fn payout_stakers_alive_staked(n: u32, ) -> Weight {
(157_564_000 as Weight)
// Standard Error: 20_000
.saturating_add((59_781_000 as Weight).saturating_mul(n as Weight))
(160_203_000 as Weight)
// Standard Error: 24_000
.saturating_add((61_321_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))
@@ -289,9 +289,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn rebond(l: u32, ) -> Weight {
(48_497_000 as Weight)
(49_593_000 as Weight)
// Standard Error: 3_000
.saturating_add((89_000 as Weight).saturating_mul(l as Weight))
.saturating_add((78_000 as Weight).saturating_mul(l as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -306,8 +306,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
fn set_history_depth(e: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 73_000
.saturating_add((34_176_000 as Weight).saturating_mul(e as Weight))
// Standard Error: 71_000
.saturating_add((35_237_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)))
@@ -323,22 +323,21 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Payee (r:0 w:1)
// Storage: Staking SpanSlash (r:0 w:1)
fn reap_stash(s: u32, ) -> Weight {
(71_895_000 as Weight)
// Standard Error: 0
.saturating_add((2_376_000 as Weight).saturating_mul(s as Weight))
(72_484_000 as Weight)
// Standard Error: 2_000
.saturating_add((2_452_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(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
// Storage: Staking CounterForNominators (r:1 w:0)
// Storage: Staking CounterForValidators (r:1 w:0)
// Storage: Staking SlashingSpans (r:1 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 SlashingSpans (r:1 w:0)
// Storage: Staking Nominators (r:101 w:0)
// Storage: Staking ValidatorCount (r:1 w:0)
// Storage: System BlockWeight (r:1 w:1)
// Storage: Staking MinimumValidatorCount (r:1 w:0)
// Storage: Staking CurrentEra (r:1 w:1)
// Storage: Staking HistoryDepth (r:1 w:0)
@@ -349,14 +348,14 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
fn new_era(v: u32, n: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 980_000
.saturating_add((300_866_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 49_000
.saturating_add((46_397_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(10 as Weight))
// Standard Error: 856_000
.saturating_add((305_057_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 43_000
.saturating_add((47_890_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(9 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().writes(4 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight)))
}
// Storage: Staking Validators (r:501 w:0)
@@ -367,11 +366,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 98_000
.saturating_add((24_916_000 as Weight).saturating_mul(v as Weight))
.saturating_add((25_610_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 98_000
.saturating_add((26_575_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 3_335_000
.saturating_add((22_464_000 as Weight).saturating_mul(s as Weight))
.saturating_add((28_064_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 3_346_000
.saturating_add((18_123_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 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)))
@@ -379,9 +378,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
}
// Storage: Staking Validators (r:501 w:0)
fn get_npos_targets(v: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 32_000
.saturating_add((10_706_000 as Weight).saturating_mul(v as Weight))
(30_422_000 as Weight)
// Standard Error: 33_000
.saturating_add((11_252_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
}
@@ -391,7 +390,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking MaxNominatorsCount (r:0 w:1)
// Storage: Staking MinNominatorBond (r:0 w:1)
fn set_staking_limits() -> Weight {
(6_463_000 as Weight)
(6_486_000 as Weight)
.saturating_add(T::DbWeight::get().writes(5 as Weight))
}
// Storage: Staking Ledger (r:1 w:0)
@@ -402,7 +401,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking CounterForValidators (r:1 w:1)
// Storage: Staking MinValidatorBond (r:1 w:0)
fn chill_other() -> Weight {
(56_717_000 as Weight)
(58_222_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
@@ -417,7 +416,7 @@ impl WeightInfo for () {
// Storage: Balances Locks (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn bond() -> Weight {
(72_423_000 as Weight)
(73_523_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
}
@@ -425,7 +424,7 @@ impl WeightInfo for () {
// Storage: Staking Ledger (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn bond_extra() -> Weight {
(56_157_000 as Weight)
(58_129_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
@@ -436,7 +435,7 @@ impl WeightInfo for () {
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn unbond() -> Weight {
(59_039_000 as Weight)
(61_542_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
@@ -445,9 +444,9 @@ impl WeightInfo for () {
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn withdraw_unbonded_update(s: u32, ) -> Weight {
(51_503_000 as Weight)
(53_160_000 as Weight)
// Standard Error: 0
.saturating_add((59_000 as Weight).saturating_mul(s as Weight))
.saturating_add((53_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
@@ -462,9 +461,9 @@ impl WeightInfo for () {
// Storage: Staking Payee (r:0 w:1)
// Storage: Staking SpanSlash (r:0 w:2)
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
(84_211_000 as Weight)
// Standard Error: 4_000
.saturating_add((2_391_000 as Weight).saturating_mul(s as Weight))
(85_826_000 as Weight)
// Standard Error: 2_000
.saturating_add((2_453_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(8 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
@@ -476,16 +475,16 @@ impl WeightInfo for () {
// Storage: Staking Nominators (r:1 w:0)
// Storage: Staking CounterForValidators (r:1 w:1)
fn validate() -> Weight {
(34_206_000 as Weight)
(34_936_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
fn kick(k: u32, ) -> Weight {
(22_863_000 as Weight)
// Standard Error: 13_000
.saturating_add((16_208_000 as Weight).saturating_mul(k as Weight))
(23_493_000 as Weight)
// Standard Error: 17_000
.saturating_add((16_632_000 as Weight).saturating_mul(k as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(k as Weight)))
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(k as Weight)))
@@ -498,9 +497,9 @@ impl WeightInfo for () {
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking CounterForNominators (r:1 w:1)
fn nominate(n: u32, ) -> Weight {
(41_047_000 as Weight)
// Standard Error: 10_000
.saturating_add((5_611_000 as Weight).saturating_mul(n as Weight))
(41_733_000 as Weight)
// Standard Error: 11_000
.saturating_add((5_840_000 as Weight).saturating_mul(n as Weight))
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
@@ -509,46 +508,46 @@ impl WeightInfo for () {
// Storage: Staking Validators (r:1 w:0)
// Storage: Staking Nominators (r:1 w:0)
fn chill() -> Weight {
(17_489_000 as Weight)
(17_901_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Payee (r:0 w:1)
fn set_payee() -> Weight {
(13_384_000 as Weight)
(13_760_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:2 w:2)
fn set_controller() -> Weight {
(27_863_000 as Weight)
(28_388_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
// Storage: Staking ValidatorCount (r:0 w:1)
fn set_validator_count() -> Weight {
(2_468_000 as Weight)
(2_537_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_no_eras() -> Weight {
(2_798_000 as Weight)
(2_749_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era() -> Weight {
(2_763_000 as Weight)
(2_834_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era_always() -> Weight {
(2_707_000 as Weight)
(2_800_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Staking Invulnerables (r:0 w:1)
fn set_invulnerables(v: u32, ) -> Weight {
(3_353_000 as Weight)
(3_429_000 as Weight)
// Standard Error: 0
.saturating_add((56_000 as Weight).saturating_mul(v as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
@@ -563,18 +562,18 @@ impl WeightInfo for () {
// Storage: Staking Payee (r:0 w:1)
// Storage: Staking SpanSlash (r:0 w:2)
fn force_unstake(s: u32, ) -> Weight {
(60_682_000 as Weight)
// Standard Error: 1_000
.saturating_add((2_384_000 as Weight).saturating_mul(s as Weight))
(61_799_000 as Weight)
// Standard Error: 2_000
.saturating_add((2_451_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
// Storage: Staking UnappliedSlashes (r:1 w:1)
fn cancel_deferred_slash(s: u32, ) -> Weight {
(3_368_335_000 as Weight)
// Standard Error: 221_000
.saturating_add((19_815_000 as Weight).saturating_mul(s as Weight))
(3_383_988_000 as Weight)
// Standard Error: 223_000
.saturating_add((19_981_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -589,9 +588,9 @@ impl WeightInfo for () {
// Storage: Staking Payee (r:2 w:0)
// Storage: System Account (r:2 w:2)
fn payout_stakers_dead_controller(n: u32, ) -> Weight {
(108_594_000 as Weight)
// Standard Error: 15_000
.saturating_add((46_477_000 as Weight).saturating_mul(n as Weight))
(124_714_000 as Weight)
// Standard Error: 23_000
.saturating_add((47_575_000 as Weight).saturating_mul(n as Weight))
.saturating_add(RocksDbWeight::get().reads(10 as Weight))
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
@@ -609,9 +608,9 @@ impl WeightInfo for () {
// Storage: System Account (r:2 w:2)
// Storage: Balances Locks (r:2 w:2)
fn payout_stakers_alive_staked(n: u32, ) -> Weight {
(157_564_000 as Weight)
// Standard Error: 20_000
.saturating_add((59_781_000 as Weight).saturating_mul(n as Weight))
(160_203_000 as Weight)
// Standard Error: 24_000
.saturating_add((61_321_000 as Weight).saturating_mul(n as Weight))
.saturating_add(RocksDbWeight::get().reads(11 as Weight))
.saturating_add(RocksDbWeight::get().reads((5 as Weight).saturating_mul(n as Weight)))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
@@ -621,9 +620,9 @@ impl WeightInfo for () {
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn rebond(l: u32, ) -> Weight {
(48_497_000 as Weight)
(49_593_000 as Weight)
// Standard Error: 3_000
.saturating_add((89_000 as Weight).saturating_mul(l as Weight))
.saturating_add((78_000 as Weight).saturating_mul(l as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
@@ -638,8 +637,8 @@ impl WeightInfo for () {
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
fn set_history_depth(e: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 73_000
.saturating_add((34_176_000 as Weight).saturating_mul(e as Weight))
// Standard Error: 71_000
.saturating_add((35_237_000 as Weight).saturating_mul(e as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
.saturating_add(RocksDbWeight::get().writes((7 as Weight).saturating_mul(e as Weight)))
@@ -655,22 +654,21 @@ impl WeightInfo for () {
// Storage: Staking Payee (r:0 w:1)
// Storage: Staking SpanSlash (r:0 w:1)
fn reap_stash(s: u32, ) -> Weight {
(71_895_000 as Weight)
// Standard Error: 0
.saturating_add((2_376_000 as Weight).saturating_mul(s as Weight))
(72_484_000 as Weight)
// Standard Error: 2_000
.saturating_add((2_452_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
// Storage: Staking CounterForNominators (r:1 w:0)
// Storage: Staking CounterForValidators (r:1 w:0)
// Storage: Staking SlashingSpans (r:1 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 SlashingSpans (r:1 w:0)
// Storage: Staking Nominators (r:101 w:0)
// Storage: Staking ValidatorCount (r:1 w:0)
// Storage: System BlockWeight (r:1 w:1)
// Storage: Staking MinimumValidatorCount (r:1 w:0)
// Storage: Staking CurrentEra (r:1 w:1)
// Storage: Staking HistoryDepth (r:1 w:0)
@@ -681,14 +679,14 @@ impl WeightInfo for () {
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
fn new_era(v: u32, n: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 980_000
.saturating_add((300_866_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 49_000
.saturating_add((46_397_000 as Weight).saturating_mul(n as Weight))
.saturating_add(RocksDbWeight::get().reads(10 as Weight))
// Standard Error: 856_000
.saturating_add((305_057_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 43_000
.saturating_add((47_890_000 as Weight).saturating_mul(n as Weight))
.saturating_add(RocksDbWeight::get().reads(9 as Weight))
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(v as Weight)))
}
// Storage: Staking Validators (r:501 w:0)
@@ -699,11 +697,11 @@ impl WeightInfo for () {
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 98_000
.saturating_add((24_916_000 as Weight).saturating_mul(v as Weight))
.saturating_add((25_610_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 98_000
.saturating_add((26_575_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 3_335_000
.saturating_add((22_464_000 as Weight).saturating_mul(s as Weight))
.saturating_add((28_064_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 3_346_000
.saturating_add((18_123_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
@@ -711,9 +709,9 @@ impl WeightInfo for () {
}
// Storage: Staking Validators (r:501 w:0)
fn get_npos_targets(v: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 32_000
.saturating_add((10_706_000 as Weight).saturating_mul(v as Weight))
(30_422_000 as Weight)
// Standard Error: 33_000
.saturating_add((11_252_000 as Weight).saturating_mul(v as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
}
@@ -723,7 +721,7 @@ impl WeightInfo for () {
// Storage: Staking MaxNominatorsCount (r:0 w:1)
// Storage: Staking MinNominatorBond (r:0 w:1)
fn set_staking_limits() -> Weight {
(6_463_000 as Weight)
(6_486_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
}
// Storage: Staking Ledger (r:1 w:0)
@@ -734,7 +732,7 @@ impl WeightInfo for () {
// Storage: Staking CounterForValidators (r:1 w:1)
// Storage: Staking MinValidatorBond (r:1 w:0)
fn chill_other() -> Weight {
(56_717_000 as Weight)
(58_222_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}