Unverified Commit e0295edf authored by Qinxuan Chen's avatar Qinxuan Chen Committed by GitHub
Browse files

Companion for substrate#9878 (#3949)



* Companion for substrate#9878
Signed-off-by: default avatarkoushiro <koushiro.cqx@gmail.com>

* update substrate
Co-authored-by: thiolliere's avatarthiolliere <gui.thiolliere@gmail.com>
parent c198d26d
Pipeline #166452 passed with stages
in 43 minutes and 7 seconds
This diff is collapsed.
...@@ -51,7 +51,7 @@ use frame_support::{ ...@@ -51,7 +51,7 @@ use frame_support::{
construct_runtime, match_type, parameter_types, construct_runtime, match_type, parameter_types,
traits::{ traits::{
Contains, Everything, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing, Contains, Everything, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing,
PrivilegeCmp, OnRuntimeUpgrade, PrivilegeCmp,
}, },
weights::Weight, weights::Weight,
PalletId, RuntimeDebug, PalletId, RuntimeDebug,
...@@ -1595,11 +1595,32 @@ pub type Executive = frame_executive::Executive< ...@@ -1595,11 +1595,32 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>, frame_system::ChainContext<Runtime>,
Runtime, Runtime,
AllPallets, AllPallets,
(), (SessionHistoricalPalletPrefixMigration,),
>; >;
/// 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>;
/// Migrate session-historical from `Session` to the new pallet prefix `Historical`
pub struct SessionHistoricalPalletPrefixMigration;
impl OnRuntimeUpgrade for SessionHistoricalPalletPrefixMigration {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
pallet_session::migrations::v1::migrate::<Runtime, Historical>()
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
pallet_session::migrations::v1::pre_migrate::<Runtime, Historical>();
Ok(())
}
#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
pallet_session::migrations::v1::post_migrate::<Runtime, Historical>();
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 {
......
...@@ -1396,7 +1396,7 @@ pub type Executive = frame_executive::Executive< ...@@ -1396,7 +1396,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>, frame_system::ChainContext<Runtime>,
Runtime, Runtime,
AllPallets, AllPallets,
StakingBagsListMigrationV8, (StakingBagsListMigrationV8, SessionHistoricalPalletPrefixMigration),
>; >;
/// 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>;
...@@ -1420,6 +1420,27 @@ impl OnRuntimeUpgrade for StakingBagsListMigrationV8 { ...@@ -1420,6 +1420,27 @@ impl OnRuntimeUpgrade for StakingBagsListMigrationV8 {
} }
} }
/// Migrate session-historical from `Session` to the new pallet prefix `Historical`
pub struct SessionHistoricalPalletPrefixMigration;
impl OnRuntimeUpgrade for SessionHistoricalPalletPrefixMigration {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
pallet_session::migrations::v1::migrate::<Runtime, Historical>()
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
pallet_session::migrations::v1::pre_migrate::<Runtime, Historical>();
Ok(())
}
#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
pallet_session::migrations::v1::post_migrate::<Runtime, Historical>();
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 {
......
...@@ -81,7 +81,7 @@ pub use pallet_balances::Call as BalancesCall; ...@@ -81,7 +81,7 @@ pub use pallet_balances::Call as BalancesCall;
use polkadot_parachain::primitives::Id as ParaId; use polkadot_parachain::primitives::Id as ParaId;
use constants::{currency::*, fee::*, time::*}; use constants::{currency::*, fee::*, time::*};
use frame_support::traits::InstanceFilter; use frame_support::traits::{InstanceFilter, OnRuntimeUpgrade};
use xcm::latest::prelude::*; use xcm::latest::prelude::*;
use xcm_builder::{ use xcm_builder::{
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, BackingToPlurality, AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, BackingToPlurality,
...@@ -158,11 +158,32 @@ pub type Executive = frame_executive::Executive< ...@@ -158,11 +158,32 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>, frame_system::ChainContext<Runtime>,
Runtime, Runtime,
AllPallets, AllPallets,
(), (SessionHistoricalModulePrefixMigration,),
>; >;
/// 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>;
/// Migrate session-historical from `Session` to the new pallet prefix `Historical`
pub struct SessionHistoricalModulePrefixMigration;
impl OnRuntimeUpgrade for SessionHistoricalModulePrefixMigration {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
pallet_session::migrations::v1::migrate::<Runtime, Historical>()
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
pallet_session::migrations::v1::pre_migrate::<Runtime, Historical>();
Ok(())
}
#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
pallet_session::migrations::v1::post_migrate::<Runtime, Historical>();
Ok(())
}
}
impl_opaque_keys! { impl_opaque_keys! {
pub struct SessionKeys { pub struct SessionKeys {
pub grandpa: Grandpa, pub grandpa: Grandpa,
......
...@@ -59,7 +59,9 @@ use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; ...@@ -59,7 +59,9 @@ 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, Nothing}, traits::{
Contains, Everything, InstanceFilter, KeyOwnerProofSystem, Nothing, OnRuntimeUpgrade,
},
weights::Weight, weights::Weight,
PalletId, RuntimeDebug, PalletId, RuntimeDebug,
}; };
...@@ -1143,11 +1145,32 @@ pub type Executive = frame_executive::Executive< ...@@ -1143,11 +1145,32 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>, frame_system::ChainContext<Runtime>,
Runtime, Runtime,
AllPallets, AllPallets,
(), (SessionHistoricalPalletPrefixMigration,),
>; >;
/// 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>;
/// Migrate session-historical from `Session` to the new pallet prefix `Historical`
pub struct SessionHistoricalPalletPrefixMigration;
impl OnRuntimeUpgrade for SessionHistoricalPalletPrefixMigration {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
pallet_session::migrations::v1::migrate::<Runtime, Historical>()
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
pallet_session::migrations::v1::pre_migrate::<Runtime, Historical>();
Ok(())
}
#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
pallet_session::migrations::v1::post_migrate::<Runtime, Historical>();
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 {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment