Remove implicit approval chilling upon slash. (#12420)

* don't read slashing spans when taking election snapshot

* update cargo.toml

* bring back remote test

* fix merge stuff

* fix npos-voters function sig

* remove as much redundant diff as you can

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

Co-authored-by: Andronik <write@reusable.software>

* fix

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

* update lock

* fix all tests

* review comments

* fmt

* fix offence bench

* clippy

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

Co-authored-by: Andronik <write@reusable.software>
Co-authored-by: Ankan <ankan.anurag@gmail.com>
Co-authored-by: command-bot <>
This commit is contained in:
Kian Paimani
2022-12-12 17:05:13 +00:00
committed by GitHub
parent af46f85e0c
commit 0b29691688
9 changed files with 526 additions and 546 deletions
+4 -7
View File
@@ -792,12 +792,10 @@ benchmarks! {
}
get_npos_voters {
// number of validator intention.
// number of validator intention. we will iterate all of them.
let v in (MaxValidators::<T>::get() / 2) .. MaxValidators::<T>::get();
// number of nominator intention.
// number of nominator intention. we will iterate all of them.
let n in (MaxNominators::<T>::get() / 2) .. MaxNominators::<T>::get();
// total number of slashing spans. Assigned to validators randomly.
let s in 1 .. 20;
let validators = create_validators_with_nominators_for_era::<T>(
v, n, T::MaxNominations::get() as usize, false, None
@@ -806,9 +804,8 @@ benchmarks! {
.map(|v| T::Lookup::lookup(v).unwrap())
.collect::<Vec<_>>();
(0..s).for_each(|index| {
add_slashing_spans::<T>(&validators[index as usize], 10);
});
assert_eq!(Validators::<T>::count(), v);
assert_eq!(Nominators::<T>::count(), n);
let num_voters = (v + n) as usize;
}: {
+14 -23
View File
@@ -40,7 +40,7 @@ use sp_staking::{
offence::{DisableStrategy, OffenceDetails, OnOffenceHandler},
EraIndex, SessionIndex, Stake, StakingInterface,
};
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
use sp_std::prelude::*;
use crate::{
log, slashing, weights::WeightInfo, ActiveEraInfo, BalanceOf, EraPayout, Exposure, ExposureOf,
@@ -351,6 +351,7 @@ impl<T: Config> Pallet<T> {
}
}
/// Start a new era. It does:
///
/// * Increment `active_era.index`,
/// * reset `active_era.start`,
@@ -704,11 +705,6 @@ impl<T: Config> Pallet<T> {
/// `maybe_max_len` can imposes a cap on the number of voters returned;
///
/// This function is self-weighing as [`DispatchClass::Mandatory`].
///
/// ### Slashing
///
/// All votes that have been submitted before the last non-zero slash of the corresponding
/// target are *auto-chilled*, but still count towards the limit imposed by `maybe_max_len`.
pub fn get_npos_voters(maybe_max_len: Option<usize>) -> Vec<VoterOf<Self>> {
let max_allowed_len = {
let all_voter_count = T::VoterList::count() as usize;
@@ -719,7 +715,6 @@ impl<T: Config> Pallet<T> {
// cache a few things.
let weight_of = Self::weight_of_fn();
let slashing_spans = <SlashingSpans<T>>::iter().collect::<BTreeMap<_, _>>();
let mut voters_seen = 0u32;
let mut validators_taken = 0u32;
@@ -737,18 +732,12 @@ impl<T: Config> Pallet<T> {
None => break,
};
if let Some(Nominations { submitted_in, mut targets, suppressed: _ }) =
<Nominators<T>>::get(&voter)
{
// if this voter is a nominator:
targets.retain(|stash| {
slashing_spans
.get(stash)
.map_or(true, |spans| submitted_in >= spans.last_nonzero_slash())
});
if !targets.len().is_zero() {
if let Some(Nominations { targets, .. }) = <Nominators<T>>::get(&voter) {
if !targets.is_empty() {
all_voters.push((voter.clone(), weight_of(&voter), targets));
nominators_taken.saturating_inc();
} else {
// Technically should never happen, but not much we can do about it.
}
} else if Validators::<T>::contains_key(&voter) {
// if this voter is a validator:
@@ -771,18 +760,14 @@ impl<T: Config> Pallet<T> {
warn,
"DEFENSIVE: invalid item in `VoterList`: {:?}, this nominator probably has too many nominations now",
voter
)
);
}
}
// all_voters should have not re-allocated.
debug_assert!(all_voters.capacity() == max_allowed_len);
Self::register_weight(T::WeightInfo::get_npos_voters(
validators_taken,
nominators_taken,
slashing_spans.len() as u32,
));
Self::register_weight(T::WeightInfo::get_npos_voters(validators_taken, nominators_taken));
log!(
info,
@@ -1285,6 +1270,12 @@ where
disable_strategy,
});
Self::deposit_event(Event::<T>::SlashReported {
validator: stash.clone(),
fraction: *slash_fraction,
slash_era,
});
if let Some(mut unapplied) = unapplied {
let nominators_len = unapplied.others.len() as u64;
let reporters_len = details.reporters.len() as u64;
+5 -2
View File
@@ -517,7 +517,7 @@ pub mod pallet {
#[pallet::storage]
#[pallet::getter(fn slashing_spans)]
#[pallet::unbounded]
pub(crate) type SlashingSpans<T: Config> =
pub type SlashingSpans<T: Config> =
StorageMap<_, Twox64Concat, T::AccountId, slashing::SlashingSpans>;
/// Records information about the maximum slash of a stash within a slashing span,
@@ -671,8 +671,11 @@ pub mod pallet {
EraPaid { era_index: EraIndex, validator_payout: BalanceOf<T>, remainder: BalanceOf<T> },
/// The nominator has been rewarded by this amount.
Rewarded { stash: T::AccountId, amount: BalanceOf<T> },
/// One staker (and potentially its nominators) has been slashed by the given amount.
/// A staker (validator or nominator) has been slashed by the given amount.
Slashed { staker: T::AccountId, amount: BalanceOf<T> },
/// A slash for the given validator, for the given percentage of their stake, at the given
/// era as been reported.
SlashReported { validator: T::AccountId, fraction: Perbill, slash_era: EraIndex },
/// An old slashing report from a prior era was discarded because it could
/// not be processed.
OldSlashingReportDiscarded { session_index: SessionIndex },
+3 -7
View File
@@ -239,9 +239,9 @@ pub(crate) fn compute_slash<T: Config>(
return None
}
let (prior_slash_p, _era_slash) =
let prior_slash_p =
<Pallet<T> as Store>::ValidatorSlashInEra::get(&params.slash_era, params.stash)
.unwrap_or((Perbill::zero(), Zero::zero()));
.map_or(Zero::zero(), |(prior_slash_proportion, _)| prior_slash_proportion);
// compare slash proportions rather than slash values to avoid issues due to rounding
// error.
@@ -390,9 +390,7 @@ fn slash_nominators<T: Config>(
let mut era_slash =
<Pallet<T> as Store>::NominatorSlashInEra::get(&params.slash_era, stash)
.unwrap_or_else(Zero::zero);
era_slash += own_slash_difference;
<Pallet<T> as Store>::NominatorSlashInEra::insert(&params.slash_era, stash, &era_slash);
era_slash
@@ -411,12 +409,10 @@ fn slash_nominators<T: Config>(
let target_span = spans.compare_and_update_span_slash(params.slash_era, era_slash);
if target_span == Some(spans.span_index()) {
// End the span, but don't chill the nominator. its nomination
// on this validator will be ignored in the future.
// end the span, but don't chill the nominator.
spans.end_span(params.now);
}
}
nominators_slashed.push((stash.clone(), nom_slashed));
}
+158 -172
View File
@@ -2845,6 +2845,8 @@ fn deferred_slashes_are_deferred() {
assert_eq!(Balances::free_balance(101), 2000);
let nominated_value = exposure.others.iter().find(|o| o.who == 101).unwrap().value;
System::reset_events();
on_offence_now(
&[OffenceDetails {
offender: (11, Staking::eras_stakers(active_era(), 11)),
@@ -2853,6 +2855,9 @@ fn deferred_slashes_are_deferred() {
&[Perbill::from_percent(10)],
);
// nominations are not removed regardless of the deferring.
assert_eq!(Staking::nominators(101).unwrap().targets, vec![11, 21]);
assert_eq!(Balances::free_balance(11), 1000);
assert_eq!(Balances::free_balance(101), 2000);
@@ -2866,8 +2871,6 @@ fn deferred_slashes_are_deferred() {
assert_eq!(Balances::free_balance(11), 1000);
assert_eq!(Balances::free_balance(101), 2000);
System::reset_events();
// at the start of era 4, slashes from era 1 are processed,
// after being deferred for at least 2 full eras.
mock::start_active_era(4);
@@ -2875,15 +2878,16 @@ fn deferred_slashes_are_deferred() {
assert_eq!(Balances::free_balance(11), 900);
assert_eq!(Balances::free_balance(101), 2000 - (nominated_value / 10));
assert_eq!(
staking_events_since_last_call(),
vec![
Event::StakersElected,
Event::EraPaid { era_index: 3, validator_payout: 11075, remainder: 33225 },
assert!(matches!(
staking_events_since_last_call().as_slice(),
&[
Event::Chilled { stash: 11 },
Event::SlashReported { validator: 11, slash_era: 1, .. },
..,
Event::Slashed { staker: 11, amount: 100 },
Event::Slashed { staker: 101, amount: 12 }
]
);
));
})
}
@@ -2896,25 +2900,29 @@ fn retroactive_deferred_slashes_two_eras_before() {
let exposure_11_at_era1 = Staking::eras_stakers(active_era(), 11);
mock::start_active_era(3);
assert_eq!(Staking::nominators(101).unwrap().targets, vec![11, 21]);
System::reset_events();
on_offence_in_era(
&[OffenceDetails { offender: (11, exposure_11_at_era1), reporters: vec![] }],
&[Perbill::from_percent(10)],
1, // should be deferred for two full eras, and applied at the beginning of era 4.
DisableStrategy::Never,
);
System::reset_events();
mock::start_active_era(4);
assert_eq!(
staking_events_since_last_call(),
vec![
Event::StakersElected,
Event::EraPaid { era_index: 3, validator_payout: 7100, remainder: 21300 },
assert!(matches!(
staking_events_since_last_call().as_slice(),
&[
Event::Chilled { stash: 11 },
Event::SlashReported { validator: 11, slash_era: 1, .. },
..,
Event::Slashed { staker: 11, amount: 100 },
Event::Slashed { staker: 101, amount: 12 },
Event::Slashed { staker: 101, amount: 12 }
]
);
));
})
}
@@ -2932,35 +2940,29 @@ fn retroactive_deferred_slashes_one_before() {
assert_ok!(Staking::unbond(RuntimeOrigin::signed(10), 100));
mock::start_active_era(3);
System::reset_events();
on_offence_in_era(
&[OffenceDetails { offender: (11, exposure_11_at_era1), reporters: vec![] }],
&[Perbill::from_percent(10)],
2, // should be deferred for two full eras, and applied at the beginning of era 5.
DisableStrategy::Never,
);
System::reset_events();
mock::start_active_era(4);
assert_eq!(
staking_events_since_last_call(),
vec![
Event::StakersElected,
Event::EraPaid { era_index: 3, validator_payout: 11075, remainder: 33225 }
]
);
assert_eq!(Staking::ledger(10).unwrap().total, 1000);
// slash happens after the next line.
mock::start_active_era(5);
assert_eq!(
staking_events_since_last_call(),
vec![
Event::StakersElected,
Event::EraPaid { era_index: 4, validator_payout: 11075, remainder: 33225 },
assert!(matches!(
staking_events_since_last_call().as_slice(),
&[
Event::SlashReported { validator: 11, slash_era: 2, .. },
..,
Event::Slashed { staker: 11, amount: 100 },
Event::Slashed { staker: 101, amount: 12 }
]
);
));
// their ledger has already been slashed.
assert_eq!(Staking::ledger(10).unwrap().total, 900);
@@ -3068,6 +3070,7 @@ fn remove_deferred() {
mock::start_active_era(2);
// reported later, but deferred to start of era 4 as well.
System::reset_events();
on_offence_in_era(
&[OffenceDetails { offender: (11, exposure.clone()), reporters: vec![] }],
&[Perbill::from_percent(15)],
@@ -3094,19 +3097,18 @@ fn remove_deferred() {
// at the start of era 4, slashes from era 1 are processed,
// after being deferred for at least 2 full eras.
System::reset_events();
mock::start_active_era(4);
// the first slash for 10% was cancelled, but the 15% one
assert_eq!(
staking_events_since_last_call(),
vec![
Event::StakersElected,
Event::EraPaid { era_index: 3, validator_payout: 11075, remainder: 33225 },
// the first slash for 10% was cancelled, but the 15% one not.
assert!(matches!(
staking_events_since_last_call().as_slice(),
&[
Event::SlashReported { validator: 11, slash_era: 1, .. },
..,
Event::Slashed { staker: 11, amount: 50 },
Event::Slashed { staker: 101, amount: 7 }
]
);
));
let slash_10 = Perbill::from_percent(10);
let slash_15 = Perbill::from_percent(15);
@@ -3196,6 +3198,9 @@ fn slash_kicks_validators_not_nominators_and_disables_nominator_for_kicked_valid
assert_eq!(Balances::free_balance(11), 1000);
assert_eq!(Balances::free_balance(101), 2000);
// 100 has approval for 11 as of now
assert!(Staking::nominators(101).unwrap().targets.contains(&11));
// 11 and 21 both have the support of 100
let exposure_11 = Staking::eras_stakers(active_era(), &11);
let exposure_21 = Staking::eras_stakers(active_era(), &21);
@@ -3208,23 +3213,29 @@ fn slash_kicks_validators_not_nominators_and_disables_nominator_for_kicked_valid
&[Perbill::from_percent(10)],
);
assert_eq!(
staking_events_since_last_call(),
vec![
Event::StakersElected,
Event::EraPaid { era_index: 0, validator_payout: 11075, remainder: 33225 },
Event::Chilled { stash: 11 },
Event::SlashReported {
validator: 11,
fraction: Perbill::from_percent(10),
slash_era: 1
},
Event::Slashed { staker: 11, amount: 100 },
Event::Slashed { staker: 101, amount: 12 },
]
);
// post-slash balance
let nominator_slash_amount_11 = 125 / 10;
assert_eq!(Balances::free_balance(11), 900);
assert_eq!(Balances::free_balance(101), 2000 - nominator_slash_amount_11);
// This is the best way to check that the validator was chilled; `get` will
// return default value.
for (stash, _) in <Staking as Store>::Validators::iter() {
assert!(stash != 11);
}
let nominations = <Staking as Store>::Nominators::get(&101).unwrap();
// and make sure that the vote will be ignored even if the validator
// re-registers.
let last_slash = <Staking as Store>::SlashingSpans::get(&11).unwrap().last_nonzero_slash();
assert!(nominations.submitted_in < last_slash);
// check that validator was chilled.
assert!(<Staking as Store>::Validators::iter().all(|(stash, _)| stash != 11));
// actually re-bond the slashed validator
assert_ok!(Staking::validate(RuntimeOrigin::signed(10), Default::default()));
@@ -3233,11 +3244,12 @@ fn slash_kicks_validators_not_nominators_and_disables_nominator_for_kicked_valid
let exposure_11 = Staking::eras_stakers(active_era(), &11);
let exposure_21 = Staking::eras_stakers(active_era(), &21);
// 10 is re-elected, but without the support of 100
assert_eq!(exposure_11.total, 900);
// 20 is re-elected, with the (almost) entire support of 100
assert_eq!(exposure_21.total, 1000 + 500 - nominator_slash_amount_11);
// 11's own expo is reduced. sum of support from 11 is less (448), which is 500
// 900 + 146
assert!(matches!(exposure_11, Exposure { own: 900, total: 1046, .. }));
// 1000 + 342
assert!(matches!(exposure_21, Exposure { own: 1000, total: 1342, .. }));
assert_eq!(500 - 146 - 342, nominator_slash_amount_11);
});
}
@@ -3256,12 +3268,40 @@ fn non_slashable_offence_doesnt_disable_validator() {
&[Perbill::zero()],
);
// it does NOT affect the nominator.
assert_eq!(Staking::nominators(101).unwrap().targets, vec![11, 21]);
// offence that slashes 25% of the bond
on_offence_now(
&[OffenceDetails { offender: (21, exposure_21.clone()), reporters: vec![] }],
&[Perbill::from_percent(25)],
);
// it DOES NOT affect the nominator.
assert_eq!(Staking::nominators(101).unwrap().targets, vec![11, 21]);
assert_eq!(
staking_events_since_last_call(),
vec![
Event::StakersElected,
Event::EraPaid { era_index: 0, validator_payout: 11075, remainder: 33225 },
Event::Chilled { stash: 11 },
Event::SlashReported {
validator: 11,
fraction: Perbill::from_percent(0),
slash_era: 1
},
Event::Chilled { stash: 21 },
Event::SlashReported {
validator: 21,
fraction: Perbill::from_percent(25),
slash_era: 1
},
Event::Slashed { staker: 21, amount: 250 },
Event::Slashed { staker: 101, amount: 94 }
]
);
// the offence for validator 10 wasn't slashable so it wasn't disabled
assert!(!is_disabled(10));
// whereas validator 20 gets disabled
@@ -3288,6 +3328,9 @@ fn slashing_independent_of_disabling_validator() {
DisableStrategy::Always,
);
// nomination remains untouched.
assert_eq!(Staking::nominators(101).unwrap().targets, vec![11, 21]);
// offence that slashes 25% of the bond, BUT not disabling
on_offence_in_era(
&[OffenceDetails { offender: (21, exposure_21.clone()), reporters: vec![] }],
@@ -3296,6 +3339,31 @@ fn slashing_independent_of_disabling_validator() {
DisableStrategy::Never,
);
// nomination remains untouched.
assert_eq!(Staking::nominators(101).unwrap().targets, vec![11, 21]);
assert_eq!(
staking_events_since_last_call(),
vec![
Event::StakersElected,
Event::EraPaid { era_index: 0, validator_payout: 11075, remainder: 33225 },
Event::Chilled { stash: 11 },
Event::SlashReported {
validator: 11,
fraction: Perbill::from_percent(0),
slash_era: 1
},
Event::Chilled { stash: 21 },
Event::SlashReported {
validator: 21,
fraction: Perbill::from_percent(25),
slash_era: 1
},
Event::Slashed { staker: 21, amount: 250 },
Event::Slashed { staker: 101, amount: 94 }
]
);
// the offence for validator 10 was explicitly disabled
assert!(is_disabled(10));
// whereas validator 20 is explicitly not disabled
@@ -3370,6 +3438,9 @@ fn disabled_validators_are_kept_disabled_for_whole_era() {
&[Perbill::from_percent(25)],
);
// nominations are not updated.
assert_eq!(Staking::nominators(101).unwrap().targets, vec![11, 21]);
// validator 10 should not be disabled since the offence wasn't slashable
assert!(!is_disabled(10));
// validator 20 gets disabled since it got slashed
@@ -3387,6 +3458,9 @@ fn disabled_validators_are_kept_disabled_for_whole_era() {
&[Perbill::from_percent(25)],
);
// nominations are not updated.
assert_eq!(Staking::nominators(101).unwrap().targets, vec![11, 21]);
advance_session();
// and both are disabled in the last session of the era
@@ -3503,18 +3577,10 @@ fn zero_slash_keeps_nominators() {
assert_eq!(Balances::free_balance(11), 1000);
assert_eq!(Balances::free_balance(101), 2000);
// This is the best way to check that the validator was chilled; `get` will
// return default value.
for (stash, _) in <Staking as Store>::Validators::iter() {
assert!(stash != 11);
}
let nominations = <Staking as Store>::Nominators::get(&101).unwrap();
// and make sure that the vote will not be ignored, because the slash was
// zero.
let last_slash = <Staking as Store>::SlashingSpans::get(&11).unwrap().last_nonzero_slash();
assert!(nominations.submitted_in >= last_slash);
// 11 is still removed..
assert!(<Staking as Store>::Validators::iter().all(|(stash, _)| stash != 11));
// but their nominations are kept.
assert_eq!(Staking::nominators(101).unwrap().targets, vec![11, 21]);
});
}
@@ -4380,15 +4446,14 @@ mod election_data_provider {
// we assume a network only wants up to 1000 validators in most cases, thus having 2000
// candidates is as high as it gets.
let validators = 2000;
// we assume the worse case: each validator also has a slashing span.
let slashing_spans = validators;
let mut nominators = 1000;
while <Test as Config>::WeightInfo::get_npos_voters(validators, nominators, slashing_spans)
.all_lt(Weight::from_parts(
while <Test as Config>::WeightInfo::get_npos_voters(validators, nominators).all_lt(
Weight::from_parts(
2u64 * frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND,
u64::MAX,
)) {
),
) {
nominators += 1;
}
@@ -4410,49 +4475,6 @@ mod election_data_provider {
})
}
#[test]
fn voters_exclude_slashed() {
ExtBuilder::default().build_and_execute(|| {
assert_eq!(Staking::nominators(101).unwrap().targets, vec![11, 21]);
assert_eq!(
<Staking as ElectionDataProvider>::electing_voters(None)
.unwrap()
.iter()
.find(|x| x.0 == 101)
.unwrap()
.2,
vec![11, 21]
);
start_active_era(1);
add_slash(&11);
// 11 is gone.
start_active_era(2);
assert_eq!(
<Staking as ElectionDataProvider>::electing_voters(None)
.unwrap()
.iter()
.find(|x| x.0 == 101)
.unwrap()
.2,
vec![21]
);
// resubmit and it is back
assert_ok!(Staking::nominate(RuntimeOrigin::signed(100), vec![11, 21]));
assert_eq!(
<Staking as ElectionDataProvider>::electing_voters(None)
.unwrap()
.iter()
.find(|x| x.0 == 101)
.unwrap()
.2,
vec![11, 21]
);
})
}
#[test]
fn respects_snapshot_len_limits() {
ExtBuilder::default()
@@ -4489,10 +4511,26 @@ mod election_data_provider {
fn only_iterates_max_2_times_max_allowed_len() {
ExtBuilder::default()
.nominate(false)
// the other nominators only nominate 21
.add_staker(61, 60, 2_000, StakerStatus::<AccountId>::Nominator(vec![21]))
.add_staker(71, 70, 2_000, StakerStatus::<AccountId>::Nominator(vec![21]))
.add_staker(81, 80, 2_000, StakerStatus::<AccountId>::Nominator(vec![21]))
// the best way to invalidate a bunch of nominators is to have them nominate a lot of
// ppl, but then lower the MaxNomination limit.
.add_staker(
61,
60,
2_000,
StakerStatus::<AccountId>::Nominator(vec![21, 22, 23, 24, 25]),
)
.add_staker(
71,
70,
2_000,
StakerStatus::<AccountId>::Nominator(vec![21, 22, 23, 24, 25]),
)
.add_staker(
81,
80,
2_000,
StakerStatus::<AccountId>::Nominator(vec![21, 22, 23, 24, 25]),
)
.build_and_execute(|| {
// all voters ordered by stake,
assert_eq!(
@@ -4500,10 +4538,7 @@ mod election_data_provider {
vec![61, 71, 81, 11, 21, 31]
);
run_to_block(25);
// slash 21, the only validator nominated by our first 3 nominators
add_slash(&21);
MaxNominations::set(2);
// we want 2 voters now, and in maximum we allow 4 iterations. This is what happens:
// 61 is pruned;
@@ -4523,55 +4558,6 @@ mod election_data_provider {
});
}
// Even if some of the higher staked nominators are slashed, we still get up to max len voters
// by adding more lower staked nominators. In other words, we assert that we keep on adding
// valid nominators until we reach max len voters; which is opposed to simply stopping after we
// have iterated max len voters, but not adding all of them to voters due to some nominators not
// having valid targets.
#[test]
fn get_max_len_voters_even_if_some_nominators_are_slashed() {
ExtBuilder::default()
.nominate(false)
.add_staker(61, 60, 20, StakerStatus::<AccountId>::Nominator(vec![21]))
.add_staker(71, 70, 10, StakerStatus::<AccountId>::Nominator(vec![11, 21]))
.add_staker(81, 80, 10, StakerStatus::<AccountId>::Nominator(vec![11, 21]))
.build_and_execute(|| {
// given our voters ordered by stake,
assert_eq!(
<Test as Config>::VoterList::iter().collect::<Vec<_>>(),
vec![11, 21, 31, 61, 71, 81]
);
// we take 4 voters
assert_eq!(
Staking::electing_voters(Some(4))
.unwrap()
.iter()
.map(|(stash, _, _)| stash)
.copied()
.collect::<Vec<_>>(),
vec![11, 21, 31, 61],
);
// roll to session 5
run_to_block(25);
// slash 21, the only validator nominated by 61.
add_slash(&21);
// we take 4 voters; 71 and 81 are replacing the ejected ones.
assert_eq!(
Staking::electing_voters(Some(4))
.unwrap()
.iter()
.map(|(stash, _, _)| stash)
.copied()
.collect::<Vec<_>>(),
vec![11, 31, 71, 81],
);
});
}
#[test]
fn estimate_next_election_works() {
ExtBuilder::default().session_per_era(5).period(5).build_and_execute(|| {
+312 -319
View File
@@ -18,24 +18,25 @@
//! Autogenerated weights for pallet_staking
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-11-07, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! DATE: 2022-12-12, 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:
// ./target/production/substrate
// /home/benchbot/cargo_target_dir/production/substrate
// benchmark
// pallet
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=pallet_staking
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./frame/staking/src/weights.rs
// --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)]
@@ -70,7 +71,7 @@ pub trait WeightInfo {
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, s: 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;
@@ -87,10 +88,10 @@ 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 {
// Minimum execution time: 53_097 nanoseconds.
Weight::from_ref_time(53_708_000 as u64)
.saturating_add(T::DbWeight::get().reads(4 as u64))
.saturating_add(T::DbWeight::get().writes(4 as u64))
// Minimum execution time: 56_034 nanoseconds.
Weight::from_ref_time(56_646_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)
@@ -98,10 +99,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: VoterList ListNodes (r:3 w:3)
// Storage: VoterList ListBags (r:2 w:2)
fn bond_extra() -> Weight {
// Minimum execution time: 92_199 nanoseconds.
Weight::from_ref_time(93_541_000 as u64)
.saturating_add(T::DbWeight::get().reads(8 as u64))
.saturating_add(T::DbWeight::get().writes(7 as u64))
// Minimum execution time: 94_354 nanoseconds.
Weight::from_ref_time(95_318_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)
@@ -113,10 +114,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Bonded (r:1 w:0)
// Storage: VoterList ListBags (r:2 w:2)
fn unbond() -> Weight {
// Minimum execution time: 98_227 nanoseconds.
Weight::from_ref_time(99_070_000 as u64)
.saturating_add(T::DbWeight::get().reads(12 as u64))
.saturating_add(T::DbWeight::get().writes(8 as u64))
// Minimum execution time: 99_960 nanoseconds.
Weight::from_ref_time(101_022_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)
@@ -124,12 +125,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// 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_058 nanoseconds.
Weight::from_ref_time(46_592_713 as u64)
// Standard Error: 413
.saturating_add(Weight::from_ref_time(63_036 as u64).saturating_mul(s as u64))
.saturating_add(T::DbWeight::get().reads(4 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
// Minimum execution time: 45_819 nanoseconds.
Weight::from_ref_time(48_073_614)
// Standard Error: 1_410
.saturating_add(Weight::from_ref_time(62_881).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)
@@ -146,10 +147,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Payee (r:0 w:1)
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_kill(_s: u32, ) -> Weight {
// Minimum execution time: 86_087 nanoseconds.
Weight::from_ref_time(87_627_894 as u64)
.saturating_add(T::DbWeight::get().reads(13 as u64))
.saturating_add(T::DbWeight::get().writes(11 as u64))
// Minimum execution time: 86_035 nanoseconds.
Weight::from_ref_time(89_561_735)
.saturating_add(T::DbWeight::get().reads(13))
.saturating_add(T::DbWeight::get().writes(11))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking MinValidatorBond (r:1 w:0)
@@ -163,22 +164,22 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: VoterList CounterForListNodes (r:1 w:1)
// Storage: Staking CounterForValidators (r:1 w:1)
fn validate() -> Weight {
// Minimum execution time: 67_690 nanoseconds.
Weight::from_ref_time(68_348_000 as u64)
.saturating_add(T::DbWeight::get().reads(11 as u64))
.saturating_add(T::DbWeight::get().writes(5 as u64))
// Minimum execution time: 68_748 nanoseconds.
Weight::from_ref_time(69_285_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: 43_512 nanoseconds.
Weight::from_ref_time(47_300_477 as u64)
// Standard Error: 11_609
.saturating_add(Weight::from_ref_time(6_770_405 as u64).saturating_mul(k as u64))
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(k as u64)))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(k as u64)))
// Minimum execution time: 41_641 nanoseconds.
Weight::from_ref_time(48_919_231)
// Standard Error: 11_548
.saturating_add(Weight::from_ref_time(6_901_201).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)
@@ -193,13 +194,13 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking CounterForNominators (r:1 w:1)
/// The range of component `n` is `[1, 16]`.
fn nominate(n: u32, ) -> Weight {
// Minimum execution time: 74_296 nanoseconds.
Weight::from_ref_time(73_201_782 as u64)
// Standard Error: 5_007
.saturating_add(Weight::from_ref_time(2_810_370 as u64).saturating_mul(n as u64))
.saturating_add(T::DbWeight::get().reads(12 as u64))
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(n as u64)))
.saturating_add(T::DbWeight::get().writes(6 as u64))
// Minimum execution time: 75_097 nanoseconds.
Weight::from_ref_time(74_052_497)
// Standard Error: 6_784
.saturating_add(Weight::from_ref_time(2_842_146).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)
@@ -209,59 +210,59 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
fn chill() -> Weight {
// Minimum execution time: 66_605 nanoseconds.
Weight::from_ref_time(67_279_000 as u64)
.saturating_add(T::DbWeight::get().reads(8 as u64))
.saturating_add(T::DbWeight::get().writes(6 as u64))
// Minimum execution time: 67_307 nanoseconds.
Weight::from_ref_time(67_838_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_897 nanoseconds.
Weight::from_ref_time(19_357_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
// Minimum execution time: 18_831 nanoseconds.
Weight::from_ref_time(19_047_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_509 nanoseconds.
Weight::from_ref_time(26_961_000 as u64)
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
// Minimum execution time: 27_534 nanoseconds.
Weight::from_ref_time(27_806_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: 5_025 nanoseconds.
Weight::from_ref_time(5_240_000 as u64)
.saturating_add(T::DbWeight::get().writes(1 as u64))
// Minimum execution time: 5_211 nanoseconds.
Weight::from_ref_time(5_372_000)
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_no_eras() -> Weight {
// Minimum execution time: 5_107 nanoseconds.
Weight::from_ref_time(5_320_000 as u64)
.saturating_add(T::DbWeight::get().writes(1 as u64))
// Minimum execution time: 5_382 nanoseconds.
Weight::from_ref_time(5_654_000)
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era() -> Weight {
// Minimum execution time: 5_094 nanoseconds.
Weight::from_ref_time(5_377_000 as u64)
.saturating_add(T::DbWeight::get().writes(1 as u64))
// Minimum execution time: 5_618 nanoseconds.
Weight::from_ref_time(5_714_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_219 nanoseconds.
Weight::from_ref_time(5_434_000 as u64)
.saturating_add(T::DbWeight::get().writes(1 as u64))
// Minimum execution time: 5_589 nanoseconds.
Weight::from_ref_time(5_776_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_122 nanoseconds.
Weight::from_ref_time(5_977_533 as u64)
// Standard Error: 34
.saturating_add(Weight::from_ref_time(10_205 as u64).saturating_mul(v as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
// Minimum execution time: 5_541 nanoseconds.
Weight::from_ref_time(6_479_253)
// Standard Error: 49
.saturating_add(Weight::from_ref_time(10_125).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)
@@ -278,23 +279,23 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// 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_216 nanoseconds.
Weight::from_ref_time(86_090_609 as u64)
// Standard Error: 2_006
.saturating_add(Weight::from_ref_time(1_039_308 as u64).saturating_mul(s as u64))
.saturating_add(T::DbWeight::get().reads(11 as u64))
.saturating_add(T::DbWeight::get().writes(12 as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64)))
// Minimum execution time: 81_041 nanoseconds.
Weight::from_ref_time(88_526_481)
// Standard Error: 11_494
.saturating_add(Weight::from_ref_time(1_095_933).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: 92_034 nanoseconds.
Weight::from_ref_time(896_585_370 as u64)
// Standard Error: 58_231
.saturating_add(Weight::from_ref_time(4_908_277 as u64).saturating_mul(s as u64))
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
// Minimum execution time: 92_308 nanoseconds.
Weight::from_ref_time(900_351_007)
// Standard Error: 59_145
.saturating_add(Weight::from_ref_time(4_944_988).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)
@@ -307,14 +308,14 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// 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_936 nanoseconds.
Weight::from_ref_time(184_556_084 as u64)
// Standard Error: 26_981
.saturating_add(Weight::from_ref_time(21_786_304 as u64).saturating_mul(n as u64))
.saturating_add(T::DbWeight::get().reads(9 as u64))
.saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(n as u64)))
.saturating_add(T::DbWeight::get().writes(2 as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(n as u64)))
// Minimum execution time: 131_855 nanoseconds.
Weight::from_ref_time(197_412_779)
// Standard Error: 21_283
.saturating_add(Weight::from_ref_time(22_093_758).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)
@@ -328,14 +329,14 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// 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: 157_778 nanoseconds.
Weight::from_ref_time(223_306_359 as u64)
// Standard Error: 27_216
.saturating_add(Weight::from_ref_time(30_612_663 as u64).saturating_mul(n as u64))
.saturating_add(T::DbWeight::get().reads(10 as u64))
.saturating_add(T::DbWeight::get().reads((5 as u64).saturating_mul(n as u64)))
.saturating_add(T::DbWeight::get().writes(3 as u64))
.saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(n as u64)))
// Minimum execution time: 163_118 nanoseconds.
Weight::from_ref_time(229_356_697)
// Standard Error: 30_740
.saturating_add(Weight::from_ref_time(31_575_360).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)
@@ -345,12 +346,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: VoterList ListBags (r:2 w:2)
/// The range of component `l` is `[1, 32]`.
fn rebond(l: u32, ) -> Weight {
// Minimum execution time: 92_880 nanoseconds.
Weight::from_ref_time(94_434_663 as u64)
// Standard Error: 1_734
.saturating_add(Weight::from_ref_time(34_453 as u64).saturating_mul(l as u64))
.saturating_add(T::DbWeight::get().reads(9 as u64))
.saturating_add(T::DbWeight::get().writes(8 as u64))
// Minimum execution time: 94_048 nanoseconds.
Weight::from_ref_time(95_784_236)
// Standard Error: 2_313
.saturating_add(Weight::from_ref_time(52_798).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)
@@ -367,16 +368,15 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// 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_334 nanoseconds.
Weight::from_ref_time(95_207_614 as u64)
// Standard Error: 1_822
.saturating_add(Weight::from_ref_time(1_036_787 as u64).saturating_mul(s as u64))
.saturating_add(T::DbWeight::get().reads(12 as u64))
.saturating_add(T::DbWeight::get().writes(12 as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64)))
// Minimum execution time: 93_342 nanoseconds.
Weight::from_ref_time(95_756_184)
// Standard Error: 2_067
.saturating_add(Weight::from_ref_time(1_090_785).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: Staking SlashingSpans (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)
@@ -395,20 +395,19 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// 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: 535_169 nanoseconds.
Weight::from_ref_time(548_667_000 as u64)
// Standard Error: 1_759_252
.saturating_add(Weight::from_ref_time(58_283_319 as u64).saturating_mul(v as u64))
// Standard Error: 175_299
.saturating_add(Weight::from_ref_time(13_578_512 as u64).saturating_mul(n as u64))
.saturating_add(T::DbWeight::get().reads(207 as u64))
.saturating_add(T::DbWeight::get().reads((5 as u64).saturating_mul(v as u64)))
.saturating_add(T::DbWeight::get().reads((4 as u64).saturating_mul(n as u64)))
.saturating_add(T::DbWeight::get().writes(3 as u64))
.saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(v as u64)))
// Minimum execution time: 506_874 nanoseconds.
Weight::from_ref_time(507_798_000)
// Standard Error: 1_802_261
.saturating_add(Weight::from_ref_time(59_874_736).saturating_mul(v.into()))
// Standard Error: 179_585
.saturating_add(Weight::from_ref_time(13_668_574).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: Staking SlashingSpans (r:21 w:0)
// Storage: VoterList ListBags (r:200 w:0)
// Storage: VoterList ListNodes (r:1500 w:0)
// Storage: Staking Nominators (r:1500 w:0)
@@ -417,29 +416,27 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Ledger (r:1500 w:0)
/// The range of component `v` is `[500, 1000]`.
/// The range of component `n` is `[500, 1000]`.
/// The range of component `s` is `[1, 20]`.
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
// Minimum execution time: 25_323_129 nanoseconds.
Weight::from_ref_time(25_471_672_000 as u64)
// Standard Error: 266_391
.saturating_add(Weight::from_ref_time(6_665_504 as u64).saturating_mul(v as u64))
// Standard Error: 266_391
.saturating_add(Weight::from_ref_time(6_956_606 as u64).saturating_mul(n as u64))
.saturating_add(T::DbWeight::get().reads(202 as u64))
.saturating_add(T::DbWeight::get().reads((5 as u64).saturating_mul(v as u64)))
.saturating_add(T::DbWeight::get().reads((4 as u64).saturating_mul(n as u64)))
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(s as u64)))
fn get_npos_voters(v: u32, n: u32, ) -> Weight {
// Minimum execution time: 24_634_585 nanoseconds.
Weight::from_ref_time(24_718_377_000)
// Standard Error: 324_839
.saturating_add(Weight::from_ref_time(3_654_508).saturating_mul(v.into()))
// Standard Error: 324_839
.saturating_add(Weight::from_ref_time(2_927_535).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_905_036 nanoseconds.
Weight::from_ref_time(78_163_554 as u64)
// Standard Error: 23_723
.saturating_add(Weight::from_ref_time(9_784_870 as u64).saturating_mul(v as u64))
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(v as u64)))
// Minimum execution time: 4_805_490 nanoseconds.
Weight::from_ref_time(118_475_494)
// Standard Error: 26_332
.saturating_add(Weight::from_ref_time(9_635_188).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)
@@ -448,9 +445,9 @@ 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_configs_all_set() -> Weight {
// Minimum execution time: 10_096 nanoseconds.
Weight::from_ref_time(10_538_000 as u64)
.saturating_add(T::DbWeight::get().writes(6 as u64))
// Minimum execution time: 10_816 nanoseconds.
Weight::from_ref_time(11_242_000)
.saturating_add(T::DbWeight::get().writes(6))
}
// Storage: Staking MinCommission (r:0 w:1)
// Storage: Staking MinValidatorBond (r:0 w:1)
@@ -459,9 +456,9 @@ 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_configs_all_remove() -> Weight {
// Minimum execution time: 9_045 nanoseconds.
Weight::from_ref_time(9_379_000 as u64)
.saturating_add(T::DbWeight::get().writes(6 as u64))
// Minimum execution time: 9_581 nanoseconds.
Weight::from_ref_time(10_383_000)
.saturating_add(T::DbWeight::get().writes(6))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
@@ -474,18 +471,18 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
fn chill_other() -> Weight {
// Minimum execution time: 81_457 nanoseconds.
Weight::from_ref_time(82_410_000 as u64)
.saturating_add(T::DbWeight::get().reads(11 as u64))
.saturating_add(T::DbWeight::get().writes(6 as u64))
// Minimum execution time: 83_669 nanoseconds.
Weight::from_ref_time(84_772_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: 19_684 nanoseconds.
Weight::from_ref_time(20_059_000 as u64)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
// Minimum execution time: 20_553 nanoseconds.
Weight::from_ref_time(20_933_000)
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
}
@@ -497,10 +494,10 @@ impl WeightInfo for () {
// Storage: Balances Locks (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn bond() -> Weight {
// Minimum execution time: 53_097 nanoseconds.
Weight::from_ref_time(53_708_000 as u64)
.saturating_add(RocksDbWeight::get().reads(4 as u64))
.saturating_add(RocksDbWeight::get().writes(4 as u64))
// Minimum execution time: 56_034 nanoseconds.
Weight::from_ref_time(56_646_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)
@@ -508,10 +505,10 @@ impl WeightInfo for () {
// Storage: VoterList ListNodes (r:3 w:3)
// Storage: VoterList ListBags (r:2 w:2)
fn bond_extra() -> Weight {
// Minimum execution time: 92_199 nanoseconds.
Weight::from_ref_time(93_541_000 as u64)
.saturating_add(RocksDbWeight::get().reads(8 as u64))
.saturating_add(RocksDbWeight::get().writes(7 as u64))
// Minimum execution time: 94_354 nanoseconds.
Weight::from_ref_time(95_318_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)
@@ -523,10 +520,10 @@ impl WeightInfo for () {
// Storage: Staking Bonded (r:1 w:0)
// Storage: VoterList ListBags (r:2 w:2)
fn unbond() -> Weight {
// Minimum execution time: 98_227 nanoseconds.
Weight::from_ref_time(99_070_000 as u64)
.saturating_add(RocksDbWeight::get().reads(12 as u64))
.saturating_add(RocksDbWeight::get().writes(8 as u64))
// Minimum execution time: 99_960 nanoseconds.
Weight::from_ref_time(101_022_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)
@@ -534,12 +531,12 @@ impl WeightInfo for () {
// 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_058 nanoseconds.
Weight::from_ref_time(46_592_713 as u64)
// Standard Error: 413
.saturating_add(Weight::from_ref_time(63_036 as u64).saturating_mul(s as u64))
.saturating_add(RocksDbWeight::get().reads(4 as u64))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
// Minimum execution time: 45_819 nanoseconds.
Weight::from_ref_time(48_073_614)
// Standard Error: 1_410
.saturating_add(Weight::from_ref_time(62_881).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)
@@ -556,10 +553,10 @@ impl WeightInfo for () {
// Storage: Staking Payee (r:0 w:1)
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_kill(_s: u32, ) -> Weight {
// Minimum execution time: 86_087 nanoseconds.
Weight::from_ref_time(87_627_894 as u64)
.saturating_add(RocksDbWeight::get().reads(13 as u64))
.saturating_add(RocksDbWeight::get().writes(11 as u64))
// Minimum execution time: 86_035 nanoseconds.
Weight::from_ref_time(89_561_735)
.saturating_add(RocksDbWeight::get().reads(13))
.saturating_add(RocksDbWeight::get().writes(11))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking MinValidatorBond (r:1 w:0)
@@ -573,22 +570,22 @@ impl WeightInfo for () {
// Storage: VoterList CounterForListNodes (r:1 w:1)
// Storage: Staking CounterForValidators (r:1 w:1)
fn validate() -> Weight {
// Minimum execution time: 67_690 nanoseconds.
Weight::from_ref_time(68_348_000 as u64)
.saturating_add(RocksDbWeight::get().reads(11 as u64))
.saturating_add(RocksDbWeight::get().writes(5 as u64))
// Minimum execution time: 68_748 nanoseconds.
Weight::from_ref_time(69_285_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: 43_512 nanoseconds.
Weight::from_ref_time(47_300_477 as u64)
// Standard Error: 11_609
.saturating_add(Weight::from_ref_time(6_770_405 as u64).saturating_mul(k as u64))
.saturating_add(RocksDbWeight::get().reads(1 as u64))
.saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(k as u64)))
.saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(k as u64)))
// Minimum execution time: 41_641 nanoseconds.
Weight::from_ref_time(48_919_231)
// Standard Error: 11_548
.saturating_add(Weight::from_ref_time(6_901_201).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)
@@ -603,13 +600,13 @@ impl WeightInfo for () {
// Storage: Staking CounterForNominators (r:1 w:1)
/// The range of component `n` is `[1, 16]`.
fn nominate(n: u32, ) -> Weight {
// Minimum execution time: 74_296 nanoseconds.
Weight::from_ref_time(73_201_782 as u64)
// Standard Error: 5_007
.saturating_add(Weight::from_ref_time(2_810_370 as u64).saturating_mul(n as u64))
.saturating_add(RocksDbWeight::get().reads(12 as u64))
.saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(n as u64)))
.saturating_add(RocksDbWeight::get().writes(6 as u64))
// Minimum execution time: 75_097 nanoseconds.
Weight::from_ref_time(74_052_497)
// Standard Error: 6_784
.saturating_add(Weight::from_ref_time(2_842_146).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)
@@ -619,59 +616,59 @@ impl WeightInfo for () {
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
fn chill() -> Weight {
// Minimum execution time: 66_605 nanoseconds.
Weight::from_ref_time(67_279_000 as u64)
.saturating_add(RocksDbWeight::get().reads(8 as u64))
.saturating_add(RocksDbWeight::get().writes(6 as u64))
// Minimum execution time: 67_307 nanoseconds.
Weight::from_ref_time(67_838_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_897 nanoseconds.
Weight::from_ref_time(19_357_000 as u64)
.saturating_add(RocksDbWeight::get().reads(1 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
// Minimum execution time: 18_831 nanoseconds.
Weight::from_ref_time(19_047_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_509 nanoseconds.
Weight::from_ref_time(26_961_000 as u64)
.saturating_add(RocksDbWeight::get().reads(3 as u64))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
// Minimum execution time: 27_534 nanoseconds.
Weight::from_ref_time(27_806_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: 5_025 nanoseconds.
Weight::from_ref_time(5_240_000 as u64)
.saturating_add(RocksDbWeight::get().writes(1 as u64))
// Minimum execution time: 5_211 nanoseconds.
Weight::from_ref_time(5_372_000)
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_no_eras() -> Weight {
// Minimum execution time: 5_107 nanoseconds.
Weight::from_ref_time(5_320_000 as u64)
.saturating_add(RocksDbWeight::get().writes(1 as u64))
// Minimum execution time: 5_382 nanoseconds.
Weight::from_ref_time(5_654_000)
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era() -> Weight {
// Minimum execution time: 5_094 nanoseconds.
Weight::from_ref_time(5_377_000 as u64)
.saturating_add(RocksDbWeight::get().writes(1 as u64))
// Minimum execution time: 5_618 nanoseconds.
Weight::from_ref_time(5_714_000)
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era_always() -> Weight {
// Minimum execution time: 5_219 nanoseconds.
Weight::from_ref_time(5_434_000 as u64)
.saturating_add(RocksDbWeight::get().writes(1 as u64))
// Minimum execution time: 5_589 nanoseconds.
Weight::from_ref_time(5_776_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_122 nanoseconds.
Weight::from_ref_time(5_977_533 as u64)
// Standard Error: 34
.saturating_add(Weight::from_ref_time(10_205 as u64).saturating_mul(v as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
// Minimum execution time: 5_541 nanoseconds.
Weight::from_ref_time(6_479_253)
// Standard Error: 49
.saturating_add(Weight::from_ref_time(10_125).saturating_mul(v.into()))
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking SlashingSpans (r:1 w:0)
@@ -688,23 +685,23 @@ impl WeightInfo for () {
// 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_216 nanoseconds.
Weight::from_ref_time(86_090_609 as u64)
// Standard Error: 2_006
.saturating_add(Weight::from_ref_time(1_039_308 as u64).saturating_mul(s as u64))
.saturating_add(RocksDbWeight::get().reads(11 as u64))
.saturating_add(RocksDbWeight::get().writes(12 as u64))
.saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(s as u64)))
// Minimum execution time: 81_041 nanoseconds.
Weight::from_ref_time(88_526_481)
// Standard Error: 11_494
.saturating_add(Weight::from_ref_time(1_095_933).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: 92_034 nanoseconds.
Weight::from_ref_time(896_585_370 as u64)
// Standard Error: 58_231
.saturating_add(Weight::from_ref_time(4_908_277 as u64).saturating_mul(s as u64))
.saturating_add(RocksDbWeight::get().reads(1 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
// Minimum execution time: 92_308 nanoseconds.
Weight::from_ref_time(900_351_007)
// Standard Error: 59_145
.saturating_add(Weight::from_ref_time(4_944_988).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)
@@ -717,14 +714,14 @@ impl WeightInfo for () {
// 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_936 nanoseconds.
Weight::from_ref_time(184_556_084 as u64)
// Standard Error: 26_981
.saturating_add(Weight::from_ref_time(21_786_304 as u64).saturating_mul(n as u64))
.saturating_add(RocksDbWeight::get().reads(9 as u64))
.saturating_add(RocksDbWeight::get().reads((3 as u64).saturating_mul(n as u64)))
.saturating_add(RocksDbWeight::get().writes(2 as u64))
.saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(n as u64)))
// Minimum execution time: 131_855 nanoseconds.
Weight::from_ref_time(197_412_779)
// Standard Error: 21_283
.saturating_add(Weight::from_ref_time(22_093_758).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)
@@ -738,14 +735,14 @@ impl WeightInfo for () {
// 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: 157_778 nanoseconds.
Weight::from_ref_time(223_306_359 as u64)
// Standard Error: 27_216
.saturating_add(Weight::from_ref_time(30_612_663 as u64).saturating_mul(n as u64))
.saturating_add(RocksDbWeight::get().reads(10 as u64))
.saturating_add(RocksDbWeight::get().reads((5 as u64).saturating_mul(n as u64)))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
.saturating_add(RocksDbWeight::get().writes((3 as u64).saturating_mul(n as u64)))
// Minimum execution time: 163_118 nanoseconds.
Weight::from_ref_time(229_356_697)
// Standard Error: 30_740
.saturating_add(Weight::from_ref_time(31_575_360).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)
@@ -755,12 +752,12 @@ impl WeightInfo for () {
// Storage: VoterList ListBags (r:2 w:2)
/// The range of component `l` is `[1, 32]`.
fn rebond(l: u32, ) -> Weight {
// Minimum execution time: 92_880 nanoseconds.
Weight::from_ref_time(94_434_663 as u64)
// Standard Error: 1_734
.saturating_add(Weight::from_ref_time(34_453 as u64).saturating_mul(l as u64))
.saturating_add(RocksDbWeight::get().reads(9 as u64))
.saturating_add(RocksDbWeight::get().writes(8 as u64))
// Minimum execution time: 94_048 nanoseconds.
Weight::from_ref_time(95_784_236)
// Standard Error: 2_313
.saturating_add(Weight::from_ref_time(52_798).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)
@@ -777,16 +774,15 @@ impl WeightInfo for () {
// 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_334 nanoseconds.
Weight::from_ref_time(95_207_614 as u64)
// Standard Error: 1_822
.saturating_add(Weight::from_ref_time(1_036_787 as u64).saturating_mul(s as u64))
.saturating_add(RocksDbWeight::get().reads(12 as u64))
.saturating_add(RocksDbWeight::get().writes(12 as u64))
.saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(s as u64)))
// Minimum execution time: 93_342 nanoseconds.
Weight::from_ref_time(95_756_184)
// Standard Error: 2_067
.saturating_add(Weight::from_ref_time(1_090_785).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: Staking SlashingSpans (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)
@@ -805,20 +801,19 @@ impl WeightInfo for () {
/// 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: 535_169 nanoseconds.
Weight::from_ref_time(548_667_000 as u64)
// Standard Error: 1_759_252
.saturating_add(Weight::from_ref_time(58_283_319 as u64).saturating_mul(v as u64))
// Standard Error: 175_299
.saturating_add(Weight::from_ref_time(13_578_512 as u64).saturating_mul(n as u64))
.saturating_add(RocksDbWeight::get().reads(207 as u64))
.saturating_add(RocksDbWeight::get().reads((5 as u64).saturating_mul(v as u64)))
.saturating_add(RocksDbWeight::get().reads((4 as u64).saturating_mul(n as u64)))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
.saturating_add(RocksDbWeight::get().writes((3 as u64).saturating_mul(v as u64)))
// Minimum execution time: 506_874 nanoseconds.
Weight::from_ref_time(507_798_000)
// Standard Error: 1_802_261
.saturating_add(Weight::from_ref_time(59_874_736).saturating_mul(v.into()))
// Standard Error: 179_585
.saturating_add(Weight::from_ref_time(13_668_574).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: Staking SlashingSpans (r:21 w:0)
// Storage: VoterList ListBags (r:200 w:0)
// Storage: VoterList ListNodes (r:1500 w:0)
// Storage: Staking Nominators (r:1500 w:0)
@@ -827,29 +822,27 @@ impl WeightInfo for () {
// Storage: Staking Ledger (r:1500 w:0)
/// The range of component `v` is `[500, 1000]`.
/// The range of component `n` is `[500, 1000]`.
/// The range of component `s` is `[1, 20]`.
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
// Minimum execution time: 25_323_129 nanoseconds.
Weight::from_ref_time(25_471_672_000 as u64)
// Standard Error: 266_391
.saturating_add(Weight::from_ref_time(6_665_504 as u64).saturating_mul(v as u64))
// Standard Error: 266_391
.saturating_add(Weight::from_ref_time(6_956_606 as u64).saturating_mul(n as u64))
.saturating_add(RocksDbWeight::get().reads(202 as u64))
.saturating_add(RocksDbWeight::get().reads((5 as u64).saturating_mul(v as u64)))
.saturating_add(RocksDbWeight::get().reads((4 as u64).saturating_mul(n as u64)))
.saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(s as u64)))
fn get_npos_voters(v: u32, n: u32, ) -> Weight {
// Minimum execution time: 24_634_585 nanoseconds.
Weight::from_ref_time(24_718_377_000)
// Standard Error: 324_839
.saturating_add(Weight::from_ref_time(3_654_508).saturating_mul(v.into()))
// Standard Error: 324_839
.saturating_add(Weight::from_ref_time(2_927_535).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_905_036 nanoseconds.
Weight::from_ref_time(78_163_554 as u64)
// Standard Error: 23_723
.saturating_add(Weight::from_ref_time(9_784_870 as u64).saturating_mul(v as u64))
.saturating_add(RocksDbWeight::get().reads(2 as u64))
.saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(v as u64)))
// Minimum execution time: 4_805_490 nanoseconds.
Weight::from_ref_time(118_475_494)
// Standard Error: 26_332
.saturating_add(Weight::from_ref_time(9_635_188).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)
@@ -858,9 +851,9 @@ impl WeightInfo for () {
// Storage: Staking MaxNominatorsCount (r:0 w:1)
// Storage: Staking MinNominatorBond (r:0 w:1)
fn set_staking_configs_all_set() -> Weight {
// Minimum execution time: 10_096 nanoseconds.
Weight::from_ref_time(10_538_000 as u64)
.saturating_add(RocksDbWeight::get().writes(6 as u64))
// Minimum execution time: 10_816 nanoseconds.
Weight::from_ref_time(11_242_000)
.saturating_add(RocksDbWeight::get().writes(6))
}
// Storage: Staking MinCommission (r:0 w:1)
// Storage: Staking MinValidatorBond (r:0 w:1)
@@ -869,9 +862,9 @@ impl WeightInfo for () {
// 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_045 nanoseconds.
Weight::from_ref_time(9_379_000 as u64)
.saturating_add(RocksDbWeight::get().writes(6 as u64))
// Minimum execution time: 9_581 nanoseconds.
Weight::from_ref_time(10_383_000)
.saturating_add(RocksDbWeight::get().writes(6))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
@@ -884,17 +877,17 @@ impl WeightInfo for () {
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
fn chill_other() -> Weight {
// Minimum execution time: 81_457 nanoseconds.
Weight::from_ref_time(82_410_000 as u64)
.saturating_add(RocksDbWeight::get().reads(11 as u64))
.saturating_add(RocksDbWeight::get().writes(6 as u64))
// Minimum execution time: 83_669 nanoseconds.
Weight::from_ref_time(84_772_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: 19_684 nanoseconds.
Weight::from_ref_time(20_059_000 as u64)
.saturating_add(RocksDbWeight::get().reads(2 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
// Minimum execution time: 20_553 nanoseconds.
Weight::from_ref_time(20_933_000)
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(1))
}
}