Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,40 @@ construct_runtime! {
}
}

const TECHNICAL_MEMBERSHIP_OLD_PREFIX: &str = "Instance1Membership";
pub struct TechnicalMembershipStoragePrefixMigration;
impl frame_support::traits::OnRuntimeUpgrade for TechnicalMembershipStoragePrefixMigration {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
use frame_support::traits::PalletInfo;
let name = <Runtime as frame_system::Config>::PalletInfo::name::<TechnicalMembership>()
.expect("membership is part of pallets in construct_runtime, so it has a name; qed");
pallet_membership::migrations::v3_1::migrate::<Runtime, TechnicalMembership, _>(
TECHNICAL_MEMBERSHIP_OLD_PREFIX,
name,
)
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
use frame_support::traits::PalletInfo;
let name = <Runtime as frame_system::Config>::PalletInfo::name::<TechnicalMembership>()
.expect("membership is part of pallets in construct_runtime, so it has a name; qed");
pallet_membership::migrations::v3_1::pre_migration::<Runtime, TechnicalMembership, _>(
TECHNICAL_MEMBERSHIP_OLD_PREFIX,
name,
);
Ok(())
}

#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
pallet_membership::migrations::v3_1::post_migration::<TechnicalMembership>(
TECHNICAL_MEMBERSHIP_OLD_PREFIX,
);
Ok(())
}
}

/// The address format for describing accounts.
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
/// Block header type as expected by this runtime.
Expand Down Expand Up @@ -1507,6 +1541,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
TechnicalMembershipStoragePrefixMigration,
>;
/// The payload being signed in the transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
Expand Down
36 changes: 35 additions & 1 deletion runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,40 @@ impl frame_support::traits::OnRuntimeUpgrade for GrandpaStoragePrefixMigration {
}
}

const TECHNICAL_MEMBERSHIP_OLD_PREFIX: &str = "Instance1Membership";
pub struct TechnicalMembershipStoragePrefixMigration;
impl frame_support::traits::OnRuntimeUpgrade for TechnicalMembershipStoragePrefixMigration {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
use frame_support::traits::PalletInfo;
let name = <Runtime as frame_system::Config>::PalletInfo::name::<TechnicalMembership>()
.expect("membership is part of pallets in construct_runtime, so it has a name; qed");
pallet_membership::migrations::v3_1::migrate::<Runtime, TechnicalMembership, _>(
TECHNICAL_MEMBERSHIP_OLD_PREFIX,
name,
)
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
use frame_support::traits::PalletInfo;
let name = <Runtime as frame_system::Config>::PalletInfo::name::<TechnicalMembership>()
.expect("membership is part of pallets in construct_runtime, so it has a name; qed");
pallet_membership::migrations::v3_1::pre_migration::<Runtime, TechnicalMembership, _>(
TECHNICAL_MEMBERSHIP_OLD_PREFIX,
name,
);
Ok(())
}

#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
pallet_membership::migrations::v3_1::post_migration::<TechnicalMembership>(
TECHNICAL_MEMBERSHIP_OLD_PREFIX,
);
Ok(())
}
}

/// The address format for describing accounts.
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
/// Block header type as expected by this runtime.
Expand Down Expand Up @@ -1093,7 +1127,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
GrandpaStoragePrefixMigration,
(GrandpaStoragePrefixMigration, TechnicalMembershipStoragePrefixMigration),
>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
Expand Down