diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 07aab58d6a49f..2ddd692f6c780 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -1284,9 +1284,31 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPallets, - pallet_bags_list::migrations::CheckCounterPrefix, + ( + pallet_bags_list::migrations::CheckCounterPrefix, + 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::() + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result<(), &'static str> { + pallet_staking::migrations::v8::pre_migrate::() + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade() -> Result<(), &'static str> { + pallet_staking::migrations::v8::post_migrate::() + } +} + impl_runtime_apis! { impl sp_api::Core for Runtime { fn version() -> RuntimeVersion {