diff --git a/polkadot/runtime/kusama/src/lib.rs b/polkadot/runtime/kusama/src/lib.rs index 39a532b475..0837d2caf1 100644 --- a/polkadot/runtime/kusama/src/lib.rs +++ b/polkadot/runtime/kusama/src/lib.rs @@ -1555,12 +1555,50 @@ pub type Executive = frame_executive::Executive< TechnicalCommitteeStoragePrefixMigration, TechnicalMembershipStoragePrefixMigration, MigrateTipsPalletPrefix, + BountiesPrefixMigration, StakingBagsListMigrationV8, ), >; /// The payload being signed in the transactions. pub type SignedPayload = generic::SignedPayload; +const BOUNTIES_OLD_PREFIX: &str = "Treasury"; + +/// Migrate from 'Treasury' to the new prefix 'Bounties' +pub struct BountiesPrefixMigration; + +impl OnRuntimeUpgrade for BountiesPrefixMigration { + fn on_runtime_upgrade() -> frame_support::weights::Weight { + use frame_support::traits::PalletInfo; + let name = ::PalletInfo::name::() + .expect("Bounties is part of runtime, so it has a name; qed"); + pallet_bounties::migrations::v4::migrate::(BOUNTIES_OLD_PREFIX, name) + } + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result<(), &'static str> { + use frame_support::traits::PalletInfo; + let name = ::PalletInfo::name::() + .expect("Bounties is part of runtime, so it has a name; qed"); + pallet_bounties::migrations::v4::pre_migration::( + BOUNTIES_OLD_PREFIX, + name, + ); + Ok(()) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade() -> Result<(), &'static str> { + use frame_support::traits::PalletInfo; + let name = ::PalletInfo::name::() + .expect("Bounties is part of runtime, so it has a name; qed"); + pallet_bounties::migrations::v4::post_migration::( + BOUNTIES_OLD_PREFIX, + name, + ); + Ok(()) + } +} + const COUNCIL_OLD_PREFIX: &str = "Instance1Collective"; /// Migrate from `Instance1Collective` to the new pallet prefix `Council` pub struct CouncilStoragePrefixMigration; diff --git a/polkadot/runtime/polkadot/src/lib.rs b/polkadot/runtime/polkadot/src/lib.rs index 72a5c74884..a69e28554e 100644 --- a/polkadot/runtime/polkadot/src/lib.rs +++ b/polkadot/runtime/polkadot/src/lib.rs @@ -1156,6 +1156,7 @@ pub type Executive = frame_executive::Executive< Runtime, AllPallets, ( + BountiesPrefixMigration, CouncilStoragePrefixMigration, TechnicalCommitteeStoragePrefixMigration, TechnicalMembershipStoragePrefixMigration, @@ -1165,6 +1166,44 @@ pub type Executive = frame_executive::Executive< /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; +const BOUNTIES_OLD_PREFIX: &str = "Treasury"; + +/// Migrate from 'Treasury' to the new prefix 'Bounties' +pub struct BountiesPrefixMigration; + +impl OnRuntimeUpgrade for BountiesPrefixMigration { + fn on_runtime_upgrade() -> frame_support::weights::Weight { + use frame_support::traits::PalletInfo; + let name = ::PalletInfo::name::() + .expect("Bounties is part of runtime, so it has a name; qed"); + pallet_bounties::migrations::v4::migrate::(BOUNTIES_OLD_PREFIX, name) + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result<(), &'static str> { + use frame_support::traits::PalletInfo; + let name = ::PalletInfo::name::() + .expect("Bounties is part of runtime, so it has a name; qed"); + pallet_bounties::migrations::v4::pre_migration::( + BOUNTIES_OLD_PREFIX, + name, + ); + Ok(()) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade() -> Result<(), &'static str> { + use frame_support::traits::PalletInfo; + let name = ::PalletInfo::name::() + .expect("Bounties is part of runtime, so it has a name; qed"); + pallet_bounties::migrations::v4::post_migration::( + BOUNTIES_OLD_PREFIX, + name, + ); + Ok(()) + } +} + const COUNCIL_OLD_PREFIX: &str = "Instance1Collective"; /// Migrate from `Instance1Collective` to the new pallet prefix `Council` pub struct CouncilStoragePrefixMigration;