Allow StakingAdmin to set min_commission (#13018)

* staking admin can set min commission

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

* fmt

* fix for pr comments

Co-authored-by: command-bot <>
This commit is contained in:
Ankan
2022-12-26 16:48:40 +01:00
committed by GitHub
parent 017cf70378
commit 9726a10dbb
14 changed files with 286 additions and 201 deletions
@@ -922,6 +922,13 @@ benchmarks! {
);
}
set_min_commission {
let min_commission = Perbill::max_value();
}: _(RawOrigin::Root, min_commission)
verify {
assert_eq!(MinCommission::<T>::get(), Perbill::from_percent(100));
}
impl_benchmark_test_suite!(
Staking,
crate::mock::ExtBuilder::default().has_stakers(true),
+10 -4
View File
@@ -20,13 +20,14 @@
use crate::{self as pallet_staking, *};
use frame_election_provider_support::{onchain, SequentialPhragmen, VoteWeight};
use frame_support::{
assert_ok, parameter_types,
assert_ok, ord_parameter_types, parameter_types,
traits::{
ConstU32, ConstU64, Currency, FindAuthor, GenesisBuild, Get, Hooks, Imbalance,
OnUnbalanced, OneSessionHandler,
ConstU32, ConstU64, Currency, EitherOfDiverse, FindAuthor, GenesisBuild, Get, Hooks,
Imbalance, OnUnbalanced, OneSessionHandler,
},
weights::constants::RocksDbWeight,
};
use frame_system::{EnsureRoot, EnsureSignedBy};
use sp_core::H256;
use sp_io;
use sp_runtime::{
@@ -292,7 +293,7 @@ impl crate::pallet::pallet::Config for Test {
type Reward = MockReward;
type SessionsPerEra = SessionsPerEra;
type SlashDeferDuration = SlashDeferDuration;
type SlashCancelOrigin = frame_system::EnsureRoot<Self::AccountId>;
type AdminOrigin = EnsureOneOrRoot;
type BondingDuration = BondingDuration;
type SessionInterface = Self;
type EraPayout = ConvertCurve<RewardCurve>;
@@ -797,6 +798,11 @@ pub(crate) fn staking_events() -> Vec<crate::Event<Test>> {
parameter_types! {
static StakingEventsIndex: usize = 0;
}
ord_parameter_types! {
pub const One: u64 = 1;
}
type EnsureOneOrRoot = EitherOfDiverse<EnsureRoot<AccountId>, EnsureSignedBy<One, AccountId>>;
pub(crate) fn staking_events_since_last_call() -> Vec<crate::Event<Test>> {
let all: Vec<_> = System::events()
+18 -5
View File
@@ -183,8 +183,10 @@ pub mod pallet {
#[pallet::constant]
type SlashDeferDuration: Get<EraIndex>;
/// The origin which can cancel a deferred slash. Root can always do this.
type SlashCancelOrigin: EnsureOrigin<Self::RuntimeOrigin>;
/// The origin which can manage less critical staking parameters that does not require root.
///
/// Supported actions: (1) cancel deferred slash, (2) set minimum commission.
type AdminOrigin: EnsureOrigin<Self::RuntimeOrigin>;
/// Interface for interacting with a session pallet.
type SessionInterface: SessionInterface<Self::AccountId>;
@@ -1452,7 +1454,7 @@ pub mod pallet {
/// Cancel enactment of a deferred slash.
///
/// Can be called by the `T::SlashCancelOrigin`.
/// Can be called by the `T::AdminOrigin`.
///
/// Parameters: era and indices of the slashes for that era to kill.
#[pallet::call_index(17)]
@@ -1462,7 +1464,7 @@ pub mod pallet {
era: EraIndex,
slash_indices: Vec<u32>,
) -> DispatchResult {
T::SlashCancelOrigin::ensure_origin(origin)?;
T::AdminOrigin::ensure_origin(origin)?;
ensure!(!slash_indices.is_empty(), Error::<T>::EmptyTargets);
ensure!(is_sorted_and_unique(&slash_indices), Error::<T>::NotSortedAndUnique);
@@ -1683,7 +1685,6 @@ pub mod pallet {
config_op_exp!(MinCommission<T>, min_commission);
Ok(())
}
/// Declare a `controller` to stop participating as either a validator or nominator.
///
/// Effects will be felt at the beginning of the next era.
@@ -1792,6 +1793,18 @@ pub mod pallet {
})?;
Ok(())
}
/// Sets the minimum amount of commission that each validators must maintain.
///
/// This call has lower privilege requirements than `set_staking_config` and can be called
/// by the `T::AdminOrigin`. Root can always call this.
#[pallet::call_index(25)]
#[pallet::weight(T::WeightInfo::set_min_commission())]
pub fn set_min_commission(origin: OriginFor<T>, new: Perbill) -> DispatchResult {
T::AdminOrigin::ensure_origin(origin)?;
MinCommission::<T>::put(new);
Ok(())
}
}
}
+40
View File
@@ -5726,6 +5726,46 @@ fn scale_validator_count_errors() {
})
}
#[test]
fn set_min_commission_works_with_admin_origin() {
ExtBuilder::default().build_and_execute(|| {
// no minimum commission set initially
assert_eq!(MinCommission::<Test>::get(), Zero::zero());
// root can set min commission
assert_ok!(Staking::set_min_commission(RuntimeOrigin::root(), Perbill::from_percent(10)));
assert_eq!(MinCommission::<Test>::get(), Perbill::from_percent(10));
// Non privileged origin can not set min_commission
assert_noop!(
Staking::set_min_commission(RuntimeOrigin::signed(2), Perbill::from_percent(15)),
BadOrigin
);
// Admin Origin can set min commission
assert_ok!(Staking::set_min_commission(
RuntimeOrigin::signed(1),
Perbill::from_percent(15),
));
// setting commission below min_commission fails
assert_noop!(
Staking::validate(
RuntimeOrigin::signed(10),
ValidatorPrefs { commission: Perbill::from_percent(14), blocked: false }
),
Error::<Test>::CommissionTooLow
);
// setting commission >= min_commission works
assert_ok!(Staking::validate(
RuntimeOrigin::signed(10),
ValidatorPrefs { commission: Perbill::from_percent(15), blocked: false }
));
})
}
mod staking_interface {
use frame_support::storage::with_storage_layer;
use sp_staking::StakingInterface;
+202 -183
View File
@@ -18,7 +18,7 @@
//! Autogenerated weights for pallet_staking
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-12-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2022-12-25, 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
@@ -77,6 +77,7 @@ pub trait WeightInfo {
fn set_staking_configs_all_remove() -> Weight;
fn chill_other() -> Weight;
fn force_apply_min_commission() -> Weight;
fn set_min_commission() -> Weight;
}
/// Weights for pallet_staking using the Substrate node and recommended hardware.
@@ -88,8 +89,8 @@ 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: 54_402 nanoseconds.
Weight::from_ref_time(55_096_000)
// Minimum execution time: 54_884 nanoseconds.
Weight::from_ref_time(55_487_000)
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
@@ -99,8 +100,8 @@ 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: 94_407 nanoseconds.
Weight::from_ref_time(95_209_000)
// Minimum execution time: 95_115 nanoseconds.
Weight::from_ref_time(96_213_000)
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(7))
}
@@ -114,8 +115,8 @@ 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: 101_046 nanoseconds.
Weight::from_ref_time(101_504_000)
// Minimum execution time: 102_031 nanoseconds.
Weight::from_ref_time(102_842_000)
.saturating_add(T::DbWeight::get().reads(12))
.saturating_add(T::DbWeight::get().writes(8))
}
@@ -125,10 +126,10 @@ 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_452 nanoseconds.
Weight::from_ref_time(47_031_537)
// Standard Error: 491
.saturating_add(Weight::from_ref_time(67_148).saturating_mul(s.into()))
// Minimum execution time: 46_569 nanoseconds.
Weight::from_ref_time(48_034_493)
// Standard Error: 654
.saturating_add(Weight::from_ref_time(63_628).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
}
@@ -148,10 +149,10 @@ 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 withdraw_unbonded_kill(s: u32, ) -> Weight {
// Minimum execution time: 88_067 nanoseconds.
Weight::from_ref_time(93_309_587)
// Standard Error: 4_762
.saturating_add(Weight::from_ref_time(1_114_938).saturating_mul(s.into()))
// Minimum execution time: 90_154 nanoseconds.
Weight::from_ref_time(95_725_631)
// Standard Error: 2_491
.saturating_add(Weight::from_ref_time(1_110_795).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(13))
.saturating_add(T::DbWeight::get().writes(12))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into())))
@@ -168,8 +169,8 @@ 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_308 nanoseconds.
Weight::from_ref_time(68_266_000)
// Minimum execution time: 67_978 nanoseconds.
Weight::from_ref_time(69_153_000)
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(5))
}
@@ -177,10 +178,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Nominators (r:1 w:1)
/// The range of component `k` is `[1, 128]`.
fn kick(k: u32, ) -> Weight {
// Minimum execution time: 40_913 nanoseconds.
Weight::from_ref_time(48_140_584)
// Standard Error: 13_396
.saturating_add(Weight::from_ref_time(6_862_893).saturating_mul(k.into()))
// Minimum execution time: 45_328 nanoseconds.
Weight::from_ref_time(47_719_103)
// Standard Error: 14_458
.saturating_add(Weight::from_ref_time(6_999_252).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())))
@@ -198,10 +199,10 @@ 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: 73_490 nanoseconds.
Weight::from_ref_time(72_520_864)
// Standard Error: 7_090
.saturating_add(Weight::from_ref_time(2_800_566).saturating_mul(n.into()))
// Minimum execution time: 74_650 nanoseconds.
Weight::from_ref_time(74_350_075)
// Standard Error: 10_527
.saturating_add(Weight::from_ref_time(2_878_737).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))
@@ -214,58 +215,58 @@ 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_293 nanoseconds.
Weight::from_ref_time(66_946_000)
// Minimum execution time: 67_790 nanoseconds.
Weight::from_ref_time(68_738_000)
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(6))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Payee (r:0 w:1)
fn set_payee() -> Weight {
// Minimum execution time: 18_134 nanoseconds.
Weight::from_ref_time(18_497_000)
// Minimum execution time: 19_237 nanoseconds.
Weight::from_ref_time(19_534_000)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:2 w:2)
fn set_controller() -> Weight {
// Minimum execution time: 26_728 nanoseconds.
Weight::from_ref_time(27_154_000)
// Minimum execution time: 27_288 nanoseconds.
Weight::from_ref_time(27_667_000)
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
// Storage: Staking ValidatorCount (r:0 w:1)
fn set_validator_count() -> Weight {
// Minimum execution time: 4_877 nanoseconds.
Weight::from_ref_time(5_028_000)
// Minimum execution time: 5_155 nanoseconds.
Weight::from_ref_time(5_464_000)
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_no_eras() -> Weight {
// Minimum execution time: 5_000 nanoseconds.
Weight::from_ref_time(5_290_000)
// Minimum execution time: 5_405 nanoseconds.
Weight::from_ref_time(5_670_000)
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era() -> Weight {
// Minimum execution time: 5_093 nanoseconds.
Weight::from_ref_time(5_378_000)
// Minimum execution time: 5_459 nanoseconds.
Weight::from_ref_time(5_616_000)
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era_always() -> Weight {
// Minimum execution time: 5_144 nanoseconds.
Weight::from_ref_time(5_454_000)
// Minimum execution time: 5_476 nanoseconds.
Weight::from_ref_time(5_692_000)
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking Invulnerables (r:0 w:1)
/// The range of component `v` is `[0, 1000]`.
fn set_invulnerables(v: u32, ) -> Weight {
// Minimum execution time: 5_190 nanoseconds.
Weight::from_ref_time(5_960_962)
// Standard Error: 41
.saturating_add(Weight::from_ref_time(10_329).saturating_mul(v.into()))
// Minimum execution time: 5_544 nanoseconds.
Weight::from_ref_time(6_513_190)
// Standard Error: 76
.saturating_add(Weight::from_ref_time(9_975).saturating_mul(v.into()))
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking Bonded (r:1 w:1)
@@ -283,10 +284,10 @@ 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_516 nanoseconds.
Weight::from_ref_time(86_317_884)
// Standard Error: 2_212
.saturating_add(Weight::from_ref_time(1_103_962).saturating_mul(s.into()))
// Minimum execution time: 82_414 nanoseconds.
Weight::from_ref_time(88_511_246)
// Standard Error: 2_622
.saturating_add(Weight::from_ref_time(1_131_814).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())))
@@ -294,10 +295,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking UnappliedSlashes (r:1 w:1)
/// The range of component `s` is `[1, 1000]`.
fn cancel_deferred_slash(s: u32, ) -> Weight {
// Minimum execution time: 91_795 nanoseconds.
Weight::from_ref_time(904_524_900)
// Standard Error: 59_193
.saturating_add(Weight::from_ref_time(4_944_680).saturating_mul(s.into()))
// Minimum execution time: 94_197 nanoseconds.
Weight::from_ref_time(903_418_326)
// Standard Error: 59_354
.saturating_add(Weight::from_ref_time(4_948_354).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -312,10 +313,10 @@ 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_774 nanoseconds.
Weight::from_ref_time(178_857_156)
// Standard Error: 15_229
.saturating_add(Weight::from_ref_time(22_112_174).saturating_mul(n.into()))
// Minimum execution time: 133_065 nanoseconds.
Weight::from_ref_time(197_555_906)
// Standard Error: 19_561
.saturating_add(Weight::from_ref_time(22_683_426).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))
@@ -333,10 +334,10 @@ 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: 161_910 nanoseconds.
Weight::from_ref_time(217_635_072)
// Standard Error: 30_726
.saturating_add(Weight::from_ref_time(31_244_329).saturating_mul(n.into()))
// Minimum execution time: 164_719 nanoseconds.
Weight::from_ref_time(226_304_276)
// Standard Error: 31_675
.saturating_add(Weight::from_ref_time(32_622_427).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))
@@ -350,10 +351,10 @@ 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_986 nanoseconds.
Weight::from_ref_time(94_880_481)
// Standard Error: 2_007
.saturating_add(Weight::from_ref_time(31_421).saturating_mul(l.into()))
// Minimum execution time: 95_631 nanoseconds.
Weight::from_ref_time(96_861_556)
// Standard Error: 2_114
.saturating_add(Weight::from_ref_time(37_543).saturating_mul(l.into()))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(8))
}
@@ -372,10 +373,10 @@ 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_750 nanoseconds.
Weight::from_ref_time(95_115_568)
// Standard Error: 2_037
.saturating_add(Weight::from_ref_time(1_086_488).saturating_mul(s.into()))
// Minimum execution time: 95_251 nanoseconds.
Weight::from_ref_time(97_818_954)
// Standard Error: 2_356
.saturating_add(Weight::from_ref_time(1_104_695).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())))
@@ -396,19 +397,20 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking ErasStakers (r:0 w:1)
// Storage: Staking ErasTotalStake (r:0 w:1)
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
// Storage: Staking MinimumActiveStake (r:0 w:1)
/// The range of component `v` is `[1, 10]`.
/// The range of component `n` is `[0, 100]`.
fn new_era(v: u32, n: u32, ) -> Weight {
// Minimum execution time: 506_543 nanoseconds.
Weight::from_ref_time(507_261_000)
// Standard Error: 1_766_631
.saturating_add(Weight::from_ref_time(59_139_153).saturating_mul(v.into()))
// Standard Error: 176_035
.saturating_add(Weight::from_ref_time(13_512_781).saturating_mul(n.into()))
// Minimum execution time: 512_923 nanoseconds.
Weight::from_ref_time(514_740_000)
// Standard Error: 1_790_238
.saturating_add(Weight::from_ref_time(59_320_539).saturating_mul(v.into()))
// Standard Error: 178_387
.saturating_add(Weight::from_ref_time(13_902_705).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(4))
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(v.into())))
}
// Storage: VoterList CounterForListNodes (r:1 w:0)
@@ -418,27 +420,29 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Validators (r:500 w:0)
// Storage: Staking Bonded (r:1500 w:0)
// Storage: Staking Ledger (r:1500 w:0)
// Storage: Staking MinimumActiveStake (r:0 w:1)
/// The range of component `v` is `[500, 1000]`.
/// The range of component `n` is `[500, 1000]`.
fn get_npos_voters(v: u32, n: u32, ) -> Weight {
// Minimum execution time: 24_155_382 nanoseconds.
Weight::from_ref_time(24_252_568_000)
// Standard Error: 319_250
.saturating_add(Weight::from_ref_time(3_596_056).saturating_mul(v.into()))
// Standard Error: 319_250
.saturating_add(Weight::from_ref_time(2_852_023).saturating_mul(n.into()))
// Minimum execution time: 24_913_316 nanoseconds.
Weight::from_ref_time(25_053_596_000)
// Standard Error: 324_610
.saturating_add(Weight::from_ref_time(3_454_859).saturating_mul(v.into()))
// Standard Error: 324_610
.saturating_add(Weight::from_ref_time(3_020_267).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())))
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking CounterForValidators (r:1 w:0)
// Storage: Staking Validators (r:501 w:0)
/// The range of component `v` is `[500, 1000]`.
fn get_npos_targets(v: u32, ) -> Weight {
// Minimum execution time: 4_741_111 nanoseconds.
Weight::from_ref_time(113_360_179)
// Standard Error: 25_375
.saturating_add(Weight::from_ref_time(9_494_142).saturating_mul(v.into()))
// Minimum execution time: 4_916_401 nanoseconds.
Weight::from_ref_time(81_160_966)
// Standard Error: 23_829
.saturating_add(Weight::from_ref_time(9_883_413).saturating_mul(v.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into())))
}
@@ -449,8 +453,8 @@ 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: 11_074 nanoseconds.
Weight::from_ref_time(11_312_000)
// Minimum execution time: 10_937 nanoseconds.
Weight::from_ref_time(11_324_000)
.saturating_add(T::DbWeight::get().writes(6))
}
// Storage: Staking MinCommission (r:0 w:1)
@@ -460,8 +464,8 @@ 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_795 nanoseconds.
Weight::from_ref_time(10_116_000)
// Minimum execution time: 9_424 nanoseconds.
Weight::from_ref_time(10_021_000)
.saturating_add(T::DbWeight::get().writes(6))
}
// Storage: Staking Ledger (r:1 w:0)
@@ -475,19 +479,25 @@ 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: 82_914 nanoseconds.
Weight::from_ref_time(83_848_000)
// Minimum execution time: 84_495 nanoseconds.
Weight::from_ref_time(85_559_000)
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(6))
}
// Storage: Staking MinCommission (r:1 w:0)
// Storage: Staking Validators (r:1 w:1)
fn force_apply_min_commission() -> Weight {
// Minimum execution time: 20_317 nanoseconds.
Weight::from_ref_time(20_639_000)
// Minimum execution time: 20_385 nanoseconds.
Weight::from_ref_time(20_824_000)
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: Staking MinCommission (r:0 w:1)
fn set_min_commission() -> Weight {
// Minimum execution time: 6_995 nanoseconds.
Weight::from_ref_time(7_213_000)
.saturating_add(T::DbWeight::get().writes(1))
}
}
// For backwards compatibility and tests
@@ -498,8 +508,8 @@ impl WeightInfo for () {
// Storage: Balances Locks (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn bond() -> Weight {
// Minimum execution time: 54_402 nanoseconds.
Weight::from_ref_time(55_096_000)
// Minimum execution time: 54_884 nanoseconds.
Weight::from_ref_time(55_487_000)
.saturating_add(RocksDbWeight::get().reads(4))
.saturating_add(RocksDbWeight::get().writes(4))
}
@@ -509,8 +519,8 @@ impl WeightInfo for () {
// Storage: VoterList ListNodes (r:3 w:3)
// Storage: VoterList ListBags (r:2 w:2)
fn bond_extra() -> Weight {
// Minimum execution time: 94_407 nanoseconds.
Weight::from_ref_time(95_209_000)
// Minimum execution time: 95_115 nanoseconds.
Weight::from_ref_time(96_213_000)
.saturating_add(RocksDbWeight::get().reads(8))
.saturating_add(RocksDbWeight::get().writes(7))
}
@@ -524,8 +534,8 @@ impl WeightInfo for () {
// Storage: Staking Bonded (r:1 w:0)
// Storage: VoterList ListBags (r:2 w:2)
fn unbond() -> Weight {
// Minimum execution time: 101_046 nanoseconds.
Weight::from_ref_time(101_504_000)
// Minimum execution time: 102_031 nanoseconds.
Weight::from_ref_time(102_842_000)
.saturating_add(RocksDbWeight::get().reads(12))
.saturating_add(RocksDbWeight::get().writes(8))
}
@@ -535,10 +545,10 @@ 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_452 nanoseconds.
Weight::from_ref_time(47_031_537)
// Standard Error: 491
.saturating_add(Weight::from_ref_time(67_148).saturating_mul(s.into()))
// Minimum execution time: 46_569 nanoseconds.
Weight::from_ref_time(48_034_493)
// Standard Error: 654
.saturating_add(Weight::from_ref_time(63_628).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(4))
.saturating_add(RocksDbWeight::get().writes(3))
}
@@ -558,10 +568,10 @@ impl WeightInfo for () {
// Storage: Staking SpanSlash (r:0 w:2)
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
// Minimum execution time: 88_067 nanoseconds.
Weight::from_ref_time(93_309_587)
// Standard Error: 4_762
.saturating_add(Weight::from_ref_time(1_114_938).saturating_mul(s.into()))
// Minimum execution time: 90_154 nanoseconds.
Weight::from_ref_time(95_725_631)
// Standard Error: 2_491
.saturating_add(Weight::from_ref_time(1_110_795).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(13))
.saturating_add(RocksDbWeight::get().writes(12))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(s.into())))
@@ -578,8 +588,8 @@ impl WeightInfo for () {
// Storage: VoterList CounterForListNodes (r:1 w:1)
// Storage: Staking CounterForValidators (r:1 w:1)
fn validate() -> Weight {
// Minimum execution time: 67_308 nanoseconds.
Weight::from_ref_time(68_266_000)
// Minimum execution time: 67_978 nanoseconds.
Weight::from_ref_time(69_153_000)
.saturating_add(RocksDbWeight::get().reads(11))
.saturating_add(RocksDbWeight::get().writes(5))
}
@@ -587,10 +597,10 @@ impl WeightInfo for () {
// Storage: Staking Nominators (r:1 w:1)
/// The range of component `k` is `[1, 128]`.
fn kick(k: u32, ) -> Weight {
// Minimum execution time: 40_913 nanoseconds.
Weight::from_ref_time(48_140_584)
// Standard Error: 13_396
.saturating_add(Weight::from_ref_time(6_862_893).saturating_mul(k.into()))
// Minimum execution time: 45_328 nanoseconds.
Weight::from_ref_time(47_719_103)
// Standard Error: 14_458
.saturating_add(Weight::from_ref_time(6_999_252).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())))
@@ -608,10 +618,10 @@ 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: 73_490 nanoseconds.
Weight::from_ref_time(72_520_864)
// Standard Error: 7_090
.saturating_add(Weight::from_ref_time(2_800_566).saturating_mul(n.into()))
// Minimum execution time: 74_650 nanoseconds.
Weight::from_ref_time(74_350_075)
// Standard Error: 10_527
.saturating_add(Weight::from_ref_time(2_878_737).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))
@@ -624,58 +634,58 @@ impl WeightInfo for () {
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
fn chill() -> Weight {
// Minimum execution time: 66_293 nanoseconds.
Weight::from_ref_time(66_946_000)
// Minimum execution time: 67_790 nanoseconds.
Weight::from_ref_time(68_738_000)
.saturating_add(RocksDbWeight::get().reads(8))
.saturating_add(RocksDbWeight::get().writes(6))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Payee (r:0 w:1)
fn set_payee() -> Weight {
// Minimum execution time: 18_134 nanoseconds.
Weight::from_ref_time(18_497_000)
// Minimum execution time: 19_237 nanoseconds.
Weight::from_ref_time(19_534_000)
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:2 w:2)
fn set_controller() -> Weight {
// Minimum execution time: 26_728 nanoseconds.
Weight::from_ref_time(27_154_000)
// Minimum execution time: 27_288 nanoseconds.
Weight::from_ref_time(27_667_000)
.saturating_add(RocksDbWeight::get().reads(3))
.saturating_add(RocksDbWeight::get().writes(3))
}
// Storage: Staking ValidatorCount (r:0 w:1)
fn set_validator_count() -> Weight {
// Minimum execution time: 4_877 nanoseconds.
Weight::from_ref_time(5_028_000)
// Minimum execution time: 5_155 nanoseconds.
Weight::from_ref_time(5_464_000)
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_no_eras() -> Weight {
// Minimum execution time: 5_000 nanoseconds.
Weight::from_ref_time(5_290_000)
// Minimum execution time: 5_405 nanoseconds.
Weight::from_ref_time(5_670_000)
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era() -> Weight {
// Minimum execution time: 5_093 nanoseconds.
Weight::from_ref_time(5_378_000)
// Minimum execution time: 5_459 nanoseconds.
Weight::from_ref_time(5_616_000)
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking ForceEra (r:0 w:1)
fn force_new_era_always() -> Weight {
// Minimum execution time: 5_144 nanoseconds.
Weight::from_ref_time(5_454_000)
// Minimum execution time: 5_476 nanoseconds.
Weight::from_ref_time(5_692_000)
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking Invulnerables (r:0 w:1)
/// The range of component `v` is `[0, 1000]`.
fn set_invulnerables(v: u32, ) -> Weight {
// Minimum execution time: 5_190 nanoseconds.
Weight::from_ref_time(5_960_962)
// Standard Error: 41
.saturating_add(Weight::from_ref_time(10_329).saturating_mul(v.into()))
// Minimum execution time: 5_544 nanoseconds.
Weight::from_ref_time(6_513_190)
// Standard Error: 76
.saturating_add(Weight::from_ref_time(9_975).saturating_mul(v.into()))
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking Bonded (r:1 w:1)
@@ -693,10 +703,10 @@ 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_516 nanoseconds.
Weight::from_ref_time(86_317_884)
// Standard Error: 2_212
.saturating_add(Weight::from_ref_time(1_103_962).saturating_mul(s.into()))
// Minimum execution time: 82_414 nanoseconds.
Weight::from_ref_time(88_511_246)
// Standard Error: 2_622
.saturating_add(Weight::from_ref_time(1_131_814).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())))
@@ -704,10 +714,10 @@ impl WeightInfo for () {
// Storage: Staking UnappliedSlashes (r:1 w:1)
/// The range of component `s` is `[1, 1000]`.
fn cancel_deferred_slash(s: u32, ) -> Weight {
// Minimum execution time: 91_795 nanoseconds.
Weight::from_ref_time(904_524_900)
// Standard Error: 59_193
.saturating_add(Weight::from_ref_time(4_944_680).saturating_mul(s.into()))
// Minimum execution time: 94_197 nanoseconds.
Weight::from_ref_time(903_418_326)
// Standard Error: 59_354
.saturating_add(Weight::from_ref_time(4_948_354).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
@@ -722,10 +732,10 @@ 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_774 nanoseconds.
Weight::from_ref_time(178_857_156)
// Standard Error: 15_229
.saturating_add(Weight::from_ref_time(22_112_174).saturating_mul(n.into()))
// Minimum execution time: 133_065 nanoseconds.
Weight::from_ref_time(197_555_906)
// Standard Error: 19_561
.saturating_add(Weight::from_ref_time(22_683_426).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))
@@ -743,10 +753,10 @@ 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: 161_910 nanoseconds.
Weight::from_ref_time(217_635_072)
// Standard Error: 30_726
.saturating_add(Weight::from_ref_time(31_244_329).saturating_mul(n.into()))
// Minimum execution time: 164_719 nanoseconds.
Weight::from_ref_time(226_304_276)
// Standard Error: 31_675
.saturating_add(Weight::from_ref_time(32_622_427).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))
@@ -760,10 +770,10 @@ 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_986 nanoseconds.
Weight::from_ref_time(94_880_481)
// Standard Error: 2_007
.saturating_add(Weight::from_ref_time(31_421).saturating_mul(l.into()))
// Minimum execution time: 95_631 nanoseconds.
Weight::from_ref_time(96_861_556)
// Standard Error: 2_114
.saturating_add(Weight::from_ref_time(37_543).saturating_mul(l.into()))
.saturating_add(RocksDbWeight::get().reads(9))
.saturating_add(RocksDbWeight::get().writes(8))
}
@@ -782,10 +792,10 @@ 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_750 nanoseconds.
Weight::from_ref_time(95_115_568)
// Standard Error: 2_037
.saturating_add(Weight::from_ref_time(1_086_488).saturating_mul(s.into()))
// Minimum execution time: 95_251 nanoseconds.
Weight::from_ref_time(97_818_954)
// Standard Error: 2_356
.saturating_add(Weight::from_ref_time(1_104_695).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())))
@@ -806,19 +816,20 @@ impl WeightInfo for () {
// Storage: Staking ErasStakers (r:0 w:1)
// Storage: Staking ErasTotalStake (r:0 w:1)
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
// Storage: Staking MinimumActiveStake (r:0 w:1)
/// The range of component `v` is `[1, 10]`.
/// The range of component `n` is `[0, 100]`.
fn new_era(v: u32, n: u32, ) -> Weight {
// Minimum execution time: 506_543 nanoseconds.
Weight::from_ref_time(507_261_000)
// Standard Error: 1_766_631
.saturating_add(Weight::from_ref_time(59_139_153).saturating_mul(v.into()))
// Standard Error: 176_035
.saturating_add(Weight::from_ref_time(13_512_781).saturating_mul(n.into()))
// Minimum execution time: 512_923 nanoseconds.
Weight::from_ref_time(514_740_000)
// Standard Error: 1_790_238
.saturating_add(Weight::from_ref_time(59_320_539).saturating_mul(v.into()))
// Standard Error: 178_387
.saturating_add(Weight::from_ref_time(13_902_705).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(4))
.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(v.into())))
}
// Storage: VoterList CounterForListNodes (r:1 w:0)
@@ -828,27 +839,29 @@ impl WeightInfo for () {
// Storage: Staking Validators (r:500 w:0)
// Storage: Staking Bonded (r:1500 w:0)
// Storage: Staking Ledger (r:1500 w:0)
// Storage: Staking MinimumActiveStake (r:0 w:1)
/// The range of component `v` is `[500, 1000]`.
/// The range of component `n` is `[500, 1000]`.
fn get_npos_voters(v: u32, n: u32, ) -> Weight {
// Minimum execution time: 24_155_382 nanoseconds.
Weight::from_ref_time(24_252_568_000)
// Standard Error: 319_250
.saturating_add(Weight::from_ref_time(3_596_056).saturating_mul(v.into()))
// Standard Error: 319_250
.saturating_add(Weight::from_ref_time(2_852_023).saturating_mul(n.into()))
// Minimum execution time: 24_913_316 nanoseconds.
Weight::from_ref_time(25_053_596_000)
// Standard Error: 324_610
.saturating_add(Weight::from_ref_time(3_454_859).saturating_mul(v.into()))
// Standard Error: 324_610
.saturating_add(Weight::from_ref_time(3_020_267).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())))
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking CounterForValidators (r:1 w:0)
// Storage: Staking Validators (r:501 w:0)
/// The range of component `v` is `[500, 1000]`.
fn get_npos_targets(v: u32, ) -> Weight {
// Minimum execution time: 4_741_111 nanoseconds.
Weight::from_ref_time(113_360_179)
// Standard Error: 25_375
.saturating_add(Weight::from_ref_time(9_494_142).saturating_mul(v.into()))
// Minimum execution time: 4_916_401 nanoseconds.
Weight::from_ref_time(81_160_966)
// Standard Error: 23_829
.saturating_add(Weight::from_ref_time(9_883_413).saturating_mul(v.into()))
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(v.into())))
}
@@ -859,8 +872,8 @@ 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: 11_074 nanoseconds.
Weight::from_ref_time(11_312_000)
// Minimum execution time: 10_937 nanoseconds.
Weight::from_ref_time(11_324_000)
.saturating_add(RocksDbWeight::get().writes(6))
}
// Storage: Staking MinCommission (r:0 w:1)
@@ -870,8 +883,8 @@ 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_795 nanoseconds.
Weight::from_ref_time(10_116_000)
// Minimum execution time: 9_424 nanoseconds.
Weight::from_ref_time(10_021_000)
.saturating_add(RocksDbWeight::get().writes(6))
}
// Storage: Staking Ledger (r:1 w:0)
@@ -885,17 +898,23 @@ impl WeightInfo for () {
// Storage: VoterList ListBags (r:1 w:1)
// Storage: VoterList CounterForListNodes (r:1 w:1)
fn chill_other() -> Weight {
// Minimum execution time: 82_914 nanoseconds.
Weight::from_ref_time(83_848_000)
// Minimum execution time: 84_495 nanoseconds.
Weight::from_ref_time(85_559_000)
.saturating_add(RocksDbWeight::get().reads(11))
.saturating_add(RocksDbWeight::get().writes(6))
}
// Storage: Staking MinCommission (r:1 w:0)
// Storage: Staking Validators (r:1 w:1)
fn force_apply_min_commission() -> Weight {
// Minimum execution time: 20_317 nanoseconds.
Weight::from_ref_time(20_639_000)
// Minimum execution time: 20_385 nanoseconds.
Weight::from_ref_time(20_824_000)
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(1))
}
// Storage: Staking MinCommission (r:0 w:1)
fn set_min_commission() -> Weight {
// Minimum execution time: 6_995 nanoseconds.
Weight::from_ref_time(7_213_000)
.saturating_add(RocksDbWeight::get().writes(1))
}
}