mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 15:41:02 +00:00
westend: remove SessionKeys migration already applied on-chain (#2363)
Westend now successfully updated to `spec: 103000`, we **have to remove** the session keys migration before the next release as it doesn't gracefully handle reapplying it.
This commit is contained in:
@@ -425,17 +425,6 @@ parameter_types! {
|
|||||||
pub const Offset: BlockNumber = 0;
|
pub const Offset: BlockNumber = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_opaque_keys! {
|
|
||||||
pub struct OldSessionKeys {
|
|
||||||
pub grandpa: Grandpa,
|
|
||||||
pub babe: Babe,
|
|
||||||
pub im_online: ImOnline,
|
|
||||||
pub para_validator: Initializer,
|
|
||||||
pub para_assignment: ParaSessionInfo,
|
|
||||||
pub authority_discovery: AuthorityDiscovery,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_opaque_keys! {
|
impl_opaque_keys! {
|
||||||
pub struct SessionKeys {
|
pub struct SessionKeys {
|
||||||
pub grandpa: Grandpa,
|
pub grandpa: Grandpa,
|
||||||
@@ -448,32 +437,6 @@ impl_opaque_keys! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove this when removing `OldSessionKeys`
|
|
||||||
fn transform_session_keys(v: AccountId, old: OldSessionKeys) -> SessionKeys {
|
|
||||||
SessionKeys {
|
|
||||||
grandpa: old.grandpa,
|
|
||||||
babe: old.babe,
|
|
||||||
im_online: old.im_online,
|
|
||||||
para_validator: old.para_validator,
|
|
||||||
para_assignment: old.para_assignment,
|
|
||||||
authority_discovery: old.authority_discovery,
|
|
||||||
beefy: {
|
|
||||||
// From Session::upgrade_keys():
|
|
||||||
//
|
|
||||||
// Care should be taken that the raw versions of the
|
|
||||||
// added keys are unique for every `ValidatorId, KeyTypeId` combination.
|
|
||||||
// This is an invariant that the session pallet typically maintains internally.
|
|
||||||
//
|
|
||||||
// So, produce a dummy value that's unique for the `ValidatorId, KeyTypeId` combination.
|
|
||||||
let mut id: BeefyId = sp_application_crypto::ecdsa::Public::from_raw([0u8; 33]).into();
|
|
||||||
let id_raw: &mut [u8] = id.as_mut();
|
|
||||||
id_raw[1..33].copy_from_slice(v.as_ref());
|
|
||||||
id_raw[0..4].copy_from_slice(b"beef");
|
|
||||||
id
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl pallet_session::Config for Runtime {
|
impl pallet_session::Config for Runtime {
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type ValidatorId = AccountId;
|
type ValidatorId = AccountId;
|
||||||
@@ -1560,16 +1523,6 @@ pub type Migrations = migrations::Unreleased;
|
|||||||
pub mod migrations {
|
pub mod migrations {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
/// Upgrade Session keys to include BEEFY key.
|
|
||||||
/// When this is removed, should also remove `OldSessionKeys`.
|
|
||||||
pub struct UpgradeSessionKeys;
|
|
||||||
impl frame_support::traits::OnRuntimeUpgrade for UpgradeSessionKeys {
|
|
||||||
fn on_runtime_upgrade() -> Weight {
|
|
||||||
Session::upgrade_keys::<OldSessionKeys, _>(transform_session_keys);
|
|
||||||
Perbill::from_percent(50) * BlockWeights::get().max_block
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Unreleased migrations. Add new ones here:
|
/// Unreleased migrations. Add new ones here:
|
||||||
pub type Unreleased = (
|
pub type Unreleased = (
|
||||||
pallet_im_online::migration::v1::Migration<Runtime>,
|
pallet_im_online::migration::v1::Migration<Runtime>,
|
||||||
@@ -1578,7 +1531,6 @@ pub mod migrations {
|
|||||||
assigned_slots::migration::v1::MigrateToV1<Runtime>,
|
assigned_slots::migration::v1::MigrateToV1<Runtime>,
|
||||||
parachains_scheduler::migration::v1::MigrateToV1<Runtime>,
|
parachains_scheduler::migration::v1::MigrateToV1<Runtime>,
|
||||||
parachains_configuration::migration::v8::MigrateToV8<Runtime>,
|
parachains_configuration::migration::v8::MigrateToV8<Runtime>,
|
||||||
UpgradeSessionKeys,
|
|
||||||
parachains_configuration::migration::v9::MigrateToV9<Runtime>,
|
parachains_configuration::migration::v9::MigrateToV9<Runtime>,
|
||||||
paras_registrar::migration::MigrateToV1<Runtime, ()>,
|
paras_registrar::migration::MigrateToV1<Runtime, ()>,
|
||||||
pallet_nomination_pools::migration::versioned_migrations::V5toV6<Runtime>,
|
pallet_nomination_pools::migration::versioned_migrations::V5toV6<Runtime>,
|
||||||
|
|||||||
Reference in New Issue
Block a user