From 4ad728255d873c47905631e70409541a5e46025b Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Wed, 3 Sep 2025 10:23:19 +0100 Subject: [PATCH 01/11] deprecate OnRuntimeUpgrade parameter in Executive struct --- .../assets/asset-hub-rococo/src/lib.rs | 2 +- .../assets/asset-hub-westend/src/lib.rs | 2 +- .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 2 +- .../bridge-hubs/bridge-hub-westend/src/lib.rs | 2 +- .../collectives-westend/src/lib.rs | 2 +- .../coretime/coretime-rococo/src/lib.rs | 2 +- .../coretime/coretime-westend/src/lib.rs | 2 +- .../runtimes/people/people-rococo/src/lib.rs | 2 +- .../runtimes/people/people-westend/src/lib.rs | 2 +- .../runtimes/testing/penpal/src/lib.rs | 2 +- .../testing/rococo-parachain/src/lib.rs | 2 +- .../testing/yet-another-parachain/src/lib.rs | 2 +- .../frame_runtime_upgrades_and_migrations.rs | 15 ++---- polkadot/runtime/rococo/src/lib.rs | 2 +- polkadot/runtime/westend/src/lib.rs | 2 +- substrate/bin/node/runtime/src/lib.rs | 2 +- substrate/frame/executive/README.md | 24 ---------- substrate/frame/executive/src/lib.rs | 47 +++---------------- .../runtimes/parachain/src/lib.rs | 2 +- .../staking-async/runtimes/rc/src/lib.rs | 2 +- substrate/frame/support/src/migrations.rs | 20 +++----- 21 files changed, 34 insertions(+), 106 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs index 209f11d8173a5..eb6d53248048d 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs @@ -185,6 +185,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = SS58Prefix; type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = frame_support::traits::ConstU32<16>; + type SingleBlockMigrations = Migrations; } impl cumulus_pallet_weight_reclaim::Config for Runtime { @@ -1237,7 +1238,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; #[cfg(feature = "runtime-benchmarks")] diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 744d4d6b7d422..60b1970fbc7aa 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -202,6 +202,7 @@ impl frame_system::Config for Runtime { type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = frame_support::traits::ConstU32<16>; type MultiBlockMigrator = MultiBlockMigrations; + type SingleBlockMigrations = Migrations; } impl cumulus_pallet_weight_reclaim::Config for Runtime { @@ -1574,7 +1575,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; #[cfg(feature = "runtime-benchmarks")] diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index d91dd0adcdfb6..424103bd8c283 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -239,7 +239,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; impl_opaque_keys! { @@ -324,6 +323,7 @@ impl frame_system::Config for Runtime { /// The action to take on a Runtime Upgrade type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = frame_support::traits::ConstU32<16>; + type SingleBlockMigrations = Migrations; } impl cumulus_pallet_weight_reclaim::Config for Runtime { diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs index eaa58ac1b62ed..e153092eddfc1 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs @@ -229,7 +229,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; impl_opaque_keys! { @@ -314,6 +313,7 @@ impl frame_system::Config for Runtime { /// The action to take on a Runtime Upgrade type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = frame_support::traits::ConstU32<16>; + type SingleBlockMigrations = Migrations; } impl cumulus_pallet_weight_reclaim::Config for Runtime { diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs index cd89e9151c635..0adc1d38e113e 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs @@ -192,6 +192,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = SS58Prefix; type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = frame_support::traits::ConstU32<16>; + type SingleBlockMigrations = Migrations; } impl cumulus_pallet_weight_reclaim::Config for Runtime { @@ -809,7 +810,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; #[cfg(feature = "runtime-benchmarks")] diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs index dfefc339e6a76..8f7317686da37 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs @@ -145,7 +145,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; impl_opaque_keys! { @@ -228,6 +227,7 @@ impl frame_system::Config for Runtime { /// The action to take on a Runtime Upgrade type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = ConstU32<16>; + type SingleBlockMigrations = Migrations; } impl cumulus_pallet_weight_reclaim::Config for Runtime { diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs index 0a60b6660e46b..a5df2fef755bb 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs @@ -145,7 +145,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; impl_opaque_keys! { @@ -228,6 +227,7 @@ impl frame_system::Config for Runtime { /// The action to take on a Runtime Upgrade type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = ConstU32<16>; + type SingleBlockMigrations = Migrations; } impl cumulus_pallet_weight_reclaim::Config for Runtime { diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs index 9e20bf64f91cf..daba832337ca9 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs @@ -132,7 +132,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; impl_opaque_keys! { @@ -203,6 +202,7 @@ impl frame_system::Config for Runtime { type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = ConstU32<16>; type MultiBlockMigrator = MultiBlockMigrations; + type SingleBlockMigrations = Migrations; } impl cumulus_pallet_weight_reclaim::Config for Runtime { diff --git a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs index cbdca464f860b..1e2d10b0078e7 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs @@ -135,7 +135,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; impl_opaque_keys! { @@ -206,6 +205,7 @@ impl frame_system::Config for Runtime { type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = ConstU32<16>; type MultiBlockMigrator = MultiBlockMigrations; + type SingleBlockMigrations = Migrations; } impl cumulus_pallet_weight_reclaim::Config for Runtime { diff --git a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs index ce485a96ba2d1..08108e66def43 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs @@ -205,7 +205,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; /// Handles converting a weight scalar to a fee value, based on the scale and granularity of the @@ -433,6 +432,7 @@ impl frame_system::Config for Runtime { /// The action to take on a Runtime Upgrade type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = frame_support::traits::ConstU32<16>; + type SingleBlockMigrations = Migrations; } impl pallet_timestamp::Config for Runtime { diff --git a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs index 0c2a379d35e4c..b071ea23d7c99 100644 --- a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -226,6 +226,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = SS58Prefix; type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = frame_support::traits::ConstU32<16>; + type SingleBlockMigrations = RemoveCollectiveFlip; } impl cumulus_pallet_weight_reclaim::Config for Runtime { @@ -695,7 +696,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - RemoveCollectiveFlip, >; pub struct RemoveCollectiveFlip; diff --git a/cumulus/parachains/runtimes/testing/yet-another-parachain/src/lib.rs b/cumulus/parachains/runtimes/testing/yet-another-parachain/src/lib.rs index 2eace1d860a03..412decb0cb71e 100644 --- a/cumulus/parachains/runtimes/testing/yet-another-parachain/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/yet-another-parachain/src/lib.rs @@ -214,6 +214,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = SS58Prefix; type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = frame_support::traits::ConstU32<16>; + type SingleBlockMigrations = RemoveCollectiveFlip; } impl cumulus_pallet_weight_reclaim::Config for Runtime { @@ -489,7 +490,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - RemoveCollectiveFlip, >; pub struct RemoveCollectiveFlip; diff --git a/docs/sdk/src/reference_docs/frame_runtime_upgrades_and_migrations.rs b/docs/sdk/src/reference_docs/frame_runtime_upgrades_and_migrations.rs index 065cbee25709b..3c0c79aff3892 100644 --- a/docs/sdk/src/reference_docs/frame_runtime_upgrades_and_migrations.rs +++ b/docs/sdk/src/reference_docs/frame_runtime_upgrades_and_migrations.rs @@ -59,8 +59,8 @@ //! //! ### Scheduling the Single Block Migrations to Run Next Runtime Upgrade //! -//! Schedule migrations to run next runtime upgrade passing them as a generic parameter to your -//! [`Executive`](frame_executive) pallet: +//! Schedule migrations to run next runtime upgrade passing them as a parameter to your +//! [`Config`](frame_system) pallet: //! //! ```ignore //! /// Tuple of migrations (structs that implement `OnRuntimeUpgrade`) @@ -69,14 +69,9 @@ //! MyCustomMigration, //! // ...more migrations here //! ); -//! pub type Executive = frame_executive::Executive< -//! Runtime, -//! Block, -//! frame_system::ChainContext, -//! Runtime, -//! AllPalletsWithSystem, -//! Migrations, // <-- pass your migrations to Executive here -//! >; +//! impl frame_system::Config for Runtime { +//! type SingleBlockMigrations = Migrations; +//! } //! ``` //! //! ### Ensuring Single Block Migration Safety diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index 7f5a615444763..8bf7ca066acb4 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -238,6 +238,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = SS58Prefix; type MaxConsumers = frame_support::traits::ConstU32<16>; type MultiBlockMigrator = MultiBlockMigrations; + type SingleBlockMigrations = Migrations; } parameter_types! { @@ -1810,7 +1811,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index 7b1b9031762b4..ae994b6ea6e0c 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -227,6 +227,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = SS58Prefix; type MaxConsumers = frame_support::traits::ConstU32<16>; type MultiBlockMigrator = MultiBlockMigrations; + type SingleBlockMigrations = Migrations; } parameter_types! { @@ -2094,7 +2095,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index f03eebeeecc3c..90e4a069f72cc 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -364,6 +364,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = ConstU16<42>; type MaxConsumers = ConstU32<16>; type MultiBlockMigrator = MultiBlockMigrations; + type SingleBlockMigrations = Migrations; } impl pallet_insecure_randomness_collective_flip::Config for Runtime {} @@ -2874,7 +2875,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; // We don't have a limit in the Relay Chain. diff --git a/substrate/frame/executive/README.md b/substrate/frame/executive/README.md index 6151232ecaf1b..1ae88c0264079 100644 --- a/substrate/frame/executive/README.md +++ b/substrate/frame/executive/README.md @@ -44,28 +44,4 @@ pub type Executive = executive::Executive< >; ``` -### Custom `OnRuntimeUpgrade` logic - -You can add custom logic that should be called in your runtime on a runtime upgrade. This is done by setting an optional -generic parameter. The custom logic will be called before the on runtime upgrade logic of all modules is called. - -```rust -struct CustomOnRuntimeUpgrade; -impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { - fn on_runtime_upgrade() -> frame_support::weights::Weight { - // Do whatever you want. - frame_support::weights::Weight::zero() - } -} - -pub type Executive = executive::Executive< - Runtime, - Block, - Context, - Runtime, - AllPalletsWithSystem, - CustomOnRuntimeUpgrade, ->; -``` - License: Apache-2.0 diff --git a/substrate/frame/executive/src/lib.rs b/substrate/frame/executive/src/lib.rs index ac25bd573c3eb..8cb8e87f2fe7e 100644 --- a/substrate/frame/executive/src/lib.rs +++ b/substrate/frame/executive/src/lib.rs @@ -79,44 +79,6 @@ //! /// Executive: handles dispatch to the various modules. //! pub type Executive = executive::Executive; //! ``` -//! -//! ### Custom `OnRuntimeUpgrade` logic -//! -//! You can add custom logic that should be called in your runtime on a runtime upgrade. This is -//! done by setting an optional generic parameter. The custom logic will be called before -//! the on runtime upgrade logic of all modules is called. -//! -//! ``` -//! # use sp_runtime::generic; -//! # use frame_executive as executive; -//! # pub struct UncheckedExtrinsic {}; -//! # pub struct Header {}; -//! # type Context = frame_system::ChainContext; -//! # pub type Block = generic::Block; -//! # pub type Balances = u64; -//! # pub type AllPalletsWithSystem = u64; -//! # pub enum Runtime {}; -//! # use sp_runtime::transaction_validity::{ -//! # TransactionValidity, UnknownTransaction, TransactionSource, -//! # }; -//! # use sp_runtime::traits::ValidateUnsigned; -//! # impl ValidateUnsigned for Runtime { -//! # type Call = (); -//! # -//! # fn validate_unsigned(_source: TransactionSource, _call: &Self::Call) -> TransactionValidity { -//! # UnknownTransaction::NoUnsignedValidator.into() -//! # } -//! # } -//! struct CustomOnRuntimeUpgrade; -//! impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { -//! fn on_runtime_upgrade() -> frame_support::weights::Weight { -//! // Do whatever you want. -//! frame_support::weights::Weight::zero() -//! } -//! } -//! -//! pub type Executive = executive::Executive; -//! ``` #[cfg(doc)] #[cfg_attr(doc, aquamarine::aquamarine)] @@ -230,15 +192,18 @@ impl core::fmt::Debug for ExecutiveError { /// - `UnsignedValidator`: The unsigned transaction validator of the runtime. /// - `AllPalletsWithSystem`: Tuple that contains all pallets including frame system pallet. Will be /// used to call hooks e.g. `on_initialize`. -/// - `OnRuntimeUpgrade`: Custom logic that should be called after a runtime upgrade. Modules are -/// already called by `AllPalletsWithSystem`. It will be called before all modules will be called. +/// - [**DEPRECATED** `OnRuntimeUpgrade`]: This parameter is deprecated and will be removed after +/// September 2026. Use type `SingleBlockMigrations` in frame_system::Config instead. pub struct Executive< System, Block, Context, UnsignedValidator, AllPalletsWithSystem, - OnRuntimeUpgrade = (), + #[deprecated( + note = "`OnRuntimeUpgrade` parameter in Executive is deprecated, will be removed after September 2026. \ + Use type `SingleBlockMigrations` in frame_system::Config instead." + )] OnRuntimeUpgrade = (), >( PhantomData<( System, diff --git a/substrate/frame/staking-async/runtimes/parachain/src/lib.rs b/substrate/frame/staking-async/runtimes/parachain/src/lib.rs index df0996a66f210..d67d61b1319ed 100644 --- a/substrate/frame/staking-async/runtimes/parachain/src/lib.rs +++ b/substrate/frame/staking-async/runtimes/parachain/src/lib.rs @@ -188,6 +188,7 @@ impl frame_system::Config for Runtime { type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = frame_support::traits::ConstU32<16>; type MultiBlockMigrator = MultiBlockMigrations; + type SingleBlockMigrations = Migrations; } impl cumulus_pallet_weight_reclaim::Config for Runtime { @@ -1242,7 +1243,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; #[cfg(feature = "runtime-benchmarks")] diff --git a/substrate/frame/staking-async/runtimes/rc/src/lib.rs b/substrate/frame/staking-async/runtimes/rc/src/lib.rs index 9837448fe3827..3849bfff239c8 100644 --- a/substrate/frame/staking-async/runtimes/rc/src/lib.rs +++ b/substrate/frame/staking-async/runtimes/rc/src/lib.rs @@ -225,6 +225,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = SS58Prefix; type MaxConsumers = frame_support::traits::ConstU32<16>; type MultiBlockMigrator = MultiBlockMigrations; + type SingleBlockMigrations = Migrations; } parameter_types! { @@ -1993,7 +1994,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - Migrations, >; /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; diff --git a/substrate/frame/support/src/migrations.rs b/substrate/frame/support/src/migrations.rs index 3fdf8d6edc958..67dec5a9828e6 100644 --- a/substrate/frame/support/src/migrations.rs +++ b/substrate/frame/support/src/migrations.rs @@ -299,13 +299,9 @@ pub fn migrate_from_pallet_version_to_storage_version< /// AnyOtherMigrations... /// ); /// -/// pub type Executive = frame_executive::Executive< -/// Runtime, -/// Block, -/// frame_system::ChainContext, -/// Runtime, -/// Migrations -/// >; +/// impl frame_system::Config for Runtime { +/// type SingleBlockMigrations = CustomOnRuntimeUpgrade; +/// } /// ``` /// /// WARNING: `RemovePallet` has no guard rails preventing it from bricking the chain if the @@ -410,13 +406,9 @@ impl, DbWeight: Get> frame_support::traits /// AnyOtherMigrations... /// ); /// -/// pub type Executive = frame_executive::Executive< -/// Runtime, -/// Block, -/// frame_system::ChainContext, -/// Runtime, -/// Migrations -/// >; +/// impl frame_system::Config for Runtime { +/// type SingleBlockMigrations = Migrations; +/// } /// ``` /// /// WARNING: `RemoveStorage` has no guard rails preventing it from bricking the chain if the From a613498b1cce7c09b82152a82622ebc85f16eb10 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Wed, 3 Sep 2025 17:01:23 +0100 Subject: [PATCH 02/11] add prdoc --- prdoc/pr_9638.prdoc | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 prdoc/pr_9638.prdoc diff --git a/prdoc/pr_9638.prdoc b/prdoc/pr_9638.prdoc new file mode 100644 index 0000000000000..60d899ac70d3d --- /dev/null +++ b/prdoc/pr_9638.prdoc @@ -0,0 +1,9 @@ +title: Deprecate `OnRuntimeUpgrade` parameter in `frame_executive::Executive` struct. +doc: +- audience: Runtime Dev + description: |- + Deprecate `OnRuntimeUpgrade` parameter in `frame_executive::Executive` struct. + +crates: +- name: pallet-executive + bump: major From f308a10e8dbf7d61772fa09db6336c8beb2c228e Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Wed, 3 Sep 2025 10:23:19 +0100 Subject: [PATCH 03/11] deprecate OnRuntimeUpgrade parameter in Executive struct --- substrate/frame/support/src/migrations.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/support/src/migrations.rs b/substrate/frame/support/src/migrations.rs index 67dec5a9828e6..b001a003d0131 100644 --- a/substrate/frame/support/src/migrations.rs +++ b/substrate/frame/support/src/migrations.rs @@ -300,7 +300,7 @@ pub fn migrate_from_pallet_version_to_storage_version< /// ); /// /// impl frame_system::Config for Runtime { -/// type SingleBlockMigrations = CustomOnRuntimeUpgrade; +/// type SingleBlockMigrations = Migrations; /// } /// ``` /// From 9a11b2cf87e1e909269f6cf258bbb25c6cc4ccb1 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Wed, 3 Sep 2025 17:06:51 +0100 Subject: [PATCH 04/11] fix prdoc --- prdoc/pr_9638.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_9638.prdoc b/prdoc/pr_9638.prdoc index 60d899ac70d3d..8ef30c0f7a537 100644 --- a/prdoc/pr_9638.prdoc +++ b/prdoc/pr_9638.prdoc @@ -5,5 +5,5 @@ doc: Deprecate `OnRuntimeUpgrade` parameter in `frame_executive::Executive` struct. crates: -- name: pallet-executive +- name: frame-executive bump: major From 429bfb0afbeb4c8c219c6b14a205f9cdc6e8eee0 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Wed, 3 Sep 2025 17:38:43 +0100 Subject: [PATCH 05/11] allow deprecation warnings --- substrate/frame/executive/src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/substrate/frame/executive/src/lib.rs b/substrate/frame/executive/src/lib.rs index 8cb8e87f2fe7e..a3cbaf94b9efb 100644 --- a/substrate/frame/executive/src/lib.rs +++ b/substrate/frame/executive/src/lib.rs @@ -194,6 +194,7 @@ impl core::fmt::Debug for ExecutiveError { /// used to call hooks e.g. `on_initialize`. /// - [**DEPRECATED** `OnRuntimeUpgrade`]: This parameter is deprecated and will be removed after /// September 2026. Use type `SingleBlockMigrations` in frame_system::Config instead. +#[allow(deprecated)] pub struct Executive< System, Block, @@ -215,6 +216,10 @@ pub struct Executive< )>, ); +// Allow deprecated `OnRuntimeUpgrade` trait usage. +// Deprecated since it moved to `frame_system::Config::SingleBlockMigrations`. +// Can be removed after September 2026. +#[allow(deprecated)] impl< System: frame_system::Config + IsInherent, Block: traits::Block< @@ -253,6 +258,10 @@ where } } +// Allow deprecated `OnRuntimeUpgrade` trait usage. +// Deprecated since it moved to `frame_system::Config::SingleBlockMigrations`. +// Can be removed after September 2026. +#[allow(deprecated)] #[cfg(feature = "try-runtime")] impl< System: frame_system::Config + IsInherent, @@ -458,6 +467,10 @@ where } } +// Allow deprecated `OnRuntimeUpgrade` trait usage. +// Deprecated since it moved to `frame_system::Config::SingleBlockMigrations`. +// Can be removed after September 2026. +#[allow(deprecated)] impl< System: frame_system::Config + IsInherent, Block: traits::Block< From 876397409f8ef086a2f7fd5d5b6e3da79bffd268 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Wed, 3 Sep 2025 18:12:08 +0100 Subject: [PATCH 06/11] allow deprecation in test --- substrate/frame/support/test/tests/pallet.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/substrate/frame/support/test/tests/pallet.rs b/substrate/frame/support/test/tests/pallet.rs index 7de37f1c98150..d273069cefe0f 100644 --- a/substrate/frame/support/test/tests/pallet.rs +++ b/substrate/frame/support/test/tests/pallet.rs @@ -2410,6 +2410,7 @@ fn post_runtime_upgrade_detects_storage_version_issues() { AllPalletsWithSystem, >; + #[allow(deprecated)] type ExecutiveWithUpgrade = frame_executive::Executive< Runtime, Block, @@ -2419,6 +2420,7 @@ fn post_runtime_upgrade_detects_storage_version_issues() { CustomUpgrade, >; + #[allow(deprecated)] type ExecutiveWithUpgradePallet4 = frame_executive::Executive< Runtime, Block, From 09aea25a2e6ccc987dcc283a553e878233f9d4d8 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Wed, 3 Sep 2025 19:01:29 +0100 Subject: [PATCH 07/11] fix deprecation warning --- cumulus/test/runtime/src/lib.rs | 2 +- substrate/frame/executive/src/tests.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cumulus/test/runtime/src/lib.rs b/cumulus/test/runtime/src/lib.rs index f00665def12bf..6bc30b9fb162f 100644 --- a/cumulus/test/runtime/src/lib.rs +++ b/cumulus/test/runtime/src/lib.rs @@ -278,6 +278,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = SS58Prefix; type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = frame_support::traits::ConstU32<16>; + type SingleBlockMigrations = TestOnRuntimeUpgrade; } impl cumulus_pallet_weight_reclaim::Config for Runtime { @@ -506,7 +507,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - TestOnRuntimeUpgrade, >; /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; diff --git a/substrate/frame/executive/src/tests.rs b/substrate/frame/executive/src/tests.rs index 6863aa1a4fc1d..db5ad4af7922b 100644 --- a/substrate/frame/executive/src/tests.rs +++ b/substrate/frame/executive/src/tests.rs @@ -501,6 +501,7 @@ impl OnRuntimeUpgrade for CustomOnRuntimeUpgrade { } } +#[allow(deprecated)] type Executive = super::Executive< Runtime, Block, From 1cd992098e76787303c877531e43fb48334f01e4 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Thu, 4 Sep 2025 08:23:37 +0100 Subject: [PATCH 08/11] add TODO for removing #[allow(deprecated)] when the generic type is removed --- substrate/frame/executive/src/lib.rs | 18 +++++++++--------- substrate/frame/executive/src/tests.rs | 3 +++ substrate/frame/support/test/tests/pallet.rs | 6 ++++++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/substrate/frame/executive/src/lib.rs b/substrate/frame/executive/src/lib.rs index a3cbaf94b9efb..5f05400896e64 100644 --- a/substrate/frame/executive/src/lib.rs +++ b/substrate/frame/executive/src/lib.rs @@ -216,9 +216,9 @@ pub struct Executive< )>, ); -// Allow deprecated `OnRuntimeUpgrade` trait usage. -// Deprecated since it moved to `frame_system::Config::SingleBlockMigrations`. -// Can be removed after September 2026. +/// TODO: The `OnRuntimeUpgrade` generic parameter in `Executive` is deprecated and will be +/// removed in a future version. Once removed, this `#[allow(deprecated)]` attribute +/// can be safely deleted. #[allow(deprecated)] impl< System: frame_system::Config + IsInherent, @@ -258,9 +258,9 @@ where } } -// Allow deprecated `OnRuntimeUpgrade` trait usage. -// Deprecated since it moved to `frame_system::Config::SingleBlockMigrations`. -// Can be removed after September 2026. +/// TODO: The `OnRuntimeUpgrade` generic parameter in `Executive` is deprecated and will be +/// removed in a future version. Once removed, this `#[allow(deprecated)]` attribute +/// can be safely deleted. #[allow(deprecated)] #[cfg(feature = "try-runtime")] impl< @@ -467,9 +467,9 @@ where } } -// Allow deprecated `OnRuntimeUpgrade` trait usage. -// Deprecated since it moved to `frame_system::Config::SingleBlockMigrations`. -// Can be removed after September 2026. +/// TODO: The `OnRuntimeUpgrade` generic parameter in `Executive` is deprecated and will be +/// removed in a future version. Once removed, this `#[allow(deprecated)]` attribute +/// can be safely deleted. #[allow(deprecated)] impl< System: frame_system::Config + IsInherent, diff --git a/substrate/frame/executive/src/tests.rs b/substrate/frame/executive/src/tests.rs index db5ad4af7922b..268a7472a51c9 100644 --- a/substrate/frame/executive/src/tests.rs +++ b/substrate/frame/executive/src/tests.rs @@ -501,6 +501,9 @@ impl OnRuntimeUpgrade for CustomOnRuntimeUpgrade { } } +/// TODO: The `OnRuntimeUpgrade` generic parameter in `Executive` is deprecated and will be +/// removed in a future version. Once removed, this `#[allow(deprecated)]` attribute +/// can be safely deleted. #[allow(deprecated)] type Executive = super::Executive< Runtime, diff --git a/substrate/frame/support/test/tests/pallet.rs b/substrate/frame/support/test/tests/pallet.rs index d273069cefe0f..ff6c5b85e8759 100644 --- a/substrate/frame/support/test/tests/pallet.rs +++ b/substrate/frame/support/test/tests/pallet.rs @@ -2410,6 +2410,9 @@ fn post_runtime_upgrade_detects_storage_version_issues() { AllPalletsWithSystem, >; + /// TODO: The `OnRuntimeUpgrade` generic parameter in `Executive` is deprecated and will be + /// removed in a future version. Once removed, this `#[allow(deprecated)]` attribute + /// can be safely deleted. #[allow(deprecated)] type ExecutiveWithUpgrade = frame_executive::Executive< Runtime, @@ -2420,6 +2423,9 @@ fn post_runtime_upgrade_detects_storage_version_issues() { CustomUpgrade, >; + /// TODO: The `OnRuntimeUpgrade` generic parameter in `Executive` is deprecated and will be + /// removed in a future version. Once removed, this `#[allow(deprecated)]` attribute + /// can be safely deleted. #[allow(deprecated)] type ExecutiveWithUpgradePallet4 = frame_executive::Executive< Runtime, From 2a5ce00f36412b073d0c12c9f68e392a19fe04d6 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Thu, 11 Sep 2025 12:03:22 +0100 Subject: [PATCH 09/11] update prdoc --- cumulus/pallets/parachain-system/src/lib.rs | 5 +--- prdoc/pr_9638.prdoc | 30 +++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/cumulus/pallets/parachain-system/src/lib.rs b/cumulus/pallets/parachain-system/src/lib.rs index 589c97499acc9..bfd551e360c7b 100644 --- a/cumulus/pallets/parachain-system/src/lib.rs +++ b/cumulus/pallets/parachain-system/src/lib.rs @@ -989,10 +989,7 @@ pub mod pallet { #[pallet::genesis_build] impl BuildGenesisConfig for GenesisConfig { - fn build(&self) { - // TODO: Remove after https://github.com/paritytech/cumulus/issues/479 - sp_io::storage::set(b":c", &[]); - } + fn build(&self) {} } } diff --git a/prdoc/pr_9638.prdoc b/prdoc/pr_9638.prdoc index 8ef30c0f7a537..e4b3cc2ea71d2 100644 --- a/prdoc/pr_9638.prdoc +++ b/prdoc/pr_9638.prdoc @@ -7,3 +7,33 @@ doc: crates: - name: frame-executive bump: major +- name: frame-support + bump: patch +- name: westend-runtime + bump: patch +- name: rococo-runtime + bump: patch +- name: asset-hub-rococo-runtime + bump: patch +- name: asset-hub-westend-runtime + bump: patch +- name: bridge-hub-rococo-runtime + bump: patch +- name: bridge-hub-westend-runtime + bump: patch +- name: collectives-westend-runtime + bump: patch +- name: coretime-rococo-runtime + bump: patch +- name: coretime-westend-runtime + bump: patch +- name: people-rococo-runtime + bump: patch +- name: people-westend-runtime + bump: patch +- name: penpal-runtime + bump: patch +- name: rococo-parachain-runtime + bump: patch +- name: yet-another-parachain-runtime + bump: patch \ No newline at end of file From c9a4320a9b86ba421ecebe241f44a73213bc6c2d Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Thu, 11 Sep 2025 12:04:24 +0100 Subject: [PATCH 10/11] Revert "update prdoc" This reverts commit 2a5ce00f36412b073d0c12c9f68e392a19fe04d6. --- cumulus/pallets/parachain-system/src/lib.rs | 5 +++- prdoc/pr_9638.prdoc | 30 --------------------- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/cumulus/pallets/parachain-system/src/lib.rs b/cumulus/pallets/parachain-system/src/lib.rs index bfd551e360c7b..589c97499acc9 100644 --- a/cumulus/pallets/parachain-system/src/lib.rs +++ b/cumulus/pallets/parachain-system/src/lib.rs @@ -989,7 +989,10 @@ pub mod pallet { #[pallet::genesis_build] impl BuildGenesisConfig for GenesisConfig { - fn build(&self) {} + fn build(&self) { + // TODO: Remove after https://github.com/paritytech/cumulus/issues/479 + sp_io::storage::set(b":c", &[]); + } } } diff --git a/prdoc/pr_9638.prdoc b/prdoc/pr_9638.prdoc index e4b3cc2ea71d2..8ef30c0f7a537 100644 --- a/prdoc/pr_9638.prdoc +++ b/prdoc/pr_9638.prdoc @@ -7,33 +7,3 @@ doc: crates: - name: frame-executive bump: major -- name: frame-support - bump: patch -- name: westend-runtime - bump: patch -- name: rococo-runtime - bump: patch -- name: asset-hub-rococo-runtime - bump: patch -- name: asset-hub-westend-runtime - bump: patch -- name: bridge-hub-rococo-runtime - bump: patch -- name: bridge-hub-westend-runtime - bump: patch -- name: collectives-westend-runtime - bump: patch -- name: coretime-rococo-runtime - bump: patch -- name: coretime-westend-runtime - bump: patch -- name: people-rococo-runtime - bump: patch -- name: people-westend-runtime - bump: patch -- name: penpal-runtime - bump: patch -- name: rococo-parachain-runtime - bump: patch -- name: yet-another-parachain-runtime - bump: patch \ No newline at end of file From debffe84214242b6cb315906343509b60b7a8a2f Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Thu, 11 Sep 2025 12:04:38 +0100 Subject: [PATCH 11/11] update prdoc --- prdoc/pr_9638.prdoc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/prdoc/pr_9638.prdoc b/prdoc/pr_9638.prdoc index 8ef30c0f7a537..e4b3cc2ea71d2 100644 --- a/prdoc/pr_9638.prdoc +++ b/prdoc/pr_9638.prdoc @@ -7,3 +7,33 @@ doc: crates: - name: frame-executive bump: major +- name: frame-support + bump: patch +- name: westend-runtime + bump: patch +- name: rococo-runtime + bump: patch +- name: asset-hub-rococo-runtime + bump: patch +- name: asset-hub-westend-runtime + bump: patch +- name: bridge-hub-rococo-runtime + bump: patch +- name: bridge-hub-westend-runtime + bump: patch +- name: collectives-westend-runtime + bump: patch +- name: coretime-rococo-runtime + bump: patch +- name: coretime-westend-runtime + bump: patch +- name: people-rococo-runtime + bump: patch +- name: people-westend-runtime + bump: patch +- name: penpal-runtime + bump: patch +- name: rococo-parachain-runtime + bump: patch +- name: yet-another-parachain-runtime + bump: patch \ No newline at end of file