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

Commit

Permalink
Add storage migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
MRamanenkau committed Nov 22, 2022
1 parent cf41d98 commit 18d6a14
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use frame_support::{
construct_runtime, parameter_types,
traits::{
Currency, EqualPrivilegeOnly, Everything, Imbalance, InstanceFilter, KeyOwnerProofSystem,
LockIdentifier, Nothing, OnUnbalanced, U128CurrencyToVote,
LockIdentifier, Nothing, OnUnbalanced, U128CurrencyToVote, OnRuntimeUpgrade,
},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
Expand Down Expand Up @@ -1284,9 +1284,31 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
pallet_bags_list::migrations::CheckCounterPrefix<Runtime>,
(
pallet_bags_list::migrations::CheckCounterPrefix<Runtime>,
StakingBagsListMigrationV8,
)
>;

// Migration to generate pallet staking's `SortedListProvider` from pre-existing nominators.
pub struct StakingBagsListMigrationV8;

impl OnRuntimeUpgrade for StakingBagsListMigrationV8 {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
pallet_staking::migrations::v8::migrate::<Runtime>()
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
pallet_staking::migrations::v8::pre_migrate::<Runtime>()
}

#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
pallet_staking::migrations::v8::post_migrate::<Runtime>()
}
}

impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
Expand Down

0 comments on commit 18d6a14

Please sign in to comment.