Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
use the experimental feature flag instead
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier committed Aug 4, 2023
1 parent 2bf4d45 commit aeef644
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion bin/node-template/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -114,3 +114,4 @@ try-runtime = [
"pallet-transaction-payment/try-runtime",
"sp-runtime/try-runtime"
]
experimental = ["pallet-aura/experimental"]
2 changes: 2 additions & 0 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ impl pallet_aura::Config for Runtime {
type DisabledValidators = ();
type MaxAuthorities = ConstU32<32>;
type AllowMultipleBlocksPerSlot = ConstBool<false>;

#[cfg(feature = "experimental")]
type SlotDuration = pallet_aura::MinimumPeriodTimesTwo<Runtime>;
}

Expand Down
2 changes: 1 addition & 1 deletion frame/aura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ try-runtime = [
"pallet-timestamp/try-runtime",
"sp-runtime/try-runtime"
]
explicit-slot-duration = []
experimental = []
10 changes: 5 additions & 5 deletions frame/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(sp_std::marker::PhantomData<T>);

Expand Down Expand Up @@ -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<<Self as pallet_timestamp::Config>::Moment>;
}

Expand Down Expand Up @@ -245,12 +245,12 @@ impl<T: Config> Pallet<T> {

/// 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.
Expand Down
2 changes: 1 addition & 1 deletion frame/aura/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SLOT_DURATION>;
}

Expand Down

0 comments on commit aeef644

Please sign in to comment.