make block builder and construct_runtime! generic over inherent-data (#1191)

* make block builder generic over inherent-data

* construct_runtime has you specify inherent data type

* get all tests to compile
This commit is contained in:
Robert Habermeier
2018-12-03 11:49:30 +01:00
committed by GitHub
parent 69a288e586
commit 63980e3770
17 changed files with 96 additions and 109 deletions
@@ -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<InherentData> {
/// Apply the given extrinsics.
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyResult;
/// Finish the current block.
fn finalise_block() -> <Block as BlockT>::Header;
/// Generate inherent extrinsics.
/// Generate inherent extrinsics. The inherent data will vary from chain to chain.
fn inherent_extrinsics(inherent: InherentData) -> Vec<<Block as BlockT>::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() -> <Block as BlockT>::Hash;
@@ -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: <Block as BlockT>::Header,
extrinsics: Vec<<Block as BlockT>::Extrinsic>,
api: ApiRef<'a, A::Api>,
block_id: BlockId<Block>,
_marker: PhantomData<InherentData>,
}
impl<'a, Block, A> BlockBuilder<'a, Block, A>
impl<'a, Block, A, InherentData> BlockBuilder<'a, Block, InherentData, A>
where
Block: BlockT<Hash=H256>,
A: ProvideRuntimeApi + HeaderBackend<Block> + 'a,
A::Api: BlockBuilderApi<Block>,
A::Api: BlockBuilderApi<Block, InherentData>,
{
/// Create a new instance of builder from the given client, building on the latest block.
pub fn new(api: &'a A) -> error::Result<Self> {
@@ -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: <Block as BlockT>::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<Block>,
xt: Block::Extrinsic,
extrinsics: &mut Vec<Block::Extrinsic>
) -> error::Result<()> where T: BlockBuilderApi<Block> {
) -> error::Result<()> where T: BlockBuilderApi<Block, InherentData> {
api.map_api_result(|api| {
match api.apply_extrinsic(block_id, &xt)? {
Ok(ApplyOutcome::Success) | Ok(ApplyOutcome::Fail) => {
+6 -6
View File
@@ -538,21 +538,21 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
}
/// Create a new block, built on the head of the chain.
pub fn new_block(
pub fn new_block<InherentData>(
&self
) -> error::Result<block_builder::BlockBuilder<Block, Self>> where
) -> error::Result<block_builder::BlockBuilder<Block, InherentData, Self>> where
E: Clone + Send + Sync,
RA: BlockBuilderAPI<Block>
RA: BlockBuilderAPI<Block, InherentData>
{
block_builder::BlockBuilder::new(self)
}
/// Create a new block, built on top of `parent`.
pub fn new_block_at(
pub fn new_block_at<InherentData>(
&self, parent: &BlockId<Block>
) -> error::Result<block_builder::BlockBuilder<Block, Self>> where
) -> error::Result<block_builder::BlockBuilder<Block, InherentData, Self>> where
E: Clone + Send + Sync,
RA: BlockBuilderAPI<Block>
RA: BlockBuilderAPI<Block, InherentData>
{
block_builder::BlockBuilder::at_block(parent, &self)
}
+2 -2
View File
@@ -196,7 +196,7 @@ pub trait BlockBuilder<Block: BlockT> {
pub trait AuthoringApi:
Send
+ Sync
+ BlockBuilderAPI<<Self as AuthoringApi>::Block, Error=<Self as AuthoringApi>::Error>
+ BlockBuilderAPI<<Self as AuthoringApi>::Block, InherentData, Error=<Self as AuthoringApi>::Error>
+ Core<<Self as AuthoringApi>::Block, AuthorityId, Error=<Self as AuthoringApi>::Error>
+ OldTxQueue<<Self as AuthoringApi>::Block, Error=<Self as AuthoringApi>::Error>
{
@@ -1174,7 +1174,7 @@ impl<C, A> BaseProposer<<C as AuthoringApi>::Block> for Proposer<C, A> 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),
+1 -1
View File
@@ -234,7 +234,7 @@ impl<V: 'static + Verifier<Block>, D> Peer<V, D> {
/// Add blocks to the peer -- edit the block before adding
pub fn generate_blocks<F>(&self, count: usize, origin: BlockOrigin, mut edit_block: F)
where F: FnMut(BlockBuilder<Block, PeersClient>) -> Block
where F: FnMut(BlockBuilder<Block, (), PeersClient>) -> Block
{
use blocks::BlockData;
+12 -10
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
//! 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<F: FnMut(&mut BlockBuilder<Self::Block>) -> ()>(
&self,
at: &BlockId<Self::Block>,
inherent_data: InherentData,
inherent_data: BasicInherentData,
build_ctx: F,
) -> Result<Self::Block, error::Error>;
}
impl<'a, B, E, Block, RA> BlockBuilder<Block> for client::block_builder::BlockBuilder<'a, Block, SubstrateClient<B, E, Block, RA>> where
impl<'a, B, E, Block, RA> BlockBuilder<Block>
for client::block_builder::BlockBuilder<'a, Block, BasicInherentData, SubstrateClient<B, E, Block, RA>>
where
B: client::backend::Backend<Block, Blake2Hasher> + 'static,
E: CallExecutor<Block, Blake2Hasher> + Send + Sync + Clone + 'static,
Block: BlockT<Hash=H256>,
RA: BlockBuilderApi<Block>,
RA: BlockBuilderApi<Block, BasicInherentData>,
{
fn push_extrinsic(&mut self, extrinsic: <Block as BlockT>::Extrinsic) -> Result<(), error::Error> {
client::block_builder::BlockBuilder::push(self, extrinsic).map_err(Into::into)
@@ -80,7 +82,7 @@ impl<B, E, Block, RA> AuthoringApi for SubstrateClient<B, E, Block, RA> where
B: client::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
E: CallExecutor<Block, Blake2Hasher> + Send + Sync + Clone + 'static,
Block: BlockT<Hash=H256>,
RA: BlockBuilderApi<Block>,
RA: BlockBuilderApi<Block, BasicInherentData>,
{
type Block = Block;
type Error = client::error::Error;
@@ -88,7 +90,7 @@ impl<B, E, Block, RA> AuthoringApi for SubstrateClient<B, E, Block, RA> where
fn build_block<F: FnMut(&mut BlockBuilder<Self::Block>) -> ()>(
&self,
at: &BlockId<Self::Block>,
inherent_data: InherentData,
inherent_data: BasicInherentData,
mut build_ctx: F,
) -> Result<Self::Block, error::Error> {
let runtime_version = self.runtime_version_at(at)?;
@@ -119,7 +121,7 @@ pub struct ProposerFactory<C, A> where A: txpool::ChainApi {
impl<C, A> consensus_common::Environment<<C as AuthoringApi>::Block> for ProposerFactory<C, A> where
C: AuthoringApi,
<C as ProvideRuntimeApi>::Api: BlockBuilderApi<<C as AuthoringApi>::Block>,
<C as ProvideRuntimeApi>::Api: BlockBuilderApi<<C as AuthoringApi>::Block, BasicInherentData>,
A: txpool::ChainApi<Block=<C as AuthoringApi>::Block>,
client::error::Error: From<<C as AuthoringApi>::Error>
{
@@ -174,7 +176,7 @@ pub struct Proposer<Block: BlockT, C, A: txpool::ChainApi> {
impl<Block, C, A> consensus_common::Proposer<<C as AuthoringApi>::Block> for Proposer<Block, C, A> where
Block: BlockT,
C: AuthoringApi<Block=Block>,
<C as ProvideRuntimeApi>::Api: BlockBuilderApi<Block>,
<C as ProvideRuntimeApi>::Api: BlockBuilderApi<Block, BasicInherentData>,
A: txpool::ChainApi<Block=Block>,
client::error::Error: From<<C as AuthoringApi>::Error>
{
@@ -201,7 +203,7 @@ impl<Block, C, A> consensus_common::Proposer<<C as AuthoringApi>::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,
+4 -4
View File
@@ -180,9 +180,9 @@ impl<F: ServiceFactory> TestNet<F> {
}
}
pub fn connectivity<F: ServiceFactory>(spec: FactoryChainSpec<F>) where
pub fn connectivity<F: ServiceFactory, Inherent>(spec: FactoryChainSpec<F>) where
<F as ServiceFactory>::RuntimeApi:
client::block_builder::api::BlockBuilder<<F as service::ServiceFactory>::Block>
client::block_builder::api::BlockBuilder<<F as service::ServiceFactory>::Block, Inherent>
{
const NUM_NODES: u32 = 10;
{
@@ -224,7 +224,7 @@ where
B: Fn(&F::FullService) -> ImportBlock<F::Block>,
E: Fn(&F::FullService) -> FactoryExtrinsic<F>,
<F as ServiceFactory>::RuntimeApi:
client::block_builder::api::BlockBuilder<<F as service::ServiceFactory>::Block> +
client::block_builder::api::BlockBuilder<<F as service::ServiceFactory>::Block, ()> +
client::runtime_api::TaggedTransactionQueue<<F as service::ServiceFactory>::Block>
{
const NUM_NODES: u32 = 10;
@@ -263,7 +263,7 @@ pub fn consensus<F>(spec: FactoryChainSpec<F>, authorities: Vec<String>)
where
F: ServiceFactory,
<F as ServiceFactory>::RuntimeApi:
client::block_builder::api::BlockBuilder<<F as service::ServiceFactory>::Block>
client::block_builder::api::BlockBuilder<<F as service::ServiceFactory>::Block, ()>
{
const NUM_NODES: u32 = 20;
const NUM_BLOCKS: u64 = 200;
+4 -4
View File
@@ -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<u32>,
}
impl InherentData {
/// Create a new `InherentData` instance.
impl BasicInherentData {
/// Create a new `BasicInherentData` instance.
pub fn new(timestamp: u64, consensus: Vec<u32>) -> Self {
Self {
timestamp,
@@ -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<runtime::Block> + 'a,
A::Api: BlockBuilder<runtime::Block>
A::Api: BlockBuilder<runtime::Block, ()>
{
fn push_transfer(&mut self, transfer: runtime::Transfer) -> Result<(), client::error::Error> {
self.push(sign_tx(transfer))
+4 -4
View File
@@ -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<Block> for Runtime {
impl block_builder_api::BlockBuilder<Block, ()> for Runtime {
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyResult {
system::execute_transaction(extrinsic)
}
@@ -229,11 +229,11 @@ impl_runtime_apis! {
system::finalise_block()
}
fn inherent_extrinsics(_data: InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
fn inherent_extrinsics(_data: ()) -> Vec<<Block as BlockT>::Extrinsic> {
unimplemented!()
}
fn check_inherents(_block: Block, _data: InherentData) -> Result<(), CheckInherentError> {
fn check_inherents(_block: Block, _data: ()) -> Result<(), CheckInherentError> {
unimplemented!()
}
+1 -1
View File
@@ -330,6 +330,6 @@ mod tests {
#[test]
fn test_connectiviy() {
service_test::connectivity::<Factory>(integration_test_config());
service_test::connectivity::<Factory, node_primitives::InherentData>(integration_test_config());
}
}
+2
View File
@@ -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;
+7 -6
View File
@@ -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<Hash, SessionKey>) where
Block = Block,
NodeBlock = node_primitives::Block
NodeBlock = node_primitives::Block,
InherentData = BasicInherentData
{
System: system::{default, Log(ChangesTrieRoot)},
Timestamp: timestamp::{Module, Call, Storage, Config<T>, Inherent},
@@ -274,7 +275,7 @@ impl_runtime_apis! {
}
}
impl block_builder_api::BlockBuilder<Block> for Runtime {
impl block_builder_api::BlockBuilder<Block, BasicInherentData> for Runtime {
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyResult {
Executive::apply_extrinsic(extrinsic)
}
@@ -283,7 +284,7 @@ impl_runtime_apis! {
Executive::finalise_block()
}
fn inherent_extrinsics(data: runtime_primitives::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
fn inherent_extrinsics(data: BasicInherentData) -> Vec<<Block as BlockT>::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() -> <Block as BlockT>::Hash {
+14 -49
View File
@@ -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(())
}
+25 -11
View File
@@ -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,)*
}
);
};
}