-
Notifications
You must be signed in to change notification settings - Fork 378
Feature Flagging Consensus Hook Type Parameter #2911
Changes from 2 commits
5f0980a
e155997
7afe68b
d1238b0
6ff8923
eec072d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,3 +77,5 @@ runtime-benchmarks = [ | |
] | ||
|
||
try-runtime = ["frame-support/try-runtime"] | ||
|
||
parameterized-consensus-hook = [] | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,11 +225,14 @@ const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( | |
|
||
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included | ||
/// into the relay chain. | ||
#[cfg(feature = "parameterized-consensus-hook")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't actually need feature-flags in the parachain-template, as it's meant to be example code. So it should use the most recently available logic. |
||
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. | ||
#[cfg(feature = "parameterized-consensus-hook")] | ||
const BLOCK_PROCESSING_VELOCITY: u32 = 1; | ||
/// Relay chain slot duration, in seconds. | ||
#[cfg(feature = "parameterized-consensus-hook")] | ||
const RELAY_CHAIN_SLOT_DURATION: u32 = 6; | ||
|
||
/// The version information used to identify this runtime when compiled natively. | ||
|
@@ -388,6 +391,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime { | |
type XcmpMessageHandler = XcmpQueue; | ||
type ReservedXcmpWeight = ReservedXcmpWeight; | ||
type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; | ||
#[cfg(feature = "parameterized-consensus-hook")] | ||
type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< | ||
Runtime, | ||
RELAY_CHAIN_SLOT_DURATION, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,9 @@ use sp_version::NativeVersion; | |
use sp_version::RuntimeVersion; | ||
|
||
use codec::{Decode, Encode, MaxEncodedLen}; | ||
use constants::{consensus::*, currency::*, fee::WeightToFee}; | ||
#[cfg(feature = "parameterized-consensus-hook")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need the feature flag in system-parachain runtimes either, as they're binaries, not libraries. |
||
use constants::consensus::*; | ||
use constants::{currency::*, fee::WeightToFee}; | ||
use frame_support::{ | ||
construct_runtime, | ||
dispatch::DispatchClass, | ||
|
@@ -537,6 +539,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime { | |
type XcmpMessageHandler = XcmpQueue; | ||
type ReservedXcmpWeight = ReservedXcmpWeight; | ||
type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; | ||
#[cfg(feature = "parameterized-consensus-hook")] | ||
type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< | ||
Runtime, | ||
RELAY_CHAIN_SLOT_DURATION, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -286,6 +286,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime { | |
type XcmpMessageHandler = (); | ||
type ReservedXcmpWeight = (); | ||
type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::AnyRelayNumber; | ||
#[cfg(feature = "parameterized-consensus-hook")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. likewise here - it seems fine for the test runtime (which is effectively a binary crate used internally, not a library) to explicitly use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which way is best to get this to compile without the feature flag here? I expect some change is needed around line 215 of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we just have it unconditionally enable the crate feature in its There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That does make sense 👍 Will be back on to try it this evening. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Robert probably meant doing cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false, features = [
"parameterized-consensus-hook",
] }
instead of introducing a feature to test-crates. |
||
type ConsensusHook = cumulus_pallet_parachain_system::consensus_hook::RequireParentIncluded; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing endlines though