From 220049e09de3bf715986b67273c4cac5ad40211c Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Fri, 15 Mar 2024 20:31:28 +0200 Subject: [PATCH] Polkadot: Remove applied migrations (#241) Changes: - Remove all migrations from Polkadot since 1.1.2 was enacted on-chain. Two other commits have been manually back-ported to the release branch and are not shown in the diff: - Enable idempotency check (#164) - [CI] Run on all MRs and on release branch (#173) [x] Does not require a CHANGELOG entry --------- Signed-off-by: Oliver Tale-Yazdi --- relay/polkadot/src/lib.rs | 56 +-------------------------------------- 1 file changed, 1 insertion(+), 55 deletions(-) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 35874e6773..ddae0d8326 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -429,17 +429,6 @@ impl pallet_authorship::Config for Runtime { type EventHandler = (Staking, ImOnline); } -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! { pub struct SessionKeys { pub grandpa: Grandpa, @@ -452,32 +441,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 { type RuntimeEvent = RuntimeEvent; type ValidatorId = AccountId; @@ -1687,25 +1650,8 @@ pub type Migrations = migrations::Unreleased; /// The runtime migrations per release. #[allow(deprecated, missing_docs)] pub mod migrations { - 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::(transform_session_keys); - Perbill::from_percent(50) * BlockWeights::get().max_block - } - } - /// Unreleased migrations. Add new ones here: - pub type Unreleased = ( - // Upgrade SessionKeys to include BEEFY key - UpgradeSessionKeys, - pallet_nomination_pools::migration::versioned_migrations::V5toV6, - pallet_nomination_pools::migration::versioned_migrations::V6ToV7, - ); + pub type Unreleased = (); } /// Unchecked extrinsic type as expected by this runtime.