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 @@ -2698,3 +2698,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 @@ -135,6 +135,7 @@ 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 Signed = MultiBlockElectionSigned;
type WeightInfo = weights::pallet_election_provider_multi_block::WeightInfo<Runtime>;
}

Expand Down Expand Up @@ -498,3 +499,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)),
);
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
//! Autogenerated weights for `pallet_election_provider_multi_block`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-12, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2025-11-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `e7fc875cf0e9`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `dc396778ddb0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024

// Executed Command:
Expand Down Expand Up @@ -54,20 +54,20 @@ impl<T: frame_system::Config> pallet_election_provider_multi_block::WeightInfo f
/// 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: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0)
fn on_initialize_nothing() -> Weight {
fn per_block_nothing() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3688`
// Minimum execution time: 9_014_000 picoseconds.
Weight::from_parts(9_476_000, 0)
.saturating_add(Weight::from_parts(0, 3688))
.saturating_add(T::DbWeight::get().reads(3))
// Measured: `118`
// Estimated: `1603`
// Minimum execution time: 7_356_000 picoseconds.
Weight::from_parts(7_708_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)
Expand All @@ -76,28 +76,26 @@ impl<T: frame_system::Config> pallet_election_provider_multi_block::WeightInfo f
/// 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: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0)
/// Proof: `MultiBlockElectionVerifier::StatusStorage` (`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::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 on_initialize_into_snapshot_msp() -> Weight {
fn per_block_snapshot_msp() -> Weight {
// Proof Size summary in bytes:
// Measured: `48451`
// Estimated: `2526916`
// Minimum execution time: 6_260_099_000 picoseconds.
Weight::from_parts(6_346_593_000, 0)
.saturating_add(Weight::from_parts(0, 2526916))
.saturating_add(T::DbWeight::get().reads(1007))
// Measured: `48346`
// Estimated: `2526811`
// Minimum execution time: 6_024_190_000 picoseconds.
Weight::from_parts(6_087_417_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)
Expand All @@ -116,10 +114,6 @@ impl<T: frame_system::Config> pallet_election_provider_multi_block::WeightInfo f
/// 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: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0)
/// Proof: `MultiBlockElectionVerifier::StatusStorage` (`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: `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)
Expand All @@ -128,92 +122,34 @@ impl<T: frame_system::Config> pallet_election_provider_multi_block::WeightInfo f
/// 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 on_initialize_into_snapshot_rest() -> Weight {
fn per_block_snapshot_rest() -> Weight {
// Proof Size summary in bytes:
// Measured: `1495743`
// Estimated: `3241608`
// Minimum execution time: 35_371_801_000 picoseconds.
Weight::from_parts(36_135_165_000, 0)
.saturating_add(Weight::from_parts(0, 3241608))
.saturating_add(T::DbWeight::get().reads(2924))
// Measured: `1495638`
// Estimated: `3241503`
// Minimum execution time: 31_899_661_000 picoseconds.
Weight::from_parts(33_446_559_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: `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::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: `VoterList::ListBags` (r:2 w:0)
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `Measured`)
/// Storage: `Staking::Validators` (r:37 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: UNKNOWN KEY `0x6358acd2035ec4bb863fa981e0c177b9` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x6358acd2035ec4bb863fa981e0c177b9` (r:1 w:0)
/// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0)
/// Proof: `MultiBlockElectionVerifier::StatusStorage` (`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: `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 on_initialize_into_signed() -> Weight {
// Proof Size summary in bytes:
// Measured: `1527537`
// Estimated: `3273402`
// Minimum execution time: 34_672_020_000 picoseconds.
Weight::from_parts(36_788_513_000, 0)
.saturating_add(Weight::from_parts(0, 3273402))
.saturating_add(T::DbWeight::get().reads(2860))
.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: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0)
/// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`)
fn on_initialize_into_signed_validation() -> Weight {
// Proof Size summary in bytes:
// Measured: `417`
// Estimated: `3882`
// Minimum execution time: 40_009_000 picoseconds.
Weight::from_parts(48_764_000, 0)
.saturating_add(Weight::from_parts(0, 3882))
.saturating_add(T::DbWeight::get().reads(3))
.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: `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`)
/// Storage: UNKNOWN KEY `0xc209f5d8eb920681b56c64b8694ea78c` (r:1 w:0)
/// Proof: UNKNOWN KEY `0xc209f5d8eb920681b56c64b8694ea78c` (r:1 w:0)
/// Storage: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0)
fn on_initialize_into_unsigned() -> Weight {
fn per_block_start_signed_validation() -> Weight {
// Proof Size summary in bytes:
// Measured: `417`
// Estimated: `3882`
// Minimum execution time: 43_182_000 picoseconds.
Weight::from_parts(50_229_000, 0)
.saturating_add(Weight::from_parts(0, 3882))
.saturating_add(T::DbWeight::get().reads(4))
// Measured: `592`
// Estimated: `4057`
// Minimum execution time: 51_167_000 picoseconds.
Weight::from_parts(59_251_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)
Expand All @@ -234,8 +170,8 @@ impl<T: frame_system::Config> pallet_election_provider_multi_block::WeightInfo f
// Proof Size summary in bytes:
// Measured: `1479`
// Estimated: `4944`
// Minimum execution time: 79_265_000 picoseconds.
Weight::from_parts(97_578_000, 0)
// Minimum execution time: 73_201_000 picoseconds.
Weight::from_parts(93_569_000, 0)
.saturating_add(Weight::from_parts(0, 4944))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(3))
Expand Down Expand Up @@ -272,8 +208,8 @@ impl<T: frame_system::Config> pallet_election_provider_multi_block::WeightInfo f
// Proof Size summary in bytes:
// Measured: `4847`
// Estimated: `85037`
// Minimum execution time: 286_577_000 picoseconds.
Weight::from_parts(411_747_000, 0)
// Minimum execution time: 272_512_000 picoseconds.
Weight::from_parts(324_716_000, 0)
.saturating_add(Weight::from_parts(0, 85037))
.saturating_add(T::DbWeight::get().reads(104))
.saturating_add(T::DbWeight::get().writes(106))
Expand All @@ -298,8 +234,8 @@ impl<T: frame_system::Config> pallet_election_provider_multi_block::WeightInfo f
// Proof Size summary in bytes:
// Measured: `372173`
// Estimated: `375638`
// Minimum execution time: 3_130_891_000 picoseconds.
Weight::from_parts(3_242_891_000, 0)
// Minimum execution time: 2_971_188_000 picoseconds.
Weight::from_parts(3_184_664_000, 0)
.saturating_add(Weight::from_parts(0, 375638))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(2))
Expand All @@ -318,8 +254,8 @@ impl<T: frame_system::Config> pallet_election_provider_multi_block::WeightInfo f
// Proof Size summary in bytes:
// Measured: `308`
// Estimated: `3773`
// Minimum execution time: 58_785_000 picoseconds.
Weight::from_parts(72_105_000, 0)
// Minimum execution time: 59_840_000 picoseconds.
Weight::from_parts(71_832_000, 0)
.saturating_add(Weight::from_parts(0, 3773))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
Expand Down
Loading
Loading