Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Companion for substrate#9878 #3949

Merged
merged 11 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from 10 commits
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
25 changes: 23 additions & 2 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use frame_support::{
construct_runtime, match_type, parameter_types,
traits::{
Contains, Everything, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing,
PrivilegeCmp,
OnRuntimeUpgrade, PrivilegeCmp,
},
weights::Weight,
PalletId, RuntimeDebug,
Expand Down Expand Up @@ -1593,11 +1593,32 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
(),
(SessionHistoricalPalletPrefixMigration,),
>;
/// The payload being signed in the transactions.
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"))]
sp_api::impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
Expand Down
23 changes: 22 additions & 1 deletion runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
StakingBagsListMigrationV8,
(StakingBagsListMigrationV8, SessionHistoricalPalletPrefixMigration),
>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
Expand All @@ -1418,6 +1418,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"))]
sp_api::impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
Expand Down
25 changes: 23 additions & 2 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub use pallet_balances::Call as BalancesCall;
use polkadot_parachain::primitives::Id as ParaId;

use constants::{currency::*, fee::*, time::*};
use frame_support::traits::InstanceFilter;
use frame_support::traits::{InstanceFilter, OnRuntimeUpgrade};
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, BackingToPlurality,
Expand Down Expand Up @@ -158,11 +158,32 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
(),
(SessionHistoricalModulePrefixMigration,),
>;
/// The payload being signed in transactions.
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! {
pub struct SessionKeys {
pub grandpa: Grandpa,
Expand Down
27 changes: 25 additions & 2 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
use beefy_primitives::crypto::AuthorityId as BeefyId;
use frame_support::{
construct_runtime, parameter_types,
traits::{Contains, Everything, InstanceFilter, KeyOwnerProofSystem, Nothing},
traits::{
Contains, Everything, InstanceFilter, KeyOwnerProofSystem, Nothing, OnRuntimeUpgrade,
},
weights::Weight,
PalletId, RuntimeDebug,
};
Expand Down Expand Up @@ -1141,11 +1143,32 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
(),
(SessionHistoricalPalletPrefixMigration,),
>;
/// The payload being signed in transactions.
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"))]
sp_api::impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
Expand Down