From aeef6446cd4282aa02337b21edbe80f68e247f94 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Thu, 3 Aug 2023 20:58:26 -0700 Subject: [PATCH] use the experimental feature flag instead --- bin/node-template/runtime/Cargo.toml | 3 ++- bin/node-template/runtime/src/lib.rs | 2 ++ frame/aura/Cargo.toml | 2 +- frame/aura/src/lib.rs | 10 +++++----- frame/aura/src/mock.rs | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bin/node-template/runtime/Cargo.toml b/bin/node-template/runtime/Cargo.toml index f2186dbfee745..51e30187c9d63 100644 --- a/bin/node-template/runtime/Cargo.toml +++ b/bin/node-template/runtime/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] } scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } -pallet-aura = { version = "4.0.0-dev", default-features = false, features = ["explicit-slot-duration"], path = "../../../frame/aura" } +pallet-aura = { version = "4.0.0-dev", default-features = false, path = "../../../frame/aura" } pallet-balances = { version = "4.0.0-dev", default-features = false, path = "../../../frame/balances" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../../../frame/support" } pallet-grandpa = { version = "4.0.0-dev", default-features = false, path = "../../../frame/grandpa" } @@ -114,3 +114,4 @@ try-runtime = [ "pallet-transaction-payment/try-runtime", "sp-runtime/try-runtime" ] +experimental = ["pallet-aura/experimental"] diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index b03835912e5cc..c3375d2ee601a 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/bin/node-template/runtime/src/lib.rs @@ -207,6 +207,8 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<32>; type AllowMultipleBlocksPerSlot = ConstBool; + + #[cfg(feature = "experimental")] type SlotDuration = pallet_aura::MinimumPeriodTimesTwo; } diff --git a/frame/aura/Cargo.toml b/frame/aura/Cargo.toml index 4c6558219ceb4..99c8c2fb497f0 100644 --- a/frame/aura/Cargo.toml +++ b/frame/aura/Cargo.toml @@ -48,4 +48,4 @@ try-runtime = [ "pallet-timestamp/try-runtime", "sp-runtime/try-runtime" ] -explicit-slot-duration = [] +experimental = [] diff --git a/frame/aura/src/lib.rs b/frame/aura/src/lib.rs index 856730dda8854..641d5fc47e90e 100644 --- a/frame/aura/src/lib.rs +++ b/frame/aura/src/lib.rs @@ -67,7 +67,7 @@ const LOG_TARGET: &str = "runtime::aura"; /// This was the default behavior of the Aura pallet and may be used for /// backwards compatibility. /// -/// Note that this type is likely not useful without the `explicit-slot-duration` +/// Note that this type is likely not useful without the `experimental` /// feature. pub struct MinimumPeriodTimesTwo(sp_std::marker::PhantomData); @@ -118,9 +118,9 @@ pub mod pallet { /// /// For backwards compatibility either use [`MinimumPeriodTimesTwo`] or a const. /// - /// This associated type is only present when compiled with the `explicit-slot-duration` + /// This associated type is only present when compiled with the `experimental` /// feature. - #[cfg(feature = "explicit-slot-duration")] + #[cfg(feature = "experimental")] type SlotDuration: Get<::Moment>; } @@ -245,12 +245,12 @@ impl Pallet { /// Determine the Aura slot-duration based on the Timestamp module configuration. pub fn slot_duration() -> T::Moment { - #[cfg(feature = "explicit-slot-duration")] + #[cfg(feature = "experimental")] { T::SlotDuration::get() } - #[cfg(not(feature = "explicit-slot-duration"))] + #[cfg(not(feature = "experimental"))] { // we double the minimum block-period so each author can always propose within // the majority of its slot. diff --git a/frame/aura/src/mock.rs b/frame/aura/src/mock.rs index 04a0564f34ecd..39b798c2f6841 100644 --- a/frame/aura/src/mock.rs +++ b/frame/aura/src/mock.rs @@ -103,7 +103,7 @@ impl pallet_aura::Config for Test { type MaxAuthorities = ConstU32<10>; type AllowMultipleBlocksPerSlot = AllowMultipleBlocksPerSlot; - #[cfg(feature = "explicit-slot-duration")] + #[cfg(feature = "experimental")] type SlotDuration = ConstU64; }