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
+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 {