diff --git a/substrate/core/client/src/block_builder/api.rs b/substrate/core/client/src/block_builder/api.rs index 3b8ceb6305..d122909eaf 100644 --- a/substrate/core/client/src/block_builder/api.rs +++ b/substrate/core/client/src/block_builder/api.rs @@ -16,19 +16,19 @@ //! The runtime api for building blocks. -use runtime_primitives::{traits::Block as BlockT, ApplyResult, InherentData, CheckInherentError}; +use runtime_primitives::{traits::Block as BlockT, ApplyResult, CheckInherentError}; use rstd::vec::Vec; decl_runtime_apis! { /// The `BlockBuilder` api trait that provides required functions for building a block for a runtime. - pub trait BlockBuilder { + pub trait BlockBuilder { /// Apply the given extrinsics. fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult; /// Finish the current block. fn finalise_block() -> ::Header; - /// Generate inherent extrinsics. + /// Generate inherent extrinsics. The inherent data will vary from chain to chain. fn inherent_extrinsics(inherent: InherentData) -> Vec<::Extrinsic>; - /// Check that the inherents are valid. + /// Check that the inherents are valid. The inherent data will vary from chain to chain. fn check_inherents(block: Block, data: InherentData) -> Result<(), CheckInherentError>; /// Generate a random seed. fn random_seed() -> ::Hash; diff --git a/substrate/core/client/src/block_builder/block_builder.rs b/substrate/core/client/src/block_builder/block_builder.rs index 7d5b867e3a..8656bfed53 100644 --- a/substrate/core/client/src/block_builder/block_builder.rs +++ b/substrate/core/client/src/block_builder/block_builder.rs @@ -16,6 +16,7 @@ use super::api::BlockBuilder as BlockBuilderApi; use std::vec::Vec; +use std::marker::PhantomData; use codec::Encode; use blockchain::HeaderBackend; use runtime_primitives::traits::{ @@ -28,18 +29,19 @@ use error; use runtime_primitives::ApplyOutcome; /// Utility for building new (valid) blocks from a stream of extrinsics. -pub struct BlockBuilder<'a, Block, A: ProvideRuntimeApi> where Block: BlockT { +pub struct BlockBuilder<'a, Block, InherentData, A: ProvideRuntimeApi> where Block: BlockT { header: ::Header, extrinsics: Vec<::Extrinsic>, api: ApiRef<'a, A::Api>, block_id: BlockId, + _marker: PhantomData, } -impl<'a, Block, A> BlockBuilder<'a, Block, A> +impl<'a, Block, A, InherentData> BlockBuilder<'a, Block, InherentData, A> where Block: BlockT, A: ProvideRuntimeApi + HeaderBackend + 'a, - A::Api: BlockBuilderApi, + A::Api: BlockBuilderApi, { /// Create a new instance of builder from the given client, building on the latest block. pub fn new(api: &'a A) -> error::Result { @@ -72,6 +74,7 @@ where extrinsics: Vec::new(), api, block_id: *block_id, + _marker: PhantomData, }) } @@ -79,12 +82,12 @@ where /// can be validly executed (by executing it); if it is invalid, it'll be returned along with /// the error. Otherwise, it will return a mutable reference to self (in order to chain). pub fn push(&mut self, xt: ::Extrinsic) -> error::Result<()> { - fn impl_push<'a, T, Block: BlockT>( + fn impl_push<'a, T, Block: BlockT, InherentData>( api: &mut ApiRef<'a, T>, block_id: &BlockId, xt: Block::Extrinsic, extrinsics: &mut Vec - ) -> error::Result<()> where T: BlockBuilderApi { + ) -> error::Result<()> where T: BlockBuilderApi { api.map_api_result(|api| { match api.apply_extrinsic(block_id, &xt)? { Ok(ApplyOutcome::Success) | Ok(ApplyOutcome::Fail) => { diff --git a/substrate/core/client/src/client.rs b/substrate/core/client/src/client.rs index 205827b6d4..60a68665ff 100644 --- a/substrate/core/client/src/client.rs +++ b/substrate/core/client/src/client.rs @@ -538,21 +538,21 @@ impl Client where } /// Create a new block, built on the head of the chain. - pub fn new_block( + pub fn new_block( &self - ) -> error::Result> where + ) -> error::Result> where E: Clone + Send + Sync, - RA: BlockBuilderAPI + RA: BlockBuilderAPI { block_builder::BlockBuilder::new(self) } /// Create a new block, built on top of `parent`. - pub fn new_block_at( + pub fn new_block_at( &self, parent: &BlockId - ) -> error::Result> where + ) -> error::Result> where E: Clone + Send + Sync, - RA: BlockBuilderAPI + RA: BlockBuilderAPI { block_builder::BlockBuilder::at_block(parent, &self) } diff --git a/substrate/core/consensus/rhd/src/lib.rs b/substrate/core/consensus/rhd/src/lib.rs index 449f9c3ffa..135fbd03a2 100644 --- a/substrate/core/consensus/rhd/src/lib.rs +++ b/substrate/core/consensus/rhd/src/lib.rs @@ -196,7 +196,7 @@ pub trait BlockBuilder { pub trait AuthoringApi: Send + Sync - + BlockBuilderAPI<::Block, Error=::Error> + + BlockBuilderAPI<::Block, InherentData, Error=::Error> + Core<::Block, AuthorityId, Error=::Error> + OldTxQueue<::Block, Error=::Error> { @@ -1174,7 +1174,7 @@ impl BaseProposer<::Block> for Proposer where let proposed_timestamp = match self.client.check_inherents( &self.parent_id, &unchecked_proposal, - &inherent + &inherent, ) { Ok(Ok(())) => None, Ok(Err(BlockBuilderError::TimestampInFuture(timestamp))) => Some(timestamp), diff --git a/substrate/core/network/src/test/mod.rs b/substrate/core/network/src/test/mod.rs index 603aaa9572..7f490a9459 100644 --- a/substrate/core/network/src/test/mod.rs +++ b/substrate/core/network/src/test/mod.rs @@ -234,7 +234,7 @@ impl, D> Peer { /// Add blocks to the peer -- edit the block before adding pub fn generate_blocks(&self, count: usize, origin: BlockOrigin, mut edit_block: F) - where F: FnMut(BlockBuilder) -> Block + where F: FnMut(BlockBuilder) -> Block { use blocks::BlockData; diff --git a/substrate/core/service/src/consensus.rs b/substrate/core/service/src/consensus.rs index 240ba7dc49..2a7b96f199 100644 --- a/substrate/core/service/src/consensus.rs +++ b/substrate/core/service/src/consensus.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -//! provide consensus service to substrate. +//! A consensus proposer for "basic" chains which use the primitive inherent-data. // FIXME: move this into substrate-consensus-common - https://github.com/paritytech/substrate/issues/1021 @@ -29,7 +29,7 @@ use consensus_common::{self, evaluation, offline_tracker::OfflineTracker}; use primitives::{H256, AuthorityId, ed25519, Blake2Hasher}; use runtime_primitives::traits::{Block as BlockT, Hash as HashT, Header as HeaderT, ProvideRuntimeApi}; use runtime_primitives::generic::BlockId; -use runtime_primitives::InherentData; +use runtime_primitives::BasicInherentData; use transaction_pool::txpool::{self, Pool as TransactionPool}; use parking_lot::RwLock; @@ -60,16 +60,18 @@ pub trait AuthoringApi: Send + Sync + ProvideRuntimeApi where fn build_block) -> ()>( &self, at: &BlockId, - inherent_data: InherentData, + inherent_data: BasicInherentData, build_ctx: F, ) -> Result; } -impl<'a, B, E, Block, RA> BlockBuilder for client::block_builder::BlockBuilder<'a, Block, SubstrateClient> where +impl<'a, B, E, Block, RA> BlockBuilder + for client::block_builder::BlockBuilder<'a, Block, BasicInherentData, SubstrateClient> +where B: client::backend::Backend + 'static, E: CallExecutor + Send + Sync + Clone + 'static, Block: BlockT, - RA: BlockBuilderApi, + RA: BlockBuilderApi, { fn push_extrinsic(&mut self, extrinsic: ::Extrinsic) -> Result<(), error::Error> { client::block_builder::BlockBuilder::push(self, extrinsic).map_err(Into::into) @@ -80,7 +82,7 @@ impl AuthoringApi for SubstrateClient where B: client::backend::Backend + Send + Sync + 'static, E: CallExecutor + Send + Sync + Clone + 'static, Block: BlockT, - RA: BlockBuilderApi, + RA: BlockBuilderApi, { type Block = Block; type Error = client::error::Error; @@ -88,7 +90,7 @@ impl AuthoringApi for SubstrateClient where fn build_block) -> ()>( &self, at: &BlockId, - inherent_data: InherentData, + inherent_data: BasicInherentData, mut build_ctx: F, ) -> Result { let runtime_version = self.runtime_version_at(at)?; @@ -119,7 +121,7 @@ pub struct ProposerFactory where A: txpool::ChainApi { impl consensus_common::Environment<::Block> for ProposerFactory where C: AuthoringApi, - ::Api: BlockBuilderApi<::Block>, + ::Api: BlockBuilderApi<::Block, BasicInherentData>, A: txpool::ChainApi::Block>, client::error::Error: From<::Error> { @@ -174,7 +176,7 @@ pub struct Proposer { impl consensus_common::Proposer<::Block> for Proposer where Block: BlockT, C: AuthoringApi, - ::Api: BlockBuilderApi, + ::Api: BlockBuilderApi, A: txpool::ChainApi, client::error::Error: From<::Error> { @@ -201,7 +203,7 @@ impl consensus_common::Proposer<::Block> for Pro ) } - let inherent_data = InherentData::new(timestamp, offline_indices); + let inherent_data = BasicInherentData::new(timestamp, offline_indices); let block = self.client.build_block( &self.parent_id, diff --git a/substrate/core/service/test/src/lib.rs b/substrate/core/service/test/src/lib.rs index 7ffa783e97..fdb39ed991 100644 --- a/substrate/core/service/test/src/lib.rs +++ b/substrate/core/service/test/src/lib.rs @@ -180,9 +180,9 @@ impl TestNet { } } -pub fn connectivity(spec: FactoryChainSpec) where +pub fn connectivity(spec: FactoryChainSpec) where ::RuntimeApi: - client::block_builder::api::BlockBuilder<::Block> + client::block_builder::api::BlockBuilder<::Block, Inherent> { const NUM_NODES: u32 = 10; { @@ -224,7 +224,7 @@ where B: Fn(&F::FullService) -> ImportBlock, E: Fn(&F::FullService) -> FactoryExtrinsic, ::RuntimeApi: - client::block_builder::api::BlockBuilder<::Block> + + client::block_builder::api::BlockBuilder<::Block, ()> + client::runtime_api::TaggedTransactionQueue<::Block> { const NUM_NODES: u32 = 10; @@ -263,7 +263,7 @@ pub fn consensus(spec: FactoryChainSpec, authorities: Vec) where F: ServiceFactory, ::RuntimeApi: - client::block_builder::api::BlockBuilder<::Block> + client::block_builder::api::BlockBuilder<::Block, ()> { const NUM_NODES: u32 = 20; const NUM_BLOCKS: u64 = 200; diff --git a/substrate/core/sr-primitives/src/lib.rs b/substrate/core/sr-primitives/src/lib.rs index 86c93ab3d7..e07711668c 100644 --- a/substrate/core/sr-primitives/src/lib.rs +++ b/substrate/core/sr-primitives/src/lib.rs @@ -463,17 +463,17 @@ macro_rules! impl_outer_log { } //TODO: https://github.com/paritytech/substrate/issues/1022 -/// Inherent data to include in a block. +/// Basic Inherent data to include in a block; used by simple runtimes. #[derive(Encode, Decode)] -pub struct InherentData { +pub struct BasicInherentData { /// Current timestamp. pub timestamp: u64, /// Indices of offline validators. pub consensus: Vec, } -impl InherentData { - /// Create a new `InherentData` instance. +impl BasicInherentData { + /// Create a new `BasicInherentData` instance. pub fn new(timestamp: u64, consensus: Vec) -> Self { Self { timestamp, diff --git a/substrate/core/test-client/src/block_builder_ext.rs b/substrate/core/test-client/src/block_builder_ext.rs index 3c334b07a1..651559114a 100644 --- a/substrate/core/test-client/src/block_builder_ext.rs +++ b/substrate/core/test-client/src/block_builder_ext.rs @@ -29,9 +29,9 @@ pub trait BlockBuilderExt { fn push_transfer(&mut self, transfer: runtime::Transfer) -> Result<(), client::error::Error>; } -impl<'a, A> BlockBuilderExt for client::block_builder::BlockBuilder<'a, runtime::Block, A> where +impl<'a, A> BlockBuilderExt for client::block_builder::BlockBuilder<'a, runtime::Block, (), A> where A: ProvideRuntimeApi + client::blockchain::HeaderBackend + 'a, - A::Api: BlockBuilder + A::Api: BlockBuilder { fn push_transfer(&mut self, transfer: runtime::Transfer) -> Result<(), client::error::Error> { self.push(sign_tx(transfer)) diff --git a/substrate/core/test-runtime/src/lib.rs b/substrate/core/test-runtime/src/lib.rs index 50a0134e90..e3228cae3c 100644 --- a/substrate/core/test-runtime/src/lib.rs +++ b/substrate/core/test-runtime/src/lib.rs @@ -56,7 +56,7 @@ use runtime_primitives::{ traits::{ BlindCheckable, BlakeTwo256, Block as BlockT, Extrinsic as ExtrinsicT, GetNodeBlockType, GetRuntimeBlockType - }, InherentData, CheckInherentError + }, CheckInherentError }; use runtime_version::RuntimeVersion; pub use primitives::hash::H256; @@ -220,7 +220,7 @@ impl_runtime_apis! { } } - impl block_builder_api::BlockBuilder for Runtime { + impl block_builder_api::BlockBuilder for Runtime { fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult { system::execute_transaction(extrinsic) } @@ -229,11 +229,11 @@ impl_runtime_apis! { system::finalise_block() } - fn inherent_extrinsics(_data: InherentData) -> Vec<::Extrinsic> { + fn inherent_extrinsics(_data: ()) -> Vec<::Extrinsic> { unimplemented!() } - fn check_inherents(_block: Block, _data: InherentData) -> Result<(), CheckInherentError> { + fn check_inherents(_block: Block, _data: ()) -> Result<(), CheckInherentError> { unimplemented!() } diff --git a/substrate/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm b/substrate/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm index c9643519e9..62fa99174f 100644 Binary files a/substrate/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm and b/substrate/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm differ diff --git a/substrate/node/cli/src/chain_spec.rs b/substrate/node/cli/src/chain_spec.rs index fd53d64612..58ccc7dee0 100644 --- a/substrate/node/cli/src/chain_spec.rs +++ b/substrate/node/cli/src/chain_spec.rs @@ -330,6 +330,6 @@ mod tests { #[test] fn test_connectiviy() { - service_test::connectivity::(integration_test_config()); + service_test::connectivity::(integration_test_config()); } } diff --git a/substrate/node/primitives/src/lib.rs b/substrate/node/primitives/src/lib.rs index e9b32db752..e2336acafd 100644 --- a/substrate/node/primitives/src/lib.rs +++ b/substrate/node/primitives/src/lib.rs @@ -38,6 +38,8 @@ use runtime_primitives::generic; use primitives::bytes; use runtime_primitives::traits::{BlakeTwo256, self}; +pub use runtime_primitives::BasicInherentData as InherentData; + /// An index to a block. pub type BlockNumber = u64; diff --git a/substrate/node/runtime/src/lib.rs b/substrate/node/runtime/src/lib.rs index 6abd5c2b05..b8ff92d1dd 100644 --- a/substrate/node/runtime/src/lib.rs +++ b/substrate/node/runtime/src/lib.rs @@ -63,7 +63,7 @@ use grandpa::fg_primitives::{self, ScheduledChange, id::*}; use client::{ block_builder::api as block_builder_api, runtime_api::{self as client_api, id::*} }; -use runtime_primitives::{ApplyResult, CheckInherentError}; +use runtime_primitives::{ApplyResult, CheckInherentError, BasicInherentData}; use runtime_primitives::transaction_validity::TransactionValidity; use runtime_primitives::generic; use runtime_primitives::traits::{ @@ -209,7 +209,8 @@ impl grandpa::Trait for Runtime { construct_runtime!( pub enum Runtime with Log(InternalLog: DigestItem) where Block = Block, - NodeBlock = node_primitives::Block + NodeBlock = node_primitives::Block, + InherentData = BasicInherentData { System: system::{default, Log(ChangesTrieRoot)}, Timestamp: timestamp::{Module, Call, Storage, Config, Inherent}, @@ -274,7 +275,7 @@ impl_runtime_apis! { } } - impl block_builder_api::BlockBuilder for Runtime { + impl block_builder_api::BlockBuilder for Runtime { fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult { Executive::apply_extrinsic(extrinsic) } @@ -283,7 +284,7 @@ impl_runtime_apis! { Executive::finalise_block() } - fn inherent_extrinsics(data: runtime_primitives::InherentData) -> Vec<::Extrinsic> { + fn inherent_extrinsics(data: BasicInherentData) -> Vec<::Extrinsic> { let mut inherent = Vec::new(); inherent.extend( @@ -302,8 +303,8 @@ impl_runtime_apis! { inherent.into_iter().map(|v| v.1).collect() } - fn check_inherents(block: Block, data: runtime_primitives::InherentData) -> Result<(), CheckInherentError> { - InherentData::check_inherents(data, block) + fn check_inherents(block: Block, data: BasicInherentData) -> Result<(), CheckInherentError> { + Runtime::check_inherents(block, data) } fn random_seed() -> ::Hash { diff --git a/substrate/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm b/substrate/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm index fb0d9a9d04..7c0b3a2619 100644 Binary files a/substrate/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm and b/substrate/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm differ diff --git a/substrate/srml/support/src/inherent.rs b/substrate/srml/support/src/inherent.rs index 8be51f4224..4b2443138c 100644 --- a/substrate/srml/support/src/inherent.rs +++ b/substrate/srml/support/src/inherent.rs @@ -18,7 +18,7 @@ pub use rstd::{result::Result, vec::Vec}; #[doc(hidden)] pub use runtime_primitives::{ - traits::{ProvideInherent, Block as BlockT}, CheckInherentError, InherentData + traits::{ProvideInherent, Block as BlockT}, CheckInherentError }; @@ -40,62 +40,27 @@ pub use runtime_primitives::{ #[macro_export] macro_rules! impl_outer_inherent { ( - $(#[$attr:meta])* - pub struct $name:ident where Block = $block:ident { - $( $module:ident: $module_ty:ident, )* + for $runtime:ident, + Block = $block:ident, + InherentData = $inherent:ty + { + $( $module:ident: $module_ty:ident,)* } ) => { - impl_outer_inherent!( - $( #[$attr] )* - pub struct $name where Block = $block, Call = Call { - $( $module: $module_ty, )* - } - ); - }; - ( - $(#[$attr:meta])* - pub struct $name:ident where Block = $block:ident { - $( $module:ident: $module_ty:ident, )* - } - ) => { - impl_outer_inherent!( - $( #[$attr] )* - pub struct $name where Block = $block, Call = Call { - $( $module: $module_ty, )* - } - ); - }; - ( - $(#[$attr:meta])* - pub struct $name:ident where Block = $block:ident, Call = $call:ident { - $( $module:ident: $module_ty:ident, )* - } - ) => { - $( #[$attr] )* - #[derive(Encode, Decode)] - /// Inherent data to include in a block. - pub struct $name { - $( $module: <$module_ty as $crate::inherent::ProvideInherent>::Inherent, )* - } - - impl $name { - /// Create a new instance. - pub fn new( $( $module: <$module_ty as $crate::inherent::ProvideInherent>::Inherent ),* ) -> Self { - Self { - $( $module, )* - } - } - + impl $runtime { fn check_inherents( - data: $crate::inherent::InherentData, - block: $block + block: $block, + data: $inherent ) -> $crate::inherent::Result<(), $crate::inherent::CheckInherentError> { $( <$module_ty as $crate::inherent::ProvideInherent>::check_inherent( - &block, data.$module, &|xt| match xt.function { + &block, + data.$module, + &|xt| match xt.function { Call::$module_ty(ref data) => Some(data), _ => None, - })?; + }, + )?; )* Ok(()) } diff --git a/substrate/srml/support/src/runtime.rs b/substrate/srml/support/src/runtime.rs index 0376179e38..5fcd8c565b 100644 --- a/substrate/srml/support/src/runtime.rs +++ b/substrate/srml/support/src/runtime.rs @@ -53,7 +53,8 @@ macro_rules! construct_runtime { pub enum $runtime:ident with Log ($log_internal:ident: DigestItem<$( $log_genarg:ty ),+>) where Block = $block:ident, - NodeBlock = $node_block:ty + NodeBlock = $node_block:ty, + InherentData = $inherent:ty { $( $rest:tt )* } @@ -62,6 +63,7 @@ macro_rules! construct_runtime { $runtime; $block; $node_block; + $inherent; $log_internal < $( $log_genarg ),* >; ; $( $rest )* @@ -71,6 +73,7 @@ macro_rules! construct_runtime { $runtime:ident; $block:ident; $node_block:ty; + $inherent:ty; $log_internal:ident <$( $log_genarg:ty ),+>; $( $expanded_name:ident: $expanded_module:ident::{ @@ -98,6 +101,7 @@ macro_rules! construct_runtime { $runtime; $block; $node_block; + $inherent; $log_internal < $( $log_genarg ),* >; $( $expanded_name: $expanded_module::{ @@ -125,6 +129,7 @@ macro_rules! construct_runtime { $runtime:ident; $block:ident; $node_block:ty; + $inherent:ty; $log_internal:ident <$( $log_genarg:ty ),+>; $( $expanded_name:ident: $expanded_module:ident::{ @@ -159,6 +164,7 @@ macro_rules! construct_runtime { $runtime; $block; $node_block; + $inherent; $log_internal < $( $log_genarg ),* >; $( $expanded_name: $expanded_module::{ @@ -192,6 +198,7 @@ macro_rules! construct_runtime { $runtime:ident; $block:ident; $node_block:ty; + $inherent:ty; $log_internal:ident <$( $log_genarg:ty ),+>; $( $expanded_name:ident: $expanded_module:ident::{ @@ -225,6 +232,7 @@ macro_rules! construct_runtime { $runtime; $block; $node_block; + $inherent; $log_internal < $( $log_genarg ),* >; $( $expanded_name: $expanded_module::{ @@ -257,6 +265,7 @@ macro_rules! construct_runtime { $runtime:ident; $block:ident; $node_block:ty; + $inherent:ty; $log_internal:ident <$( $log_genarg:ty ),+>; $( $name:ident: $module:ident::{ @@ -271,7 +280,6 @@ macro_rules! construct_runtime { mashup! { $( substrate_generate_ident_name["config-ident" $name] = $name Config; - substrate_generate_ident_name["inherent-error-ident" $name] = $name InherentError; )* } @@ -337,6 +345,7 @@ macro_rules! construct_runtime { __decl_outer_inherent!( $runtime; $block; + $inherent; ; $( $name: $module::{ $( $modules $( <$modules_generic> )* ),* } @@ -1062,6 +1071,7 @@ macro_rules! __decl_outer_inherent { ( $runtime:ident; $block:ident; + $inherent:ty; $( $parsed_modules:ident :: $parsed_name:ident ),*; $name:ident: $module:ident::{ Inherent $(, $modules:ident $( <$modules_generic:ident> )* )* @@ -1073,6 +1083,7 @@ macro_rules! __decl_outer_inherent { __decl_outer_inherent!( $runtime; $block; + $inherent; $( $parsed_modules :: $parsed_name, )* $module::$name; $( $rest_name: $rest_module::{ @@ -1084,6 +1095,7 @@ macro_rules! __decl_outer_inherent { ( $runtime:ident; $block:ident; + $inherent:ty; $( $parsed_modules:ident :: $parsed_name:ident ),*; $name:ident: $module:ident::{ $ingore:ident $( <$ignor:ident> )* $(, $modules:ident $( <$modules_generic:ident> )* )* @@ -1095,6 +1107,7 @@ macro_rules! __decl_outer_inherent { __decl_outer_inherent!( $runtime; $block; + $inherent; $( $parsed_modules :: $parsed_name ),*; $name: $module::{ $( $modules $( <$modules_generic> )* ),* } $( @@ -1107,6 +1120,7 @@ macro_rules! __decl_outer_inherent { ( $runtime:ident; $block:ident; + $inherent:ty; $( $parsed_modules:ident :: $parsed_name:ident ),*; $name:ident: $module:ident::{} $(, $rest_name:ident : $rest_module:ident::{ @@ -1116,6 +1130,7 @@ macro_rules! __decl_outer_inherent { __decl_outer_inherent!( $runtime; $block; + $inherent; $( $parsed_modules :: $parsed_name ),*; $( $rest_name: $rest_module::{ @@ -1127,17 +1142,16 @@ macro_rules! __decl_outer_inherent { ( $runtime:ident; $block:ident; + $inherent:ty; $( $parsed_modules:ident :: $parsed_name:ident ),*; ; ) => { - substrate_generate_ident_name! { - impl_outer_inherent!( - pub struct InherentData where Block = $block { - $( - $parsed_modules: $parsed_name, - )* - } - ); - } + impl_outer_inherent!( + for $runtime, + Block = $block, + InherentData = $inherent { + $($parsed_modules : $parsed_name,)* + } + ); }; }