Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
6b7aba3
Fix bags-list on_idle benchmark fragility across MaxAutoRebagPerBlock…
sigurpol Apr 1, 2026
b17be00
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] Apr 1, 2026
d614279
Add parameterized test for on_idle benchmark across rebag budgets
sigurpol Apr 1, 2026
009ce6c
Improve prdoc
sigurpol Apr 1, 2026
0f5da67
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Apr 1, 2026
b9a33a7
prdoc
sigurpol Apr 1, 2026
b3f5bda
Merge branch 'master' into sigurpol-bag-list-better-on-idle-benchmark
sigurpol Apr 2, 2026
52dfd32
Bags-list on_idle: per-item weight consumption via WeightMeter
sigurpol Apr 2, 2026
89c2bd0
fix staking-async test runtime weights
sigurpol Apr 2, 2026
137a2c3
fix prdoc
sigurpol Apr 2, 2026
431c930
Merge branch 'master' into sigurpol-bag-list-better-on-idle-benchmark
sigurpol Apr 2, 2026
d64c82d
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Apr 2, 2026
c5bf270
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Apr 2, 2026
58a5249
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Apr 2, 2026
9eda45f
fmt
sigurpol Apr 2, 2026
a4e82b4
add assertion
sigurpol Apr 2, 2026
149352d
improve on_idle to account for overhead before per-item loop
sigurpol Apr 2, 2026
686b0e3
Merge branch 'master' into sigurpol-bag-list-better-on-idle-benchmark
sigurpol Apr 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
//! Autogenerated weights for `pallet_bags_list`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-09-12, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2026-04-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `157b7e44410a`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `fbbc55bc678e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024

// Executed Command:
Expand Down Expand Up @@ -52,47 +52,55 @@ pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
/// Storage: `VoterList::Lock` (r:1 w:0)
/// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`)
/// Storage: `VoterList::PendingRebag` (r:1 w:0)
/// Proof: `VoterList::PendingRebag` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `VoterList::PendingRebag` (r:1 w:1)
/// Proof: `VoterList::PendingRebag` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListNodes` (r:4 w:4)
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, 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: `Staking::Nominators` (r:1 w:0)
/// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, 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::ListBags` (r:1 w:1)
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
fn rebag_non_terminal() -> Weight {
// Proof Size summary in bytes:
// Measured: `5012`
// Measured: `7723`
// Estimated: `11506`
// Minimum execution time: 154_457_000 picoseconds.
Weight::from_parts(161_546_000, 0)
// Minimum execution time: 211_700_000 picoseconds.
Weight::from_parts(229_389_000, 0)
.saturating_add(Weight::from_parts(0, 11506))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(5))
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `VoterList::Lock` (r:1 w:0)
/// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`)
/// Storage: `VoterList::PendingRebag` (r:1 w:0)
/// Proof: `VoterList::PendingRebag` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `VoterList::PendingRebag` (r:1 w:1)
/// Proof: `VoterList::PendingRebag` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListNodes` (r:3 w:3)
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, 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: `Staking::Nominators` (r:1 w:0)
/// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, 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::ListBags` (r:2 w:2)
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
fn rebag_terminal() -> Weight {
// Proof Size summary in bytes:
// Measured: `4915`
// Measured: `7627`
// Estimated: `8877`
// Minimum execution time: 155_177_000 picoseconds.
Weight::from_parts(159_976_000, 0)
// Minimum execution time: 213_366_000 picoseconds.
Weight::from_parts(228_988_000, 0)
.saturating_add(Weight::from_parts(0, 8877))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(5))
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `VoterList::Lock` (r:1 w:0)
/// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`)
Expand All @@ -102,46 +110,50 @@ impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::Ledger` (r:2 w:0)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`)
/// Storage: `Staking::Nominators` (r:2 w:0)
/// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`)
/// Storage: `Staking::Validators` (r:2 w:0)
/// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, 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: `VoterList::ListBags` (r:1 w:1)
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
fn put_in_front_of() -> Weight {
// Proof Size summary in bytes:
// Measured: `7365`
// Measured: `12142`
// Estimated: `11506`
// Minimum execution time: 190_977_000 picoseconds.
Weight::from_parts(206_642_000, 0)
// Minimum execution time: 272_353_000 picoseconds.
Weight::from_parts(293_615_000, 0)
.saturating_add(Weight::from_parts(0, 11506))
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().reads(15))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `VoterList::CounterForListNodes` (r:1 w:1)
/// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `VoterList::CounterForPendingRebag` (r:1 w:1)
/// Proof: `VoterList::CounterForPendingRebag` (`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::NextNodeAutoRebagged` (r:1 w:1)
/// Proof: `VoterList::NextNodeAutoRebagged` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `VoterList::PendingRebag` (r:12 w:3)
/// Proof: `VoterList::PendingRebag` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListBags` (r:199 w:3)
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListNodes` (r:11 w:10)
/// Storage: `VoterList::PendingRebag` (r:1 w:1)
/// Proof: `VoterList::PendingRebag` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
/// Storage: `VoterList::CounterForPendingRebag` (r:1 w:1)
/// Proof: `VoterList::CounterForPendingRebag` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListNodes` (r:4 w:4)
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:10 w:0)
/// 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:9 w:0)
/// Storage: `Staking::Ledger` (r:1 w:0)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`)
fn on_idle() -> Weight {
/// Storage: `Staking::Nominators` (r:1 w:0)
/// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, 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::ListBags` (r:1 w:1)
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
fn on_idle_rebag() -> Weight {
// Proof Size summary in bytes:
// Measured: `23853`
// Estimated: `509833`
// Minimum execution time: 1_173_907_000 picoseconds.
Weight::from_parts(1_196_347_000, 0)
.saturating_add(Weight::from_parts(0, 509833))
.saturating_add(T::DbWeight::get().reads(245))
.saturating_add(T::DbWeight::get().writes(19))
// Measured: `8193`
// Estimated: `11506`
// Minimum execution time: 214_841_000 picoseconds.
Weight::from_parts(235_538_000, 0)
.saturating_add(Weight::from_parts(0, 11506))
.saturating_add(T::DbWeight::get().reads(12))
.saturating_add(T::DbWeight::get().writes(7))
}
}
62 changes: 33 additions & 29 deletions polkadot/runtime/westend/src/weights/pallet_bags_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_bags_list`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-07-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2026-04-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `66f1737e2c94`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `2ddc133507b4`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024

// Executed Command:
Expand Down Expand Up @@ -53,6 +53,8 @@ pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
/// Storage: `VoterList::Lock` (r:1 w:0)
/// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`)
/// Storage: `VoterList::PendingRebag` (r:1 w:1)
/// Proof: `VoterList::PendingRebag` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListNodes` (r:4 w:4)
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:0)
Expand All @@ -65,14 +67,16 @@ impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1684`
// Estimated: `11506`
// Minimum execution time: 71_398_000 picoseconds.
Weight::from_parts(73_741_000, 0)
// Minimum execution time: 75_617_000 picoseconds.
Weight::from_parts(79_912_000, 0)
.saturating_add(Weight::from_parts(0, 11506))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(5))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `VoterList::Lock` (r:1 w:0)
/// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`)
/// Storage: `VoterList::PendingRebag` (r:1 w:1)
/// Proof: `VoterList::PendingRebag` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListNodes` (r:3 w:3)
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:0)
Expand All @@ -85,11 +89,11 @@ impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1578`
// Estimated: `8877`
// Minimum execution time: 69_243_000 picoseconds.
Weight::from_parts(71_825_000, 0)
// Minimum execution time: 73_267_000 picoseconds.
Weight::from_parts(77_504_000, 0)
.saturating_add(Weight::from_parts(0, 8877))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(5))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `VoterList::Lock` (r:1 w:0)
/// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`)
Expand All @@ -107,34 +111,34 @@ impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1889`
// Estimated: `11506`
// Minimum execution time: 79_898_000 picoseconds.
Weight::from_parts(83_764_000, 0)
// Minimum execution time: 80_558_000 picoseconds.
Weight::from_parts(84_659_000, 0)
.saturating_add(Weight::from_parts(0, 11506))
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `VoterList::CounterForListNodes` (r:1 w:0)
/// Proof: `VoterList::CounterForListNodes` (`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::NextNodeAutoRebagged` (r:1 w:1)
/// Proof: `VoterList::NextNodeAutoRebagged` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListBags` (r:200 w:4)
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListNodes` (r:11 w:11)
/// Storage: `VoterList::PendingRebag` (r:1 w:1)
/// Proof: `VoterList::PendingRebag` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
/// Storage: `VoterList::CounterForPendingRebag` (r:1 w:1)
/// Proof: `VoterList::CounterForPendingRebag` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListNodes` (r:4 w:4)
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:10 w:0)
/// 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:10 w:0)
/// Storage: `Staking::Ledger` (r:1 w:0)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
fn on_idle() -> Weight {
/// Storage: `VoterList::ListBags` (r:1 w:1)
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
fn on_idle_rebag() -> Weight {
// Proof Size summary in bytes:
// Measured: `4777`
// Estimated: `512390`
// Minimum execution time: 711_092_000 picoseconds.
Weight::from_parts(722_007_000, 0)
.saturating_add(Weight::from_parts(0, 512390))
.saturating_add(T::DbWeight::get().reads(234))
.saturating_add(T::DbWeight::get().writes(16))
// Measured: `1771`
// Estimated: `11506`
// Minimum execution time: 74_532_000 picoseconds.
Weight::from_parts(78_630_000, 0)
.saturating_add(Weight::from_parts(0, 11506))
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(7))
}
}
18 changes: 18 additions & 0 deletions prdoc/pr_11594.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
title: 'Bags-list on_idle: per-item weight consumption via WeightMeter'
doc:
- audience: Runtime Dev
description: |-
Replaces the bulk `on_idle` benchmark with a per-item `on_idle_rebag` benchmark that
measures the worst-case cost of a single rebag. `on_idle` now consumes weight per
iteration via `WeightMeter` instead of reserving a single bulk weight upfront.
This decouples the benchmark from `MaxAutoRebagPerBlock` — changing the config no
longer requires re-running benchmarks.
crates:
- name: pallet-bags-list
bump: major
- name: asset-hub-westend-runtime
bump: patch
- name: pallet-staking-async-parachain-runtime
bump: patch
- name: westend-runtime
bump: patch
Loading
Loading