Skip to content

Commit 46bb077

Browse files
authored
Moves single block migrations from frame_executive to frame_system config (#844)
**Depends on** paritytech/polkadot-sdk#9451 --- Based on PR paritytech/polkadot-sdk#1781 and [PRDoc](https://github.com/paritytech/polkadot-sdk/blob/beb9030b249cc078b3955232074a8495e7e0302a/prdoc/1.9.0/pr_1781.prdoc#L29), the new way for providing the single block migrations should be through `SingleBlockMigrations` in `frame_system::Config`. Providing them from `frame_executive::Executive` is still supported, but from what I understood is or will be deprecated. > `SingleBlockMigrations` this is the new way of configuring migrations that run in a single block. Previously they were defined as last generic argument of Executive. This shift is brings all central configuration about migrations closer into view of the developer (migrations that are configured in Executive will still work for now but is deprecated). Will also open a PR on polkadot-sdk side, adding a deprecation warning.
1 parent 81e932f commit 46bb077

File tree

13 files changed

+49
-95
lines changed

13 files changed

+49
-95
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
165165
- [#9202](https://github.com/paritytech/polkadot-sdk/pull/9202): `apply_authorized_force_set_current_code` does not need to consume the whole block
166166
- Proxy type `NonTranfer`: Use a whitelist of calls and remove some not useful calls from the whitelist ([polkadot-fellows/runtimes/pull/646](https://github.com/polkadot-fellows/runtimes/pull/646))
167167
- Add Snowbridge V2 pallets, to enable Snowbridge V2 bridging: [polkadot-fellows/runtimes/pull/796](https://github.com/polkadot-fellows/runtimes/pull/796))
168+
- Moves single block migrations from frame_executive::Executive to frame_system::Config. [polkadot-fellows/runtimes/pull/844](https://github.com/polkadot-fellows/runtimes/pull/844)
168169

169170
## [1.6.1] 24.06.2025
170171

relay/kusama/src/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl frame_system::Config for Runtime {
241241
type SS58Prefix = SS58Prefix;
242242
type OnSetCode = ();
243243
type MaxConsumers = frame_support::traits::ConstU32<16>;
244-
type SingleBlockMigrations = ();
244+
type SingleBlockMigrations = migrations::SingleBlockMigrations;
245245
type MultiBlockMigrator = ();
246246
type PreInherents = ();
247247
type PostInherents = ();
@@ -2195,12 +2195,6 @@ pub type TxExtension = (
21952195
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
21962196
);
21972197

2198-
/// All migrations that will run on the next runtime upgrade.
2199-
///
2200-
/// This contains the combined migrations of the last 10 releases. It allows to skip runtime
2201-
/// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT.
2202-
pub type Migrations = (migrations::Unreleased, migrations::Permanent);
2203-
22042198
/// The runtime migrations per release.
22052199
#[allow(deprecated, missing_docs)]
22062200
pub mod migrations {
@@ -2214,6 +2208,9 @@ pub mod migrations {
22142208
/// Migrations/checks that do not need to be versioned and can run on every update.
22152209
pub type Permanent = pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>;
22162210

2211+
/// All migrations that will run on the next runtime upgrade.
2212+
pub type SingleBlockMigrations = (Unreleased, Permanent);
2213+
22172214
/// Kick off the Asset Hub Migration.
22182215
pub struct KickOffAhm<T>(pub core::marker::PhantomData<T>);
22192216
impl<T: pallet_rc_migrator::Config> OnRuntimeUpgrade for KickOffAhm<T> {
@@ -2259,7 +2256,6 @@ pub type Executive = frame_executive::Executive<
22592256
frame_system::ChainContext<Runtime>,
22602257
Runtime,
22612258
AllPalletsWithSystem,
2262-
Migrations,
22632259
>;
22642260
/// The payload being signed in the transactions.
22652261
pub type SignedPayload = generic::SignedPayload<RuntimeCall, TxExtension>;

relay/polkadot/src/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl frame_system::Config for Runtime {
228228
type SS58Prefix = SS58Prefix;
229229
type OnSetCode = ();
230230
type MaxConsumers = frame_support::traits::ConstU32<16>;
231-
type SingleBlockMigrations = ();
231+
type SingleBlockMigrations = migrations::SingleBlockMigrations;
232232
type MultiBlockMigrator = ();
233233
type PreInherents = ();
234234
type PostInherents = ();
@@ -1927,12 +1927,6 @@ pub type TxExtension = (
19271927
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
19281928
);
19291929

1930-
/// All migrations that will run on the next runtime upgrade.
1931-
///
1932-
/// This contains the combined migrations of the last 10 releases. It allows to skip runtime
1933-
/// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT.
1934-
pub type Migrations = (migrations::Unreleased, migrations::Permanent);
1935-
19361930
/// The runtime migrations per release.
19371931
#[allow(deprecated, missing_docs)]
19381932
pub mod migrations {
@@ -1943,6 +1937,9 @@ pub mod migrations {
19431937

19441938
/// Migrations/checks that do not need to be versioned and can run on every update.
19451939
pub type Permanent = pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>;
1940+
1941+
/// All migrations that will run on the next runtime upgrade.
1942+
pub type SingleBlockMigrations = (Unreleased, Permanent);
19461943
}
19471944

19481945
/// Unchecked extrinsic type as expected by this runtime.
@@ -1955,7 +1952,6 @@ pub type Executive = frame_executive::Executive<
19551952
frame_system::ChainContext<Runtime>,
19561953
Runtime,
19571954
AllPalletsWithSystem,
1958-
Migrations,
19591955
>;
19601956

19611957
/// The payload being signed in transactions.

system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ impl frame_system::Config for Runtime {
209209
type SS58Prefix = SS58Prefix;
210210
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
211211
type MaxConsumers = ConstU32<256>;
212-
type SingleBlockMigrations = ();
212+
type SingleBlockMigrations = migrations::SingleBlockMigrations;
213213
type MultiBlockMigrator = MultiBlockMigrations;
214214
type PreInherents = ();
215215
type PostInherents = ();
@@ -1691,12 +1691,6 @@ impl EthExtra for EthExtraImpl {
16911691
pub type UncheckedExtrinsic =
16921692
pallet_revive::evm::runtime::UncheckedExtrinsic<Address, Signature, EthExtraImpl>;
16931693

1694-
/// All migrations that will run on the next runtime upgrade.
1695-
///
1696-
/// This contains the combined migrations of the last 10 releases. It allows to skip runtime
1697-
/// upgrades in case the government decides to do so. THE ORDER IS IMPORTANT.
1698-
pub type Migrations = (migrations::Unreleased, migrations::Permanent);
1699-
17001694
/// The runtime migrations per release.
17011695
#[allow(deprecated, missing_docs)]
17021696
pub mod migrations {
@@ -1708,6 +1702,9 @@ pub mod migrations {
17081702
/// Migrations/checks that do not need to be versioned and can run on every update.
17091703
pub type Permanent = pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>;
17101704

1705+
/// All single block migrations that will run on the next runtime upgrade.
1706+
pub type SingleBlockMigrations = (Unreleased, Permanent);
1707+
17111708
/// MBM migrations to apply on runtime upgrade.
17121709
pub type MbmMigrations = pallet_revive::migrations::v1::Migration<Runtime>;
17131710
}
@@ -1719,7 +1716,6 @@ pub type Executive = frame_executive::Executive<
17191716
frame_system::ChainContext<Runtime>,
17201717
Runtime,
17211718
AllPalletsWithSystem,
1722-
Migrations,
17231719
>;
17241720

17251721
#[cfg(feature = "runtime-benchmarks")]

system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl frame_system::Config for Runtime {
257257
type SS58Prefix = SS58Prefix;
258258
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
259259
type MaxConsumers = ConstU32<64>;
260-
type SingleBlockMigrations = ();
260+
type SingleBlockMigrations = migrations::SingleBlockMigrations;
261261
type MultiBlockMigrator = ();
262262
type PreInherents = ();
263263
type PostInherents = ();
@@ -1458,12 +1458,6 @@ pub type TxExtension = (
14581458
pub type UncheckedExtrinsic =
14591459
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
14601460

1461-
/// All migrations that will run on the next runtime upgrade.
1462-
///
1463-
/// This contains the combined migrations of the last 10 releases. It allows to skip runtime
1464-
/// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT.
1465-
pub type Migrations = (migrations::Unreleased, migrations::Permanent);
1466-
14671461
/// The runtime migrations per release.
14681462
#[allow(deprecated, missing_docs)]
14691463
pub mod migrations {
@@ -1482,6 +1476,9 @@ pub mod migrations {
14821476
/// Migrations/checks that do not need to be versioned and can run on every update.
14831477
pub type Permanent = pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>;
14841478

1479+
/// All single block migrations that will run on the next runtime upgrade.
1480+
pub type SingleBlockMigrations = (Unreleased, Permanent);
1481+
14851482
/// MBM migrations to apply on runtime upgrade.
14861483
pub type MbmMigrations = ();
14871484
}
@@ -1493,7 +1490,6 @@ pub type Executive = frame_executive::Executive<
14931490
frame_system::ChainContext<Runtime>,
14941491
Runtime,
14951492
AllPalletsWithSystem,
1496-
Migrations,
14971493
>;
14981494

14991495
#[cfg(feature = "runtime-benchmarks")]

system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,6 @@ bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages! {
138138
pub type UncheckedExtrinsic =
139139
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
140140

141-
/// All migrations that will run on the next runtime upgrade.
142-
///
143-
/// This contains the combined migrations of the last 10 releases. It allows to skip runtime
144-
/// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT.
145-
pub type Migrations = (migrations::Unreleased, migrations::Permanent);
146-
147141
/// The runtime migrations per release.
148142
#[allow(deprecated, missing_docs)]
149143
pub mod migrations {
@@ -155,6 +149,9 @@ pub mod migrations {
155149
/// Migrations/checks that do not need to be versioned and can run on every update.
156150
pub type Permanent = pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>;
157151

152+
/// All migrations that will run on the next runtime upgrade.
153+
pub type SingleBlockMigrations = (Unreleased, Permanent);
154+
158155
/// MBM migrations to apply on runtime upgrade.
159156
pub type MbmMigrations = ();
160157
}
@@ -166,7 +163,6 @@ pub type Executive = frame_executive::Executive<
166163
frame_system::ChainContext<Runtime>,
167164
Runtime,
168165
AllPalletsWithSystem,
169-
Migrations,
170166
>;
171167

172168
impl_opaque_keys! {
@@ -268,7 +264,7 @@ impl frame_system::Config for Runtime {
268264
/// The action to take on a Runtime Upgrade
269265
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
270266
type MaxConsumers = ConstU32<16>;
271-
type SingleBlockMigrations = ();
267+
type SingleBlockMigrations = migrations::SingleBlockMigrations;
272268
type MultiBlockMigrator = ();
273269
type PreInherents = ();
274270
type PostInherents = ();

system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,6 @@ parameter_types! {
148148
pub const NativeToForeignIdKey: &'static str = "NativeToForeignId";
149149
}
150150

151-
/// All migrations that will run on the next runtime upgrade.
152-
///
153-
/// This contains the combined migrations of the last 10 releases. It allows to skip runtime
154-
/// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT.
155-
pub type Migrations = (migrations::Unreleased, migrations::Permanent);
156-
157151
/// The runtime migrations per release.
158152
#[allow(deprecated, missing_docs)]
159153
pub mod migrations {
@@ -185,6 +179,9 @@ pub mod migrations {
185179
/// Migrations/checks that do not need to be versioned and can run on every update.
186180
pub type Permanent = pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>;
187181

182+
/// All migrations that will run on the next runtime upgrade.
183+
pub type SingleBlockMigrations = (Unreleased, Permanent);
184+
188185
/// MBM migrations to apply on runtime upgrade.
189186
pub type MbmMigrations = ();
190187
}
@@ -196,7 +193,6 @@ pub type Executive = frame_executive::Executive<
196193
frame_system::ChainContext<Runtime>,
197194
Runtime,
198195
AllPalletsWithSystem,
199-
Migrations,
200196
>;
201197

202198
impl_opaque_keys! {
@@ -298,7 +294,7 @@ impl frame_system::Config for Runtime {
298294
/// The action to take on a Runtime Upgrade
299295
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
300296
type MaxConsumers = ConstU32<16>;
301-
type SingleBlockMigrations = ();
297+
type SingleBlockMigrations = migrations::SingleBlockMigrations;
302298
type MultiBlockMigrator = ();
303299
type PreInherents = ();
304300
type PostInherents = ();

system-parachains/collectives/collectives-polkadot/src/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl frame_system::Config for Runtime {
200200
type SS58Prefix = ConstU16<0>;
201201
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
202202
type MaxConsumers = frame_support::traits::ConstU32<16>;
203-
type SingleBlockMigrations = ();
203+
type SingleBlockMigrations = migrations::SingleBlockMigrations;
204204
type MultiBlockMigrator = ();
205205
type PreInherents = ();
206206
type PostInherents = ();
@@ -839,12 +839,6 @@ pub type TxExtension = (
839839
pub type UncheckedExtrinsic =
840840
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
841841

842-
/// All migrations that will run on the next runtime upgrade.
843-
///
844-
/// This contains the combined migrations of the last 10 releases. It allows to skip runtime
845-
/// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT.
846-
pub type Migrations = (migrations::Unreleased, migrations::Permanent);
847-
848842
/// The runtime migrations per release.
849843
#[allow(deprecated, missing_docs)]
850844
pub mod migrations {
@@ -862,6 +856,9 @@ pub mod migrations {
862856
/// Migrations/checks that do not need to be versioned and can run on every update.
863857
pub type Permanent = pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>;
864858

859+
/// All migrations that will run on the next runtime upgrade.
860+
pub type SingleBlockMigrations = (Unreleased, Permanent);
861+
865862
/// MBM migrations to apply on runtime upgrade.
866863
pub type MbmMigrations = ();
867864
}
@@ -873,7 +870,6 @@ pub type Executive = frame_executive::Executive<
873870
frame_system::ChainContext<Runtime>,
874871
Runtime,
875872
AllPalletsWithSystem,
876-
Migrations,
877873
>;
878874

879875
#[cfg(feature = "runtime-benchmarks")]

system-parachains/coretime/coretime-kusama/src/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,6 @@ pub type TxExtensions = (
115115
pub type UncheckedExtrinsic =
116116
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtensions>;
117117

118-
/// All migrations that will run on the next runtime upgrade.
119-
///
120-
/// This contains the combined migrations of the last 10 releases. It allows to skip runtime
121-
/// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT.
122-
pub type Migrations = (migrations::Unreleased, migrations::Permanent);
123-
124118
/// The runtime migrations per release.
125119
#[allow(deprecated, missing_docs)]
126120
pub mod migrations {
@@ -131,6 +125,9 @@ pub mod migrations {
131125

132126
/// Migrations/checks that do not need to be versioned and can run on every update.
133127
pub type Permanent = pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>;
128+
129+
/// All migrations that will run on the next runtime upgrade.
130+
pub type SingleBlockMigrations = (Unreleased, Permanent);
134131
}
135132

136133
/// Executive: handles dispatch to the various modules.
@@ -140,7 +137,6 @@ pub type Executive = frame_executive::Executive<
140137
frame_system::ChainContext<Runtime>,
141138
Runtime,
142139
AllPalletsWithSystem,
143-
Migrations,
144140
>;
145141

146142
impl_opaque_keys! {
@@ -254,7 +250,7 @@ impl frame_system::Config for Runtime {
254250
/// The action to take on a Runtime Upgrade
255251
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
256252
type MaxConsumers = ConstU32<16>;
257-
type SingleBlockMigrations = ();
253+
type SingleBlockMigrations = migrations::SingleBlockMigrations;
258254
type MultiBlockMigrator = ();
259255
type PreInherents = ();
260256
type PostInherents = ();

system-parachains/coretime/coretime-polkadot/src/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,6 @@ pub type TxExtension = (
115115
pub type UncheckedExtrinsic =
116116
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
117117

118-
/// All migrations that will run on the next runtime upgrade.
119-
///
120-
/// This contains the combined migrations of the last 10 releases. It allows to skip runtime
121-
/// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT.
122-
pub type Migrations = (migrations::Unreleased, migrations::Permanent);
123-
124118
/// The runtime migrations per release.
125119
#[allow(deprecated, missing_docs)]
126120
pub mod migrations {
@@ -138,6 +132,9 @@ pub mod migrations {
138132

139133
/// Migrations/checks that do not need to be versioned and can run on every update.
140134
pub type Permanent = pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>;
135+
136+
/// All migrations that will run on the next runtime upgrade.
137+
pub type SingleBlockMigrations = (Unreleased, Permanent);
141138
}
142139

143140
/// Executive: handles dispatch to the various modules.
@@ -147,7 +144,6 @@ pub type Executive = frame_executive::Executive<
147144
frame_system::ChainContext<Runtime>,
148145
Runtime,
149146
AllPalletsWithSystem,
150-
Migrations,
151147
>;
152148

153149
impl_opaque_keys! {
@@ -267,7 +263,7 @@ impl frame_system::Config for Runtime {
267263
/// The action to take on a Runtime Upgrade
268264
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
269265
type MaxConsumers = ConstU32<16>;
270-
type SingleBlockMigrations = ();
266+
type SingleBlockMigrations = migrations::SingleBlockMigrations;
271267
type MultiBlockMigrator = ();
272268
type PreInherents = ();
273269
type PostInherents = ();

0 commit comments

Comments
 (0)