From 68a78b5f263073326d4c423cbb6bbce7814998cd Mon Sep 17 00:00:00 2001 From: Alessandro Siniscalchi Date: Fri, 20 Sep 2024 11:36:10 +0200 Subject: [PATCH] fix the hook for the cumulus consensus --- .../src/configs/cumulus_parachain_system.rs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/runtime/laos/src/configs/cumulus_parachain_system.rs b/runtime/laos/src/configs/cumulus_parachain_system.rs index 48dc8101..e35c566e 100644 --- a/runtime/laos/src/configs/cumulus_parachain_system.rs +++ b/runtime/laos/src/configs/cumulus_parachain_system.rs @@ -38,12 +38,29 @@ impl cumulus_pallet_parachain_system::Config for Runtime { type ReservedDmpWeight = ReservedDmpWeight; type XcmpMessageHandler = XcmpQueue; type ReservedXcmpWeight = ReservedXcmpWeight; - type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; - type ConsensusHook = cumulus_pallet_parachain_system::ExpectParentIncluded; + type CheckAssociatedRelayNumber = + cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; + type ConsensusHook = ConsensusHook; type DmpQueue = frame_support::traits::EnqueueWithOrigin; type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo; } +/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included +/// into the relay chain. +const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1; +/// How many parachain blocks are processed by the relay chain per parent. Limits the +/// number of blocks authored per slot. +const BLOCK_PROCESSING_VELOCITY: u32 = 1; +/// Relay chain slot duration, in milliseconds. +const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; + +type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< + Runtime, + RELAY_CHAIN_SLOT_DURATION_MILLIS, + BLOCK_PROCESSING_VELOCITY, + UNINCLUDED_SEGMENT_CAPACITY, +>; + // This struct is never instantiated, it is only used for the `CheckInherents` implementation. // It will be deprecated soon: // https://github.com/moonbeam-foundation/moonbeam/blob/26a88a553563647992f39fbd1cce3d45a363e991/runtime/moonbeam/src/lib.rs#L1585-L1614