Extrinsic to restore corrupt staking ledgers (#3706)

This PR adds a new extrinsic `Call::restore_ledger ` gated by
`StakingAdmin` origin that restores a corrupted staking ledger. This
extrinsic will be used to recover ledgers that were affected by the
issue discussed in
https://github.com/paritytech/polkadot-sdk/issues/3245.

The extrinsic will re-write the storage items associated with a stash
account provided as input parameter. The data used to reset the ledger
can be either i) fetched on-chain or ii) partially/totally set by the
input parameters of the call.

In order to use on-chain data to restore the staking locks, we need a
way to read the current lock in the balances pallet. This PR adds a
`InspectLockableCurrency` trait and implements it in the pallet
balances. An alternative would be to tightly couple staking with the
pallet balances but that's inelegant (an example of how it would look
like in [this
branch](https://github.com/paritytech/polkadot-sdk/tree/gpestana/ledger-badstate-clean_tightly)).

More details on the type of corruptions and corresponding fixes
https://hackmd.io/DLb5jEYWSmmvqXC9ae4yRg?view#/

We verified that the `Call::restore_ledger` does fix all current
corrupted ledgers in Polkadot and Kusama. You can verify it here
https://hackmd.io/v-XNrEoGRpe7APR-EZGhOA.

**Changes introduced**
- Adds `Call::restore_ledger ` extrinsic to recover a corrupted ledger;
- Adds trait `frame_support::traits::currency::InspectLockableCurrency`
to allow external pallets to read current locks given an account and
lock ID;
- Implements the `InspectLockableCurrency` in the pallet-balances.
- Adds staking locks try-runtime checks
(https://github.com/paritytech/polkadot-sdk/issues/3751)

**Todo**
- [x] benchmark `Call::restore_ledger`
- [x] throughout testing of all ledger recovering cases
- [x] consider adding the staking locks try-runtime checks to this PR
(https://github.com/paritytech/polkadot-sdk/issues/3751)
- [x] simulate restoring all ledgers
(https://hackmd.io/Dsa2tvhISNSs7zcqriTaxQ?view) in Polkadot and Kusama
using chopsticks -- https://hackmd.io/v-XNrEoGRpe7APR-EZGhOA

Related to https://github.com/paritytech/polkadot-sdk/issues/3245
Closes https://github.com/paritytech/polkadot-sdk/issues/3751

---------

Co-authored-by: command-bot <>
This commit is contained in:
Gonçalo Pestana
2024-03-27 18:20:24 +01:00
committed by GitHub
parent 374aefa4f2
commit bbdbeb7ec6
15 changed files with 1201 additions and 486 deletions
@@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_staking`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-01-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-03-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-8idpd4bs-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-h2rr8wx7-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("westend-dev")`, DB CACHE: 1024
// Executed Command:
@@ -50,22 +50,22 @@ pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
/// Storage: `Staking::Bonded` (r:1 w:1)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::Ledger` (r:1 w:1)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
/// Storage: `Balances::Locks` (r:1 w:1)
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
/// Storage: `Balances::Freezes` (r:1 w:0)
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
/// Storage: `Staking::Ledger` (r:0 w:1)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
/// Storage: `Staking::Payee` (r:0 w:1)
/// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
fn bond() -> Weight {
// Proof Size summary in bytes:
// Measured: `894`
// Measured: `1009`
// Estimated: `4764`
// Minimum execution time: 37_340_000 picoseconds.
Weight::from_parts(38_930_000, 0)
// Minimum execution time: 40_585_000 picoseconds.
Weight::from_parts(41_800_000, 0)
.saturating_add(Weight::from_parts(0, 4764))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `Staking::Bonded` (r:1 w:0)
@@ -84,22 +84,22 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1921`
// Estimated: `8877`
// Minimum execution time: 80_630_000 picoseconds.
Weight::from_parts(82_196_000, 0)
// Minimum execution time: 81_809_000 picoseconds.
Weight::from_parts(84_387_000, 0)
.saturating_add(Weight::from_parts(0, 8877))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(7))
}
/// Storage: `Staking::Ledger` (r:1 w:1)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::Nominators` (r:1 w:0)
/// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`)
/// Storage: `Staking::MinNominatorBond` (r:1 w:0)
/// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `Staking::CurrentEra` (r:1 w:0)
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Balances::Locks` (r:1 w:1)
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
/// Storage: `Balances::Freezes` (r:1 w:0)
@@ -112,43 +112,45 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `2128`
// Estimated: `8877`
// Minimum execution time: 83_523_000 picoseconds.
Weight::from_parts(86_639_000, 0)
// Minimum execution time: 89_419_000 picoseconds.
Weight::from_parts(91_237_000, 0)
.saturating_add(Weight::from_parts(0, 8877))
.saturating_add(T::DbWeight::get().reads(12))
.saturating_add(T::DbWeight::get().writes(7))
}
/// Storage: `Staking::Ledger` (r:1 w:1)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
/// Storage: `Staking::CurrentEra` (r:1 w:0)
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::CurrentEra` (r:1 w:0)
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Balances::Locks` (r:1 w:1)
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
/// Storage: `Balances::Freezes` (r:1 w:0)
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
/// Storage: `NominationPools::ReversePoolIdLookup` (r:1 w:0)
/// Proof: `NominationPools::ReversePoolIdLookup` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_update(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `1075`
// Measured: `1223`
// Estimated: `4764`
// Minimum execution time: 38_636_000 picoseconds.
Weight::from_parts(40_399_283, 0)
// Minimum execution time: 45_152_000 picoseconds.
Weight::from_parts(46_460_819, 0)
.saturating_add(Weight::from_parts(0, 4764))
// Standard Error: 869
.saturating_add(Weight::from_parts(37_752, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(5))
// Standard Error: 972
.saturating_add(Weight::from_parts(55_473, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Staking::Ledger` (r:1 w:1)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:1)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::CurrentEra` (r:1 w:0)
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Staking::SlashingSpans` (r:1 w:1)
/// Proof: `Staking::SlashingSpans` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Staking::Bonded` (r:1 w:1)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Balances::Locks` (r:1 w:1)
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
/// Storage: `Balances::Freezes` (r:1 w:0)
@@ -174,11 +176,11 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `2127 + s * (4 ±0)`
// Estimated: `6248 + s * (4 ±0)`
// Minimum execution time: 81_301_000 picoseconds.
Weight::from_parts(88_609_205, 0)
// Minimum execution time: 82_762_000 picoseconds.
Weight::from_parts(91_035_077, 0)
.saturating_add(Weight::from_parts(0, 6248))
// Standard Error: 3_388
.saturating_add(Weight::from_parts(1_253_692, 0).saturating_mul(s.into()))
// Standard Error: 3_771
.saturating_add(Weight::from_parts(1_217_871, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(13))
.saturating_add(T::DbWeight::get().writes(11))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into())))
@@ -186,6 +188,8 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
}
/// Storage: `Staking::Ledger` (r:1 w:0)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::MinValidatorBond` (r:1 w:0)
/// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `Staking::MinCommission` (r:1 w:0)
@@ -196,8 +200,6 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
/// Proof: `Staking::MaxValidatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Staking::Nominators` (r:1 w:0)
/// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListNodes` (r:1 w:1)
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListBags` (r:1 w:1)
@@ -210,33 +212,37 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1301`
// Estimated: `4556`
// Minimum execution time: 47_292_000 picoseconds.
Weight::from_parts(48_566_000, 0)
// Minimum execution time: 50_555_000 picoseconds.
Weight::from_parts(52_052_000, 0)
.saturating_add(Weight::from_parts(0, 4556))
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(5))
}
/// Storage: `Staking::Ledger` (r:1 w:0)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::Nominators` (r:128 w:128)
/// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`)
/// The range of component `k` is `[1, 128]`.
fn kick(k: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `1243 + k * (569 ±0)`
// Measured: `1778 + k * (572 ±0)`
// Estimated: `4556 + k * (3033 ±0)`
// Minimum execution time: 28_840_000 picoseconds.
Weight::from_parts(27_510_817, 0)
// Minimum execution time: 35_037_000 picoseconds.
Weight::from_parts(35_081_878, 0)
.saturating_add(Weight::from_parts(0, 4556))
// Standard Error: 6_603
.saturating_add(Weight::from_parts(6_268_853, 0).saturating_mul(k.into()))
.saturating_add(T::DbWeight::get().reads(1))
// Standard Error: 5_473
.saturating_add(Weight::from_parts(6_667_924, 0).saturating_mul(k.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into())))
.saturating_add(Weight::from_parts(0, 3033).saturating_mul(k.into()))
}
/// Storage: `Staking::Ledger` (r:1 w:0)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::MinNominatorBond` (r:1 w:0)
/// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `Staking::Nominators` (r:1 w:1)
@@ -247,8 +253,6 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
/// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`)
/// Storage: `Staking::CurrentEra` (r:1 w:0)
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListNodes` (r:2 w:2)
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListBags` (r:1 w:1)
@@ -262,11 +266,11 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1797 + n * (102 ±0)`
// Estimated: `6248 + n * (2520 ±0)`
// Minimum execution time: 57_537_000 picoseconds.
Weight::from_parts(55_854_233, 0)
// Minimum execution time: 62_098_000 picoseconds.
Weight::from_parts(60_154_061, 0)
.saturating_add(Weight::from_parts(0, 6248))
// Standard Error: 14_427
.saturating_add(Weight::from_parts(3_844_957, 0).saturating_mul(n.into()))
// Standard Error: 19_257
.saturating_add(Weight::from_parts(3_839_855, 0).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))
@@ -274,6 +278,8 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
}
/// Storage: `Staking::Ledger` (r:1 w:0)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::Validators` (r:1 w:0)
/// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`)
/// Storage: `Staking::Nominators` (r:1 w:1)
@@ -288,12 +294,12 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
/// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
fn chill() -> Weight {
// Proof Size summary in bytes:
// Measured: `1581`
// Measured: `1747`
// Estimated: `6248`
// Minimum execution time: 49_997_000 picoseconds.
Weight::from_parts(51_266_000, 0)
// Minimum execution time: 54_993_000 picoseconds.
Weight::from_parts(56_698_000, 0)
.saturating_add(Weight::from_parts(0, 6248))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `Staking::Ledger` (r:1 w:0)
@@ -306,40 +312,40 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `865`
// Estimated: `4556`
// Minimum execution time: 15_342_000 picoseconds.
Weight::from_parts(15_970_000, 0)
// Minimum execution time: 18_100_000 picoseconds.
Weight::from_parts(18_547_000, 0)
.saturating_add(Weight::from_parts(0, 4556))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Staking::Ledger` (r:1 w:0)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
/// Storage: `Staking::Payee` (r:1 w:1)
/// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::Payee` (r:1 w:1)
/// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
fn update_payee() -> Weight {
// Proof Size summary in bytes:
// Measured: `932`
// Estimated: `4556`
// Minimum execution time: 20_719_000 picoseconds.
Weight::from_parts(21_373_000, 0)
// Minimum execution time: 23_428_000 picoseconds.
Weight::from_parts(24_080_000, 0)
.saturating_add(Weight::from_parts(0, 4556))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Staking::Bonded` (r:1 w:1)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::Ledger` (r:1 w:2)
/// Storage: `Staking::Ledger` (r:2 w:2)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
fn set_controller() -> Weight {
// Proof Size summary in bytes:
// Measured: `865`
// Estimated: `4556`
// Minimum execution time: 18_237_000 picoseconds.
Weight::from_parts(18_896_000, 0)
.saturating_add(Weight::from_parts(0, 4556))
.saturating_add(T::DbWeight::get().reads(2))
// Estimated: `8122`
// Minimum execution time: 21_159_000 picoseconds.
Weight::from_parts(21_706_000, 0)
.saturating_add(Weight::from_parts(0, 8122))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `Staking::ValidatorCount` (r:0 w:1)
@@ -348,8 +354,8 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 1_946_000 picoseconds.
Weight::from_parts(2_131_000, 0)
// Minimum execution time: 1_910_000 picoseconds.
Weight::from_parts(2_003_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -359,8 +365,8 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 6_840_000 picoseconds.
Weight::from_parts(7_208_000, 0)
// Minimum execution time: 7_076_000 picoseconds.
Weight::from_parts(7_349_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -370,8 +376,8 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 6_812_000 picoseconds.
Weight::from_parts(7_254_000, 0)
// Minimum execution time: 7_067_000 picoseconds.
Weight::from_parts(7_389_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -381,8 +387,8 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 6_787_000 picoseconds.
Weight::from_parts(7_206_000, 0)
// Minimum execution time: 7_148_000 picoseconds.
Weight::from_parts(7_446_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -393,32 +399,32 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_045_000 picoseconds.
Weight::from_parts(2_281_841, 0)
// Minimum execution time: 2_025_000 picoseconds.
Weight::from_parts(2_229_953, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 70
.saturating_add(Weight::from_parts(11_592, 0).saturating_mul(v.into()))
// Standard Error: 67
.saturating_add(Weight::from_parts(11_785, 0).saturating_mul(v.into()))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Staking::Ledger` (r:751 w:1502)
/// Storage: `Staking::Ledger` (r:1502 w:1502)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:751 w:751)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::Payee` (r:751 w:0)
/// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:0 w:751)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// The range of component `i` is `[0, 751]`.
fn deprecate_controller_batch(i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `668 + i * (148 ±0)`
// Estimated: `990 + i * (3566 ±0)`
// Minimum execution time: 1_657_000 picoseconds.
Weight::from_parts(1_702_000, 0)
// Measured: `680 + i * (227 ±0)`
// Estimated: `990 + i * (7132 ±0)`
// Minimum execution time: 4_321_000 picoseconds.
Weight::from_parts(4_407_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 20_041
.saturating_add(Weight::from_parts(13_165_254, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(i.into())))
// Standard Error: 37_239
.saturating_add(Weight::from_parts(21_300_598, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(i.into())))
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(i.into())))
.saturating_add(Weight::from_parts(0, 3566).saturating_mul(i.into()))
.saturating_add(Weight::from_parts(0, 7132).saturating_mul(i.into()))
}
/// Storage: `Staking::SlashingSpans` (r:1 w:1)
/// Proof: `Staking::SlashingSpans` (`max_values`: None, `max_size`: None, mode: `Measured`)
@@ -453,11 +459,11 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `2127 + s * (4 ±0)`
// Estimated: `6248 + s * (4 ±0)`
// Minimum execution time: 78_774_000 picoseconds.
Weight::from_parts(85_770_713, 0)
// Minimum execution time: 78_908_000 picoseconds.
Weight::from_parts(84_886_373, 0)
.saturating_add(Weight::from_parts(0, 6248))
// Standard Error: 2_815
.saturating_add(Weight::from_parts(1_244_494, 0).saturating_mul(s.into()))
// Standard Error: 3_376
.saturating_add(Weight::from_parts(1_217_850, 0).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())))
@@ -470,11 +476,11 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `66639`
// Estimated: `70104`
// Minimum execution time: 129_905_000 picoseconds.
Weight::from_parts(932_195_554, 0)
// Minimum execution time: 136_389_000 picoseconds.
Weight::from_parts(1_207_241_524, 0)
.saturating_add(Weight::from_parts(0, 70104))
// Standard Error: 57_492
.saturating_add(Weight::from_parts(4_826_754, 0).saturating_mul(s.into()))
// Standard Error: 77_138
.saturating_add(Weight::from_parts(6_443_948, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -511,11 +517,11 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `8249 + n * (396 ±0)`
// Estimated: `10779 + n * (3774 ±0)`
// Minimum execution time: 127_094_000 picoseconds.
Weight::from_parts(160_088_053, 0)
// Minimum execution time: 130_222_000 picoseconds.
Weight::from_parts(167_236_150, 0)
.saturating_add(Weight::from_parts(0, 10779))
// Standard Error: 32_978
.saturating_add(Weight::from_parts(39_845_710, 0).saturating_mul(n.into()))
// Standard Error: 34_051
.saturating_add(Weight::from_parts(39_899_917, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(14))
.saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(4))
@@ -539,11 +545,11 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1922 + l * (5 ±0)`
// Estimated: `8877`
// Minimum execution time: 75_672_000 picoseconds.
Weight::from_parts(78_708_335, 0)
// Minimum execution time: 79_136_000 picoseconds.
Weight::from_parts(82_129_497, 0)
.saturating_add(Weight::from_parts(0, 8877))
// Standard Error: 3_387
.saturating_add(Weight::from_parts(37_084, 0).saturating_mul(l.into()))
// Standard Error: 3_867
.saturating_add(Weight::from_parts(75_156, 0).saturating_mul(l.into()))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(7))
}
@@ -578,11 +584,11 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `2127 + s * (4 ±0)`
// Estimated: `6248 + s * (4 ±0)`
// Minimum execution time: 87_991_000 picoseconds.
Weight::from_parts(90_272_005, 0)
// Minimum execution time: 89_375_000 picoseconds.
Weight::from_parts(91_224_907, 0)
.saturating_add(Weight::from_parts(0, 6248))
// Standard Error: 2_815
.saturating_add(Weight::from_parts(1_232_322, 0).saturating_mul(s.into()))
// Standard Error: 3_424
.saturating_add(Weight::from_parts(1_219_542, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(12))
.saturating_add(T::DbWeight::get().writes(11))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into())))
@@ -627,14 +633,14 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
fn new_era(v: u32, n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0 + n * (716 ±0) + v * (3594 ±0)`
// Estimated: `456136 + n * (3566 ±0) + v * (3566 ±0)`
// Minimum execution time: 528_862_000 picoseconds.
Weight::from_parts(534_620_000, 0)
// Estimated: `456136 + n * (3566 ±4) + v * (3566 ±0)`
// Minimum execution time: 520_905_000 picoseconds.
Weight::from_parts(523_771_000, 0)
.saturating_add(Weight::from_parts(0, 456136))
// Standard Error: 2_005_553
.saturating_add(Weight::from_parts(65_586_008, 0).saturating_mul(v.into()))
// Standard Error: 199_842
.saturating_add(Weight::from_parts(18_155_389, 0).saturating_mul(n.into()))
// Standard Error: 2_142_714
.saturating_add(Weight::from_parts(68_631_588, 0).saturating_mul(v.into()))
// Standard Error: 213_509
.saturating_add(Weight::from_parts(19_343_025, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(184))
.saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(v.into())))
.saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(n.into())))
@@ -665,13 +671,13 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `3108 + n * (907 ±0) + v * (391 ±0)`
// Estimated: `456136 + n * (3566 ±0) + v * (3566 ±0)`
// Minimum execution time: 33_532_110_000 picoseconds.
Weight::from_parts(33_926_321_000, 0)
// Minimum execution time: 36_848_619_000 picoseconds.
Weight::from_parts(37_362_442_000, 0)
.saturating_add(Weight::from_parts(0, 456136))
// Standard Error: 374_134
.saturating_add(Weight::from_parts(4_627_629, 0).saturating_mul(v.into()))
// Standard Error: 374_134
.saturating_add(Weight::from_parts(4_068_168, 0).saturating_mul(n.into()))
// Standard Error: 415_031
.saturating_add(Weight::from_parts(5_204_987, 0).saturating_mul(v.into()))
// Standard Error: 415_031
.saturating_add(Weight::from_parts(4_132_636, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(179))
.saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(v.into())))
.saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(n.into())))
@@ -688,11 +694,11 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `946 + v * (50 ±0)`
// Estimated: `3510 + v * (2520 ±0)`
// Minimum execution time: 2_395_956_000 picoseconds.
Weight::from_parts(88_416_870, 0)
// Minimum execution time: 2_512_817_000 picoseconds.
Weight::from_parts(119_401_374, 0)
.saturating_add(Weight::from_parts(0, 3510))
// Standard Error: 8_731
.saturating_add(Weight::from_parts(4_750_956, 0).saturating_mul(v.into()))
// Standard Error: 8_463
.saturating_add(Weight::from_parts(4_860_364, 0).saturating_mul(v.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into())))
.saturating_add(Weight::from_parts(0, 2520).saturating_mul(v.into()))
@@ -715,8 +721,8 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_761_000 picoseconds.
Weight::from_parts(4_013_000, 0)
// Minimum execution time: 3_686_000 picoseconds.
Weight::from_parts(3_881_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(7))
}
@@ -738,8 +744,8 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_325_000 picoseconds.
Weight::from_parts(3_519_000, 0)
// Minimum execution time: 3_143_000 picoseconds.
Weight::from_parts(3_424_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(7))
}
@@ -769,8 +775,8 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1870`
// Estimated: `6248`
// Minimum execution time: 63_583_000 picoseconds.
Weight::from_parts(65_917_000, 0)
// Minimum execution time: 66_946_000 picoseconds.
Weight::from_parts(69_382_000, 0)
.saturating_add(Weight::from_parts(0, 6248))
.saturating_add(T::DbWeight::get().reads(12))
.saturating_add(T::DbWeight::get().writes(6))
@@ -783,8 +789,8 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `658`
// Estimated: `3510`
// Minimum execution time: 10_975_000 picoseconds.
Weight::from_parts(11_328_000, 0)
// Minimum execution time: 11_278_000 picoseconds.
Weight::from_parts(11_603_000, 0)
.saturating_add(Weight::from_parts(0, 3510))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@@ -795,9 +801,29 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 1_954_000 picoseconds.
Weight::from_parts(2_081_000, 0)
// Minimum execution time: 1_963_000 picoseconds.
Weight::from_parts(2_077_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Balances::Locks` (r:1 w:1)
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:1)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::Ledger` (r:1 w:1)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
/// Storage: `Balances::Freezes` (r:1 w:0)
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
fn restore_ledger() -> Weight {
// Proof Size summary in bytes:
// Measured: `1014`
// Estimated: `4764`
// Minimum execution time: 40_258_000 picoseconds.
Weight::from_parts(41_210_000, 0)
.saturating_add(Weight::from_parts(0, 4764))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(4))
}
}