mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Companion for substrate#9080 (#3263)
* runtime(kusama/polkadot): migrations for membership storage prefix Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix Signed-off-by: koushiro <koushiro.cqx@gmail.com> * make correct custom migration * some fix * Update Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix format Signed-off-by: koushiro <koushiro.cqx@gmail.com> * import traits * update Substrate Co-authored-by: thiolliere <gui.thiolliere@gmail.com> Co-authored-by: parity-processbot <>
This commit is contained in:
Generated
+154
-153
File diff suppressed because it is too large
Load Diff
@@ -49,7 +49,10 @@ use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
|||||||
use beefy_primitives::crypto::AuthorityId as BeefyId;
|
use beefy_primitives::crypto::AuthorityId as BeefyId;
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
traits::{Contains, Everything, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing},
|
traits::{
|
||||||
|
Contains, Everything, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing,
|
||||||
|
OnRuntimeUpgrade,
|
||||||
|
},
|
||||||
weights::Weight,
|
weights::Weight,
|
||||||
PalletId, RuntimeDebug,
|
PalletId, RuntimeDebug,
|
||||||
};
|
};
|
||||||
@@ -1501,11 +1504,51 @@ pub type Executive = frame_executive::Executive<
|
|||||||
frame_system::ChainContext<Runtime>,
|
frame_system::ChainContext<Runtime>,
|
||||||
Runtime,
|
Runtime,
|
||||||
AllPallets,
|
AllPallets,
|
||||||
(),
|
TechnicalMembershipStoragePrefixMigration,
|
||||||
>;
|
>;
|
||||||
/// The payload being signed in the transactions.
|
/// The payload being signed in the transactions.
|
||||||
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
||||||
|
|
||||||
|
const TECHNICAL_MEMBERSHIP_OLD_PREFIX: &str = "Instance1Membership";
|
||||||
|
/// Migrate from `Instance1Membership` to the new pallet prefix `TechnicalMembership`
|
||||||
|
pub struct TechnicalMembershipStoragePrefixMigration;
|
||||||
|
|
||||||
|
impl 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("TechnicalMembership is part of runtime, so it has a name; qed");
|
||||||
|
pallet_membership::migrations::v4::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("TechnicalMembership is part of runtime, so it has a name; qed");
|
||||||
|
pallet_membership::migrations::v4::pre_migrate::<TechnicalMembership, _>(
|
||||||
|
TECHNICAL_MEMBERSHIP_OLD_PREFIX,
|
||||||
|
name,
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "try-runtime")]
|
||||||
|
fn post_upgrade() -> Result<(), &'static str> {
|
||||||
|
use frame_support::traits::PalletInfo;
|
||||||
|
let name = <Runtime as frame_system::Config>::PalletInfo::name::<TechnicalMembership>()
|
||||||
|
.expect("TechnicalMembership is part of runtime, so it has a name; qed");
|
||||||
|
pallet_membership::migrations::v4::post_migrate::<TechnicalMembership, _>(
|
||||||
|
TECHNICAL_MEMBERSHIP_OLD_PREFIX,
|
||||||
|
name,
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "disable-runtime-api"))]
|
#[cfg(not(feature = "disable-runtime-api"))]
|
||||||
sp_api::impl_runtime_apis! {
|
sp_api::impl_runtime_apis! {
|
||||||
impl sp_api::Core<Block> for Runtime {
|
impl sp_api::Core<Block> for Runtime {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
|||||||
use beefy_primitives::crypto::AuthorityId as BeefyId;
|
use beefy_primitives::crypto::AuthorityId as BeefyId;
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
traits::{Contains, KeyOwnerProofSystem, LockIdentifier},
|
traits::{Contains, KeyOwnerProofSystem, LockIdentifier, OnRuntimeUpgrade},
|
||||||
weights::Weight,
|
weights::Weight,
|
||||||
PalletId, RuntimeDebug,
|
PalletId, RuntimeDebug,
|
||||||
};
|
};
|
||||||
@@ -1130,11 +1130,51 @@ pub type Executive = frame_executive::Executive<
|
|||||||
frame_system::ChainContext<Runtime>,
|
frame_system::ChainContext<Runtime>,
|
||||||
Runtime,
|
Runtime,
|
||||||
AllPallets,
|
AllPallets,
|
||||||
(),
|
TechnicalMembershipStoragePrefixMigration,
|
||||||
>;
|
>;
|
||||||
/// The payload being signed in transactions.
|
/// The payload being signed in transactions.
|
||||||
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
||||||
|
|
||||||
|
const TECHNICAL_MEMBERSHIP_OLD_PREFIX: &str = "Instance1Membership";
|
||||||
|
/// Migrate from `Instance1Membership` to the new pallet prefix `TechnicalMembership`
|
||||||
|
pub struct TechnicalMembershipStoragePrefixMigration;
|
||||||
|
|
||||||
|
impl 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("TechnialMembership is part of runtime, so it has a name; qed");
|
||||||
|
pallet_membership::migrations::v4::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("TechnicalMembership is part of runtime, so it has a name; qed");
|
||||||
|
pallet_membership::migrations::v4::pre_migrate::<TechnicalMembership, _>(
|
||||||
|
TECHNICAL_MEMBERSHIP_OLD_PREFIX,
|
||||||
|
name,
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "try-runtime")]
|
||||||
|
fn post_upgrade() -> Result<(), &'static str> {
|
||||||
|
use frame_support::traits::PalletInfo;
|
||||||
|
let name = <Runtime as frame_system::Config>::PalletInfo::name::<TechnicalMembership>()
|
||||||
|
.expect("TechnicalMembership is part of runtime, so it has a name; qed");
|
||||||
|
pallet_membership::migrations::v4::post_migrate::<TechnicalMembership, _>(
|
||||||
|
TECHNICAL_MEMBERSHIP_OLD_PREFIX,
|
||||||
|
name,
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "disable-runtime-api"))]
|
#[cfg(not(feature = "disable-runtime-api"))]
|
||||||
sp_api::impl_runtime_apis! {
|
sp_api::impl_runtime_apis! {
|
||||||
impl sp_api::Core<Block> for Runtime {
|
impl sp_api::Core<Block> for Runtime {
|
||||||
|
|||||||
Reference in New Issue
Block a user