From 26a5a50169d292f23dc39b4093c99835f7724d31 Mon Sep 17 00:00:00 2001 From: cirko33 Date: Thu, 19 Mar 2026 11:53:28 +0100 Subject: [PATCH 01/16] raise offence queue eras bound limit --- substrate/frame/staking-async/src/pallet/mod.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/substrate/frame/staking-async/src/pallet/mod.rs b/substrate/frame/staking-async/src/pallet/mod.rs index 9600b992feb56..e21560c8a0322 100644 --- a/substrate/frame/staking-async/src/pallet/mod.rs +++ b/substrate/frame/staking-async/src/pallet/mod.rs @@ -583,6 +583,15 @@ pub mod pallet { } } + /// Custom bound for [`OffenceQueueEras`] which is equal to `2 * Config::BondingDuration`. + pub struct OffenceQueueErasBound(core::marker::PhantomData); + impl Get for OffenceQueueErasBound { + fn get() -> u32 { + let bonding_duration = T::BondingDuration::get(); + bonding_duration.saturating_add(bonding_duration) + } + } + /// A mapping from still-bonded eras to the first session index of that era. /// /// Must contains information for eras for the range: @@ -801,12 +810,13 @@ pub mod pallet { /// - When a new offence is added to `OffenceQueue`, its era is **inserted in sorted order** /// if not already present. /// - When all offences for an era are processed, it is **removed** from this list. - /// - The maximum length of this vector is bounded by `BondingDuration`. + /// - The maximum length of this vector is bounded by `2 * BondingDuration`. /// /// This eliminates the need for expensive iteration and sorting when fetching the next offence /// to process. #[pallet::storage] - pub type OffenceQueueEras = StorageValue<_, WeakBoundedVec>; + pub type OffenceQueueEras = + StorageValue<_, WeakBoundedVec>>; /// Tracks the currently processed offence record from the `OffenceQueue`. /// From 1ec3d827c59998108c6cb6cbe8163f6bd05b4f85 Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 11:00:01 +0000 Subject: [PATCH 02/16] Update from github-actions[bot] running command 'prdoc --audience runtime_dev --bump patch' --- prdoc/pr_11435.prdoc | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 prdoc/pr_11435.prdoc diff --git a/prdoc/pr_11435.prdoc b/prdoc/pr_11435.prdoc new file mode 100644 index 0000000000000..68fad6ea01f60 --- /dev/null +++ b/prdoc/pr_11435.prdoc @@ -0,0 +1,7 @@ +title: Raise offence queue eras bound limit +doc: +- audience: Runtime Dev + description: Raise offence queue `BondingDuration` limit to ensure no loss of offences. +crates: +- name: pallet-staking-async + bump: patch From 83a0e9554ddd92bb472f6db4078e85fe60cf9e28 Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 11:14:29 +0000 Subject: [PATCH 03/16] Update from github-actions[bot] running command 'prdoc --audience runtime_dev --bump minor --force' --- prdoc/pr_11435.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_11435.prdoc b/prdoc/pr_11435.prdoc index 68fad6ea01f60..d0dc6cc9fdb0c 100644 --- a/prdoc/pr_11435.prdoc +++ b/prdoc/pr_11435.prdoc @@ -4,4 +4,4 @@ doc: description: Raise offence queue `BondingDuration` limit to ensure no loss of offences. crates: - name: pallet-staking-async - bump: patch + bump: minor From b821916b16686feb53d9248116c38b8eebd1e1a2 Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 12:45:44 +0000 Subject: [PATCH 04/16] Update from github-actions[bot] running command 'bench --pallet pallet_staking_async --runtime asset-hub-westend' --- .../src/weights/pallet_staking_async.rs | 984 ++++++++++++++---- 1 file changed, 806 insertions(+), 178 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_staking_async.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_staking_async.rs index 2d2f768d8596f..07c01c75aaf74 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_staking_async.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_staking_async.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_staking_async` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2026-01-17, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2026-03-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `ad005bf13d98`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `bc292dbdd291`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -50,369 +50,997 @@ use core::marker::PhantomData; /// Weight functions for `pallet_staking_async`. pub struct WeightInfo(PhantomData); impl pallet_staking_async::WeightInfo for WeightInfo { + /// 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(753), added: 3228, 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::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(319), added: 2794, 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: `6793` - // Estimated: `0` - // Minimum execution time: 151_823_000 picoseconds. - Weight::from_parts(162_698_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `4218` + // Minimum execution time: 109_433_000 picoseconds. + Weight::from_parts(116_816_000, 0) + .saturating_add(Weight::from_parts(0, 4218)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: `Staking::Bonded` (r:1 w:0) + /// 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(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, 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::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(319), added: 2794, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) fn bond_extra() -> Weight { // Proof Size summary in bytes: // Measured: `8254` - // Estimated: `0` - // Minimum execution time: 9_824_370_000 picoseconds. - Weight::from_parts(13_177_169_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `8877` + // Minimum execution time: 300_420_000 picoseconds. + Weight::from_parts(312_182_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(753), added: 3228, 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::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `Staking::LastValidatorEra` (r:1 w:0) + /// Proof: `Staking::LastValidatorEra` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `Staking::AreNominatorsSlashable` (r:1 w:0) + /// Proof: `Staking::AreNominatorsSlashable` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(319), added: 2794, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) fn unbond() -> Weight { // Proof Size summary in bytes: // Measured: `8415` - // Estimated: `0` - // Minimum execution time: 6_984_740_000 picoseconds. - Weight::from_parts(10_286_473_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `8877` + // Minimum execution time: 267_215_000 picoseconds. + Weight::from_parts(278_969_000, 0) + .saturating_add(Weight::from_parts(0, 8877)) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(6)) } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, 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::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `Staking::UnappliedSlashes` (r:1 w:0) + /// Proof: `Staking::UnappliedSlashes` (`max_values`: None, `max_size`: Some(3231), added: 5706, mode: `MaxEncodedLen`) + /// Storage: `Staking::OffenceQueueEras` (r:1 w:0) + /// Proof: `Staking::OffenceQueueEras` (`max_values`: Some(1), `max_size`: Some(17), added: 512, 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::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(319), added: 2794, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::ReversePoolIdLookup` (r:1 w:0) + /// Proof: `NominationPools::ReversePoolIdLookup` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `DelegatedStaking::Agents` (r:1 w:0) + /// Proof: `DelegatedStaking::Agents` (`max_values`: None, `max_size`: Some(120), added: 2595, mode: `MaxEncodedLen`) fn withdraw_unbonded_update() -> Weight { // Proof Size summary in bytes: // Measured: `7393` - // Estimated: `0` - // Minimum execution time: 171_540_000 picoseconds. - Weight::from_parts(181_106_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `6696` + // Minimum execution time: 128_228_000 picoseconds. + Weight::from_parts(134_860_000, 0) + .saturating_add(Weight::from_parts(0, 6696)) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(2)) } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, 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::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `Staking::UnappliedSlashes` (r:1 w:0) + /// Proof: `Staking::UnappliedSlashes` (`max_values`: None, `max_size`: Some(3231), added: 5706, mode: `MaxEncodedLen`) + /// Storage: `Staking::OffenceQueueEras` (r:1 w:0) + /// Proof: `Staking::OffenceQueueEras` (`max_values`: Some(1), `max_size`: Some(17), added: 512, 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::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:1) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(319), added: 2794, 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) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, 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) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Staking::LastValidatorEra` (r:0 w:1) + /// Proof: `Staking::LastValidatorEra` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn withdraw_unbonded_kill() -> Weight { // Proof Size summary in bytes: // Measured: `8340` - // Estimated: `0` - // Minimum execution time: 10_719_434_000 picoseconds. - Weight::from_parts(14_830_140_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `6696` + // Minimum execution time: 307_882_000 picoseconds. + Weight::from_parts(325_627_000, 0) + .saturating_add(Weight::from_parts(0, 6696)) + .saturating_add(T::DbWeight::get().reads(17)) + .saturating_add(T::DbWeight::get().writes(12)) } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, 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) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:1) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxValidatorsCount` (r:1 w:0) + /// 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: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, 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) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForValidators` (r:1 w:1) + /// Proof: `Staking::CounterForValidators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn validate() -> Weight { // Proof Size summary in bytes: // Measured: `9885` - // Estimated: `0` - // Minimum execution time: 155_256_000 picoseconds. - Weight::from_parts(161_416_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `4218` + // Minimum execution time: 107_406_000 picoseconds. + Weight::from_parts(113_955_000, 0) + .saturating_add(Weight::from_parts(0, 4218)) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(5)) } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, 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: `12187 + k * (1121 ±0)` - // Estimated: `0` - // Minimum execution time: 98_146_000 picoseconds. - Weight::from_parts(145_793_776, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 55_127 - .saturating_add(Weight::from_parts(17_280_864, 0).saturating_mul(k.into())) + // Estimated: `4218 + k * (3033 ±0)` + // Minimum execution time: 79_016_000 picoseconds. + Weight::from_parts(88_648_086, 0) + .saturating_add(Weight::from_parts(0, 4218)) + // Standard Error: 22_509 + .saturating_add(Weight::from_parts(15_644_635, 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(753), added: 3228, 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) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxNominatorsCount` (r:1 w:0) + /// Proof: `Staking::MaxNominatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:17 w:0) + /// 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: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, 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) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 16]`. fn nominate(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `5074 + n * (68 ±0)` - // Estimated: `0` - // Minimum execution time: 3_951_847_000 picoseconds. - Weight::from_parts(11_093_536_278, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 12_371_015 - .saturating_add(Weight::from_parts(134_071_422, 0).saturating_mul(n.into())) + // Estimated: `6248 + n * (2520 ±0)` + // Minimum execution time: 180_689_000 picoseconds. + Weight::from_parts(197_222_688, 0) + .saturating_add(Weight::from_parts(0, 6248)) + // Standard Error: 65_656 + .saturating_add(Weight::from_parts(5_564_113, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(6)) + .saturating_add(Weight::from_parts(0, 2520).saturating_mul(n.into())) } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, 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) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, 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) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn chill() -> Weight { // Proof Size summary in bytes: // Measured: `5217` - // Estimated: `0` - // Minimum execution time: 5_461_816_000 picoseconds. - Weight::from_parts(5_964_595_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `6248` + // Minimum execution time: 170_145_000 picoseconds. + Weight::from_parts(176_873_000, 0) + .saturating_add(Weight::from_parts(0, 6248)) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(6)) } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, 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:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) fn set_payee() -> Weight { // Proof Size summary in bytes: // Measured: `4040` - // Estimated: `0` - // Minimum execution time: 57_034_000 picoseconds. - Weight::from_parts(61_302_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `4218` + // Minimum execution time: 35_981_000 picoseconds. + Weight::from_parts(38_831_000, 0) + .saturating_add(Weight::from_parts(0, 4218)) + .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(753), added: 3228, 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: `5712` - // Estimated: `0` - // Minimum execution time: 73_677_000 picoseconds. - Weight::from_parts(75_535_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `4218` + // Minimum execution time: 45_917_000 picoseconds. + Weight::from_parts(48_850_000, 0) + .saturating_add(Weight::from_parts(0, 4218)) + .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:2 w:2) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) fn set_controller() -> Weight { // Proof Size summary in bytes: // Measured: `5383` - // Estimated: `0` - // Minimum execution time: 73_550_000 picoseconds. - Weight::from_parts(77_231_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `7446` + // Minimum execution time: 47_479_000 picoseconds. + Weight::from_parts(52_515_000, 0) + .saturating_add(Weight::from_parts(0, 7446)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) } + /// Storage: `Staking::ValidatorCount` (r:0 w:1) + /// Proof: `Staking::ValidatorCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn set_validator_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_820_000 picoseconds. - Weight::from_parts(4_032_000, 0) + // Minimum execution time: 2_665_000 picoseconds. + Weight::from_parts(3_025_000, 0) .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `Staking::ForceEra` (r:0 w:1) + /// Proof: `Staking::ForceEra` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) fn force_no_eras() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 20_612_000 picoseconds. - Weight::from_parts(22_653_000, 0) + // Minimum execution time: 11_828_000 picoseconds. + Weight::from_parts(15_540_000, 0) .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `Staking::ForceEra` (r:0 w:1) + /// Proof: `Staking::ForceEra` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) fn force_new_era() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 20_353_000 picoseconds. - Weight::from_parts(21_738_000, 0) + // Minimum execution time: 11_812_000 picoseconds. + Weight::from_parts(15_578_000, 0) .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `Staking::ForceEra` (r:0 w:1) + /// Proof: `Staking::ForceEra` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) fn force_new_era_always() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 20_237_000 picoseconds. - Weight::from_parts(22_012_000, 0) + // Minimum execution time: 12_058_000 picoseconds. + Weight::from_parts(15_629_000, 0) .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `Staking::Ledger` (r:1502 w:1502) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, 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`) /// The range of component `u` is `[0, 751]`. fn deprecate_controller_batch(u: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `195432 + u * (1105 ±0)` - // Estimated: `0` - // Minimum execution time: 7_164_000 picoseconds. - Weight::from_parts(223_480_099, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 165_663 - .saturating_add(Weight::from_parts(60_652_060, 0).saturating_mul(u.into())) + // Estimated: `990 + u * (6456 ±0)` + // Minimum execution time: 5_564_000 picoseconds. + Weight::from_parts(526_794_998, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 68_074 + .saturating_add(Weight::from_parts(44_562_659, 0).saturating_mul(u.into())) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(u.into()))) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(u.into()))) + .saturating_add(Weight::from_parts(0, 6456).saturating_mul(u.into())) } + /// 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(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:1) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(319), added: 2794, 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::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) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, 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) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Staking::LastValidatorEra` (r:0 w:1) + /// Proof: `Staking::LastValidatorEra` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn force_unstake() -> Weight { // Proof Size summary in bytes: // Measured: `8285` - // Estimated: `0` - // Minimum execution time: 10_921_590_000 picoseconds. - Weight::from_parts(16_176_391_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `6248` + // Minimum execution time: 268_199_000 picoseconds. + Weight::from_parts(277_067_000, 0) + .saturating_add(Weight::from_parts(0, 6248)) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(13)) } + /// Storage: `Staking::CancelledSlashes` (r:1 w:1) + /// Proof: `Staking::CancelledSlashes` (`max_values`: None, `max_size`: Some(36014), added: 38489, mode: `MaxEncodedLen`) /// The range of component `s` is `[1, 1000]`. fn cancel_deferred_slash(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `633` - // Estimated: `0` - // Minimum execution time: 21_117_000 picoseconds. - Weight::from_parts(21_937_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 8_007 - .saturating_add(Weight::from_parts(3_054_448, 0).saturating_mul(s.into())) + // Estimated: `39479` + // Minimum execution time: 15_560_000 picoseconds. + Weight::from_parts(15_966_000, 0) + .saturating_add(Weight::from_parts(0, 39479)) + // Standard Error: 6_047 + .saturating_add(Weight::from_parts(2_809_865, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `Staking::ErasStakersOverview` (r:1 w:0) + /// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `Staking::ClaimedRewards` (r:1 w:1) + /// Proof: `Staking::ClaimedRewards` (`max_values`: None, `max_size`: Some(1462), added: 3937, 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::ErasValidatorReward` (r:1 w:0) + /// Proof: `Staking::ErasValidatorReward` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:65 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:65 w:65) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:65 w:65) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:65 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:65 w:65) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(319), added: 2794, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasStakersPaged` (r:1 w:0) + /// Proof: `Staking::ErasStakersPaged` (`max_values`: None, `max_size`: Some(3152), added: 5627, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasRewardPoints` (r:1 w:0) + /// Proof: `Staking::ErasRewardPoints` (`max_values`: None, `max_size`: Some(36018), added: 38493, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasValidatorPrefs` (r:1 w:0) + /// Proof: `Staking::ErasValidatorPrefs` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:65 w:0) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) /// The range of component `n` is `[0, 64]`. fn payout_stakers_alive_staked(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `32987 + n * (3657 ±0)` - // Estimated: `0` - // Minimum execution time: 6_909_131_000 picoseconds. - Weight::from_parts(20_652_651_092, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 8_042_660 - .saturating_add(Weight::from_parts(264_186_902, 0).saturating_mul(n.into())) + // Estimated: `39483 + n * (3228 ±0)` + // Minimum execution time: 318_295_000 picoseconds. + Weight::from_parts(553_237_641, 0) + .saturating_add(Weight::from_parts(0, 39483)) + // Standard Error: 230_302 + .saturating_add(Weight::from_parts(132_316_114, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3228).saturating_mul(n.into())) } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, 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::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(319), added: 2794, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) /// The range of component `l` is `[1, 32]`. - fn rebond(_l: u32, ) -> Weight { + fn rebond(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `8255 + l * (5 ±0)` - // Estimated: `0` - // Minimum execution time: 6_909_067_000 picoseconds. - Weight::from_parts(10_699_364_610, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `8877` + // Minimum execution time: 235_887_000 picoseconds. + Weight::from_parts(257_581_588, 0) + .saturating_add(Weight::from_parts(0, 8877)) + // Standard Error: 43_297 + .saturating_add(Weight::from_parts(301_031, 0).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(6)) } + /// Storage: `Staking::VirtualStakers` (r:1 w:1) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, 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::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, 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(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(319), added: 2794, 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) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, 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) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Staking::LastValidatorEra` (r:0 w:1) + /// Proof: `Staking::LastValidatorEra` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn reap_stash() -> Weight { // Proof Size summary in bytes: // Measured: `8348` - // Estimated: `0` - // Minimum execution time: 10_927_055_000 picoseconds. - Weight::from_parts(13_398_080_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `6248` + // Minimum execution time: 296_453_000 picoseconds. + Weight::from_parts(318_628_000, 0) + .saturating_add(Weight::from_parts(0, 6248)) + .saturating_add(T::DbWeight::get().reads(14)) + .saturating_add(T::DbWeight::get().writes(12)) } + /// Storage: `Staking::AreNominatorsSlashable` (r:0 w:1) + /// Proof: `Staking::AreNominatorsSlashable` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinCommission` (r:0 w:1) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:0 w:1) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxValidatorsCount` (r:0 w:1) + /// Proof: `Staking::MaxValidatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxStakedRewards` (r:0 w:1) + /// Proof: `Staking::MaxStakedRewards` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::ChillThreshold` (r:0 w:1) + /// Proof: `Staking::ChillThreshold` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxNominatorsCount` (r:0 w:1) + /// Proof: `Staking::MaxNominatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:0 w:1) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) fn set_staking_configs_all_set() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_168_000 picoseconds. - Weight::from_parts(8_893_000, 0) + // Minimum execution time: 5_048_000 picoseconds. + Weight::from_parts(5_698_000, 0) .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(8)) } + /// Storage: `Staking::AreNominatorsSlashable` (r:0 w:1) + /// Proof: `Staking::AreNominatorsSlashable` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinCommission` (r:0 w:1) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:0 w:1) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxValidatorsCount` (r:0 w:1) + /// Proof: `Staking::MaxValidatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxStakedRewards` (r:0 w:1) + /// Proof: `Staking::MaxStakedRewards` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::ChillThreshold` (r:0 w:1) + /// Proof: `Staking::ChillThreshold` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxNominatorsCount` (r:0 w:1) + /// Proof: `Staking::MaxNominatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:0 w:1) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) fn set_staking_configs_all_remove() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_548_000 picoseconds. - Weight::from_parts(8_120_000, 0) + // Minimum execution time: 4_725_000 picoseconds. + Weight::from_parts(5_276_000, 0) .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(8)) } + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::ChillThreshold` (r:1 w:0) + /// Proof: `Staking::ChillThreshold` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxNominatorsCount` (r:1 w:0) + /// Proof: `Staking::MaxNominatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, 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::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, 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) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn chill_other() -> Weight { // Proof Size summary in bytes: // Measured: `5350` - // Estimated: `0` - // Minimum execution time: 8_972_274_000 picoseconds. - Weight::from_parts(12_286_705_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `6248` + // Minimum execution time: 195_830_000 picoseconds. + Weight::from_parts(207_254_000, 0) + .saturating_add(Weight::from_parts(0, 6248)) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(6)) } + /// Storage: `Staking::MinCommission` (r:1 w:0) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:1) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) fn force_apply_min_commission() -> Weight { // Proof Size summary in bytes: // Measured: `640` - // Estimated: `0` - // Minimum execution time: 57_429_000 picoseconds. - Weight::from_parts(67_310_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `3510` + // Minimum execution time: 35_122_000 picoseconds. + Weight::from_parts(37_293_000, 0) + .saturating_add(Weight::from_parts(0, 3510)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `Staking::MinCommission` (r:0 w:1) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn set_min_commission() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_827_000 picoseconds. - Weight::from_parts(4_098_000, 0) + // Minimum execution time: 2_592_000 picoseconds. + Weight::from_parts(2_958_000, 0) .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(319), added: 2794, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:0) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, 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(753), added: 3228, mode: `MaxEncodedLen`) fn restore_ledger() -> Weight { // Proof Size summary in bytes: // Measured: `6948` - // Estimated: `0` - // Minimum execution time: 109_614_000 picoseconds. - Weight::from_parts(114_855_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `4764` + // Minimum execution time: 76_233_000 picoseconds. + Weight::from_parts(80_864_000, 0) + .saturating_add(Weight::from_parts(0, 4764)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) } + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, 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::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, 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(85), added: 2560, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(319), added: 2794, mode: `MaxEncodedLen`) fn migrate_currency() -> Weight { // Proof Size summary in bytes: // Measured: `7019` - // Estimated: `0` - // Minimum execution time: 162_554_000 picoseconds. - Weight::from_parts(169_846_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `4764` + // Minimum execution time: 123_078_000 picoseconds. + Weight::from_parts(128_553_000, 0) + .saturating_add(Weight::from_parts(0, 4764)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) } + /// Storage: `Staking::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `Staking::CancelledSlashes` (r:1 w:0) + /// Proof: `Staking::CancelledSlashes` (`max_values`: None, `max_size`: Some(36014), added: 38489, mode: `MaxEncodedLen`) + /// Storage: `Staking::UnappliedSlashes` (r:1 w:1) + /// Proof: `Staking::UnappliedSlashes` (`max_values`: None, `max_size`: Some(3231), added: 5706, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:65 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:65 w:65) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::ReversePoolIdLookup` (r:65 w:0) + /// Proof: `NominationPools::ReversePoolIdLookup` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `DelegatedStaking::Agents` (r:65 w:65) + /// Proof: `DelegatedStaking::Agents` (`max_values`: None, `max_size`: Some(120), added: 2595, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:66 w:66) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:65 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:65 w:65) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(319), added: 2794, mode: `MaxEncodedLen`) /// The range of component `n` is `[0, 64]`. fn apply_slash(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `27526 + n * (2979 ±0)` - // Estimated: `0` - // Minimum execution time: 7_428_074_000 picoseconds. - Weight::from_parts(19_830_764_737, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 7_880_082 - .saturating_add(Weight::from_parts(228_874_767, 0).saturating_mul(n.into())) + // Estimated: `39479 + n * (3228 ±0)` + // Minimum execution time: 246_238_000 picoseconds. + Weight::from_parts(420_898_336, 0) + .saturating_add(Weight::from_parts(0, 39479)) + // Standard Error: 192_241 + .saturating_add(Weight::from_parts(92_109_764, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(6)) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3228).saturating_mul(n.into())) } + /// Storage: `Staking::ProcessingOffence` (r:1 w:1) + /// Proof: `Staking::ProcessingOffence` (`max_values`: Some(1), `max_size`: Some(85), added: 580, mode: `MaxEncodedLen`) + /// Storage: `Staking::OffenceQueueEras` (r:1 w:1) + /// Proof: `Staking::OffenceQueueEras` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) + /// Storage: `Staking::OffenceQueue` (r:2 w:1) + /// Proof: `Staking::OffenceQueue` (`max_values`: None, `max_size`: Some(101), added: 2576, mode: `MaxEncodedLen`) + /// Storage: `Staking::SlashRewardFraction` (r:1 w:0) + /// Proof: `Staking::SlashRewardFraction` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasStakersOverview` (r:1 w:0) + /// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasStakersPaged` (r:1 w:0) + /// Proof: `Staking::ErasStakersPaged` (`max_values`: None, `max_size`: Some(3152), added: 5627, mode: `MaxEncodedLen`) + /// Storage: `Staking::UnappliedSlashes` (r:0 w:1) + /// Proof: `Staking::UnappliedSlashes` (`max_values`: None, `max_size`: Some(3231), added: 5706, mode: `MaxEncodedLen`) fn process_offence_queue() -> Weight { // Proof Size summary in bytes: // Measured: `3602` - // Estimated: `0` - // Minimum execution time: 5_027_278_000 picoseconds. - Weight::from_parts(12_923_992_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `6617` + // Minimum execution time: 157_089_000 picoseconds. + Weight::from_parts(163_737_000, 0) + .saturating_add(Weight::from_parts(0, 6617)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: `Staking::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `Staking::BondedEras` (r:1 w:0) + /// Proof: `Staking::BondedEras` (`max_values`: Some(1), `max_size`: Some(25), added: 520, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasStakersOverview` (r:500 w:0) + /// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `Staking::ValidatorSlashInEra` (r:500 w:500) + /// Proof: `Staking::ValidatorSlashInEra` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::OffenceQueue` (r:500 w:500) + /// Proof: `Staking::OffenceQueue` (`max_values`: None, `max_size`: Some(101), added: 2576, mode: `MaxEncodedLen`) + /// Storage: `Staking::OffenceQueueEras` (r:1 w:1) + /// Proof: `Staking::OffenceQueueEras` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) /// The range of component `v` is `[2, 500]`. fn rc_on_offence(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `667 + v * (96 ±0)` - // Estimated: `0` - // Minimum execution time: 3_997_424_000 picoseconds. - Weight::from_parts(28_149_718_556, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_586_636 - .saturating_add(Weight::from_parts(57_924_737, 0).saturating_mul(v.into())) + // Estimated: `1510 + v * (2576 ±0)` + // Minimum execution time: 90_289_000 picoseconds. + Weight::from_parts(6_594_029, 0) + .saturating_add(Weight::from_parts(0, 1510)) + // Standard Error: 17_284 + .saturating_add(Weight::from_parts(19_629_734, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(v.into()))) + .saturating_add(Weight::from_parts(0, 2576).saturating_mul(v.into())) } + /// Storage: `Staking::ActiveEra` (r:1 w:1) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasRewardPoints` (r:1 w:1) + /// Proof: `Staking::ErasRewardPoints` (`max_values`: None, `max_size`: Some(36018), added: 38493, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:1) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasTotalStake` (r:1 w:0) + /// Proof: `Staking::ErasTotalStake` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxStakedRewards` (r:1 w:0) + /// Proof: `Staking::MaxStakedRewards` (`max_values`: Some(1), `max_size`: Some(1), added: 496, 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::BondedEras` (r:1 w:1) + /// Proof: `Staking::BondedEras` (`max_values`: Some(1), `max_size`: Some(25), added: 520, mode: `MaxEncodedLen`) + /// Storage: `Staking::AreNominatorsSlashable` (r:1 w:0) + /// Proof: `Staking::AreNominatorsSlashable` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::ForceEra` (r:1 w:0) + /// Proof: `Staking::ForceEra` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasNominatorsSlashable` (r:0 w:1) + /// Proof: `Staking::ErasNominatorsSlashable` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `MaxEncodedLen`) + /// Storage: `Staking::VoterSnapshotStatus` (r:0 w:1) + /// Proof: `Staking::VoterSnapshotStatus` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasValidatorReward` (r:0 w:1) + /// Proof: `Staking::ErasValidatorReward` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `Staking::NextElectionPage` (r:0 w:1) + /// Proof: `Staking::NextElectionPage` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ElectableStashes` (r:0 w:1) + /// Proof: `Staking::ElectableStashes` (`max_values`: Some(1), `max_size`: Some(32002), added: 32497, mode: `MaxEncodedLen`) fn rc_on_session_report() -> Weight { // Proof Size summary in bytes: - // Measured: `1190` - // Estimated: `0` - // Minimum execution time: 10_892_087_000 picoseconds. - Weight::from_parts(11_439_807_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `2431` + // Estimated: `39483` + // Minimum execution time: 516_585_000 picoseconds. + Weight::from_parts(530_117_000, 0) + .saturating_add(Weight::from_parts(0, 39483)) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(11)) } + /// Storage: `Staking::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `Measured`) + /// Storage: `Staking::EraPruningState` (r:1 w:0) + /// Proof: `Staking::EraPruningState` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `Staking::ErasStakersPaged` (r:101 w:100) + /// Proof: `Staking::ErasStakersPaged` (`max_values`: None, `max_size`: Some(3152), added: 5627, mode: `Measured`) /// The range of component `v` is `[1, 1000]`. fn prune_era_stakers_paged(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `7912 + v * (3 ±0)` - // Estimated: `0` - // Minimum execution time: 233_582_000 picoseconds. - Weight::from_parts(302_127_414, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_585 - .saturating_add(Weight::from_parts(83_794, 0).saturating_mul(v.into())) + // Estimated: `258665 + v * (4 ±0)` + // Minimum execution time: 165_109_000 picoseconds. + Weight::from_parts(186_409_460, 0) + .saturating_add(Weight::from_parts(0, 258665)) + // Standard Error: 1_200 + .saturating_add(Weight::from_parts(47_505, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(103)) + .saturating_add(T::DbWeight::get().writes(100)) + .saturating_add(Weight::from_parts(0, 4).saturating_mul(v.into())) } + /// Storage: `Staking::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `Measured`) + /// Storage: `Staking::EraPruningState` (r:1 w:0) + /// Proof: `Staking::EraPruningState` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `Staking::ErasStakersOverview` (r:101 w:100) + /// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `Measured`) /// The range of component `v` is `[1, 1000]`. fn prune_era_stakers_overview(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `7425` - // Estimated: `0` - // Minimum execution time: 57_623_000 picoseconds. - Weight::from_parts(308_108_210, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 9_129 - .saturating_add(Weight::from_parts(91_683, 0).saturating_mul(v.into())) + // Estimated: `202015 + v * (83 ±0)` + // Minimum execution time: 39_079_000 picoseconds. + Weight::from_parts(163_360_821, 0) + .saturating_add(Weight::from_parts(0, 202015)) + // Standard Error: 4_565 + .saturating_add(Weight::from_parts(75_583, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(81)) + .saturating_add(T::DbWeight::get().writes(79)) + .saturating_add(Weight::from_parts(0, 83).saturating_mul(v.into())) } + /// Storage: `Staking::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `Measured`) + /// Storage: `Staking::EraPruningState` (r:1 w:0) + /// Proof: `Staking::EraPruningState` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `Staking::ErasValidatorPrefs` (r:101 w:100) + /// Proof: `Staking::ErasValidatorPrefs` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `Measured`) /// The range of component `v` is `[1, 1000]`. fn prune_era_validator_prefs(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `5865` - // Estimated: `0` - // Minimum execution time: 53_173_000 picoseconds. - Weight::from_parts(278_592_462, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 8_591 - .saturating_add(Weight::from_parts(147_948, 0).saturating_mul(v.into())) + // Estimated: `200811 + v * (83 ±21)` + // Minimum execution time: 39_182_000 picoseconds. + Weight::from_parts(149_045_041, 0) + .saturating_add(Weight::from_parts(0, 200811)) + // Standard Error: 3_528 + .saturating_add(Weight::from_parts(92_154, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(81)) + .saturating_add(T::DbWeight::get().writes(79)) + .saturating_add(Weight::from_parts(0, 83).saturating_mul(v.into())) } + /// Storage: `Staking::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `Measured`) + /// Storage: `Staking::EraPruningState` (r:1 w:0) + /// Proof: `Staking::EraPruningState` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `Staking::ClaimedRewards` (r:101 w:100) + /// Proof: `Staking::ClaimedRewards` (`max_values`: None, `max_size`: Some(1462), added: 3937, mode: `Measured`) /// The range of component `v` is `[1, 1000]`. fn prune_era_claimed_rewards(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `8873` - // Estimated: `0` - // Minimum execution time: 55_821_000 picoseconds. - Weight::from_parts(297_039_564, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 8_692 - .saturating_add(Weight::from_parts(122_602, 0).saturating_mul(v.into())) + // Estimated: `203149 + v * (84 ±0)` + // Minimum execution time: 37_632_000 picoseconds. + Weight::from_parts(148_930_188, 0) + .saturating_add(Weight::from_parts(0, 203149)) + // Standard Error: 3_824 + .saturating_add(Weight::from_parts(103_701, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(81)) + .saturating_add(T::DbWeight::get().writes(79)) + .saturating_add(Weight::from_parts(0, 84).saturating_mul(v.into())) } + /// Storage: `Staking::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `Measured`) + /// Storage: `Staking::EraPruningState` (r:1 w:1) + /// Proof: `Staking::EraPruningState` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `Staking::ErasValidatorReward` (r:0 w:1) + /// Proof: `Staking::ErasValidatorReward` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `Measured`) fn prune_era_validator_reward() -> Weight { // Proof Size summary in bytes: // Measured: `789` - // Estimated: `0` - // Minimum execution time: 42_821_000 picoseconds. - Weight::from_parts(46_037_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `4254` + // Minimum execution time: 30_149_000 picoseconds. + Weight::from_parts(32_250_000, 0) + .saturating_add(Weight::from_parts(0, 4254)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } + /// Storage: `Staking::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `Measured`) + /// Storage: `Staking::EraPruningState` (r:1 w:1) + /// Proof: `Staking::EraPruningState` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `Staking::ErasRewardPoints` (r:0 w:1) + /// Proof: `Staking::ErasRewardPoints` (`max_values`: None, `max_size`: Some(36018), added: 38493, mode: `Measured`) fn prune_era_reward_points() -> Weight { // Proof Size summary in bytes: // Measured: `789` - // Estimated: `0` - // Minimum execution time: 41_525_000 picoseconds. - Weight::from_parts(46_113_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `4254` + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(31_859_000, 0) + .saturating_add(Weight::from_parts(0, 4254)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } + /// Storage: `Staking::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `Measured`) + /// Storage: `Staking::EraPruningState` (r:1 w:1) + /// Proof: `Staking::EraPruningState` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `Staking::ErasNominatorsSlashable` (r:0 w:1) + /// Proof: `Staking::ErasNominatorsSlashable` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `Staking::ErasTotalStake` (r:0 w:1) + /// Proof: `Staking::ErasTotalStake` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `Measured`) fn prune_era_single_entry_cleanups() -> Weight { // Proof Size summary in bytes: // Measured: `789` - // Estimated: `0` - // Minimum execution time: 45_910_000 picoseconds. - Weight::from_parts(48_324_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `4254` + // Minimum execution time: 31_615_000 picoseconds. + Weight::from_parts(34_414_000, 0) + .saturating_add(Weight::from_parts(0, 4254)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) } + /// Storage: `Staking::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `Measured`) + /// Storage: `Staking::EraPruningState` (r:1 w:0) + /// Proof: `Staking::EraPruningState` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `Staking::ValidatorSlashInEra` (r:101 w:100) + /// Proof: `Staking::ValidatorSlashInEra` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `Measured`) /// The range of component `v` is `[1, 1000]`. fn prune_era_validator_slash_in_era(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `5499 + v * (3 ±0)` - // Estimated: `0` - // Minimum execution time: 60_851_000 picoseconds. - Weight::from_parts(210_957_237, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 9_601 - .saturating_add(Weight::from_parts(206_498, 0).saturating_mul(v.into())) + // Estimated: `132078 + v * (177 ±23)` + // Minimum execution time: 43_780_000 picoseconds. + Weight::from_parts(117_898_212, 0) + .saturating_add(Weight::from_parts(0, 132078)) + // Standard Error: 4_265 + .saturating_add(Weight::from_parts(133_270, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(49)) + .saturating_add(T::DbWeight::get().writes(48)) + .saturating_add(Weight::from_parts(0, 177).saturating_mul(v.into())) } } From 75bae3beaa78eb2a3ce86555a296447b39f66503 Mon Sep 17 00:00:00 2001 From: cirko33 Date: Fri, 20 Mar 2026 13:57:01 +0100 Subject: [PATCH 05/16] update prdoc --- prdoc/pr_11435.prdoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/prdoc/pr_11435.prdoc b/prdoc/pr_11435.prdoc index d0dc6cc9fdb0c..5db5bf9341c7e 100644 --- a/prdoc/pr_11435.prdoc +++ b/prdoc/pr_11435.prdoc @@ -5,3 +5,5 @@ doc: crates: - name: pallet-staking-async bump: minor +- name: asset-hub-westend-runtime + bump: patch From 2ad136eaccbe34595a68085a2996fbdc43d439b9 Mon Sep 17 00:00:00 2001 From: cirko33 Date: Wed, 25 Mar 2026 17:00:48 +0100 Subject: [PATCH 06/16] update offence processing limits in staking-async pallet --- substrate/frame/staking-async/src/pallet/impls.rs | 2 +- substrate/frame/staking-async/src/pallet/mod.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/substrate/frame/staking-async/src/pallet/impls.rs b/substrate/frame/staking-async/src/pallet/impls.rs index 6f119c2822519..6bb6b6eb7b5b8 100644 --- a/substrate/frame/staking-async/src/pallet/impls.rs +++ b/substrate/frame/staking-async/src/pallet/impls.rs @@ -1194,7 +1194,7 @@ impl rc_client::AHStakingInterface for Pallet { let oldest_reportable_offence_era = if T::SlashDeferDuration::get() == 0 { // this implies that slashes are applied immediately, so we can accept any offence up to // bonding duration old. - active_era.index.saturating_sub(T::BondingDuration::get()) + active_era.index.saturating_sub(T::BondingDuration::get()).saturating_add(2) } else { // slashes are deffered, so we only accept offences that are not older than the // defferal duration. diff --git a/substrate/frame/staking-async/src/pallet/mod.rs b/substrate/frame/staking-async/src/pallet/mod.rs index e21560c8a0322..5d59679a501d4 100644 --- a/substrate/frame/staking-async/src/pallet/mod.rs +++ b/substrate/frame/staking-async/src/pallet/mod.rs @@ -583,12 +583,12 @@ pub mod pallet { } } - /// Custom bound for [`OffenceQueueEras`] which is equal to `2 * Config::BondingDuration`. + /// Custom bound for [`OffenceQueueEras`] which is equal to `Config::BondingDuration + 10`. pub struct OffenceQueueErasBound(core::marker::PhantomData); impl Get for OffenceQueueErasBound { fn get() -> u32 { let bonding_duration = T::BondingDuration::get(); - bonding_duration.saturating_add(bonding_duration) + bonding_duration.saturating_add(10) // adding 10 eras so the system has time to process offences } } @@ -810,7 +810,7 @@ pub mod pallet { /// - When a new offence is added to `OffenceQueue`, its era is **inserted in sorted order** /// if not already present. /// - When all offences for an era are processed, it is **removed** from this list. - /// - The maximum length of this vector is bounded by `2 * BondingDuration`. + /// - The maximum length of this vector is bounded by `BondingDuration + 10`. /// /// This eliminates the need for expensive iteration and sorting when fetching the next offence /// to process. From 7a4788fb43afc47bbf9c210e41dbaf35e0104c04 Mon Sep 17 00:00:00 2001 From: cirko33 Date: Thu, 26 Mar 2026 10:14:15 +0100 Subject: [PATCH 07/16] add explaination comment & add unit test --- .../frame/staking-async/src/pallet/impls.rs | 2 + .../frame/staking-async/src/tests/slashing.rs | 75 +++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/substrate/frame/staking-async/src/pallet/impls.rs b/substrate/frame/staking-async/src/pallet/impls.rs index 6bb6b6eb7b5b8..f02c03ad9ecc7 100644 --- a/substrate/frame/staking-async/src/pallet/impls.rs +++ b/substrate/frame/staking-async/src/pallet/impls.rs @@ -1194,6 +1194,8 @@ impl rc_client::AHStakingInterface for Pallet { let oldest_reportable_offence_era = if T::SlashDeferDuration::get() == 0 { // this implies that slashes are applied immediately, so we can accept any offence up to // bonding duration old. + // +2 because: saturating_sub(BondingDuration) reduces the range to BondingDuration - 1; + // the extra buffer era ensures old offences have time to be cleared out. active_era.index.saturating_sub(T::BondingDuration::get()).saturating_add(2) } else { // slashes are deffered, so we only accept offences that are not older than the diff --git a/substrate/frame/staking-async/src/tests/slashing.rs b/substrate/frame/staking-async/src/tests/slashing.rs index e070fcc1e4de2..93a6417b10e53 100644 --- a/substrate/frame/staking-async/src/tests/slashing.rs +++ b/substrate/frame/staking-async/src/tests/slashing.rs @@ -2147,3 +2147,78 @@ mod paged_slashing { }); } } + +#[test] +fn old_offences_rejected_with_zero_slash_defer_duration() { + // Regression test: with SlashDeferDuration=0, the old formula for oldest_reportable was + // `active_era - BondingDuration`, which was too permissive. It accepted offences from more + // eras than the OffenceQueueEras bound could hold, causing a defensive_proof failure on + // try_insert. The fix narrows the window to `active_era - BondingDuration + 2`. + ExtBuilder::default().nominate(false).build_and_execute(|| { + assert_eq!(SlashDeferDuration::get(), 0); + assert_eq!(BondingDuration::get(), 3); + + // advance to era 5. + Session::roll_until_active_era(5); + assert_eq!(active_era(), 5); + + // The old (broken) formula: oldest_reportable = 5 - 3 = 2. + // This would accept eras {2, 3, 4, 5} = 4 distinct eras, exceeding the old + // OffenceQueueEras bound of BondingDuration (3). + let old_oldest_reportable = active_era() - BondingDuration::get(); + assert_eq!(old_oldest_reportable, 2); + + // The new (fixed) formula: oldest_reportable = 5 - 3 + 2 = 4. + let new_oldest_reportable = active_era() - BondingDuration::get() + 2; + assert_eq!(new_oldest_reportable, 4); + + // Era 3 would have been accepted by the old formula (3 >= 2) but is now rejected + // (3 < 4). + let offence_era = 3u32; + assert!(offence_era >= old_oldest_reportable, "old formula would have accepted this"); + assert!(offence_era < new_oldest_reportable, "new formula correctly rejects this"); + + // clear events from era transitions. + staking_events_since_last_call(); + + // WHEN: reporting offence for era 3. + add_slash_in_era(11, offence_era, Perbill::from_percent(10)); + + // THEN: correctly rejected as too old. + assert_eq!( + staking_events_since_last_call(), + vec![Event::OffenceTooOld { + offence_era, + validator: 11, + fraction: Perbill::from_percent(10), + }] + ); + + // offence is not stored. + assert!(OffenceQueue::::iter_prefix(offence_era).next().is_none()); + assert!(!OffenceQueueEras::::get().unwrap_or_default().contains(&offence_era)); + + // WHEN: reporting offence for era 4 (within the valid window). + add_slash_in_era(21, 4, Perbill::from_percent(10)); + + // THEN: offence is accepted. + assert_eq!( + staking_events_since_last_call(), + vec![Event::OffenceReported { + offence_era: 4, + validator: 21, + fraction: Perbill::from_percent(10), + }] + ); + + // AND: computed in the next block. + Session::roll_next(); + assert_eq!( + staking_events_since_last_call(), + vec![ + Event::SlashComputed { offence_era: 4, slash_era: 4, offender: 21, page: 0 }, + Event::Slashed { staker: 21, amount: 100 }, + ] + ); + }); +} From 47293842c0c46da12a8ae73b0cc6200f5a098022 Mon Sep 17 00:00:00 2001 From: cirko33 Date: Thu, 26 Mar 2026 14:20:43 +0100 Subject: [PATCH 08/16] naming and comment refactor --- substrate/frame/staking-async/src/pallet/impls.rs | 5 +++-- substrate/frame/staking-async/src/pallet/mod.rs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/substrate/frame/staking-async/src/pallet/impls.rs b/substrate/frame/staking-async/src/pallet/impls.rs index f02c03ad9ecc7..4220aec554e4f 100644 --- a/substrate/frame/staking-async/src/pallet/impls.rs +++ b/substrate/frame/staking-async/src/pallet/impls.rs @@ -1194,8 +1194,9 @@ impl rc_client::AHStakingInterface for Pallet { let oldest_reportable_offence_era = if T::SlashDeferDuration::get() == 0 { // this implies that slashes are applied immediately, so we can accept any offence up to // bonding duration old. - // +2 because: saturating_sub(BondingDuration) reduces the range to BondingDuration - 1; - // the extra buffer era ensures old offences have time to be cleared out. + // Align with the SlashDeferDuration > 0 branch: accept offences from at most + // BondingDuration - 1 distinct eras, ensuring the count fits within the + // OffenceQueueEras bound. active_era.index.saturating_sub(T::BondingDuration::get()).saturating_add(2) } else { // slashes are deffered, so we only accept offences that are not older than the diff --git a/substrate/frame/staking-async/src/pallet/mod.rs b/substrate/frame/staking-async/src/pallet/mod.rs index 5d59679a501d4..e5bd9e6c4e2c1 100644 --- a/substrate/frame/staking-async/src/pallet/mod.rs +++ b/substrate/frame/staking-async/src/pallet/mod.rs @@ -583,12 +583,13 @@ pub mod pallet { } } - /// Custom bound for [`OffenceQueueEras`] which is equal to `Config::BondingDuration + 10`. + const OFFENCE_QUEUE_ERAS_BOUND: u32 = 10; + /// Custom bound for [`OffenceQueueEras`] which is equal to `Config::BondingDuration + OFFENCE_QUEUE_ERAS_BOUND`. pub struct OffenceQueueErasBound(core::marker::PhantomData); impl Get for OffenceQueueErasBound { fn get() -> u32 { let bonding_duration = T::BondingDuration::get(); - bonding_duration.saturating_add(10) // adding 10 eras so the system has time to process offences + bonding_duration.saturating_add(OFFENCE_QUEUE_ERAS_BOUND) // adding 10 eras so the system has time to process offences } } From dc406269fd4d5525194c77e8781a2ca3d7e9da11 Mon Sep 17 00:00:00 2001 From: cirko33 Date: Thu, 26 Mar 2026 14:26:12 +0100 Subject: [PATCH 09/16] fix test and fmt --- .../frame/staking-async/src/pallet/mod.rs | 6 ++- .../frame/staking-async/src/tests/slashing.rs | 41 ++++++++----------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/substrate/frame/staking-async/src/pallet/mod.rs b/substrate/frame/staking-async/src/pallet/mod.rs index e5bd9e6c4e2c1..c361fcb0be151 100644 --- a/substrate/frame/staking-async/src/pallet/mod.rs +++ b/substrate/frame/staking-async/src/pallet/mod.rs @@ -584,12 +584,14 @@ pub mod pallet { } const OFFENCE_QUEUE_ERAS_BOUND: u32 = 10; - /// Custom bound for [`OffenceQueueEras`] which is equal to `Config::BondingDuration + OFFENCE_QUEUE_ERAS_BOUND`. + /// Custom bound for [`OffenceQueueEras`] which is equal to `Config::BondingDuration + + /// OFFENCE_QUEUE_ERAS_BOUND`. pub struct OffenceQueueErasBound(core::marker::PhantomData); impl Get for OffenceQueueErasBound { fn get() -> u32 { let bonding_duration = T::BondingDuration::get(); - bonding_duration.saturating_add(OFFENCE_QUEUE_ERAS_BOUND) // adding 10 eras so the system has time to process offences + bonding_duration.saturating_add(OFFENCE_QUEUE_ERAS_BOUND) // adding 10 eras so the system has + // time to process offences } } diff --git a/substrate/frame/staking-async/src/tests/slashing.rs b/substrate/frame/staking-async/src/tests/slashing.rs index 93a6417b10e53..28c73b15c0476 100644 --- a/substrate/frame/staking-async/src/tests/slashing.rs +++ b/substrate/frame/staking-async/src/tests/slashing.rs @@ -2150,10 +2150,10 @@ mod paged_slashing { #[test] fn old_offences_rejected_with_zero_slash_defer_duration() { - // Regression test: with SlashDeferDuration=0, the old formula for oldest_reportable was - // `active_era - BondingDuration`, which was too permissive. It accepted offences from more - // eras than the OffenceQueueEras bound could hold, causing a defensive_proof failure on - // try_insert. The fix narrows the window to `active_era - BondingDuration + 2`. + // Regression test: with SlashDeferDuration=0, the previous formula + // `oldest_reportable = active_era - BondingDuration` would have accepted era 3 here, + // which would cause OffenceQueueEras to go out of sync with OffenceQueue. The fix + // narrows the window to `active_era - BondingDuration + 2`. ExtBuilder::default().nominate(false).build_and_execute(|| { assert_eq!(SlashDeferDuration::get(), 0); assert_eq!(BondingDuration::get(), 3); @@ -2162,26 +2162,12 @@ fn old_offences_rejected_with_zero_slash_defer_duration() { Session::roll_until_active_era(5); assert_eq!(active_era(), 5); - // The old (broken) formula: oldest_reportable = 5 - 3 = 2. - // This would accept eras {2, 3, 4, 5} = 4 distinct eras, exceeding the old - // OffenceQueueEras bound of BondingDuration (3). - let old_oldest_reportable = active_era() - BondingDuration::get(); - assert_eq!(old_oldest_reportable, 2); - - // The new (fixed) formula: oldest_reportable = 5 - 3 + 2 = 4. - let new_oldest_reportable = active_era() - BondingDuration::get() + 2; - assert_eq!(new_oldest_reportable, 4); - - // Era 3 would have been accepted by the old formula (3 >= 2) but is now rejected - // (3 < 4). - let offence_era = 3u32; - assert!(offence_era >= old_oldest_reportable, "old formula would have accepted this"); - assert!(offence_era < new_oldest_reportable, "new formula correctly rejects this"); - // clear events from era transitions. staking_events_since_last_call(); - // WHEN: reporting offence for era 3. + let offence_era = 3u32; + + // WHEN: reporting offence for era 3 (outside the valid window). add_slash_in_era(11, offence_era, Perbill::from_percent(10)); // THEN: correctly rejected as too old. @@ -2194,14 +2180,14 @@ fn old_offences_rejected_with_zero_slash_defer_duration() { }] ); - // offence is not stored. + // OffenceQueue and OffenceQueueEras remain consistent: no orphaned records. assert!(OffenceQueue::::iter_prefix(offence_era).next().is_none()); assert!(!OffenceQueueEras::::get().unwrap_or_default().contains(&offence_era)); // WHEN: reporting offence for era 4 (within the valid window). add_slash_in_era(21, 4, Perbill::from_percent(10)); - // THEN: offence is accepted. + // THEN: offence is accepted and stored consistently. assert_eq!( staking_events_since_last_call(), vec![Event::OffenceReported { @@ -2211,6 +2197,11 @@ fn old_offences_rejected_with_zero_slash_defer_duration() { }] ); + // OffenceQueue has the record for era 4. + assert!(OffenceQueue::::iter_prefix(4).next().is_some()); + // OffenceQueueEras tracks era 4. + assert!(OffenceQueueEras::::get().unwrap_or_default().contains(&4)); + // AND: computed in the next block. Session::roll_next(); assert_eq!( @@ -2220,5 +2211,9 @@ fn old_offences_rejected_with_zero_slash_defer_duration() { Event::Slashed { staker: 21, amount: 100 }, ] ); + + // After processing, both storages are cleaned up consistently. + assert!(OffenceQueue::::iter_prefix(4).next().is_none()); + assert!(!OffenceQueueEras::::get().unwrap_or_default().contains(&4)); }); } From b6b701551fd60265e18e1eea7a17ff64f782c4f0 Mon Sep 17 00:00:00 2001 From: cirko33 Date: Thu, 26 Mar 2026 14:30:27 +0100 Subject: [PATCH 10/16] comment fix --- substrate/frame/staking-async/src/pallet/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/staking-async/src/pallet/mod.rs b/substrate/frame/staking-async/src/pallet/mod.rs index c361fcb0be151..68723ca60509c 100644 --- a/substrate/frame/staking-async/src/pallet/mod.rs +++ b/substrate/frame/staking-async/src/pallet/mod.rs @@ -813,7 +813,7 @@ pub mod pallet { /// - When a new offence is added to `OffenceQueue`, its era is **inserted in sorted order** /// if not already present. /// - When all offences for an era are processed, it is **removed** from this list. - /// - The maximum length of this vector is bounded by `BondingDuration + 10`. + /// - The maximum length of this vector is bounded by `BondingDuration + OFFENCE_QUEUE_ERAS_BOUND`. /// /// This eliminates the need for expensive iteration and sorting when fetching the next offence /// to process. From ce9b59ecfb194bcf9a80d4ffdd37116951331cb0 Mon Sep 17 00:00:00 2001 From: cirko33 Date: Fri, 27 Mar 2026 11:13:20 +0100 Subject: [PATCH 11/16] update prdoc --- prdoc/pr_11435.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_11435.prdoc b/prdoc/pr_11435.prdoc index 5db5bf9341c7e..8921de6ab87a1 100644 --- a/prdoc/pr_11435.prdoc +++ b/prdoc/pr_11435.prdoc @@ -1,7 +1,7 @@ title: Raise offence queue eras bound limit doc: - audience: Runtime Dev - description: Raise offence queue `BondingDuration` limit to ensure no loss of offences. + description: Fixes a bug where OffenceQueueEras bound (BondingDuration) was incorrect when SlashDeferDuration=0. The oldest reportable offence era formula allowed more eras than the bound could hold. crates: - name: pallet-staking-async bump: minor From c60f12412904c38b0772d4661e15c9ab2e559a8c Mon Sep 17 00:00:00 2001 From: cirko33 Date: Fri, 27 Mar 2026 16:22:23 +0100 Subject: [PATCH 12/16] sub instead of add & fix tests --- substrate/frame/staking-async/src/pallet/impls.rs | 2 +- .../src/tests/nominators_no_slashing.rs | 12 ++++++------ substrate/frame/staking-async/src/tests/slashing.rs | 9 ++++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/substrate/frame/staking-async/src/pallet/impls.rs b/substrate/frame/staking-async/src/pallet/impls.rs index 4220aec554e4f..07314b0087565 100644 --- a/substrate/frame/staking-async/src/pallet/impls.rs +++ b/substrate/frame/staking-async/src/pallet/impls.rs @@ -1197,7 +1197,7 @@ impl rc_client::AHStakingInterface for Pallet { // Align with the SlashDeferDuration > 0 branch: accept offences from at most // BondingDuration - 1 distinct eras, ensuring the count fits within the // OffenceQueueEras bound. - active_era.index.saturating_sub(T::BondingDuration::get()).saturating_add(2) + active_era.index.saturating_sub(T::BondingDuration::get().saturating_sub(2)) } else { // slashes are deffered, so we only accept offences that are not older than the // defferal duration. diff --git a/substrate/frame/staking-async/src/tests/nominators_no_slashing.rs b/substrate/frame/staking-async/src/tests/nominators_no_slashing.rs index 35050aed4b5f0..25083506c8796 100644 --- a/substrate/frame/staking-async/src/tests/nominators_no_slashing.rs +++ b/substrate/frame/staking-async/src/tests/nominators_no_slashing.rs @@ -569,14 +569,14 @@ fn mixed_era_offences_processed_based_on_era_specific_setting() { let nominator_stake_before = Staking::ledger(101.into()).unwrap().active; - // Report offence from era 1 (slashable) - nominator should be slashed - add_slash_in_era(11, 1, Perbill::from_percent(5)); + // Report offence from era 2 (slashable) - nominator should be slashed + add_slash_in_era(11, 2, Perbill::from_percent(5)); Session::roll_next(); - let nominator_stake_after_era1_slash = Staking::ledger(101.into()).unwrap().active; + let nominator_stake_after_era2_slash = Staking::ledger(101.into()).unwrap().active; assert!( - nominator_stake_after_era1_slash < nominator_stake_before, - "Nominator should be slashed for era 1 offence" + nominator_stake_after_era2_slash < nominator_stake_before, + "Nominator should be slashed for era 2 offence" ); // Report offence from era 3 (NOT slashable) - nominator should NOT be slashed @@ -585,7 +585,7 @@ fn mixed_era_offences_processed_based_on_era_specific_setting() { let nominator_stake_after_era3_slash = Staking::ledger(101.into()).unwrap().active; assert_eq!( - nominator_stake_after_era3_slash, nominator_stake_after_era1_slash, + nominator_stake_after_era3_slash, nominator_stake_after_era2_slash, "Nominator should NOT be slashed for era 3 offence" ); }); diff --git a/substrate/frame/staking-async/src/tests/slashing.rs b/substrate/frame/staking-async/src/tests/slashing.rs index 28c73b15c0476..58f45afd095c9 100644 --- a/substrate/frame/staking-async/src/tests/slashing.rs +++ b/substrate/frame/staking-async/src/tests/slashing.rs @@ -2150,10 +2150,8 @@ mod paged_slashing { #[test] fn old_offences_rejected_with_zero_slash_defer_duration() { - // Regression test: with SlashDeferDuration=0, the previous formula - // `oldest_reportable = active_era - BondingDuration` would have accepted era 3 here, - // which would cause OffenceQueueEras to go out of sync with OffenceQueue. The fix - // narrows the window to `active_era - BondingDuration + 2`. + // Regression test: with SlashDeferDuration=0, the oldest reportable offence era is + // `active_era - (BondingDuration - 2)`. Offences older than that are rejected. ExtBuilder::default().nominate(false).build_and_execute(|| { assert_eq!(SlashDeferDuration::get(), 0); assert_eq!(BondingDuration::get(), 3); @@ -2168,6 +2166,7 @@ fn old_offences_rejected_with_zero_slash_defer_duration() { let offence_era = 3u32; // WHEN: reporting offence for era 3 (outside the valid window). + // oldest_reportable = 5 - (3 - 2) = 4, so era 3 < 4 is too old. add_slash_in_era(11, offence_era, Perbill::from_percent(10)); // THEN: correctly rejected as too old. @@ -2184,7 +2183,7 @@ fn old_offences_rejected_with_zero_slash_defer_duration() { assert!(OffenceQueue::::iter_prefix(offence_era).next().is_none()); assert!(!OffenceQueueEras::::get().unwrap_or_default().contains(&offence_era)); - // WHEN: reporting offence for era 4 (within the valid window). + // WHEN: reporting offence for era 4 (within the valid window, 4 >= 4). add_slash_in_era(21, 4, Perbill::from_percent(10)); // THEN: offence is accepted and stored consistently. From 005bc7f38275829120a827c97c9fb727214af858 Mon Sep 17 00:00:00 2001 From: cirko33 Date: Fri, 27 Mar 2026 16:23:25 +0100 Subject: [PATCH 13/16] fmt --- substrate/frame/staking-async/src/pallet/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/substrate/frame/staking-async/src/pallet/mod.rs b/substrate/frame/staking-async/src/pallet/mod.rs index 68723ca60509c..84af303bb2d63 100644 --- a/substrate/frame/staking-async/src/pallet/mod.rs +++ b/substrate/frame/staking-async/src/pallet/mod.rs @@ -813,7 +813,8 @@ pub mod pallet { /// - When a new offence is added to `OffenceQueue`, its era is **inserted in sorted order** /// if not already present. /// - When all offences for an era are processed, it is **removed** from this list. - /// - The maximum length of this vector is bounded by `BondingDuration + OFFENCE_QUEUE_ERAS_BOUND`. + /// - The maximum length of this vector is bounded by `BondingDuration + + /// OFFENCE_QUEUE_ERAS_BOUND`. /// /// This eliminates the need for expensive iteration and sorting when fetching the next offence /// to process. From a8b5acdb93ee6260430a490900a8437abf554c77 Mon Sep 17 00:00:00 2001 From: cirko33 Date: Fri, 27 Mar 2026 16:33:12 +0100 Subject: [PATCH 14/16] fixed comment --- substrate/frame/staking-async/src/pallet/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/substrate/frame/staking-async/src/pallet/mod.rs b/substrate/frame/staking-async/src/pallet/mod.rs index 84af303bb2d63..524cf55552a23 100644 --- a/substrate/frame/staking-async/src/pallet/mod.rs +++ b/substrate/frame/staking-async/src/pallet/mod.rs @@ -590,8 +590,10 @@ pub mod pallet { impl Get for OffenceQueueErasBound { fn get() -> u32 { let bonding_duration = T::BondingDuration::get(); - bonding_duration.saturating_add(OFFENCE_QUEUE_ERAS_BOUND) // adding 10 eras so the system has - // time to process offences + bonding_duration.saturating_add(OFFENCE_QUEUE_ERAS_BOUND) // adding 10 eras to add headroom to + // the bound for runtime upgrades that + // lower BondingDuration so we avoid + // the try_into trap. } } From 339c34281227cd669986f3ed1173a2fcfa96310b Mon Sep 17 00:00:00 2001 From: cirko33 Date: Fri, 27 Mar 2026 18:58:59 +0100 Subject: [PATCH 15/16] adjust test to use 2 eras instead of 3 --- .../frame/staking-async/integration-tests/src/ah/test.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/substrate/frame/staking-async/integration-tests/src/ah/test.rs b/substrate/frame/staking-async/integration-tests/src/ah/test.rs index 9afec3a01c080..9119c9145d707 100644 --- a/substrate/frame/staking-async/integration-tests/src/ah/test.rs +++ b/substrate/frame/staking-async/integration-tests/src/ah/test.rs @@ -942,11 +942,10 @@ fn on_offence_previous_era_instant_apply() { .build() .execute_with(|| { let _ = roll_until_next_active(0); - let _ = roll_until_next_active(5); - let active_validators = roll_until_next_active(10); + let active_validators = roll_until_next_active(7); assert_eq!(active_validators, vec![3, 5, 6, 8]); - assert_eq!(Rotator::::active_era(), 3); + assert_eq!(Rotator::::active_era(), 2); // flush the events. let _ = staking_events_since_last_call(); From 89226e2b52e288ce9017cac0a13ab91250278b6c Mon Sep 17 00:00:00 2001 From: cirko33 Date: Sun, 29 Mar 2026 11:21:04 +0200 Subject: [PATCH 16/16] update comment --- substrate/frame/staking-async/src/pallet/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/substrate/frame/staking-async/src/pallet/mod.rs b/substrate/frame/staking-async/src/pallet/mod.rs index 524cf55552a23..2bbe871f6a3a0 100644 --- a/substrate/frame/staking-async/src/pallet/mod.rs +++ b/substrate/frame/staking-async/src/pallet/mod.rs @@ -590,7 +590,8 @@ pub mod pallet { impl Get for OffenceQueueErasBound { fn get() -> u32 { let bonding_duration = T::BondingDuration::get(); - bonding_duration.saturating_add(OFFENCE_QUEUE_ERAS_BOUND) // adding 10 eras to add headroom to + bonding_duration.saturating_add(OFFENCE_QUEUE_ERAS_BOUND) // adding OFFENCE_QUEUE_ERAS_BOUND eras + // to add headroom to // the bound for runtime upgrades that // lower BondingDuration so we avoid // the try_into trap.