diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs
index c3375d2ee601a..6a3328d8864af 100644
--- a/bin/node-template/runtime/src/lib.rs
+++ b/bin/node-template/runtime/src/lib.rs
@@ -280,6 +280,7 @@ impl pallet_template::Config for Runtime {
// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
+ type Migrations = ();
pub struct Runtime {
System: frame_system,
Timestamp: pallet_timestamp,
@@ -316,14 +317,6 @@ pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic
;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload;
-/// Executive: handles dispatch to the various modules.
-pub type Executive = frame_executive::Executive<
- Runtime,
- Block,
- frame_system::ChainContext,
- Runtime,
- AllPalletsWithSystem,
->;
#[cfg(feature = "runtime-benchmarks")]
#[macro_use]
@@ -348,11 +341,11 @@ impl_runtime_apis! {
}
fn execute_block(block: Block) {
- Executive::execute_block(block);
+ Runtime::api_impl_core_execute_block(block);
}
fn initialize_block(header: &::Header) {
- Executive::initialize_block(header)
+ Runtime::api_impl_core_initialize_block(header)
}
}
@@ -372,11 +365,11 @@ impl_runtime_apis! {
impl sp_block_builder::BlockBuilder for Runtime {
fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult {
- Executive::apply_extrinsic(extrinsic)
+ Runtime::api_impl_builder_apply_extrinsic(extrinsic)
}
fn finalize_block() -> ::Header {
- Executive::finalize_block()
+ Runtime::api_impl_builder_finalize_block()
}
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> {
@@ -397,13 +390,13 @@ impl_runtime_apis! {
tx: ::Extrinsic,
block_hash: ::Hash,
) -> TransactionValidity {
- Executive::validate_transaction(source, tx, block_hash)
+ Runtime::api_impl_validate_transaction(source, tx, block_hash)
}
}
impl sp_offchain::OffchainWorkerApi for Runtime {
fn offchain_worker(header: &::Header) {
- Executive::offchain_worker(header)
+ Runtime::api_impl_offchain_worker(header)
}
}
@@ -556,7 +549,7 @@ impl_runtime_apis! {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here. If any of the pre/post migration checks fail, we shall stop
// right here and right now.
- let weight = Executive::try_runtime_upgrade(checks).unwrap();
+ let weight = Runtime::api_impl_try_runtime_upgrade(checks).unwrap();
(weight, BlockWeights::get().max_block)
}
@@ -568,7 +561,7 @@ impl_runtime_apis! {
) -> Weight {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here.
- Executive::try_execute_block(block, state_root_check, signature_check, select).expect("execute-block failed")
+ Runtime::api_impl_try_execute_block(block, state_root_check, signature_check, select).expect("execute-block failed")
}
}
}
diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs
index 29aaaf5fdad5a..2b7425d7dac90 100644
--- a/bin/node/runtime/src/lib.rs
+++ b/bin/node/runtime/src/lib.rs
@@ -1874,6 +1874,13 @@ impl pallet_statement::Config for Runtime {
}
construct_runtime!(
+ // All migrations executed on runtime upgrade as a nested tuple of types implementing
+ // `OnRuntimeUpgrade`.
+ type Migrations = (
+ pallet_nomination_pools::migration::v2::MigrateToV2,
+ pallet_alliance::migration::Migration,
+ pallet_contracts::Migration,
+ );
pub struct Runtime
{
System: frame_system,
@@ -1982,23 +1989,6 @@ pub type UncheckedExtrinsic =
pub type SignedPayload = generic::SignedPayload;
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic;
-/// Executive: handles dispatch to the various modules.
-pub type Executive = frame_executive::Executive<
- Runtime,
- Block,
- frame_system::ChainContext,
- Runtime,
- AllPalletsWithSystem,
- Migrations,
->;
-
-// All migrations executed on runtime upgrade as a nested tuple of types implementing
-// `OnRuntimeUpgrade`.
-type Migrations = (
- pallet_nomination_pools::migration::v2::MigrateToV2,
- pallet_alliance::migration::Migration,
- pallet_contracts::Migration,
-);
type EventRecord = frame_system::EventRecord<
::RuntimeEvent,
@@ -2085,11 +2075,11 @@ impl_runtime_apis! {
}
fn execute_block(block: Block) {
- Executive::execute_block(block);
+ Runtime::api_impl_core_execute_block(block);
}
fn initialize_block(header: &::Header) {
- Executive::initialize_block(header)
+ Runtime::api_impl_core_initialize_block(header)
}
}
@@ -2109,11 +2099,11 @@ impl_runtime_apis! {
impl sp_block_builder::BlockBuilder for Runtime {
fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult {
- Executive::apply_extrinsic(extrinsic)
+ Runtime::api_impl_builder_apply_extrinsic(extrinsic)
}
fn finalize_block() -> ::Header {
- Executive::finalize_block()
+ Runtime::api_impl_builder_finalize_block()
}
fn inherent_extrinsics(data: InherentData) -> Vec<::Extrinsic> {
@@ -2131,7 +2121,7 @@ impl_runtime_apis! {
tx: ::Extrinsic,
block_hash: ::Hash,
) -> TransactionValidity {
- Executive::validate_transaction(source, tx, block_hash)
+ Runtime::api_impl_validate_transaction(source, tx, block_hash)
}
}
@@ -2146,7 +2136,7 @@ impl_runtime_apis! {
impl sp_offchain::OffchainWorkerApi for Runtime {
fn offchain_worker(header: &::Header) {
- Executive::offchain_worker(header)
+ Runtime::api_impl_offchain_worker(header)
}
}
@@ -2520,7 +2510,7 @@ impl_runtime_apis! {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here. If any of the pre/post migration checks fail, we shall stop
// right here and right now.
- let weight = Executive::try_runtime_upgrade(checks).unwrap();
+ let weight = Runtime::api_impl_try_runtime_upgrade(checks).unwrap();
(weight, RuntimeBlockWeights::get().max_block)
}
@@ -2532,7 +2522,7 @@ impl_runtime_apis! {
) -> Weight {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here.
- Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
+ Runtime::api_impl_try_execute_block(block, state_root_check, signature_check, select).unwrap()
}
}
diff --git a/frame/support/procedural/src/construct_runtime/expand/executive.rs b/frame/support/procedural/src/construct_runtime/expand/executive.rs
new file mode 100644
index 0000000000000..29e22ba7b74d2
--- /dev/null
+++ b/frame/support/procedural/src/construct_runtime/expand/executive.rs
@@ -0,0 +1,107 @@
+// This file is part of Substrate.
+
+// Copyright (C) Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: Apache-2.0
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License
+
+use crate::construct_runtime::parse::ExecutiveSection;
+use frame_support_procedural_tools::generate_crate_access_2018;
+use proc_macro2::{Ident, TokenStream};
+use quote::quote;
+use syn::Result;
+
+pub fn expand_executive(
+ runtime: &Ident,
+ system: &Ident,
+ scrate: &TokenStream,
+ block: &TokenStream,
+ executive_section: ExecutiveSection,
+) -> Result {
+ let executive = generate_crate_access_2018("frame-executive")?;
+
+ let migrations = match executive_section.migration_section {
+ Some(migrations) => quote!(#migrations),
+ None => quote!(()),
+ };
+
+ let try_runtime_section = if let Ok(try_runtime) =
+ generate_crate_access_2018("frame-try-runtime")
+ {
+ quote! {
+ #[cfg(feature = "try-runtime")]
+ impl #runtime {
+ fn api_impl_try_runtime_upgrade(checks: #try_runtime::UpgradeCheckSelect) -> Result {
+ Executive::try_runtime_upgrade(checks)
+ }
+
+ fn api_impl_try_execute_block(
+ block: #block,
+ state_root_check: bool,
+ signature_check: bool,
+ select: #try_runtime::TryStateSelect
+ ) -> Result {
+ Executive::try_execute_block(block, state_root_check, signature_check, select)
+ }
+ }
+ }
+ } else {
+ quote!()
+ };
+
+ let res = quote! {
+ /// Executive: handles dispatch to the various modules.
+ pub type Executive = #executive::Executive<
+ #runtime,
+ #block,
+ #system::ChainContext<#runtime>,
+ #runtime,
+ AllPalletsWithSystem,
+ (#migrations)
+ >;
+
+ impl #runtime {
+ pub fn api_impl_core_execute_block(block: #block) {
+ Executive::execute_block(block);
+ }
+
+ pub fn api_impl_core_initialize_block(header: &<#block as #scrate::sp_runtime::traits::Block>::Header) {
+ Executive::initialize_block(header);
+ }
+
+ pub fn api_impl_builder_apply_extrinsic(extrinsic: <#block as #scrate::sp_runtime::traits::Block>::Extrinsic) -> #scrate::sp_runtime::ApplyExtrinsicResult {
+ Executive::apply_extrinsic(extrinsic)
+ }
+
+ pub fn api_impl_builder_finalize_block() -> <#block as #scrate::sp_runtime::traits::Block>::Header {
+ Executive::finalize_block()
+ }
+
+ pub fn api_impl_validate_transaction(
+ source: #scrate::sp_runtime::transaction_validity::TransactionSource,
+ tx: ::Extrinsic,
+ block_hash: ::Hash,
+ ) -> #scrate::sp_runtime::transaction_validity::TransactionValidity {
+ Executive::validate_transaction(source, tx, block_hash)
+ }
+
+ pub fn api_impl_offchain_worker(header: &::Header) {
+ Executive::offchain_worker(header)
+ }
+ }
+
+ #try_runtime_section
+ };
+
+ Ok(res)
+}
diff --git a/frame/support/procedural/src/construct_runtime/expand/mod.rs b/frame/support/procedural/src/construct_runtime/expand/mod.rs
index 830338f9265ff..d284aca6ab2d7 100644
--- a/frame/support/procedural/src/construct_runtime/expand/mod.rs
+++ b/frame/support/procedural/src/construct_runtime/expand/mod.rs
@@ -17,6 +17,7 @@
mod call;
mod config;
+mod executive;
mod freeze_reason;
mod hold_reason;
mod inherent;
@@ -29,6 +30,7 @@ mod unsigned;
pub use call::expand_outer_dispatch;
pub use config::expand_outer_config;
+pub use executive::expand_executive;
pub use freeze_reason::expand_outer_freeze_reason;
pub use hold_reason::expand_outer_hold_reason;
pub use inherent::expand_outer_inherent;
diff --git a/frame/support/procedural/src/construct_runtime/mod.rs b/frame/support/procedural/src/construct_runtime/mod.rs
index efc2244154479..0fc016ff30b8b 100644
--- a/frame/support/procedural/src/construct_runtime/mod.rs
+++ b/frame/support/procedural/src/construct_runtime/mod.rs
@@ -334,7 +334,13 @@ fn construct_runtime_explicit_to_explicit_expanded(
fn construct_runtime_final_expansion(
definition: ExplicitRuntimeDeclaration,
) -> Result {
- let ExplicitRuntimeDeclaration { name, pallets, pallets_token, where_section } = definition;
+ let ExplicitRuntimeDeclaration {
+ name,
+ pallets,
+ pallets_token,
+ where_section,
+ executive_section,
+ } = definition;
let system_pallet =
pallets.iter().find(|decl| decl.name == SYSTEM_PALLET_NAME).ok_or_else(|| {
@@ -402,6 +408,11 @@ fn construct_runtime_final_expansion(
let slash_reason = expand::expand_outer_slash_reason(&pallets, &scrate);
let integrity_test = decl_integrity_test(&scrate);
let static_assertions = decl_static_assertions(&name, &pallets, &scrate);
+ let executive = if let Some(executive_section) = executive_section {
+ expand::expand_executive(&name, &frame_system, &scrate, &block, executive_section)?
+ } else {
+ quote!()
+ };
let warning =
where_section.map_or(None, |where_section| {
@@ -491,6 +502,8 @@ fn construct_runtime_final_expansion(
#integrity_test
#static_assertions
+
+ #executive
);
Ok(res)
diff --git a/frame/support/procedural/src/construct_runtime/parse.rs b/frame/support/procedural/src/construct_runtime/parse.rs
index 9b08e16469754..21a27e8b225ae 100644
--- a/frame/support/procedural/src/construct_runtime/parse.rs
+++ b/frame/support/procedural/src/construct_runtime/parse.rs
@@ -24,7 +24,7 @@ use syn::{
parse::{Parse, ParseStream},
punctuated::Punctuated,
spanned::Spanned,
- token, Attribute, Error, Ident, Path, Result, Token,
+ token, Attribute, Error, Ident, Path, Result, Token, Type,
};
mod keyword {
@@ -67,6 +67,7 @@ pub struct ImplicitRuntimeDeclaration {
pub name: Ident,
pub where_section: Option,
pub pallets: Vec,
+ pub executive_section: Option,
}
/// Declaration of a runtime with all pallet having explicit declaration of parts.
@@ -76,10 +77,13 @@ pub struct ExplicitRuntimeDeclaration {
pub where_section: Option,
pub pallets: Vec,
pub pallets_token: token::Brace,
+ pub executive_section: Option,
}
impl Parse for RuntimeDeclaration {
fn parse(input: ParseStream) -> Result {
+ let executive_section = if input.peek(Token![type]) { Some(input.parse()?) } else { None };
+
input.parse::()?;
// Support either `enum` or `struct`.
@@ -90,6 +94,7 @@ impl Parse for RuntimeDeclaration {
}
let name = input.parse::()?;
+
let where_section = if input.peek(token::Where) { Some(input.parse()?) } else { None };
let pallets =
input.parse::>>()?;
@@ -101,6 +106,7 @@ impl Parse for RuntimeDeclaration {
name,
where_section,
pallets,
+ executive_section,
})),
PalletsConversion::Explicit(pallets) =>
Ok(RuntimeDeclaration::Explicit(ExplicitRuntimeDeclaration {
@@ -108,6 +114,7 @@ impl Parse for RuntimeDeclaration {
where_section,
pallets,
pallets_token,
+ executive_section,
})),
PalletsConversion::ExplicitExpanded(pallets) =>
Ok(RuntimeDeclaration::ExplicitExpanded(ExplicitRuntimeDeclaration {
@@ -115,11 +122,77 @@ impl Parse for RuntimeDeclaration {
where_section,
pallets,
pallets_token,
+ executive_section,
})),
}
}
}
+#[derive(Debug)]
+pub struct ExecutiveSection {
+ pub span: Span,
+ pub migration_section: Option,
+}
+
+impl Parse for ExecutiveSection {
+ fn parse(input: ParseStream) -> Result {
+ let _ = input.parse::()?;
+ let name = input.parse::()?;
+
+ let migration_section = if name.to_string() == "Migrations" {
+ Some(input.parse::()?)
+ } else {
+ None
+ };
+
+ Ok(Self { span: input.span(), migration_section })
+ }
+}
+
+#[derive(Debug)]
+pub struct Migrations {
+ pub span: Span,
+ pub migrations: Punctuated,
+}
+
+impl Parse for Migrations {
+ fn parse(input: ParseStream) -> Result {
+ let _ = input.parse::()?;
+
+ let content;
+ syn::parenthesized!(content in input);
+
+ let migrations = content.parse_terminated(Migration::parse, Token![,])?;
+ let _ = input.parse::()?;
+ Ok(Self { span: input.span(), migrations })
+ }
+}
+
+impl ToTokens for Migrations {
+ fn to_tokens(&self, tokens: &mut TokenStream) {
+ self.migrations.to_tokens(tokens);
+ }
+}
+
+#[derive(Debug)]
+pub struct Migration {
+ pub span: Span,
+ pub ident: Type,
+}
+
+impl Parse for Migration {
+ fn parse(input: ParseStream) -> Result {
+ let name = input.parse::()?;
+ Ok(Self { span: input.span(), ident: name })
+ }
+}
+
+impl ToTokens for Migration {
+ fn to_tokens(&self, tokens: &mut TokenStream) {
+ self.ident.to_tokens(tokens);
+ }
+}
+
#[derive(Debug)]
pub struct WhereSection {
pub span: Span,
diff --git a/frame/support/test/tests/construct_runtime_ui/invalid_migration_param.rs b/frame/support/test/tests/construct_runtime_ui/invalid_migration_param.rs
new file mode 100644
index 0000000000000..499735b275ca9
--- /dev/null
+++ b/frame/support/test/tests/construct_runtime_ui/invalid_migration_param.rs
@@ -0,0 +1,27 @@
+use frame_support::{construct_runtime, derive_impl, traits::ConstU64};
+
+type Block = frame_system::mocking::MockBlock;
+
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+impl frame_system::Config for Runtime {
+ type Block = Block;
+ type BlockHashCount = ConstU64<10>;
+ type BaseCallFilter = frame_support::traits::Everything;
+ type RuntimeOrigin = RuntimeOrigin;
+ type RuntimeCall = RuntimeCall;
+ type RuntimeEvent = RuntimeEvent;
+ type PalletInfo = PalletInfo;
+ type OnSetCode = ();
+}
+
+struct Dummy;
+
+construct_runtime! {
+ type Migrations = (Dummy);
+ pub struct Runtime
+ {
+ System: frame_system
+ }
+}
+
+fn main() {}
diff --git a/frame/support/test/tests/construct_runtime_ui/invalid_migration_param.stderr b/frame/support/test/tests/construct_runtime_ui/invalid_migration_param.stderr
new file mode 100644
index 0000000000000..744c22eccef1d
--- /dev/null
+++ b/frame/support/test/tests/construct_runtime_ui/invalid_migration_param.stderr
@@ -0,0 +1,203 @@
+error[E0599]: the function or associated item `execute_block` exists for struct `Executive, ...>, ..., ..., ..., ...>`, but its trait bounds were not satisfied
+ --> tests/construct_runtime_ui/invalid_migration_param.rs:19:1
+ |
+17 | struct Dummy;
+ | ------------ doesn't satisfy `Dummy: OnRuntimeUpgrade`
+18 |
+19 | construct_runtime! {
+ | __^
+ | | _|
+ | ||
+20 | || type Migrations = (Dummy);
+21 | || pub struct Runtime
+22 | || {
+23 | || System: frame_system
+24 | || }
+25 | || }
+ | ||_- in this macro invocation
+... |
+ |
+ ::: $WORKSPACE/primitives/runtime/src/generic/unchecked_extrinsic.rs
+ |
+ | pub struct UncheckedExtrinsic
+ | -------------------------------------------------------------- doesn't satisfy `_: Checkable>`
+ |
+ = note: the following trait bounds were not satisfied:
+ `Dummy: OnRuntimeUpgrade`
+ `UncheckedExtrinsic: Checkable>`
+note: the trait `OnRuntimeUpgrade` must be implemented
+ --> $WORKSPACE/frame/support/src/traits/hooks.rs
+ |
+ | pub trait OnRuntimeUpgrade {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0599]: the function or associated item `initialize_block` exists for struct `Executive, ...>, ..., ..., ..., ...>`, but its trait bounds were not satisfied
+ --> tests/construct_runtime_ui/invalid_migration_param.rs:19:1
+ |
+17 | struct Dummy;
+ | ------------ doesn't satisfy `Dummy: OnRuntimeUpgrade`
+18 |
+19 | construct_runtime! {
+ | __^
+ | | _|
+ | ||
+20 | || type Migrations = (Dummy);
+21 | || pub struct Runtime
+22 | || {
+23 | || System: frame_system
+24 | || }
+25 | || }
+ | ||_- in this macro invocation
+... |
+ |
+ ::: $WORKSPACE/primitives/runtime/src/generic/unchecked_extrinsic.rs
+ |
+ | pub struct UncheckedExtrinsic
+ | -------------------------------------------------------------- doesn't satisfy `_: Checkable>`
+ |
+ = note: the following trait bounds were not satisfied:
+ `Dummy: OnRuntimeUpgrade`
+ `UncheckedExtrinsic: Checkable>`
+note: the trait `OnRuntimeUpgrade` must be implemented
+ --> $WORKSPACE/frame/support/src/traits/hooks.rs
+ |
+ | pub trait OnRuntimeUpgrade {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0599]: the function or associated item `apply_extrinsic` exists for struct `Executive, ...>, ..., ..., ..., ...>`, but its trait bounds were not satisfied
+ --> tests/construct_runtime_ui/invalid_migration_param.rs:19:1
+ |
+17 | struct Dummy;
+ | ------------ doesn't satisfy `Dummy: OnRuntimeUpgrade`
+18 |
+19 | construct_runtime! {
+ | __^
+ | | _|
+ | ||
+20 | || type Migrations = (Dummy);
+21 | || pub struct Runtime
+22 | || {
+23 | || System: frame_system
+24 | || }
+25 | || }
+ | ||_- in this macro invocation
+... |
+ |
+ ::: $WORKSPACE/primitives/runtime/src/generic/unchecked_extrinsic.rs
+ |
+ | pub struct UncheckedExtrinsic
+ | -------------------------------------------------------------- doesn't satisfy `_: Checkable>`
+ |
+ = note: the following trait bounds were not satisfied:
+ `Dummy: OnRuntimeUpgrade`
+ `UncheckedExtrinsic: Checkable>`
+note: the trait `OnRuntimeUpgrade` must be implemented
+ --> $WORKSPACE/frame/support/src/traits/hooks.rs
+ |
+ | pub trait OnRuntimeUpgrade {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0599]: the function or associated item `finalize_block` exists for struct `Executive, ...>, ..., ..., ..., ...>`, but its trait bounds were not satisfied
+ --> tests/construct_runtime_ui/invalid_migration_param.rs:19:1
+ |
+17 | struct Dummy;
+ | ------------ doesn't satisfy `Dummy: OnRuntimeUpgrade`
+18 |
+19 | construct_runtime! {
+ | __^
+ | | _|
+ | ||
+20 | || type Migrations = (Dummy);
+21 | || pub struct Runtime
+22 | || {
+23 | || System: frame_system
+24 | || }
+25 | || }
+ | ||_- in this macro invocation
+... |
+ |
+ ::: $WORKSPACE/primitives/runtime/src/generic/unchecked_extrinsic.rs
+ |
+ | pub struct UncheckedExtrinsic
+ | -------------------------------------------------------------- doesn't satisfy `_: Checkable>`
+ |
+ = note: the following trait bounds were not satisfied:
+ `Dummy: OnRuntimeUpgrade`
+ `UncheckedExtrinsic: Checkable>`
+note: the trait `OnRuntimeUpgrade` must be implemented
+ --> $WORKSPACE/frame/support/src/traits/hooks.rs
+ |
+ | pub trait OnRuntimeUpgrade {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0599]: the function or associated item `validate_transaction` exists for struct `Executive, ...>, ..., ..., ..., ...>`, but its trait bounds were not satisfied
+ --> tests/construct_runtime_ui/invalid_migration_param.rs:19:1
+ |
+17 | struct Dummy;
+ | ------------ doesn't satisfy `Dummy: OnRuntimeUpgrade`
+18 |
+19 | construct_runtime! {
+ | __^
+ | | _|
+ | ||
+20 | || type Migrations = (Dummy);
+21 | || pub struct Runtime
+22 | || {
+23 | || System: frame_system
+24 | || }
+25 | || }
+ | ||_- in this macro invocation
+... |
+ |
+ ::: $WORKSPACE/primitives/runtime/src/generic/unchecked_extrinsic.rs
+ |
+ | pub struct UncheckedExtrinsic
+ | -------------------------------------------------------------- doesn't satisfy `_: Checkable>`
+ |
+ = note: the following trait bounds were not satisfied:
+ `Dummy: OnRuntimeUpgrade`
+ `UncheckedExtrinsic: Checkable>`
+note: the trait `OnRuntimeUpgrade` must be implemented
+ --> $WORKSPACE/frame/support/src/traits/hooks.rs
+ |
+ | pub trait OnRuntimeUpgrade {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0599]: the function or associated item `offchain_worker` exists for struct `Executive, ...>, ..., ..., ..., ...>`, but its trait bounds were not satisfied
+ --> tests/construct_runtime_ui/invalid_migration_param.rs:19:1
+ |
+17 | struct Dummy;
+ | ------------ doesn't satisfy `Dummy: OnRuntimeUpgrade`
+18 |
+19 | construct_runtime! {
+ | __^
+ | | _|
+ | ||
+20 | || type Migrations = (Dummy);
+21 | || pub struct Runtime
+22 | || {
+23 | || System: frame_system
+24 | || }
+25 | || }
+ | ||_- in this macro invocation
+... |
+ |
+ ::: $WORKSPACE/primitives/runtime/src/generic/unchecked_extrinsic.rs
+ |
+ | pub struct UncheckedExtrinsic
+ | -------------------------------------------------------------- doesn't satisfy `_: Checkable>`
+ |
+ = note: the following trait bounds were not satisfied:
+ `Dummy: OnRuntimeUpgrade`
+ `UncheckedExtrinsic: Checkable>`
+note: the trait `OnRuntimeUpgrade` must be implemented
+ --> $WORKSPACE/frame/support/src/traits/hooks.rs
+ |
+ | pub trait OnRuntimeUpgrade {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/test-utils/runtime/src/lib.rs b/test-utils/runtime/src/lib.rs
index 0cc32e50956c8..528881c950e16 100644
--- a/test-utils/runtime/src/lib.rs
+++ b/test-utils/runtime/src/lib.rs
@@ -226,14 +226,6 @@ decl_runtime_apis! {
}
}
-pub type Executive = frame_executive::Executive<
- Runtime,
- Block,
- frame_system::ChainContext,
- Runtime,
- AllPalletsWithSystem,
->;
-
#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)]
pub struct CheckSubstrateCall;
@@ -297,6 +289,7 @@ impl sp_runtime::traits::SignedExtension for CheckSubstrateCall {
}
construct_runtime!(
+ type Migrations = ();
pub enum Runtime
{
System: frame_system,
@@ -478,12 +471,12 @@ impl_runtime_apis! {
fn execute_block(block: Block) {
log::trace!(target: LOG_TARGET, "execute_block: {block:#?}");
- Executive::execute_block(block);
+ Runtime::api_impl_core_execute_block(block);
}
fn initialize_block(header: &::Header) {
log::trace!(target: LOG_TARGET, "initialize_block: {header:#?}");
- Executive::initialize_block(header);
+ Runtime::api_impl_core_initialize_block(header)
}
}
@@ -506,7 +499,7 @@ impl_runtime_apis! {
utx: ::Extrinsic,
block_hash: ::Hash,
) -> TransactionValidity {
- let validity = Executive::validate_transaction(source, utx.clone(), block_hash);
+ let validity = Runtime::api_impl_validate_transaction(source, utx.clone(), block_hash);
log::trace!(target: LOG_TARGET, "validate_transaction {:?} {:?}", utx, validity);
validity
}
@@ -514,12 +507,12 @@ impl_runtime_apis! {
impl sp_block_builder::BlockBuilder for Runtime {
fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult {
- Executive::apply_extrinsic(extrinsic)
+ Runtime::api_impl_builder_apply_extrinsic(extrinsic)
}
fn finalize_block() -> ::Header {
log::trace!(target: LOG_TARGET, "finalize_block");
- Executive::finalize_block()
+ Runtime::api_impl_builder_finalize_block()
}
fn inherent_extrinsics(_data: InherentData) -> Vec<::Extrinsic> {