Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
5fc47a9
WIP
nkpar May 28, 2025
ca81567
kitchensink-runtime adoption
nkpar May 28, 2025
6b6e572
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar May 28, 2025
6977e70
Review comments and runtimes support
nkpar May 28, 2025
40fe3ef
Merge branch '8403-pallet-bags-list-add-optional-auto-rebag-within-on…
nkpar May 28, 2025
1f6943f
Update auto-rebagging logic and refine related comments
nkpar May 28, 2025
094da4d
Update from github-actions[bot] running command 'fmt'
github-actions[bot] May 28, 2025
ec01134
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] May 28, 2025
c88dc5b
Update pr_8684.prdoc
nkpar May 28, 2025
cadf8c8
Update mock.rs
nkpar May 28, 2025
d118b26
Update lib.rs
nkpar May 28, 2025
a552dae
Update from github-actions[bot] running command 'fmt'
github-actions[bot] May 28, 2025
c2b6cc7
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
Ank4n May 29, 2025
4f86865
Refactor `rebag_internal` and improve mocs readability
nkpar May 29, 2025
296fe0c
Update lib.rs
nkpar May 29, 2025
3bd16a0
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar May 29, 2025
1ded36a
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar May 29, 2025
771e3c2
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar May 29, 2025
411be09
Update lib.rs
nkpar May 29, 2025
9209ec7
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar May 29, 2025
56e508a
Update lib.rs
nkpar May 29, 2025
89d0be9
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar May 29, 2025
a8dec03
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar May 30, 2025
27a95a1
broken tests
nkpar May 30, 2025
f9b150a
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 2, 2025
5bb735b
Tests and new logic
nkpar Jun 3, 2025
f0306fb
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 3, 2025
abc1438
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 3, 2025
3c40eac
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 3, 2025
5e71b3e
Remove `iter_from_inclusive` and refactor auto-rebagging logic
nkpar Jun 3, 2025
50fd2bb
Update substrate/frame/bags-list/src/lib.rs
nkpar Jun 5, 2025
f761e3b
benchmarking, refactor auto-rebagging, and update weight configurations
nkpar Jun 5, 2025
2836fe1
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 5, 2025
d3b73c7
Update pallet_bags_list.rs
nkpar Jun 5, 2025
8ba3c5d
Merge branch '8403-pallet-bags-list-add-optional-auto-rebag-within-on…
nkpar Jun 5, 2025
befa890
Refactor `on_idle` logic and benchmarks
nkpar Jun 5, 2025
6fdc7ce
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Jun 6, 2025
4dab54a
Refactor `on_idle` benchmark
nkpar Jun 6, 2025
87e2e0f
Update benchmarks.rs
nkpar Jun 6, 2025
d719418
Update benchmarks.rs
nkpar Jun 6, 2025
8f52009
Update benchmarks.rs
nkpar Jun 6, 2025
54dce3e
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Jun 6, 2025
b1a36fe
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 6, 2025
a1cbe49
Integrate `AutoRebagPerBlock` configuration into mock runtimes
nkpar Jun 6, 2025
0b2d64a
Merge branch '8403-pallet-bags-list-add-optional-auto-rebag-within-on…
nkpar Jun 6, 2025
015fb50
Update mock.rs
nkpar Jun 6, 2025
379ce97
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 6, 2025
d4b10b6
Update pr_8684.prdoc
nkpar Jun 6, 2025
80c1809
Update substrate/frame/bags-list/src/lib.rs
nkpar Jun 6, 2025
e71c34f
Update pr_8684.prdoc
nkpar Jun 6, 2025
c2a233a
Merge branch '8403-pallet-bags-list-add-optional-auto-rebag-within-on…
nkpar Jun 6, 2025
2f9b19d
Update pr_8684.prdoc
nkpar Jun 6, 2025
545fbc0
Refine `System::events` assertions and disable auto-rebagging for tes…
nkpar Jun 6, 2025
2960b0f
Update basic.rs
nkpar Jun 6, 2025
a9ba4b6
Disable `AutoRebagNumber` in other mocks
nkpar Jun 6, 2025
b13eefb
Update lib.rs
nkpar Jun 7, 2025
a9df14a
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 9, 2025
91e430a
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 9, 2025
f5ad62d
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 10, 2025
4b68e86
Update import.rs
nkpar Jun 10, 2025
d1984de
Merge branch '8403-pallet-bags-list-add-optional-auto-rebag-within-on…
nkpar Jun 10, 2025
1f34e12
Update tests-misc.yml
nkpar Jun 10, 2025
8f1d688
Update tests-misc.yml
nkpar Jun 10, 2025
de292c9
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 11, 2025
1f4f5ff
Rename `AutoRebagPerBlock` to `MaxAutoRebagPerBlock` across the codeb…
nkpar Jun 11, 2025
357b4e4
MaxAutoRebagPerBlock
nkpar Jun 11, 2025
8170020
bags-list: optimize fast-exit path in on_idle by reordering checks
nkpar Jun 11, 2025
baa5017
bags-list: clarify on_idle weight assumptions and benchmarking depend…
nkpar Jun 11, 2025
75b7672
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 11, 2025
c757f79
Update substrate/frame/bags-list/src/tests.rs
nkpar Jun 11, 2025
8595603
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 11, 2025
55c189b
Update substrate/frame/bags-list/src/benchmarks.rs
nkpar Jun 11, 2025
9ff2260
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 13, 2025
386d808
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 16, 2025
afee4b9
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 19, 2025
d74f4ee
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jun 30, 2025
973b2d3
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Jun 30, 2025
546f59d
Update staking.rs
nkpar Jun 30, 2025
07cdb28
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Jun 30, 2025
52b2c31
Merge branch 'master' into 8403-pallet-bags-list-add-optional-auto-re…
nkpar Jul 1, 2025
a55c315
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Jul 1, 2025
8567bac
Update pallet_bags_list.rs
nkpar Jul 1, 2025
f821f23
Merge branch '8403-pallet-bags-list-add-optional-auto-rebag-within-on…
nkpar Jul 1, 2025
b8f0f10
Update pr_8684.prdoc
nkpar Jul 1, 2025
50e930b
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Jul 1, 2025
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
3 changes: 3 additions & 0 deletions .github/workflows/tests-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ jobs:
ref: ${{ matrix.branch == 'master' && matrix.branch || '' }}

- name: script
shell: bash
run: |
# Fail the step if any command in a pipeline errors out.
set -euo pipefail
ARTIFACTS_DIR=./artifacts
BENCH_TRIE_READ=::trie::read::small
BENCH_NODE_IMPORT=::node::import::sr25519::transfer_keep_alive::paritydb::small
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ impl multi_block::unsigned::miner::MinerConfig for Runtime {

parameter_types! {
pub const BagThresholds: &'static [u64] = &bag_thresholds::THRESHOLDS;
pub const AutoRebagNumber: u32 = 10;
}

type VoterBagsListInstance = pallet_bags_list::Instance1;
Expand All @@ -193,6 +194,7 @@ impl pallet_bags_list::Config<VoterBagsListInstance> for Runtime {
type WeightInfo = weights::pallet_bags_list::WeightInfo<Runtime>;
type BagThresholds = BagThresholds;
type Score = sp_npos_elections::VoteWeight;
type MaxAutoRebagPerBlock = AutoRebagNumber;
}

pub struct EraPayout;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -16,28 +15,29 @@

//! Autogenerated weights for `pallet_bags_list`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-06-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! 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: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner--ss9ysm1-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 1024
//! HOSTNAME: `66f1737e2c94`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024

// Executed Command:
// ./target/production/polkadot
// frame-omni-bencher
// v1
// benchmark
// pallet
// --chain=westend-dev
// --extrinsic=*
// --runtime=target/production/wbuild/asset-hub-westend-runtime/asset_hub_westend_runtime.wasm
// --pallet=pallet_bags_list
// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt
// --output=./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights
// --wasm-execution=compiled
// --steps=50
// --repeat=20
// --heap-pages=4096
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --pallet=pallet_bags_list
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --header=./file_header.txt
// --output=./runtime/westend/src/weights/
// --no-median-slopes

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
Expand All @@ -50,60 +50,90 @@ use core::marker::PhantomData;
/// Weight functions for `pallet_bags_list`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
/// 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(1091), added: 3566, mode: MaxEncodedLen)
/// Storage: VoterList ListNodes (r:4 w:4)
/// 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::Lock` (r:1 w:0)
/// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, 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: `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: `1656`
// Measured: `5012`
// Estimated: `11506`
// Minimum execution time: 60_240_000 picoseconds.
Weight::from_parts(62_834_000, 0)
// Minimum execution time: 149_768_000 picoseconds.
Weight::from_parts(162_271_000, 0)
.saturating_add(Weight::from_parts(0, 11506))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(5))
}
/// 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(1091), added: 3566, 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 ListBags (r:2 w:2)
/// Proof: VoterList ListBags (max_values: None, max_size: Some(82), added: 2557, 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: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: `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: `1550`
// Measured: `4915`
// Estimated: `8877`
// Minimum execution time: 59_084_000 picoseconds.
Weight::from_parts(60_589_000, 0)
// Minimum execution time: 145_767_000 picoseconds.
Weight::from_parts(157_284_000, 0)
.saturating_add(Weight::from_parts(0, 8877))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(5))
}
/// 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:2 w:0)
/// 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(1091), added: 3566, 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)
/// 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:4 w:4)
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:2 w:0)
/// 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: `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: `1861`
// Measured: `7365`
// Estimated: `11506`
// Minimum execution time: 65_945_000 picoseconds.
Weight::from_parts(67_429_000, 0)
// Minimum execution time: 192_992_000 picoseconds.
Weight::from_parts(200_226_000, 0)
.saturating_add(Weight::from_parts(0, 11506))
.saturating_add(T::DbWeight::get().reads(10))
.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)
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:10 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::Ledger` (r:10 w:0)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`)
fn on_idle() -> Weight {
// Proof Size summary in bytes:
// Measured: `24300`
// Estimated: `512390`
// Minimum execution time: 1_064_149_000 picoseconds.
Weight::from_parts(1_090_878_000, 0)
.saturating_add(Weight::from_parts(0, 512390))
.saturating_add(T::DbWeight::get().reads(234))
.saturating_add(T::DbWeight::get().writes(16))
}
}
4 changes: 3 additions & 1 deletion polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,14 +688,16 @@ impl pallet_election_provider_multi_phase::Config for Runtime {

parameter_types! {
pub const BagThresholds: &'static [u64] = &bag_thresholds::THRESHOLDS;
pub const AutoRebagNumber: u32 = 10;
Comment thread
nkpar marked this conversation as resolved.
}

type VoterBagsListInstance = pallet_bags_list::Instance1;
impl pallet_bags_list::Config<VoterBagsListInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type ScoreProvider = Staking;
type WeightInfo = weights::pallet_bags_list::WeightInfo<Runtime>;
type ScoreProvider = Staking;
type BagThresholds = BagThresholds;
type MaxAutoRebagPerBlock = AutoRebagNumber;
type Score = sp_npos_elections::VoteWeight;
}

Expand Down
60 changes: 45 additions & 15 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-02-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2025-07-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `3a2e9ae8a8f5`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `66f1737e2c94`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024

// Executed Command:
Expand Down Expand Up @@ -51,42 +51,48 @@ use core::marker::PhantomData;
/// Weight functions for `pallet_bags_list`.
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::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(1091), added: 3566, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListNodes` (r:4 w:4)
/// 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`)
fn rebag_non_terminal() -> Weight {
// Proof Size summary in bytes:
// Measured: `1684`
// Estimated: `11506`
// Minimum execution time: 70_533_000 picoseconds.
Weight::from_parts(75_116_000, 0)
// Minimum execution time: 71_398_000 picoseconds.
Weight::from_parts(73_741_000, 0)
.saturating_add(Weight::from_parts(0, 11506))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(5))
}
/// 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: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(1091), added: 3566, 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::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: `1578`
// Estimated: `8877`
// Minimum execution time: 67_601_000 picoseconds.
Weight::from_parts(70_330_000, 0)
// Minimum execution time: 69_243_000 picoseconds.
Weight::from_parts(71_825_000, 0)
.saturating_add(Weight::from_parts(0, 8877))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(5))
}
/// 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:4 w:4)
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:2 w:0)
Expand All @@ -101,10 +107,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: 83_012_000 picoseconds.
Weight::from_parts(85_139_000, 0)
// Minimum execution time: 79_898_000 picoseconds.
Weight::from_parts(83_764_000, 0)
.saturating_add(Weight::from_parts(0, 11506))
.saturating_add(T::DbWeight::get().reads(10))
.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)
Comment thread
kianenigma marked this conversation as resolved.
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
/// Storage: `VoterList::ListNodes` (r:11 w:11)
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:10 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::Ledger` (r:10 w:0)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
fn on_idle() -> 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))
}
}
27 changes: 27 additions & 0 deletions prdoc/pr_8684.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
title: Add optional auto-rebag within on-idle
doc:
- audience: Runtime Dev
description: Introduced an optional `on_idle` hook for automatic account rebagging,
improving the incremental correction of account positions within the bags-list
during block execution's idle phase. This feature leverages new storage and
configurable constants, alongside enhanced logging and internal helpers.
Setting `MaxAutoRebagPerBlock` to `0` (e.g., `type MaxAutoRebagPerBlock = ();`)
disables this functionality, preserving pre-upgrade pallet behavior.
make sure that after setting value of `MaxAutoRebagPerBlock` you regenerate weight for your runtime.
crates:
- name: pallet-bags-list
bump: major
- name: westend-runtime
bump: minor
- name: pallet-staking-async-parachain-runtime
bump: minor
- name: pallet-staking-async-rc-runtime
bump: minor
- name: pallet-staking
bump: minor
- name: pallet-nomination-pools-benchmarking
bump: minor
- name: pallet-staking-async
bump: minor
- name: asset-hub-westend-runtime
bump: minor
6 changes: 4 additions & 2 deletions substrate/bin/node/bench/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ impl core::Benchmark for ImportBenchmark {
// - 2x deposit (Balances::Deposit and Treasury::Deposit) for depositing
// the transaction fee into the treasury
// - extrinsic success
// +3 Bags List events from on_idle hook
assert_eq!(
kitchensink_runtime::System::events().len(),
(self.block.extrinsics.len() - 2) * 9 + 2,
(self.block.extrinsics.len() - 2) * 9 + 2 + 3,
);
},
BlockType::Noop => {
Expand All @@ -148,7 +149,8 @@ impl core::Benchmark for ImportBenchmark {
// those 2 events per signed are:
// - deposit event for charging transaction fee
// - extrinsic success
(self.block.extrinsics.len() - 2) * 2 + 2,
// +3 Bags List events from on_idle hook
(self.block.extrinsics.len() - 2) * 2 + 2 + 3,
);
},
_ => {},
Expand Down
Loading