mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 15:11:02 +00:00
Companion PR for substrate PR 8072 - Add a config field to babe epochs (#2467)
* Add a config field to babe epochs * Fix test * Add BABE_GENESIS_EPOCH_CONFIG consts * Use PrimaryAndSecondaryVRFSlots and remove newlines * Make epoch_configs Some * Fix tests * Fix test service tests * Add a BabeEpochConfigMigrations OnRuntimeUpgrade * Apply suggestions * Use PrimaryAndSecondaryPlainSlots in kusama * Remove migration from test runtime and rococo * Add HasPalletPrefix * Rename to BabePalletPrefix and change BabeApi -> Babe * "Update Substrate" * Update substrate * Resolve parantheses errors Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -99,6 +99,13 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
transaction_version: 4,
|
||||
};
|
||||
|
||||
/// The BABE epoch configuration at genesis.
|
||||
pub const BABE_GENESIS_EPOCH_CONFIG: babe_primitives::BabeEpochConfiguration =
|
||||
babe_primitives::BabeEpochConfiguration {
|
||||
c: PRIMARY_PROBABILITY,
|
||||
allowed_slots: babe_primitives::AllowedSlots::PrimaryAndSecondaryVRFSlots
|
||||
};
|
||||
|
||||
/// Native version.
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub fn native_version() -> NativeVersion {
|
||||
@@ -1036,6 +1043,24 @@ construct_runtime! {
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_babe::migrations::BabePalletPrefix for Runtime {
|
||||
fn pallet_prefix() -> &'static str {
|
||||
"Babe"
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BabeEpochConfigMigrations;
|
||||
impl frame_support::traits::OnRuntimeUpgrade for BabeEpochConfigMigrations {
|
||||
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
||||
pallet_babe::migrations::add_epoch_configuration::<Runtime>(
|
||||
babe_primitives::BabeEpochConfiguration {
|
||||
allowed_slots: babe_primitives::AllowedSlots::PrimaryAndSecondaryPlainSlots,
|
||||
..BABE_GENESIS_EPOCH_CONFIG
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
||||
/// Block header type as expected by this runtime.
|
||||
@@ -1067,6 +1092,7 @@ pub type Executive = frame_executive::Executive<
|
||||
frame_system::ChainContext<Runtime>,
|
||||
Runtime,
|
||||
AllModules,
|
||||
BabeEpochConfigMigrations,
|
||||
>;
|
||||
/// The payload being signed in the transactions.
|
||||
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
||||
@@ -1236,10 +1262,10 @@ sp_api::impl_runtime_apis! {
|
||||
babe_primitives::BabeGenesisConfiguration {
|
||||
slot_duration: Babe::slot_duration(),
|
||||
epoch_length: EpochDuration::get(),
|
||||
c: PRIMARY_PROBABILITY,
|
||||
c: BABE_GENESIS_EPOCH_CONFIG.c,
|
||||
genesis_authorities: Babe::authorities(),
|
||||
randomness: Babe::randomness(),
|
||||
allowed_slots: babe_primitives::AllowedSlots::PrimaryAndSecondaryVRFSlots,
|
||||
allowed_slots: BABE_GENESIS_EPOCH_CONFIG.allowed_slots,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user