mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 16:21:06 +00:00
pallet-staking: Add extrinsic force_apply_min_commission (#10786)
* pallet-staking: Add extrinsic `force_apply_min_commission` * Add benchmarks * cargo run --quiet --profile=production --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 * Bound iteration by max_validator_count * cargo run --quiet --profile=production --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 * Only apply to 1 validator * Update doc comments * Uncomment tests * cargo run --quiet --profile=production --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 * Accept signed origins * cargo run --quiet --profile=production --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 contains_key check * Add test for try_mutate_exists * Impove try_mutate_exists docs * Delete redundant try_mutate_exists tests; * Delete residual from removed test * cargo run --quiet --profile=production --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 * Return an error when the stash does not exist * Update try_mutate_exist doc wording * Update frame/staking/src/pallet/mod.rs * Apply suggestions from code review Co-authored-by: Parity Bot <admin@parity.io> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -900,6 +900,35 @@ benchmarks! {
|
||||
assert!(!T::SortedListProvider::contains(&stash));
|
||||
}
|
||||
|
||||
force_apply_min_commission {
|
||||
// Clean up any existing state
|
||||
clear_validators_and_nominators::<T>();
|
||||
|
||||
// Create a validator with a commission of 50%
|
||||
let (stash, controller) =
|
||||
create_stash_controller::<T>(1, 1, RewardDestination::Staked)?;
|
||||
let validator_prefs =
|
||||
ValidatorPrefs { commission: Perbill::from_percent(50), ..Default::default() };
|
||||
Staking::<T>::validate(RawOrigin::Signed(controller).into(), validator_prefs)?;
|
||||
|
||||
// Sanity check
|
||||
assert_eq!(
|
||||
Validators::<T>::get(&stash),
|
||||
ValidatorPrefs { commission: Perbill::from_percent(50), ..Default::default() }
|
||||
);
|
||||
|
||||
// Set the min commission to 75%
|
||||
MinCommission::<T>::set(Perbill::from_percent(75));
|
||||
let caller = whitelisted_caller();
|
||||
}: _(RawOrigin::Signed(caller), stash.clone())
|
||||
verify {
|
||||
// The validators commission has been bumped to 75%
|
||||
assert_eq!(
|
||||
Validators::<T>::get(&stash),
|
||||
ValidatorPrefs { commission: Perbill::from_percent(75), ..Default::default() }
|
||||
);
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Staking,
|
||||
crate::mock::ExtBuilder::default().has_stakers(true),
|
||||
|
||||
@@ -1616,6 +1616,28 @@ pub mod pallet {
|
||||
Self::chill_stash(&stash);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Force a validator to have at least the minimum commission. This will not affect a
|
||||
/// validator who already has a commission greater than or equal to the minimum. Any account
|
||||
/// can call this.
|
||||
#[pallet::weight(T::WeightInfo::force_apply_min_commission())]
|
||||
pub fn force_apply_min_commission(
|
||||
origin: OriginFor<T>,
|
||||
validator_stash: T::AccountId,
|
||||
) -> DispatchResult {
|
||||
ensure_signed(origin)?;
|
||||
let min_commission = MinCommission::<T>::get();
|
||||
Validators::<T>::try_mutate_exists(validator_stash, |maybe_prefs| {
|
||||
maybe_prefs
|
||||
.as_mut()
|
||||
.map(|prefs| {
|
||||
(prefs.commission < min_commission)
|
||||
.then(|| prefs.commission = min_commission)
|
||||
})
|
||||
.ok_or(Error::<T>::NotStash)
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4711,3 +4711,38 @@ mod sorted_list_provider {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn force_apply_min_commission_works() {
|
||||
let prefs = |c| ValidatorPrefs { commission: Perbill::from_percent(c), blocked: false };
|
||||
let validators = || Validators::<Test>::iter().collect::<Vec<_>>();
|
||||
ExtBuilder::default().build_and_execute(|| {
|
||||
assert_ok!(Staking::validate(Origin::signed(30), prefs(10)));
|
||||
assert_ok!(Staking::validate(Origin::signed(20), prefs(5)));
|
||||
|
||||
// Given
|
||||
assert_eq!(validators(), vec![(31, prefs(10)), (21, prefs(5)), (11, prefs(0))]);
|
||||
MinCommission::<Test>::set(Perbill::from_percent(5));
|
||||
|
||||
// When applying to a commission greater than min
|
||||
assert_ok!(Staking::force_apply_min_commission(Origin::signed(1), 31));
|
||||
// Then the commission is not changed
|
||||
assert_eq!(validators(), vec![(31, prefs(10)), (21, prefs(5)), (11, prefs(0))]);
|
||||
|
||||
// When applying to a commission that is equal to min
|
||||
assert_ok!(Staking::force_apply_min_commission(Origin::signed(1), 21));
|
||||
// Then the commission is not changed
|
||||
assert_eq!(validators(), vec![(31, prefs(10)), (21, prefs(5)), (11, prefs(0))]);
|
||||
|
||||
// When applying to a commission that is less than the min
|
||||
assert_ok!(Staking::force_apply_min_commission(Origin::signed(1), 11));
|
||||
// Then the commission is bumped to the min
|
||||
assert_eq!(validators(), vec![(31, prefs(10)), (21, prefs(5)), (11, prefs(5))]);
|
||||
|
||||
// When applying commission to a validator that doesn't exist then storage is not altered
|
||||
assert_noop!(
|
||||
Staking::force_apply_min_commission(Origin::signed(1), 420),
|
||||
Error::<Test>::NotStash
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
//! Autogenerated weights for pallet_staking
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-01-31, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2022-02-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./target/production/substrate
|
||||
// target/production/substrate
|
||||
// benchmark
|
||||
// --chain=dev
|
||||
// --steps=50
|
||||
@@ -33,9 +33,7 @@
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --output=./frame/staking/src/weights.rs
|
||||
// --template=.maintain/frame-weight-template.hbs
|
||||
// --header=HEADER-APACHE2
|
||||
// --raw
|
||||
// --template=./.maintain/frame-weight-template.hbs
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
@@ -74,6 +72,7 @@ pub trait WeightInfo {
|
||||
fn get_npos_targets(v: u32, ) -> Weight;
|
||||
fn set_staking_configs() -> Weight;
|
||||
fn chill_other() -> Weight;
|
||||
fn force_apply_min_commission() -> Weight;
|
||||
}
|
||||
|
||||
/// Weights for pallet_staking using the Substrate node and recommended hardware.
|
||||
@@ -86,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 {
|
||||
(37_688_000 as Weight)
|
||||
(37_772_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
@@ -96,7 +95,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: BagsList ListNodes (r:3 w:3)
|
||||
// Storage: BagsList ListBags (r:2 w:2)
|
||||
fn bond_extra() -> Weight {
|
||||
(63_507_000 as Weight)
|
||||
(64_816_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(8 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(7 as Weight))
|
||||
}
|
||||
@@ -110,7 +109,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: Staking Bonded (r:1 w:0)
|
||||
// Storage: BagsList ListBags (r:2 w:2)
|
||||
fn unbond() -> Weight {
|
||||
(70_634_000 as Weight)
|
||||
(71_635_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(12 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(8 as Weight))
|
||||
}
|
||||
@@ -119,9 +118,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 {
|
||||
(30_002_000 as Weight)
|
||||
(30_612_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((55_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add((59_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))
|
||||
}
|
||||
@@ -139,7 +138,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 withdraw_unbonded_kill(_s: u32, ) -> Weight {
|
||||
(58_077_000 as Weight)
|
||||
(59_116_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(13 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(11 as Weight))
|
||||
}
|
||||
@@ -155,16 +154,16 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: BagsList CounterForListNodes (r:1 w:1)
|
||||
// Storage: Staking CounterForValidators (r:1 w:1)
|
||||
fn validate() -> Weight {
|
||||
(44_603_000 as Weight)
|
||||
(45_505_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(12 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(8 as Weight))
|
||||
}
|
||||
// Storage: Staking Ledger (r:1 w:0)
|
||||
// Storage: Staking Nominators (r:1 w:1)
|
||||
fn kick(k: u32, ) -> Weight {
|
||||
(14_580_000 as Weight)
|
||||
// Standard Error: 13_000
|
||||
.saturating_add((8_076_000 as Weight).saturating_mul(k as Weight))
|
||||
(12_764_000 as Weight)
|
||||
// Standard Error: 15_000
|
||||
.saturating_add((8_301_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)))
|
||||
@@ -181,9 +180,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: BagsList CounterForListNodes (r:1 w:1)
|
||||
// Storage: Staking CounterForNominators (r:1 w:1)
|
||||
fn nominate(n: u32, ) -> Weight {
|
||||
(49_856_000 as Weight)
|
||||
// Standard Error: 8_000
|
||||
.saturating_add((3_430_000 as Weight).saturating_mul(n as Weight))
|
||||
(51_439_000 as Weight)
|
||||
// Standard Error: 10_000
|
||||
.saturating_add((3_323_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(12 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
||||
@@ -196,47 +195,47 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: BagsList ListBags (r:1 w:1)
|
||||
// Storage: BagsList CounterForListNodes (r:1 w:1)
|
||||
fn chill() -> Weight {
|
||||
(43_815_000 as Weight)
|
||||
(44_847_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(8 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
||||
}
|
||||
// Storage: Staking Ledger (r:1 w:0)
|
||||
// Storage: Staking Payee (r:0 w:1)
|
||||
fn set_payee() -> Weight {
|
||||
(7_553_000 as Weight)
|
||||
(7_795_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 {
|
||||
(15_177_000 as Weight)
|
||||
(16_051_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 {
|
||||
(1_090_000 as Weight)
|
||||
(1_107_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Staking ForceEra (r:0 w:1)
|
||||
fn force_no_eras() -> Weight {
|
||||
(1_169_000 as Weight)
|
||||
(1_126_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Staking ForceEra (r:0 w:1)
|
||||
fn force_new_era() -> Weight {
|
||||
(1_089_000 as Weight)
|
||||
(1_183_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 {
|
||||
(1_144_000 as Weight)
|
||||
(1_181_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 {
|
||||
(1_612_000 as Weight)
|
||||
(1_705_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((50_000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
@@ -255,18 +254,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 {
|
||||
(56_103_000 as Weight)
|
||||
(57_431_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((798_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add((801_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(11 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(12 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||
}
|
||||
// Storage: Staking UnappliedSlashes (r:1 w:1)
|
||||
fn cancel_deferred_slash(s: u32, ) -> Weight {
|
||||
(942_911_000 as Weight)
|
||||
// Standard Error: 55_000
|
||||
.saturating_add((4_973_000 as Weight).saturating_mul(s as Weight))
|
||||
(950_258_000 as Weight)
|
||||
// Standard Error: 56_000
|
||||
.saturating_add((5_001_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))
|
||||
}
|
||||
@@ -281,9 +280,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 {
|
||||
(77_948_000 as Weight)
|
||||
// Standard Error: 13_000
|
||||
.saturating_add((23_507_000 as Weight).saturating_mul(n as Weight))
|
||||
(94_238_000 as Weight)
|
||||
// Standard Error: 15_000
|
||||
.saturating_add((23_978_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))
|
||||
@@ -301,9 +300,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 {
|
||||
(94_386_000 as Weight)
|
||||
// Standard Error: 19_000
|
||||
.saturating_add((32_763_000 as Weight).saturating_mul(n as Weight))
|
||||
(109_323_000 as Weight)
|
||||
// Standard Error: 22_000
|
||||
.saturating_add((33_887_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))
|
||||
@@ -316,9 +315,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: Staking Bonded (r:1 w:0)
|
||||
// Storage: BagsList ListBags (r:2 w:2)
|
||||
fn rebond(l: u32, ) -> Weight {
|
||||
(63_577_000 as Weight)
|
||||
(64_807_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((47_000 as Weight).saturating_mul(l as Weight))
|
||||
.saturating_add((50_000 as Weight).saturating_mul(l as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(9 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(8 as Weight))
|
||||
}
|
||||
@@ -333,8 +332,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: 57_000
|
||||
.saturating_add((19_691_000 as Weight).saturating_mul(e as Weight))
|
||||
// Standard Error: 61_000
|
||||
.saturating_add((20_457_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)))
|
||||
@@ -353,9 +352,9 @@ 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 {
|
||||
(61_871_000 as Weight)
|
||||
(62_856_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((796_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add((802_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(12 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(12 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||
@@ -380,10 +379,10 @@ 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: 823_000
|
||||
.saturating_add((218_725_000 as Weight).saturating_mul(v as Weight))
|
||||
// Standard Error: 41_000
|
||||
.saturating_add((31_349_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 804_000
|
||||
.saturating_add((226_855_000 as Weight).saturating_mul(v as Weight))
|
||||
// Standard Error: 40_000
|
||||
.saturating_add((31_928_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(208 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
|
||||
.saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(n as Weight)))
|
||||
@@ -401,12 +400,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: Staking Nominators (r:1000 w:0)
|
||||
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 86_000
|
||||
.saturating_add((18_168_000 as Weight).saturating_mul(v as Weight))
|
||||
// Standard Error: 86_000
|
||||
.saturating_add((21_061_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 2_951_000
|
||||
.saturating_add((8_164_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 87_000
|
||||
.saturating_add((18_771_000 as Weight).saturating_mul(v as Weight))
|
||||
// Standard Error: 87_000
|
||||
.saturating_add((21_895_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 2_984_000
|
||||
.saturating_add((8_282_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(204 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
|
||||
.saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(n as Weight)))
|
||||
@@ -415,8 +414,8 @@ 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: 29_000
|
||||
.saturating_add((7_761_000 as Weight).saturating_mul(v as Weight))
|
||||
// Standard Error: 28_000
|
||||
.saturating_add((7_801_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)))
|
||||
}
|
||||
@@ -427,7 +426,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_configs() -> Weight {
|
||||
(3_586_000 as Weight)
|
||||
(3_680_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
||||
}
|
||||
// Storage: Staking Ledger (r:1 w:0)
|
||||
@@ -441,10 +440,17 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: BagsList ListBags (r:1 w:1)
|
||||
// Storage: BagsList CounterForListNodes (r:1 w:1)
|
||||
fn chill_other() -> Weight {
|
||||
(54_681_000 as Weight)
|
||||
(55_459_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(11 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
||||
}
|
||||
// Storage: Staking MinCommission (r:1 w:0)
|
||||
// Storage: Staking Validators (r:1 w:1)
|
||||
fn force_apply_min_commission() -> Weight {
|
||||
(8_939_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
|
||||
// For backwards compatibility and tests
|
||||
@@ -456,7 +462,7 @@ impl WeightInfo for () {
|
||||
// Storage: Balances Locks (r:1 w:1)
|
||||
// Storage: Staking Payee (r:0 w:1)
|
||||
fn bond() -> Weight {
|
||||
(37_688_000 as Weight)
|
||||
(37_772_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
@@ -466,7 +472,7 @@ impl WeightInfo for () {
|
||||
// Storage: BagsList ListNodes (r:3 w:3)
|
||||
// Storage: BagsList ListBags (r:2 w:2)
|
||||
fn bond_extra() -> Weight {
|
||||
(63_507_000 as Weight)
|
||||
(64_816_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(8 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(7 as Weight))
|
||||
}
|
||||
@@ -480,7 +486,7 @@ impl WeightInfo for () {
|
||||
// Storage: Staking Bonded (r:1 w:0)
|
||||
// Storage: BagsList ListBags (r:2 w:2)
|
||||
fn unbond() -> Weight {
|
||||
(70_634_000 as Weight)
|
||||
(71_635_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(12 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
|
||||
}
|
||||
@@ -489,9 +495,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 {
|
||||
(30_002_000 as Weight)
|
||||
(30_612_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((55_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add((59_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
@@ -509,7 +515,7 @@ impl WeightInfo for () {
|
||||
// Storage: Balances Locks (r:1 w:1)
|
||||
// Storage: Staking Payee (r:0 w:1)
|
||||
fn withdraw_unbonded_kill(_s: u32, ) -> Weight {
|
||||
(58_077_000 as Weight)
|
||||
(59_116_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(13 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(11 as Weight))
|
||||
}
|
||||
@@ -525,16 +531,16 @@ impl WeightInfo for () {
|
||||
// Storage: BagsList CounterForListNodes (r:1 w:1)
|
||||
// Storage: Staking CounterForValidators (r:1 w:1)
|
||||
fn validate() -> Weight {
|
||||
(44_603_000 as Weight)
|
||||
(45_505_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(12 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
|
||||
}
|
||||
// Storage: Staking Ledger (r:1 w:0)
|
||||
// Storage: Staking Nominators (r:1 w:1)
|
||||
fn kick(k: u32, ) -> Weight {
|
||||
(14_580_000 as Weight)
|
||||
// Standard Error: 13_000
|
||||
.saturating_add((8_076_000 as Weight).saturating_mul(k as Weight))
|
||||
(12_764_000 as Weight)
|
||||
// Standard Error: 15_000
|
||||
.saturating_add((8_301_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)))
|
||||
@@ -551,9 +557,9 @@ impl WeightInfo for () {
|
||||
// Storage: BagsList CounterForListNodes (r:1 w:1)
|
||||
// Storage: Staking CounterForNominators (r:1 w:1)
|
||||
fn nominate(n: u32, ) -> Weight {
|
||||
(49_856_000 as Weight)
|
||||
// Standard Error: 8_000
|
||||
.saturating_add((3_430_000 as Weight).saturating_mul(n as Weight))
|
||||
(51_439_000 as Weight)
|
||||
// Standard Error: 10_000
|
||||
.saturating_add((3_323_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(12 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
|
||||
@@ -566,47 +572,47 @@ impl WeightInfo for () {
|
||||
// Storage: BagsList ListBags (r:1 w:1)
|
||||
// Storage: BagsList CounterForListNodes (r:1 w:1)
|
||||
fn chill() -> Weight {
|
||||
(43_815_000 as Weight)
|
||||
(44_847_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(8 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
|
||||
}
|
||||
// Storage: Staking Ledger (r:1 w:0)
|
||||
// Storage: Staking Payee (r:0 w:1)
|
||||
fn set_payee() -> Weight {
|
||||
(7_553_000 as Weight)
|
||||
(7_795_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 {
|
||||
(15_177_000 as Weight)
|
||||
(16_051_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 {
|
||||
(1_090_000 as Weight)
|
||||
(1_107_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Staking ForceEra (r:0 w:1)
|
||||
fn force_no_eras() -> Weight {
|
||||
(1_169_000 as Weight)
|
||||
(1_126_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Staking ForceEra (r:0 w:1)
|
||||
fn force_new_era() -> Weight {
|
||||
(1_089_000 as Weight)
|
||||
(1_183_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Staking ForceEra (r:0 w:1)
|
||||
fn force_new_era_always() -> Weight {
|
||||
(1_144_000 as Weight)
|
||||
(1_181_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Staking Invulnerables (r:0 w:1)
|
||||
fn set_invulnerables(v: u32, ) -> Weight {
|
||||
(1_612_000 as Weight)
|
||||
(1_705_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((50_000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
@@ -625,18 +631,18 @@ impl WeightInfo for () {
|
||||
// Storage: Staking Payee (r:0 w:1)
|
||||
// Storage: Staking SpanSlash (r:0 w:2)
|
||||
fn force_unstake(s: u32, ) -> Weight {
|
||||
(56_103_000 as Weight)
|
||||
(57_431_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((798_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add((801_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(11 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(12 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 {
|
||||
(942_911_000 as Weight)
|
||||
// Standard Error: 55_000
|
||||
.saturating_add((4_973_000 as Weight).saturating_mul(s as Weight))
|
||||
(950_258_000 as Weight)
|
||||
// Standard Error: 56_000
|
||||
.saturating_add((5_001_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
@@ -651,9 +657,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 {
|
||||
(77_948_000 as Weight)
|
||||
// Standard Error: 13_000
|
||||
.saturating_add((23_507_000 as Weight).saturating_mul(n as Weight))
|
||||
(94_238_000 as Weight)
|
||||
// Standard Error: 15_000
|
||||
.saturating_add((23_978_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))
|
||||
@@ -671,9 +677,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 {
|
||||
(94_386_000 as Weight)
|
||||
// Standard Error: 19_000
|
||||
.saturating_add((32_763_000 as Weight).saturating_mul(n as Weight))
|
||||
(109_323_000 as Weight)
|
||||
// Standard Error: 22_000
|
||||
.saturating_add((33_887_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))
|
||||
@@ -686,9 +692,9 @@ impl WeightInfo for () {
|
||||
// Storage: Staking Bonded (r:1 w:0)
|
||||
// Storage: BagsList ListBags (r:2 w:2)
|
||||
fn rebond(l: u32, ) -> Weight {
|
||||
(63_577_000 as Weight)
|
||||
(64_807_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((47_000 as Weight).saturating_mul(l as Weight))
|
||||
.saturating_add((50_000 as Weight).saturating_mul(l as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(9 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
|
||||
}
|
||||
@@ -703,8 +709,8 @@ impl WeightInfo for () {
|
||||
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
|
||||
fn set_history_depth(e: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 57_000
|
||||
.saturating_add((19_691_000 as Weight).saturating_mul(e as Weight))
|
||||
// Standard Error: 61_000
|
||||
.saturating_add((20_457_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)))
|
||||
@@ -723,9 +729,9 @@ impl WeightInfo for () {
|
||||
// Storage: Staking Payee (r:0 w:1)
|
||||
// Storage: Staking SpanSlash (r:0 w:1)
|
||||
fn reap_stash(s: u32, ) -> Weight {
|
||||
(61_871_000 as Weight)
|
||||
(62_856_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((796_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add((802_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(12 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||
@@ -750,10 +756,10 @@ impl WeightInfo for () {
|
||||
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
|
||||
fn new_era(v: u32, n: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 823_000
|
||||
.saturating_add((218_725_000 as Weight).saturating_mul(v as Weight))
|
||||
// Standard Error: 41_000
|
||||
.saturating_add((31_349_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 804_000
|
||||
.saturating_add((226_855_000 as Weight).saturating_mul(v as Weight))
|
||||
// Standard Error: 40_000
|
||||
.saturating_add((31_928_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(208 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
|
||||
.saturating_add(RocksDbWeight::get().reads((4 as Weight).saturating_mul(n as Weight)))
|
||||
@@ -771,12 +777,12 @@ impl WeightInfo for () {
|
||||
// Storage: Staking Nominators (r:1000 w:0)
|
||||
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 86_000
|
||||
.saturating_add((18_168_000 as Weight).saturating_mul(v as Weight))
|
||||
// Standard Error: 86_000
|
||||
.saturating_add((21_061_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 2_951_000
|
||||
.saturating_add((8_164_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 87_000
|
||||
.saturating_add((18_771_000 as Weight).saturating_mul(v as Weight))
|
||||
// Standard Error: 87_000
|
||||
.saturating_add((21_895_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 2_984_000
|
||||
.saturating_add((8_282_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(204 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
|
||||
.saturating_add(RocksDbWeight::get().reads((4 as Weight).saturating_mul(n as Weight)))
|
||||
@@ -785,8 +791,8 @@ impl WeightInfo for () {
|
||||
// Storage: Staking Validators (r:501 w:0)
|
||||
fn get_npos_targets(v: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 29_000
|
||||
.saturating_add((7_761_000 as Weight).saturating_mul(v as Weight))
|
||||
// Standard Error: 28_000
|
||||
.saturating_add((7_801_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)))
|
||||
}
|
||||
@@ -797,7 +803,7 @@ impl WeightInfo for () {
|
||||
// Storage: Staking MaxNominatorsCount (r:0 w:1)
|
||||
// Storage: Staking MinNominatorBond (r:0 w:1)
|
||||
fn set_staking_configs() -> Weight {
|
||||
(3_586_000 as Weight)
|
||||
(3_680_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
|
||||
}
|
||||
// Storage: Staking Ledger (r:1 w:0)
|
||||
@@ -811,8 +817,15 @@ impl WeightInfo for () {
|
||||
// Storage: BagsList ListBags (r:1 w:1)
|
||||
// Storage: BagsList CounterForListNodes (r:1 w:1)
|
||||
fn chill_other() -> Weight {
|
||||
(54_681_000 as Weight)
|
||||
(55_459_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(11 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
|
||||
}
|
||||
// Storage: Staking MinCommission (r:1 w:0)
|
||||
// Storage: Staking Validators (r:1 w:1)
|
||||
fn force_apply_min_commission() -> Weight {
|
||||
(8_939_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user