From 69aa11f680a412a5d8fe3dc16600de345f488ad0 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Tue, 24 May 2022 17:24:43 +0200 Subject: [PATCH] fix: `--feature fast-runtime` on westend (#5585) The westend runtime was missing the fast runtime for `EpochDuration` which caused the epoch be 1 hour which isn't fast. This PR changes the `EpochDuration` to 2 minutes when `--fast-runtime` is enabled, the same as polkadot and kusama. --- polkadot/runtime/westend/src/lib.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index 68a8f0bba0..c824ceac2b 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -44,8 +44,8 @@ use primitives::v2::{ }; use runtime_common::{ assigned_slots, auctions, crowdloan, elections::OnChainAccuracy, impl_runtime_weights, - impls::ToAuthor, paras_registrar, paras_sudo_wrapper, slots, BlockHashCount, BlockLength, - CurrencyToVote, SlowAdjustingFeeUpdate, + impls::ToAuthor, paras_registrar, paras_sudo_wrapper, prod_or_fast, slots, BlockHashCount, + BlockLength, CurrencyToVote, SlowAdjustingFeeUpdate, }; use runtime_parachains::{ configuration as parachains_configuration, disputes as parachains_disputes, @@ -206,7 +206,10 @@ impl pallet_preimage::Config for Runtime { } parameter_types! { - pub const EpochDuration: u64 = EPOCH_DURATION_IN_SLOTS as u64; + pub const EpochDuration: u64 = prod_or_fast!( + EPOCH_DURATION_IN_SLOTS as u64, + 2 * MINUTES as u64 + ); pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; pub const ReportLongevity: u64 = BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * EpochDuration::get(); @@ -342,8 +345,14 @@ impl pallet_session::historical::Config for Runtime { parameter_types! { // phase durations. 1/4 of the last session for each. - pub const SignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4; - pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4; + pub SignedPhase: u32 = prod_or_fast!( + EPOCH_DURATION_IN_SLOTS / 4, + (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2) + ); + pub UnsignedPhase: u32 = prod_or_fast!( + EPOCH_DURATION_IN_SLOTS / 4, + (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2) + ); // signed config pub const SignedMaxSubmissions: u32 = 128;