Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
52ad11f
feature in good shape, most tests pass, except those that rely in moc…
kianenigma Sep 23, 2025
2608c36
new combinator logic, all tests pass
kianenigma Sep 23, 2025
88cb160
fix benchmarks too
kianenigma Oct 1, 2025
fac1956
move to poll, rename all weights
kianenigma Oct 1, 2025
65a2964
cleanup mock signed stuff
kianenigma Oct 1, 2025
1e4bfc2
staking uses poll now as well
kianenigma Oct 1, 2025
624e627
tidy up
kianenigma Oct 3, 2025
f74d49f
fix ahm tests and merge master
kianenigma Oct 3, 2025
c05bf0d
solid round of self-review
kianenigma Oct 3, 2025
9bcba02
Merge branch 'master' of github.com:paritytech/polkadot-sdk into kiz-…
kianenigma Oct 3, 2025
10afe31
remove some todos
kianenigma Oct 3, 2025
0c4289d
fmt
kianenigma Oct 3, 2025
5b712bb
fix build
kianenigma Oct 3, 2025
7bda95e
add unit test
kianenigma Oct 6, 2025
fe82b86
Merge branch 'master' of github.com:paritytech/polkadot-sdk into kiz-…
kianenigma Oct 6, 2025
e6d025a
add more tests, ready for benchmarks
kianenigma Oct 8, 2025
1b65e05
Merge branch 'master' of github.com:paritytech/polkadot-sdk into kiz-…
kianenigma Oct 8, 2025
cdba719
docs and add weight test
kianenigma Oct 8, 2025
62a0050
Apply suggestion from @kianenigma
kianenigma Oct 8, 2025
172ef4a
add more tests
kianenigma Oct 8, 2025
7837c72
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Oct 8, 2025
c90b1cd
Merge branch 'kiz-epmb-poll' of github.com:paritytech/polkadot-sdk in…
kianenigma Oct 8, 2025
493a46e
integrate new westend weights
kianenigma Oct 8, 2025
aa517d8
add comment
kianenigma Oct 8, 2025
c816fae
fresh tests
kianenigma Oct 9, 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
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ mod preset_names {
/// Provides the JSON representation of predefined genesis config for given `id`.
pub fn get_preset(id: &PresetId) -> Option<Vec<u8>> {
use preset_names::*;
let dev_stakers = Some((0, 25_000));
let dev_stakers = Some((1000, 25_000));
let patch = match id.as_ref() {
PRESET_GENESIS => asset_hub_westend_genesis(
// initial collators.
Expand Down
19 changes: 16 additions & 3 deletions cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1678,9 +1678,8 @@ mod benches {
[pallet_bags_list, VoterList]
[pallet_balances, Balances]
[pallet_conviction_voting, ConvictionVoting]
// Temporarily disabled due to https://github.com/paritytech/polkadot-sdk/issues/7714
// [pallet_election_provider_multi_block, MultiBlockElection]
// [pallet_election_provider_multi_block_verifier, MultiBlockElectionVerifier]
[pallet_election_provider_multi_block, MultiBlockElection]
[pallet_election_provider_multi_block_verifier, MultiBlockElectionVerifier]
[pallet_election_provider_multi_block_unsigned, MultiBlockElectionUnsigned]
[pallet_election_provider_multi_block_signed, MultiBlockElectionSigned]
[pallet_fast_unstake, FastUnstake]
Expand Down Expand Up @@ -2662,3 +2661,17 @@ fn ensure_key_ss58() {
AccountId::from_ss58check("5F4EbSkZz18X36xhbsjvDNs6NuZ82HyYtq5UiJ1h9SBHJXZD").unwrap();
assert_eq!(acc, RootMigController::sorted_members()[0]);
}

#[test]
fn ensure_epmb_weights_sane() {
use sp_io::TestExternalities;
use sp_runtime::Percent;
sp_tracing::try_init_simple();
TestExternalities::default().execute_with(|| {
pallet_election_provider_multi_block::Pallet::<Runtime>::check_all_weights(
<Runtime as frame_system::Config>::BlockWeights::get().max_block,
Some(Percent::from_percent(75)),
Some(Percent::from_percent(50)),
)
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ impl multi_block::Config for Runtime {
// Revert back to signed phase if nothing is submitted and queued, so we prolong the election.
type AreWeDone = multi_block::RevertToSignedIfNotQueuedOf<Self>;
type OnRoundRotation = multi_block::CleanRound<Self>;
type WeightInfo = multi_block::weights::westend::MultiBlockWeightInfo<Self>;
type Signed = MultiBlockElectionSigned;
type WeightInfo = weights::pallet_election_provider_multi_block::WeightInfo<Runtime>;
}

impl multi_block::verifier::Config for Runtime {
Expand All @@ -142,7 +143,7 @@ impl multi_block::verifier::Config for Runtime {
type MaxBackersPerWinnerFinal = MaxBackersPerWinnerFinal;
type SolutionDataProvider = MultiBlockElectionSigned;
type SolutionImprovementThreshold = SolutionImprovementThreshold;
type WeightInfo = multi_block::weights::westend::MultiBlockVerifierWeightInfo<Self>;
type WeightInfo = weights::pallet_election_provider_multi_block_verifier::WeightInfo<Runtime>;
}

parameter_types! {
Expand All @@ -164,7 +165,7 @@ impl multi_block::signed::Config for Runtime {
type RewardBase = RewardBase;
type MaxSubmissions = MaxSubmissions;
type EstimateCallFee = TransactionPayment;
type WeightInfo = multi_block::weights::westend::MultiBlockSignedWeightInfo<Self>;
type WeightInfo = weights::pallet_election_provider_multi_block_signed::WeightInfo<Runtime>;
}

parameter_types! {
Expand All @@ -181,7 +182,7 @@ impl multi_block::unsigned::Config for Runtime {
type OffchainSolver = SequentialPhragmen<AccountId, SolutionAccuracyOf<Runtime>>;
type MinerTxPriority = MinerTxPriority;
type OffchainRepeat = OffchainRepeat;
type WeightInfo = multi_block::weights::westend::MultiBlockUnsignedWeightInfo<Self>;
type WeightInfo = weights::pallet_election_provider_multi_block_unsigned::WeightInfo<Runtime>;
}

parameter_types! {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ pub mod pallet_bags_list;
pub mod pallet_balances;
pub mod pallet_collator_selection;
pub mod pallet_conviction_voting;
pub mod pallet_election_provider_multi_block;
pub mod pallet_election_provider_multi_block_signed;
pub mod pallet_election_provider_multi_block_unsigned;
pub mod pallet_election_provider_multi_block_verifier;
pub mod pallet_fast_unstake;
pub mod pallet_indices;
pub mod pallet_message_queue;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! Autogenerated weights for `pallet_election_provider_multi_block`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-10-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `30261411344a`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024

// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --extrinsic=*
// --runtime=target/production/wbuild/asset-hub-westend-runtime/asset_hub_westend_runtime.wasm
// --pallet=pallet_election_provider_multi_block
// --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-min-squares
// --no-median-slopes

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]

use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;

/// Weight functions for `pallet_election_provider_multi_block`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_election_provider_multi_block::WeightInfo for WeightInfo<T> {
/// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1)
/// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
/// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0)
/// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
fn per_block_nothing() -> Weight {
// Proof Size summary in bytes:
// Measured: `118`
// Estimated: `1603`
// Minimum execution time: 7_306_000 picoseconds.
Weight::from_parts(7_601_000, 0)
.saturating_add(Weight::from_parts(0, 1603))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1)
/// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
/// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0)
/// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
/// Storage: `Staking::ValidatorCount` (r:1 w:0)
/// Proof: `Staking::ValidatorCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`)
/// Storage: `MultiBlockElection::Round` (r:1 w:0)
/// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`)
/// Storage: `Staking::CounterForValidators` (r:1 w:0)
/// Proof: `Staking::CounterForValidators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`)
/// Storage: `Staking::Validators` (r:1001 w:0)
/// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `Measured`)
/// Storage: `MultiBlockElection::DesiredTargets` (r:0 w:1)
/// Proof: `MultiBlockElection::DesiredTargets` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `Measured`)
/// Storage: `MultiBlockElection::PagedTargetSnapshotHash` (r:0 w:1)
/// Proof: `MultiBlockElection::PagedTargetSnapshotHash` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `Measured`)
/// Storage: `MultiBlockElection::PagedTargetSnapshot` (r:0 w:1)
/// Proof: `MultiBlockElection::PagedTargetSnapshot` (`max_values`: None, `max_size`: Some(32026), added: 34501, mode: `Measured`)
fn per_block_snapshot_msp() -> Weight {
// Proof Size summary in bytes:
// Measured: `48346`
// Estimated: `2526811`
// Minimum execution time: 5_889_231_000 picoseconds.
Weight::from_parts(5_978_684_000, 0)
.saturating_add(Weight::from_parts(0, 2526811))
.saturating_add(T::DbWeight::get().reads(1006))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1)
/// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
/// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0)
/// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
/// Storage: `Staking::VoterSnapshotStatus` (r:1 w:1)
/// Proof: `Staking::VoterSnapshotStatus` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `Measured`)
/// Storage: `VoterList::CounterForListNodes` (r:1 w:0)
/// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`)
/// Storage: `VoterList::ListBags` (r:1 w:0)
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `Measured`)
/// Storage: `VoterList::ListNodes` (r:705 w:0)
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `Measured`)
/// Storage: `Staking::Bonded` (r:703 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `Measured`)
/// Storage: `Staking::Ledger` (r:703 w:0)
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `Measured`)
/// Storage: `Staking::Nominators` (r:703 w:0)
/// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `Measured`)
/// Storage: `Staking::Validators` (r:103 w:0)
/// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `Measured`)
/// Storage: `MultiBlockElection::Round` (r:1 w:0)
/// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`)
/// Storage: `Staking::MinimumActiveStake` (r:0 w:1)
/// Proof: `Staking::MinimumActiveStake` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`)
/// Storage: `VoterList::Lock` (r:0 w:1)
/// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `Measured`)
/// Storage: `MultiBlockElection::PagedVoterSnapshot` (r:0 w:1)
/// Proof: `MultiBlockElection::PagedVoterSnapshot` (`max_values`: None, `max_size`: Some(388785), added: 391260, mode: `Measured`)
/// Storage: `MultiBlockElection::PagedVoterSnapshotHash` (r:0 w:1)
/// Proof: `MultiBlockElection::PagedVoterSnapshotHash` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `Measured`)
fn per_block_snapshot_rest() -> Weight {
// Proof Size summary in bytes:
// Measured: `1495638`
// Estimated: `3241503`
// Minimum execution time: 31_397_565_000 picoseconds.
Weight::from_parts(33_054_412_000, 0)
.saturating_add(Weight::from_parts(0, 3241503))
.saturating_add(T::DbWeight::get().reads(2923))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1)
/// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
/// Storage: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0)
/// Storage: `MultiBlockElection::Round` (r:1 w:0)
/// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::SortedScores` (r:1 w:0)
/// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`)
/// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0)
/// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
fn per_block_start_signed_validation() -> Weight {
// Proof Size summary in bytes:
// Measured: `592`
// Estimated: `4057`
// Minimum execution time: 48_861_000 picoseconds.
Weight::from_parts(57_380_000, 0)
.saturating_add(Weight::from_parts(0, 4057))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1)
/// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
/// Storage: `MultiBlockElection::Round` (r:1 w:0)
/// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`)
/// Storage: `MultiBlockElectionVerifier::QueuedValidVariant` (r:1 w:0)
/// Proof: `MultiBlockElectionVerifier::QueuedValidVariant` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`)
/// Storage: `MultiBlockElectionVerifier::QueuedSolutionX` (r:1 w:0)
/// Proof: `MultiBlockElectionVerifier::QueuedSolutionX` (`max_values`: None, `max_size`: Some(33794026), added: 33796501, mode: `Measured`)
/// Storage: `Staking::CurrentEra` (r:1 w:0)
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`)
/// Storage: `Staking::ElectableStashes` (r:1 w:1)
/// Proof: `Staking::ElectableStashes` (`max_values`: Some(1), `max_size`: Some(32002), added: 32497, mode: `Measured`)
/// Storage: `Staking::ErasTotalStake` (r:1 w:1)
/// Proof: `Staking::ErasTotalStake` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `Measured`)
fn export_non_terminal() -> Weight {
// Proof Size summary in bytes:
// Measured: `1479`
// Estimated: `4944`
// Minimum execution time: 74_862_000 picoseconds.
Weight::from_parts(93_436_000, 0)
.saturating_add(Weight::from_parts(0, 4944))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1)
/// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
/// Storage: `MultiBlockElection::Round` (r:1 w:1)
/// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`)
/// Storage: `MultiBlockElectionVerifier::QueuedValidVariant` (r:1 w:1)
/// Proof: `MultiBlockElectionVerifier::QueuedValidVariant` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`)
/// Storage: `MultiBlockElectionVerifier::QueuedSolutionX` (r:32 w:32)
/// Proof: `MultiBlockElectionVerifier::QueuedSolutionX` (`max_values`: None, `max_size`: Some(33794026), added: 33796501, mode: `Measured`)
/// Storage: `MultiBlockElection::PagedVoterSnapshot` (r:32 w:32)
/// Proof: `MultiBlockElection::PagedVoterSnapshot` (`max_values`: None, `max_size`: Some(388785), added: 391260, mode: `Measured`)
/// Storage: `MultiBlockElection::PagedVoterSnapshotHash` (r:32 w:32)
/// Proof: `MultiBlockElection::PagedVoterSnapshotHash` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `Measured`)
/// Storage: `MultiBlockElection::PagedTargetSnapshot` (r:1 w:1)
/// Proof: `MultiBlockElection::PagedTargetSnapshot` (`max_values`: None, `max_size`: Some(32026), added: 34501, mode: `Measured`)
/// Storage: `MultiBlockElection::PagedTargetSnapshotHash` (r:1 w:1)
/// Proof: `MultiBlockElection::PagedTargetSnapshotHash` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `Measured`)
/// Storage: `Staking::CurrentEra` (r:1 w:0)
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`)
/// Storage: `Staking::ElectableStashes` (r:1 w:1)
/// Proof: `Staking::ElectableStashes` (`max_values`: Some(1), `max_size`: Some(32002), added: 32497, mode: `Measured`)
/// Storage: `Staking::ErasTotalStake` (r:1 w:1)
/// Proof: `Staking::ErasTotalStake` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `Measured`)
/// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:0 w:1)
/// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
/// Storage: `MultiBlockElectionVerifier::QueuedSolutionScore` (r:0 w:1)
/// Proof: `MultiBlockElectionVerifier::QueuedSolutionScore` (`max_values`: None, `max_size`: Some(60), added: 2535, mode: `Measured`)
/// Storage: `MultiBlockElection::DesiredTargets` (r:0 w:1)
/// Proof: `MultiBlockElection::DesiredTargets` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `Measured`)
fn export_terminal() -> Weight {
// Proof Size summary in bytes:
// Measured: `4847`
// Estimated: `85037`
// Minimum execution time: 273_049_000 picoseconds.
Weight::from_parts(329_970_000, 0)
.saturating_add(Weight::from_parts(0, 85037))
.saturating_add(T::DbWeight::get().reads(104))
.saturating_add(T::DbWeight::get().writes(106))
}
fn manage() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 198_000 picoseconds.
Weight::from_parts(234_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
}
Loading
Loading