mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-23 06:05:40 +00:00
[pallet-staking] Refund unused weight for payout_stakers (#8458)
* [pallet-staking] Refund unused weight for `payout_stakers` fixes #8428 * Use periods in comments * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs * Address Shawn's Feedback * Assert monotomic weights && improve test note * Remove stray new line * debug_assert payout_count <= max * Only track payouts to nominators; not validators * Trivial comment update Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
This commit is contained in:
@@ -290,7 +290,7 @@ use codec::{HasCompact, Encode, Decode};
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
decl_module, decl_event, decl_storage, ensure, decl_error,
|
decl_module, decl_event, decl_storage, ensure, decl_error,
|
||||||
weights::{
|
weights::{
|
||||||
Weight,
|
Weight, WithPostDispatchInfo,
|
||||||
constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS},
|
constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS},
|
||||||
},
|
},
|
||||||
storage::IterableStorageMap,
|
storage::IterableStorageMap,
|
||||||
@@ -1803,7 +1803,7 @@ decl_module! {
|
|||||||
/// Paying even a dead controller is cheaper weight-wise. We don't do any refunds here.
|
/// Paying even a dead controller is cheaper weight-wise. We don't do any refunds here.
|
||||||
/// # </weight>
|
/// # </weight>
|
||||||
#[weight = T::WeightInfo::payout_stakers_alive_staked(T::MaxNominatorRewardedPerValidator::get())]
|
#[weight = T::WeightInfo::payout_stakers_alive_staked(T::MaxNominatorRewardedPerValidator::get())]
|
||||||
fn payout_stakers(origin, validator_stash: T::AccountId, era: EraIndex) -> DispatchResult {
|
fn payout_stakers(origin, validator_stash: T::AccountId, era: EraIndex) -> DispatchResultWithPostInfo {
|
||||||
ensure_signed(origin)?;
|
ensure_signed(origin)?;
|
||||||
Self::do_payout_stakers(validator_stash, era)
|
Self::do_payout_stakers(validator_stash, era)
|
||||||
}
|
}
|
||||||
@@ -1967,24 +1967,35 @@ impl<T: Config> Module<T> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_payout_stakers(validator_stash: T::AccountId, era: EraIndex) -> DispatchResult {
|
fn do_payout_stakers(validator_stash: T::AccountId, era: EraIndex) -> DispatchResultWithPostInfo {
|
||||||
// Validate input data
|
// Validate input data
|
||||||
let current_era = CurrentEra::get().ok_or(Error::<T>::InvalidEraToReward)?;
|
let current_era = CurrentEra::get().ok_or(
|
||||||
ensure!(era <= current_era, Error::<T>::InvalidEraToReward);
|
Error::<T>::InvalidEraToReward.with_weight(T::WeightInfo::payout_stakers_alive_staked(0))
|
||||||
|
)?;
|
||||||
let history_depth = Self::history_depth();
|
let history_depth = Self::history_depth();
|
||||||
ensure!(era >= current_era.saturating_sub(history_depth), Error::<T>::InvalidEraToReward);
|
ensure!(
|
||||||
|
era <= current_era && era >= current_era.saturating_sub(history_depth),
|
||||||
|
Error::<T>::InvalidEraToReward.with_weight(T::WeightInfo::payout_stakers_alive_staked(0))
|
||||||
|
);
|
||||||
|
|
||||||
// Note: if era has no reward to be claimed, era may be future. better not to update
|
// Note: if era has no reward to be claimed, era may be future. better not to update
|
||||||
// `ledger.claimed_rewards` in this case.
|
// `ledger.claimed_rewards` in this case.
|
||||||
let era_payout = <ErasValidatorReward<T>>::get(&era)
|
let era_payout = <ErasValidatorReward<T>>::get(&era)
|
||||||
.ok_or_else(|| Error::<T>::InvalidEraToReward)?;
|
.ok_or_else(||
|
||||||
|
Error::<T>::InvalidEraToReward
|
||||||
|
.with_weight(T::WeightInfo::payout_stakers_alive_staked(0))
|
||||||
|
)?;
|
||||||
|
|
||||||
let controller = Self::bonded(&validator_stash).ok_or(Error::<T>::NotStash)?;
|
let controller = Self::bonded(&validator_stash).ok_or(
|
||||||
|
Error::<T>::NotStash.with_weight(T::WeightInfo::payout_stakers_alive_staked(0))
|
||||||
|
)?;
|
||||||
let mut ledger = <Ledger<T>>::get(&controller).ok_or_else(|| Error::<T>::NotController)?;
|
let mut ledger = <Ledger<T>>::get(&controller).ok_or_else(|| Error::<T>::NotController)?;
|
||||||
|
|
||||||
ledger.claimed_rewards.retain(|&x| x >= current_era.saturating_sub(history_depth));
|
ledger.claimed_rewards.retain(|&x| x >= current_era.saturating_sub(history_depth));
|
||||||
match ledger.claimed_rewards.binary_search(&era) {
|
match ledger.claimed_rewards.binary_search(&era) {
|
||||||
Ok(_) => Err(Error::<T>::AlreadyClaimed)?,
|
Ok(_) => Err(
|
||||||
|
Error::<T>::AlreadyClaimed.with_weight(T::WeightInfo::payout_stakers_alive_staked(0))
|
||||||
|
)?,
|
||||||
Err(pos) => ledger.claimed_rewards.insert(pos, era),
|
Err(pos) => ledger.claimed_rewards.insert(pos, era),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2008,7 +2019,9 @@ impl<T: Config> Module<T> {
|
|||||||
.unwrap_or_else(|| Zero::zero());
|
.unwrap_or_else(|| Zero::zero());
|
||||||
|
|
||||||
// Nothing to do if they have no reward points.
|
// Nothing to do if they have no reward points.
|
||||||
if validator_reward_points.is_zero() { return Ok(())}
|
if validator_reward_points.is_zero() {
|
||||||
|
return Ok(Some(T::WeightInfo::payout_stakers_alive_staked(0)).into())
|
||||||
|
}
|
||||||
|
|
||||||
// This is the fraction of the total reward that the validator and the
|
// This is the fraction of the total reward that the validator and the
|
||||||
// nominators will get.
|
// nominators will get.
|
||||||
@@ -2041,6 +2054,10 @@ impl<T: Config> Module<T> {
|
|||||||
Self::deposit_event(RawEvent::Reward(ledger.stash, imbalance.peek()));
|
Self::deposit_event(RawEvent::Reward(ledger.stash, imbalance.peek()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Track the number of payout ops to nominators. Note: `WeightInfo::payout_stakers_alive_staked`
|
||||||
|
// always assumes at least a validator is paid out, so we do not need to count their payout op.
|
||||||
|
let mut nominator_payout_count: u32 = 0;
|
||||||
|
|
||||||
// Lets now calculate how this is split to the nominators.
|
// Lets now calculate how this is split to the nominators.
|
||||||
// Reward only the clipped exposures. Note this is not necessarily sorted.
|
// Reward only the clipped exposures. Note this is not necessarily sorted.
|
||||||
for nominator in exposure.others.iter() {
|
for nominator in exposure.others.iter() {
|
||||||
@@ -2052,11 +2069,14 @@ impl<T: Config> Module<T> {
|
|||||||
let nominator_reward: BalanceOf<T> = nominator_exposure_part * validator_leftover_payout;
|
let nominator_reward: BalanceOf<T> = nominator_exposure_part * validator_leftover_payout;
|
||||||
// We can now make nominator payout:
|
// We can now make nominator payout:
|
||||||
if let Some(imbalance) = Self::make_payout(&nominator.who, nominator_reward) {
|
if let Some(imbalance) = Self::make_payout(&nominator.who, nominator_reward) {
|
||||||
|
// Note: this logic does not count payouts for `RewardDestination::None`.
|
||||||
|
nominator_payout_count += 1;
|
||||||
Self::deposit_event(RawEvent::Reward(nominator.who.clone(), imbalance.peek()));
|
Self::deposit_event(RawEvent::Reward(nominator.who.clone(), imbalance.peek()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
debug_assert!(nominator_payout_count <= T::MaxNominatorRewardedPerValidator::get());
|
||||||
|
Ok(Some(T::WeightInfo::payout_stakers_alive_staked(nominator_payout_count)).into())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update the ledger for a controller.
|
/// Update the ledger for a controller.
|
||||||
|
|||||||
@@ -269,6 +269,8 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub type Extrinsic = TestXt<Call, ()>;
|
pub type Extrinsic = TestXt<Call, ()>;
|
||||||
|
pub(crate) type StakingCall = crate::Call<Test>;
|
||||||
|
pub(crate) type TestRuntimeCall = <Test as frame_system::Config>::Call;
|
||||||
|
|
||||||
pub struct ExtBuilder {
|
pub struct ExtBuilder {
|
||||||
validator_pool: bool,
|
validator_pool: bool,
|
||||||
|
|||||||
@@ -20,12 +20,14 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use mock::*;
|
use mock::*;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
assert_eq_error_rate, traits::BadOrigin,
|
assert_eq_error_rate,
|
||||||
|
traits::{BadOrigin, Dispatchable},
|
||||||
};
|
};
|
||||||
use sp_staking::offence::OffenceDetails;
|
use sp_staking::offence::OffenceDetails;
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
assert_ok, assert_noop, StorageMap,
|
assert_ok, assert_noop, StorageMap,
|
||||||
traits::{Currency, ReservableCurrency, OnInitialize},
|
traits::{Currency, ReservableCurrency, OnInitialize},
|
||||||
|
weights::{extract_actual_weight, GetDispatchInfo},
|
||||||
};
|
};
|
||||||
use pallet_balances::Error as BalancesError;
|
use pallet_balances::Error as BalancesError;
|
||||||
use substrate_test_utils::assert_eq_uvec;
|
use substrate_test_utils::assert_eq_uvec;
|
||||||
@@ -2976,6 +2978,9 @@ fn claim_reward_at_the_last_era_and_no_double_claim_and_invalid_claim() {
|
|||||||
// * an invalid era to claim doesn't update last_reward
|
// * an invalid era to claim doesn't update last_reward
|
||||||
// * double claim of one era fails
|
// * double claim of one era fails
|
||||||
ExtBuilder::default().nominate(true).build_and_execute(|| {
|
ExtBuilder::default().nominate(true).build_and_execute(|| {
|
||||||
|
// Consumed weight for all payout_stakers dispatches that fail
|
||||||
|
let err_weight = weights::SubstrateWeight::<Test>::payout_stakers_alive_staked(0);
|
||||||
|
|
||||||
let init_balance_10 = Balances::total_balance(&10);
|
let init_balance_10 = Balances::total_balance(&10);
|
||||||
let init_balance_100 = Balances::total_balance(&100);
|
let init_balance_100 = Balances::total_balance(&100);
|
||||||
|
|
||||||
@@ -3021,19 +3026,19 @@ fn claim_reward_at_the_last_era_and_no_double_claim_and_invalid_claim() {
|
|||||||
assert_noop!(
|
assert_noop!(
|
||||||
Staking::payout_stakers(Origin::signed(1337), 11, 0),
|
Staking::payout_stakers(Origin::signed(1337), 11, 0),
|
||||||
// Fail: Era out of history
|
// Fail: Era out of history
|
||||||
Error::<Test>::InvalidEraToReward
|
Error::<Test>::InvalidEraToReward.with_weight(err_weight)
|
||||||
);
|
);
|
||||||
assert_ok!(Staking::payout_stakers(Origin::signed(1337), 11, 1));
|
assert_ok!(Staking::payout_stakers(Origin::signed(1337), 11, 1));
|
||||||
assert_ok!(Staking::payout_stakers(Origin::signed(1337), 11, 2));
|
assert_ok!(Staking::payout_stakers(Origin::signed(1337), 11, 2));
|
||||||
assert_noop!(
|
assert_noop!(
|
||||||
Staking::payout_stakers(Origin::signed(1337), 11, 2),
|
Staking::payout_stakers(Origin::signed(1337), 11, 2),
|
||||||
// Fail: Double claim
|
// Fail: Double claim
|
||||||
Error::<Test>::AlreadyClaimed
|
Error::<Test>::AlreadyClaimed.with_weight(err_weight)
|
||||||
);
|
);
|
||||||
assert_noop!(
|
assert_noop!(
|
||||||
Staking::payout_stakers(Origin::signed(1337), 11, active_era),
|
Staking::payout_stakers(Origin::signed(1337), 11, active_era),
|
||||||
// Fail: Era not finished yet
|
// Fail: Era not finished yet
|
||||||
Error::<Test>::InvalidEraToReward
|
Error::<Test>::InvalidEraToReward.with_weight(err_weight)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Era 0 can't be rewarded anymore and current era can't be rewarded yet
|
// Era 0 can't be rewarded anymore and current era can't be rewarded yet
|
||||||
@@ -3287,6 +3292,9 @@ fn test_payout_stakers() {
|
|||||||
fn payout_stakers_handles_basic_errors() {
|
fn payout_stakers_handles_basic_errors() {
|
||||||
// Here we will test payouts handle all errors.
|
// Here we will test payouts handle all errors.
|
||||||
ExtBuilder::default().has_stakers(false).build_and_execute(|| {
|
ExtBuilder::default().has_stakers(false).build_and_execute(|| {
|
||||||
|
// Consumed weight for all payout_stakers dispatches that fail
|
||||||
|
let err_weight = weights::SubstrateWeight::<Test>::payout_stakers_alive_staked(0);
|
||||||
|
|
||||||
// Same setup as the test above
|
// Same setup as the test above
|
||||||
let balance = 1000;
|
let balance = 1000;
|
||||||
bond_validator(11, 10, balance); // Default(64)
|
bond_validator(11, 10, balance); // Default(64)
|
||||||
@@ -3305,9 +3313,15 @@ fn payout_stakers_handles_basic_errors() {
|
|||||||
mock::start_active_era(2);
|
mock::start_active_era(2);
|
||||||
|
|
||||||
// Wrong Era, too big
|
// Wrong Era, too big
|
||||||
assert_noop!(Staking::payout_stakers(Origin::signed(1337), 11, 2), Error::<Test>::InvalidEraToReward);
|
assert_noop!(
|
||||||
|
Staking::payout_stakers(Origin::signed(1337), 11, 2),
|
||||||
|
Error::<Test>::InvalidEraToReward.with_weight(err_weight)
|
||||||
|
);
|
||||||
// Wrong Staker
|
// Wrong Staker
|
||||||
assert_noop!(Staking::payout_stakers(Origin::signed(1337), 10, 1), Error::<Test>::NotStash);
|
assert_noop!(
|
||||||
|
Staking::payout_stakers(Origin::signed(1337), 10, 1),
|
||||||
|
Error::<Test>::NotStash.with_weight(err_weight)
|
||||||
|
);
|
||||||
|
|
||||||
for i in 3..100 {
|
for i in 3..100 {
|
||||||
Staking::reward_by_ids(vec![(11, 1)]);
|
Staking::reward_by_ids(vec![(11, 1)]);
|
||||||
@@ -3317,14 +3331,134 @@ fn payout_stakers_handles_basic_errors() {
|
|||||||
}
|
}
|
||||||
// We are at era 99, with history depth of 84
|
// We are at era 99, with history depth of 84
|
||||||
// We should be able to payout era 15 through 98 (84 total eras), but not 14 or 99.
|
// We should be able to payout era 15 through 98 (84 total eras), but not 14 or 99.
|
||||||
assert_noop!(Staking::payout_stakers(Origin::signed(1337), 11, 14), Error::<Test>::InvalidEraToReward);
|
assert_noop!(
|
||||||
assert_noop!(Staking::payout_stakers(Origin::signed(1337), 11, 99), Error::<Test>::InvalidEraToReward);
|
Staking::payout_stakers(Origin::signed(1337), 11, 14),
|
||||||
|
Error::<Test>::InvalidEraToReward.with_weight(err_weight)
|
||||||
|
);
|
||||||
|
assert_noop!(
|
||||||
|
Staking::payout_stakers(Origin::signed(1337), 11, 99),
|
||||||
|
Error::<Test>::InvalidEraToReward.with_weight(err_weight)
|
||||||
|
);
|
||||||
assert_ok!(Staking::payout_stakers(Origin::signed(1337), 11, 15));
|
assert_ok!(Staking::payout_stakers(Origin::signed(1337), 11, 15));
|
||||||
assert_ok!(Staking::payout_stakers(Origin::signed(1337), 11, 98));
|
assert_ok!(Staking::payout_stakers(Origin::signed(1337), 11, 98));
|
||||||
|
|
||||||
// Can't claim again
|
// Can't claim again
|
||||||
assert_noop!(Staking::payout_stakers(Origin::signed(1337), 11, 15), Error::<Test>::AlreadyClaimed);
|
assert_noop!(
|
||||||
assert_noop!(Staking::payout_stakers(Origin::signed(1337), 11, 98), Error::<Test>::AlreadyClaimed);
|
Staking::payout_stakers(Origin::signed(1337), 11, 15),
|
||||||
|
Error::<Test>::AlreadyClaimed.with_weight(err_weight)
|
||||||
|
);
|
||||||
|
assert_noop!(
|
||||||
|
Staking::payout_stakers(Origin::signed(1337), 11, 98),
|
||||||
|
Error::<Test>::AlreadyClaimed.with_weight(err_weight)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn payout_stakers_handles_weight_refund() {
|
||||||
|
// Note: this test relies on the assumption that `payout_stakers_alive_staked` is solely used by
|
||||||
|
// `payout_stakers` to calculate the weight of each payout op.
|
||||||
|
ExtBuilder::default().has_stakers(false).build_and_execute(|| {
|
||||||
|
let max_nom_rewarded = <Test as Config>::MaxNominatorRewardedPerValidator::get();
|
||||||
|
// Make sure the configured value is meaningful for our use.
|
||||||
|
assert!(max_nom_rewarded >= 4);
|
||||||
|
let half_max_nom_rewarded = max_nom_rewarded / 2;
|
||||||
|
// Sanity check our max and half max nominator quantities.
|
||||||
|
assert!(half_max_nom_rewarded > 0);
|
||||||
|
assert!(max_nom_rewarded > half_max_nom_rewarded);
|
||||||
|
|
||||||
|
let max_nom_rewarded_weight
|
||||||
|
= <Test as Config>::WeightInfo::payout_stakers_alive_staked(max_nom_rewarded);
|
||||||
|
let half_max_nom_rewarded_weight
|
||||||
|
= <Test as Config>::WeightInfo::payout_stakers_alive_staked(half_max_nom_rewarded);
|
||||||
|
let zero_nom_payouts_weight = <Test as Config>::WeightInfo::payout_stakers_alive_staked(0);
|
||||||
|
assert!(zero_nom_payouts_weight > 0);
|
||||||
|
assert!(half_max_nom_rewarded_weight > zero_nom_payouts_weight);
|
||||||
|
assert!(max_nom_rewarded_weight > half_max_nom_rewarded_weight);
|
||||||
|
|
||||||
|
let balance = 1000;
|
||||||
|
bond_validator(11, 10, balance);
|
||||||
|
|
||||||
|
/* Era 1 */
|
||||||
|
start_active_era(1);
|
||||||
|
|
||||||
|
// Reward just the validator.
|
||||||
|
Staking::reward_by_ids(vec![(11, 1)]);
|
||||||
|
|
||||||
|
// Add some `half_max_nom_rewarded` nominators who will start backing the validator in the
|
||||||
|
// next era.
|
||||||
|
for i in 0..half_max_nom_rewarded {
|
||||||
|
bond_nominator((1000 + i).into(), (100 + i).into(), balance + i as Balance, vec![11]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Era 2 */
|
||||||
|
start_active_era(2);
|
||||||
|
|
||||||
|
// Collect payouts when there are no nominators
|
||||||
|
let call = TestRuntimeCall::Staking(StakingCall::payout_stakers(11, 1));
|
||||||
|
let info = call.get_dispatch_info();
|
||||||
|
let result = call.dispatch(Origin::signed(20));
|
||||||
|
assert_ok!(result);
|
||||||
|
assert_eq!(
|
||||||
|
extract_actual_weight(&result, &info),
|
||||||
|
zero_nom_payouts_weight
|
||||||
|
);
|
||||||
|
|
||||||
|
// The validator is not rewarded in this era; so there will be zero payouts to claim for this era.
|
||||||
|
|
||||||
|
/* Era 3 */
|
||||||
|
start_active_era(3);
|
||||||
|
|
||||||
|
// Collect payouts for an era where the validator did not receive any points.
|
||||||
|
let call = TestRuntimeCall::Staking(StakingCall::payout_stakers(11, 2));
|
||||||
|
let info = call.get_dispatch_info();
|
||||||
|
let result = call.dispatch(Origin::signed(20));
|
||||||
|
assert_ok!(result);
|
||||||
|
assert_eq!(extract_actual_weight(&result, &info), zero_nom_payouts_weight);
|
||||||
|
|
||||||
|
// Reward the validator and its nominators.
|
||||||
|
Staking::reward_by_ids(vec![(11, 1)]);
|
||||||
|
|
||||||
|
/* Era 4 */
|
||||||
|
start_active_era(4);
|
||||||
|
|
||||||
|
// Collect payouts when the validator has `half_max_nom_rewarded` nominators.
|
||||||
|
let call = TestRuntimeCall::Staking(StakingCall::payout_stakers(11, 3));
|
||||||
|
let info = call.get_dispatch_info();
|
||||||
|
let result = call.dispatch(Origin::signed(20));
|
||||||
|
assert_ok!(result);
|
||||||
|
assert_eq!(extract_actual_weight(&result, &info), half_max_nom_rewarded_weight);
|
||||||
|
|
||||||
|
// Add enough nominators so that we are at the limit. They will be active nominators
|
||||||
|
// in the next era.
|
||||||
|
for i in half_max_nom_rewarded..max_nom_rewarded {
|
||||||
|
bond_nominator((1000 + i).into(), (100 + i).into(), balance + i as Balance, vec![11]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Era 5 */
|
||||||
|
start_active_era(5);
|
||||||
|
// We now have `max_nom_rewarded` nominators actively nominating our validator.
|
||||||
|
|
||||||
|
// Reward the validator so we can collect for everyone in the next era.
|
||||||
|
Staking::reward_by_ids(vec![(11, 1)]);
|
||||||
|
|
||||||
|
/* Era 6 */
|
||||||
|
start_active_era(6);
|
||||||
|
|
||||||
|
// Collect payouts when the validator had `half_max_nom_rewarded` nominators.
|
||||||
|
let call = TestRuntimeCall::Staking(StakingCall::payout_stakers(11, 5));
|
||||||
|
let info = call.get_dispatch_info();
|
||||||
|
let result = call.dispatch(Origin::signed(20));
|
||||||
|
assert_ok!(result);
|
||||||
|
assert_eq!(extract_actual_weight(&result, &info), max_nom_rewarded_weight);
|
||||||
|
|
||||||
|
// Try and collect payouts for an era that has already been collected.
|
||||||
|
let call = TestRuntimeCall::Staking(StakingCall::payout_stakers(11, 5));
|
||||||
|
let info = call.get_dispatch_info();
|
||||||
|
let result = call.dispatch(Origin::signed(20));
|
||||||
|
assert!(result.is_err());
|
||||||
|
// When there is an error the consumed weight == weight when there are 0 nominator payouts.
|
||||||
|
assert_eq!(extract_actual_weight(&result, &info), zero_nom_payouts_weight);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
//! Autogenerated weights for pallet_staking
|
//! Autogenerated weights for pallet_staking
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
||||||
//! DATE: 2021-03-19, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
//! DATE: 2021-03-25, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128
|
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128
|
||||||
|
|
||||||
// Executed Command:
|
// Executed Command:
|
||||||
@@ -76,155 +76,155 @@ pub trait WeightInfo {
|
|||||||
pub struct SubstrateWeight<T>(PhantomData<T>);
|
pub struct SubstrateWeight<T>(PhantomData<T>);
|
||||||
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||||
fn bond() -> Weight {
|
fn bond() -> Weight {
|
||||||
(82_121_000 as Weight)
|
(79_895_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||||
}
|
}
|
||||||
fn bond_extra() -> Weight {
|
fn bond_extra() -> Weight {
|
||||||
(61_899_000 as Weight)
|
(60_561_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||||
}
|
}
|
||||||
fn unbond() -> Weight {
|
fn unbond() -> Weight {
|
||||||
(56_392_000 as Weight)
|
(54_996_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn withdraw_unbonded_update(s: u32, ) -> Weight {
|
fn withdraw_unbonded_update(s: u32, ) -> Weight {
|
||||||
(57_382_000 as Weight)
|
(56_056_000 as Weight)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add((70_000 as Weight).saturating_mul(s as Weight))
|
.saturating_add((67_000 as Weight).saturating_mul(s as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
|
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
|
||||||
(92_185_000 as Weight)
|
(90_267_000 as Weight)
|
||||||
// Standard Error: 1_000
|
// Standard Error: 1_000
|
||||||
.saturating_add((2_844_000 as Weight).saturating_mul(s as Weight))
|
.saturating_add((2_787_000 as Weight).saturating_mul(s as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads(6 as Weight))
|
.saturating_add(T::DbWeight::get().reads(6 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(8 as Weight))
|
.saturating_add(T::DbWeight::get().writes(8 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||||
}
|
}
|
||||||
fn validate() -> Weight {
|
fn validate() -> Weight {
|
||||||
(16_892_000 as Weight)
|
(16_345_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||||
}
|
}
|
||||||
fn kick(k: u32, ) -> Weight {
|
fn kick(k: u32, ) -> Weight {
|
||||||
(27_411_000 as Weight)
|
(27_080_000 as Weight)
|
||||||
// Standard Error: 14_000
|
// Standard Error: 14_000
|
||||||
.saturating_add((19_272_000 as Weight).saturating_mul(k as Weight))
|
.saturating_add((18_739_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_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(k 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)))
|
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(k as Weight)))
|
||||||
}
|
}
|
||||||
fn nominate(n: u32, ) -> Weight {
|
fn nominate(n: u32, ) -> Weight {
|
||||||
(30_188_000 as Weight)
|
(29_101_000 as Weight)
|
||||||
// Standard Error: 24_000
|
// Standard Error: 23_000
|
||||||
.saturating_add((5_666_000 as Weight).saturating_mul(n as Weight))
|
.saturating_add((5_670_000 as Weight).saturating_mul(n as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
|
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
|
||||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||||
}
|
}
|
||||||
fn chill() -> Weight {
|
fn chill() -> Weight {
|
||||||
(15_870_000 as Weight)
|
(15_771_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||||
}
|
}
|
||||||
fn set_payee() -> Weight {
|
fn set_payee() -> Weight {
|
||||||
(13_853_000 as Weight)
|
(13_329_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn set_controller() -> Weight {
|
fn set_controller() -> Weight {
|
||||||
(30_291_000 as Weight)
|
(29_807_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn set_validator_count() -> Weight {
|
fn set_validator_count() -> Weight {
|
||||||
(2_397_000 as Weight)
|
(2_323_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn force_no_eras() -> Weight {
|
fn force_no_eras() -> Weight {
|
||||||
(2_627_000 as Weight)
|
(2_528_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn force_new_era() -> Weight {
|
fn force_new_era() -> Weight {
|
||||||
(2_679_000 as Weight)
|
(2_529_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn force_new_era_always() -> Weight {
|
fn force_new_era_always() -> Weight {
|
||||||
(2_643_000 as Weight)
|
(2_527_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn set_invulnerables(v: u32, ) -> Weight {
|
fn set_invulnerables(v: u32, ) -> Weight {
|
||||||
(2_871_000 as Weight)
|
(2_661_000 as Weight)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add((35_000 as Weight).saturating_mul(v as Weight))
|
.saturating_add((35_000 as Weight).saturating_mul(v as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn force_unstake(s: u32, ) -> Weight {
|
fn force_unstake(s: u32, ) -> Weight {
|
||||||
(65_876_000 as Weight)
|
(64_650_000 as Weight)
|
||||||
// Standard Error: 1_000
|
// Standard Error: 1_000
|
||||||
.saturating_add((2_832_000 as Weight).saturating_mul(s as Weight))
|
.saturating_add((2_755_000 as Weight).saturating_mul(s as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(8 as Weight))
|
.saturating_add(T::DbWeight::get().writes(8 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||||
}
|
}
|
||||||
fn cancel_deferred_slash(s: u32, ) -> Weight {
|
fn cancel_deferred_slash(s: u32, ) -> Weight {
|
||||||
(5_896_640_000 as Weight)
|
(5_904_642_000 as Weight)
|
||||||
// Standard Error: 391_000
|
// Standard Error: 393_000
|
||||||
.saturating_add((34_808_000 as Weight).saturating_mul(s as Weight))
|
.saturating_add((34_810_000 as Weight).saturating_mul(s as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn payout_stakers_dead_controller(n: u32, ) -> Weight {
|
fn payout_stakers_dead_controller(n: u32, ) -> Weight {
|
||||||
(137_975_000 as Weight)
|
(131_368_000 as Weight)
|
||||||
// Standard Error: 20_000
|
// Standard Error: 17_000
|
||||||
.saturating_add((54_061_000 as Weight).saturating_mul(n as Weight))
|
.saturating_add((52_611_000 as Weight).saturating_mul(n as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads(10 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().reads((3 as Weight).saturating_mul(n as Weight)))
|
||||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight)))
|
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight)))
|
||||||
}
|
}
|
||||||
fn payout_stakers_alive_staked(n: u32, ) -> Weight {
|
fn payout_stakers_alive_staked(n: u32, ) -> Weight {
|
||||||
(163_885_000 as Weight)
|
(165_079_000 as Weight)
|
||||||
// Standard Error: 20_000
|
// Standard Error: 27_000
|
||||||
.saturating_add((68_096_000 as Weight).saturating_mul(n as Weight))
|
.saturating_add((66_740_000 as Weight).saturating_mul(n as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads(11 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().reads((5 as Weight).saturating_mul(n as Weight)))
|
||||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight)))
|
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight)))
|
||||||
}
|
}
|
||||||
fn rebond(l: u32, ) -> Weight {
|
fn rebond(l: u32, ) -> Weight {
|
||||||
(37_847_000 as Weight)
|
(37_039_000 as Weight)
|
||||||
// Standard Error: 1_000
|
// Standard Error: 2_000
|
||||||
.saturating_add((89_000 as Weight).saturating_mul(l as Weight))
|
.saturating_add((93_000 as Weight).saturating_mul(l as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn set_history_depth(e: u32, ) -> Weight {
|
fn set_history_depth(e: u32, ) -> Weight {
|
||||||
(0 as Weight)
|
(0 as Weight)
|
||||||
// Standard Error: 69_000
|
// Standard Error: 71_000
|
||||||
.saturating_add((34_413_000 as Weight).saturating_mul(e as Weight))
|
.saturating_add((34_403_000 as Weight).saturating_mul(e as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads(2 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(4 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes((7 as Weight).saturating_mul(e as Weight)))
|
.saturating_add(T::DbWeight::get().writes((7 as Weight).saturating_mul(e as Weight)))
|
||||||
}
|
}
|
||||||
fn reap_stash(s: u32, ) -> Weight {
|
fn reap_stash(s: u32, ) -> Weight {
|
||||||
(69_257_000 as Weight)
|
(67_561_000 as Weight)
|
||||||
// Standard Error: 1_000
|
// Standard Error: 0
|
||||||
.saturating_add((2_819_000 as Weight).saturating_mul(s as Weight))
|
.saturating_add((2_766_000 as Weight).saturating_mul(s as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(8 as Weight))
|
.saturating_add(T::DbWeight::get().writes(8 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||||
}
|
}
|
||||||
fn new_era(v: u32, n: u32, ) -> Weight {
|
fn new_era(v: u32, n: u32, ) -> Weight {
|
||||||
(0 as Weight)
|
(0 as Weight)
|
||||||
// Standard Error: 1_013_000
|
// Standard Error: 1_016_000
|
||||||
.saturating_add((382_529_000 as Weight).saturating_mul(v as Weight))
|
.saturating_add((389_979_000 as Weight).saturating_mul(v as Weight))
|
||||||
// Standard Error: 50_000
|
// Standard Error: 51_000
|
||||||
.saturating_add((63_170_000 as Weight).saturating_mul(n as Weight))
|
.saturating_add((63_208_000 as Weight).saturating_mul(n as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads(10 as Weight))
|
.saturating_add(T::DbWeight::get().reads(10 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
|
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
|
||||||
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
||||||
@@ -233,12 +233,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
|||||||
}
|
}
|
||||||
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
|
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
|
||||||
(0 as Weight)
|
(0 as Weight)
|
||||||
// Standard Error: 90_000
|
// Standard Error: 95_000
|
||||||
.saturating_add((27_108_000 as Weight).saturating_mul(v as Weight))
|
.saturating_add((26_419_000 as Weight).saturating_mul(v as Weight))
|
||||||
// Standard Error: 90_000
|
// Standard Error: 95_000
|
||||||
.saturating_add((29_962_000 as Weight).saturating_mul(n as Weight))
|
.saturating_add((29_033_000 as Weight).saturating_mul(n as Weight))
|
||||||
// Standard Error: 1_228_000
|
// Standard Error: 1_305_000
|
||||||
.saturating_add((26_080_000 as Weight).saturating_mul(s as Weight))
|
.saturating_add((23_680_000 as Weight).saturating_mul(s as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
|
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
|
||||||
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
||||||
@@ -247,7 +247,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
|||||||
fn get_npos_targets(v: u32, ) -> Weight {
|
fn get_npos_targets(v: u32, ) -> Weight {
|
||||||
(0 as Weight)
|
(0 as Weight)
|
||||||
// Standard Error: 32_000
|
// Standard Error: 32_000
|
||||||
.saturating_add((11_220_000 as Weight).saturating_mul(v as Weight))
|
.saturating_add((11_317_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_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
|
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
|
||||||
}
|
}
|
||||||
@@ -256,155 +256,155 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
|||||||
// For backwards compatibility and tests
|
// For backwards compatibility and tests
|
||||||
impl WeightInfo for () {
|
impl WeightInfo for () {
|
||||||
fn bond() -> Weight {
|
fn bond() -> Weight {
|
||||||
(82_121_000 as Weight)
|
(79_895_000 as Weight)
|
||||||
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
||||||
}
|
}
|
||||||
fn bond_extra() -> Weight {
|
fn bond_extra() -> Weight {
|
||||||
(61_899_000 as Weight)
|
(60_561_000 as Weight)
|
||||||
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
||||||
}
|
}
|
||||||
fn unbond() -> Weight {
|
fn unbond() -> Weight {
|
||||||
(56_392_000 as Weight)
|
(54_996_000 as Weight)
|
||||||
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn withdraw_unbonded_update(s: u32, ) -> Weight {
|
fn withdraw_unbonded_update(s: u32, ) -> Weight {
|
||||||
(57_382_000 as Weight)
|
(56_056_000 as Weight)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add((70_000 as Weight).saturating_mul(s as Weight))
|
.saturating_add((67_000 as Weight).saturating_mul(s as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
|
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
|
||||||
(92_185_000 as Weight)
|
(90_267_000 as Weight)
|
||||||
// Standard Error: 1_000
|
// Standard Error: 1_000
|
||||||
.saturating_add((2_844_000 as Weight).saturating_mul(s as Weight))
|
.saturating_add((2_787_000 as Weight).saturating_mul(s as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||||
}
|
}
|
||||||
fn validate() -> Weight {
|
fn validate() -> Weight {
|
||||||
(16_892_000 as Weight)
|
(16_345_000 as Weight)
|
||||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
||||||
}
|
}
|
||||||
fn kick(k: u32, ) -> Weight {
|
fn kick(k: u32, ) -> Weight {
|
||||||
(27_411_000 as Weight)
|
(27_080_000 as Weight)
|
||||||
// Standard Error: 14_000
|
// Standard Error: 14_000
|
||||||
.saturating_add((19_272_000 as Weight).saturating_mul(k as Weight))
|
.saturating_add((18_739_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_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(k 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)))
|
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(k as Weight)))
|
||||||
}
|
}
|
||||||
fn nominate(n: u32, ) -> Weight {
|
fn nominate(n: u32, ) -> Weight {
|
||||||
(30_188_000 as Weight)
|
(29_101_000 as Weight)
|
||||||
// Standard Error: 24_000
|
// Standard Error: 23_000
|
||||||
.saturating_add((5_666_000 as Weight).saturating_mul(n as Weight))
|
.saturating_add((5_670_000 as Weight).saturating_mul(n as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
|
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
|
||||||
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
||||||
}
|
}
|
||||||
fn chill() -> Weight {
|
fn chill() -> Weight {
|
||||||
(15_870_000 as Weight)
|
(15_771_000 as Weight)
|
||||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
||||||
}
|
}
|
||||||
fn set_payee() -> Weight {
|
fn set_payee() -> Weight {
|
||||||
(13_853_000 as Weight)
|
(13_329_000 as Weight)
|
||||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn set_controller() -> Weight {
|
fn set_controller() -> Weight {
|
||||||
(30_291_000 as Weight)
|
(29_807_000 as Weight)
|
||||||
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn set_validator_count() -> Weight {
|
fn set_validator_count() -> Weight {
|
||||||
(2_397_000 as Weight)
|
(2_323_000 as Weight)
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn force_no_eras() -> Weight {
|
fn force_no_eras() -> Weight {
|
||||||
(2_627_000 as Weight)
|
(2_528_000 as Weight)
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn force_new_era() -> Weight {
|
fn force_new_era() -> Weight {
|
||||||
(2_679_000 as Weight)
|
(2_529_000 as Weight)
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn force_new_era_always() -> Weight {
|
fn force_new_era_always() -> Weight {
|
||||||
(2_643_000 as Weight)
|
(2_527_000 as Weight)
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn set_invulnerables(v: u32, ) -> Weight {
|
fn set_invulnerables(v: u32, ) -> Weight {
|
||||||
(2_871_000 as Weight)
|
(2_661_000 as Weight)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add((35_000 as Weight).saturating_mul(v as Weight))
|
.saturating_add((35_000 as Weight).saturating_mul(v as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn force_unstake(s: u32, ) -> Weight {
|
fn force_unstake(s: u32, ) -> Weight {
|
||||||
(65_876_000 as Weight)
|
(64_650_000 as Weight)
|
||||||
// Standard Error: 1_000
|
// Standard Error: 1_000
|
||||||
.saturating_add((2_832_000 as Weight).saturating_mul(s as Weight))
|
.saturating_add((2_755_000 as Weight).saturating_mul(s as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||||
}
|
}
|
||||||
fn cancel_deferred_slash(s: u32, ) -> Weight {
|
fn cancel_deferred_slash(s: u32, ) -> Weight {
|
||||||
(5_896_640_000 as Weight)
|
(5_904_642_000 as Weight)
|
||||||
// Standard Error: 391_000
|
// Standard Error: 393_000
|
||||||
.saturating_add((34_808_000 as Weight).saturating_mul(s as Weight))
|
.saturating_add((34_810_000 as Weight).saturating_mul(s as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn payout_stakers_dead_controller(n: u32, ) -> Weight {
|
fn payout_stakers_dead_controller(n: u32, ) -> Weight {
|
||||||
(137_975_000 as Weight)
|
(131_368_000 as Weight)
|
||||||
// Standard Error: 20_000
|
// Standard Error: 17_000
|
||||||
.saturating_add((54_061_000 as Weight).saturating_mul(n as Weight))
|
.saturating_add((52_611_000 as Weight).saturating_mul(n as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads(10 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().reads((3 as Weight).saturating_mul(n as Weight)))
|
||||||
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(n as Weight)))
|
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(n as Weight)))
|
||||||
}
|
}
|
||||||
fn payout_stakers_alive_staked(n: u32, ) -> Weight {
|
fn payout_stakers_alive_staked(n: u32, ) -> Weight {
|
||||||
(163_885_000 as Weight)
|
(165_079_000 as Weight)
|
||||||
// Standard Error: 20_000
|
// Standard Error: 27_000
|
||||||
.saturating_add((68_096_000 as Weight).saturating_mul(n as Weight))
|
.saturating_add((66_740_000 as Weight).saturating_mul(n as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads(11 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().reads((5 as Weight).saturating_mul(n as Weight)))
|
||||||
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(n as Weight)))
|
.saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(n as Weight)))
|
||||||
}
|
}
|
||||||
fn rebond(l: u32, ) -> Weight {
|
fn rebond(l: u32, ) -> Weight {
|
||||||
(37_847_000 as Weight)
|
(37_039_000 as Weight)
|
||||||
// Standard Error: 1_000
|
// Standard Error: 2_000
|
||||||
.saturating_add((89_000 as Weight).saturating_mul(l as Weight))
|
.saturating_add((93_000 as Weight).saturating_mul(l as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
||||||
}
|
}
|
||||||
fn set_history_depth(e: u32, ) -> Weight {
|
fn set_history_depth(e: u32, ) -> Weight {
|
||||||
(0 as Weight)
|
(0 as Weight)
|
||||||
// Standard Error: 69_000
|
// Standard Error: 71_000
|
||||||
.saturating_add((34_413_000 as Weight).saturating_mul(e as Weight))
|
.saturating_add((34_403_000 as Weight).saturating_mul(e as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes((7 as Weight).saturating_mul(e as Weight)))
|
.saturating_add(RocksDbWeight::get().writes((7 as Weight).saturating_mul(e as Weight)))
|
||||||
}
|
}
|
||||||
fn reap_stash(s: u32, ) -> Weight {
|
fn reap_stash(s: u32, ) -> Weight {
|
||||||
(69_257_000 as Weight)
|
(67_561_000 as Weight)
|
||||||
// Standard Error: 1_000
|
// Standard Error: 0
|
||||||
.saturating_add((2_819_000 as Weight).saturating_mul(s as Weight))
|
.saturating_add((2_766_000 as Weight).saturating_mul(s as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||||
}
|
}
|
||||||
fn new_era(v: u32, n: u32, ) -> Weight {
|
fn new_era(v: u32, n: u32, ) -> Weight {
|
||||||
(0 as Weight)
|
(0 as Weight)
|
||||||
// Standard Error: 1_013_000
|
// Standard Error: 1_016_000
|
||||||
.saturating_add((382_529_000 as Weight).saturating_mul(v as Weight))
|
.saturating_add((389_979_000 as Weight).saturating_mul(v as Weight))
|
||||||
// Standard Error: 50_000
|
// Standard Error: 51_000
|
||||||
.saturating_add((63_170_000 as Weight).saturating_mul(n as Weight))
|
.saturating_add((63_208_000 as Weight).saturating_mul(n as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads(10 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(10 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
|
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
|
||||||
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
||||||
@@ -413,12 +413,12 @@ impl WeightInfo for () {
|
|||||||
}
|
}
|
||||||
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
|
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
|
||||||
(0 as Weight)
|
(0 as Weight)
|
||||||
// Standard Error: 90_000
|
// Standard Error: 95_000
|
||||||
.saturating_add((27_108_000 as Weight).saturating_mul(v as Weight))
|
.saturating_add((26_419_000 as Weight).saturating_mul(v as Weight))
|
||||||
// Standard Error: 90_000
|
// Standard Error: 95_000
|
||||||
.saturating_add((29_962_000 as Weight).saturating_mul(n as Weight))
|
.saturating_add((29_033_000 as Weight).saturating_mul(n as Weight))
|
||||||
// Standard Error: 1_228_000
|
// Standard Error: 1_305_000
|
||||||
.saturating_add((26_080_000 as Weight).saturating_mul(s as Weight))
|
.saturating_add((23_680_000 as Weight).saturating_mul(s as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
|
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
|
||||||
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
||||||
@@ -427,7 +427,7 @@ impl WeightInfo for () {
|
|||||||
fn get_npos_targets(v: u32, ) -> Weight {
|
fn get_npos_targets(v: u32, ) -> Weight {
|
||||||
(0 as Weight)
|
(0 as Weight)
|
||||||
// Standard Error: 32_000
|
// Standard Error: 32_000
|
||||||
.saturating_add((11_220_000 as Weight).saturating_mul(v as Weight))
|
.saturating_add((11_317_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_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
|
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user