Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2633,3 +2633,20 @@ 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(
// of the max block weights..
<Runtime as frame_system::Config>::BlockWeights::get().max_block,
// more than 75% is a hard stop..
Some(Percent::from_percent(75)),
// and more than 50% a warning.
Some(Percent::from_percent(50)),
)
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,12 @@ 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>;
<<<<<<< HEAD
type WeightInfo = multi_block::weights::westend::MultiBlockWeightInfo<Self>;
=======
type Signed = MultiBlockElectionSigned;
type WeightInfo = weights::pallet_election_provider_multi_block::WeightInfo<Runtime>;
>>>>>>> 05a3fb10 (Staking-Async + EPMB: Migrate operations to `poll` (#9925))
}

impl multi_block::verifier::Config for Runtime {
Expand Down Expand Up @@ -501,3 +506,20 @@ where
UncheckedExtrinsic::new_bare(call)
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn all_epmb_weights_sane() {
sp_tracing::try_init_simple();
sp_io::TestExternalities::default().execute_with(|| {
pallet_election_provider_multi_block::Pallet::<Runtime>::check_all_weights(
<Runtime as frame_system::Config>::BlockWeights::get().max_block,
Some(sp_runtime::Percent::from_percent(75)),
Some(sp_runtime::Percent::from_percent(50)),
);
})
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
// 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::signed`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `dc396778ddb0`, 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::signed
// --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::signed`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_election_provider_multi_block::signed::WeightInfo for WeightInfo<T> {
/// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:0)
/// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::Invulnerables` (r:1 w:0)
/// Proof: `MultiBlockElectionSigned::Invulnerables` (`max_values`: Some(1), `max_size`: Some(513), added: 1008, 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: `MultiBlockElectionSigned::SortedScores` (r:1 w:1)
/// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`)
/// Storage: `Balances::Holds` (r:1 w:1)
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(265), added: 2740, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:0 w:1)
/// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`)
fn register_not_full() -> Weight {
// Proof Size summary in bytes:
// Measured: `3252`
// Estimated: `6717`
// Minimum execution time: 85_153_000 picoseconds.
Weight::from_parts(87_582_000, 0)
.saturating_add(Weight::from_parts(0, 6717))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:0)
/// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::Invulnerables` (r:1 w:0)
/// Proof: `MultiBlockElectionSigned::Invulnerables` (`max_values`: Some(1), `max_size`: Some(513), added: 1008, 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: `MultiBlockElectionSigned::SortedScores` (r:1 w:1)
/// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`)
/// Storage: `Balances::Holds` (r:2 w:2)
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(265), added: 2740, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:1 w:2)
/// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:32 w:32)
/// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46478), added: 48953, mode: `Measured`)
fn register_eject() -> Weight {
// Proof Size summary in bytes:
// Measured: `7851`
// Estimated: `88041`
// Minimum execution time: 230_285_000 picoseconds.
Weight::from_parts(237_361_000, 0)
.saturating_add(Weight::from_parts(0, 88041))
.saturating_add(T::DbWeight::get().reads(39))
.saturating_add(T::DbWeight::get().writes(37))
}
/// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:0)
/// 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: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:1 w:1)
/// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::Invulnerables` (r:1 w:0)
/// Proof: `MultiBlockElectionSigned::Invulnerables` (`max_values`: Some(1), `max_size`: Some(513), added: 1008, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::SortedScores` (r:1 w:0)
/// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`)
/// Storage: `Balances::Holds` (r:1 w:1)
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(265), added: 2740, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:1 w:1)
/// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46478), added: 48953, mode: `Measured`)
fn submit_page() -> Weight {
// Proof Size summary in bytes:
// Measured: `3785`
// Estimated: `7250`
// Minimum execution time: 177_318_000 picoseconds.
Weight::from_parts(196_911_000, 0)
.saturating_add(Weight::from_parts(0, 7250))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:0)
/// 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: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:1 w:1)
/// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::Invulnerables` (r:1 w:0)
/// Proof: `MultiBlockElectionSigned::Invulnerables` (`max_values`: Some(1), `max_size`: Some(513), added: 1008, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::SortedScores` (r:1 w:0)
/// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`)
/// Storage: `Balances::Holds` (r:1 w:1)
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(265), added: 2740, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:1 w:1)
/// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46478), added: 48953, mode: `Measured`)
fn unset_page() -> Weight {
// Proof Size summary in bytes:
// Measured: `3887`
// Estimated: `7352`
// Minimum execution time: 164_593_000 picoseconds.
Weight::from_parts(207_127_000, 0)
.saturating_add(Weight::from_parts(0, 7352))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:0)
/// 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: `MultiBlockElectionSigned::SortedScores` (r:1 w:1)
/// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:32 w:32)
/// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46478), added: 48953, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:1 w:1)
/// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`)
/// Storage: `Balances::Holds` (r:1 w:1)
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(265), added: 2740, mode: `Measured`)
fn bail() -> Weight {
// Proof Size summary in bytes:
// Measured: `4717`
// Estimated: `84907`
// Minimum execution time: 141_746_000 picoseconds.
Weight::from_parts(146_143_000, 0)
.saturating_add(Weight::from_parts(0, 84907))
.saturating_add(T::DbWeight::get().reads(37))
.saturating_add(T::DbWeight::get().writes(35))
}
/// 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:1)
/// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:32 w:32)
/// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46478), added: 48953, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:1 w:1)
/// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`)
/// Storage: `Balances::Holds` (r:1 w:1)
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(265), added: 2740, mode: `Measured`)
/// Storage: `MultiBlockElectionSigned::Invulnerables` (r:1 w:0)
/// Proof: `MultiBlockElectionSigned::Invulnerables` (`max_values`: Some(1), `max_size`: Some(513), added: 1008, mode: `Measured`)
/// The range of component `p` is `[1, 32]`.
fn clear_old_round_data(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `3709 + p * (32 ±0)`
// Estimated: `7174 + p * (2507 ±0)`
// Minimum execution time: 86_306_000 picoseconds.
Weight::from_parts(88_268_158, 0)
.saturating_add(Weight::from_parts(0, 7174))
// Standard Error: 7_479
.saturating_add(Weight::from_parts(1_129_962, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into())))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into())))
.saturating_add(Weight::from_parts(0, 2507).saturating_mul(p.into()))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// 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::unsigned`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `dc396778ddb0`, 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::unsigned
// --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::unsigned`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_election_provider_multi_block::unsigned::WeightInfo for WeightInfo<T> {
/// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:0)
/// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
/// Storage: UNKNOWN KEY `0x33ed3d010c1fea25c2adbfba9297161f` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x33ed3d010c1fea25c2adbfba9297161f` (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: `MultiBlockElectionVerifier::QueuedSolutionScore` (r:1 w:0)
/// Proof: `MultiBlockElectionVerifier::QueuedSolutionScore` (`max_values`: None, `max_size`: Some(60), added: 2535, mode: `Measured`)
/// Storage: `MultiBlockElectionVerifier::MinimumScore` (r:1 w:0)
/// Proof: `MultiBlockElectionVerifier::MinimumScore` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `Measured`)
/// Storage: `MultiBlockElection::DesiredTargets` (r:1 w:0)
/// Proof: `MultiBlockElection::DesiredTargets` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `Measured`)
/// Storage: UNKNOWN KEY `0xc209f5d8eb920681b56c64b8694ea78c` (r:1 w:0)
/// Proof: UNKNOWN KEY `0xc209f5d8eb920681b56c64b8694ea78c` (r:1 w:0)
fn validate_unsigned() -> Weight {
// Proof Size summary in bytes:
// Measured: `351`
// Estimated: `3816`
// Minimum execution time: 37_670_000 picoseconds.
Weight::from_parts(45_454_000, 0)
.saturating_add(Weight::from_parts(0, 3816))
.saturating_add(T::DbWeight::get().reads(7))
}
/// Storage: UNKNOWN KEY `0x33ed3d010c1fea25c2adbfba9297161f` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x33ed3d010c1fea25c2adbfba9297161f` (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: `MultiBlockElectionVerifier::QueuedSolutionScore` (r:1 w:1)
/// Proof: `MultiBlockElectionVerifier::QueuedSolutionScore` (`max_values`: None, `max_size`: Some(60), added: 2535, mode: `Measured`)
/// Storage: `MultiBlockElectionVerifier::MinimumScore` (r:1 w:0)
/// Proof: `MultiBlockElectionVerifier::MinimumScore` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `Measured`)
/// Storage: `MultiBlockElection::PagedTargetSnapshot` (r:1 w:0)
/// Proof: `MultiBlockElection::PagedTargetSnapshot` (`max_values`: None, `max_size`: Some(32026), added: 34501, mode: `Measured`)
/// Storage: `MultiBlockElection::PagedVoterSnapshot` (r:2 w:0)
/// Proof: `MultiBlockElection::PagedVoterSnapshot` (`max_values`: None, `max_size`: Some(388785), added: 391260, mode: `Measured`)
/// Storage: `MultiBlockElection::DesiredTargets` (r:1 w:0)
/// Proof: `MultiBlockElection::DesiredTargets` (`max_values`: None, `max_size`: Some(16), added: 2491, 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::QueuedSolutionY` (r:0 w:2)
/// Proof: `MultiBlockElectionVerifier::QueuedSolutionY` (`max_values`: None, `max_size`: Some(33794026), added: 33796501, mode: `Measured`)
fn submit_unsigned() -> Weight {
// Proof Size summary in bytes:
// Measured: `760999`
// Estimated: `766939`
// Minimum execution time: 1_214_154_000 picoseconds.
Weight::from_parts(1_377_229_000, 0)
.saturating_add(Weight::from_parts(0, 766939))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(3))
}
}
Loading
Loading