Try to get grandpa tests compiling again (#1121)

* Revert "start to refactor block import wrapper a bit"

This reverts commit b919de49e1a82422a0870b66100832d531174771.

* Refactor grandpa stuff to get tests almost compiling

* Fixes after rebase

* Fixes merge compile errors
This commit is contained in:
Bastian Köcher
2018-11-16 07:44:51 +01:00
committed by Gav Wood
parent 1b202e1ffb
commit 276ec5f85d
12 changed files with 132 additions and 50 deletions
@@ -39,7 +39,7 @@ impl<'a, Block, A> BlockBuilder<'a, Block, A>
where
Block: BlockT<Hash=H256>,
A: ProvideRuntimeApi + HeaderBackend<Block> + 'a,
A::Api: BlockBuilderApi<Block> + Core<Block>,
A::Api: BlockBuilderApi<Block>,
{
/// Create a new instance of builder from the given client, building on the latest block.
pub fn new(api: &'a A) -> error::Result<Self> {
@@ -84,7 +84,7 @@ where
block_id: &BlockId<Block>,
xt: Block::Extrinsic,
extrinsics: &mut Vec<Block::Extrinsic>
) -> error::Result<()> where T: BlockBuilderApi<Block> + Core<Block> {
) -> error::Result<()> where T: BlockBuilderApi<Block> {
api.map_api_result(|api| {
match api.apply_extrinsic(block_id, &xt)? {
Ok(ApplyOutcome::Success) | Ok(ApplyOutcome::Fail) => {
+5 -5
View File
@@ -547,7 +547,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
&self
) -> error::Result<block_builder::BlockBuilder<Block, Self>> where
E: Clone + Send + Sync,
RA: BlockBuilderAPI<Block> + CoreAPI<Block>,
RA: BlockBuilderAPI<Block>
{
block_builder::BlockBuilder::new(self)
}
@@ -557,7 +557,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
&self, parent: &BlockId<Block>
) -> error::Result<block_builder::BlockBuilder<Block, Self>> where
E: Clone + Send + Sync,
RA: BlockBuilderAPI<Block> + CoreAPI<Block>,
RA: BlockBuilderAPI<Block>
{
block_builder::BlockBuilder::at_block(parent, &self)
}
@@ -568,7 +568,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
at: Block::Hash,
body: &Option<Vec<Block::Extrinsic>>
) -> error::Result<Vec<TransactionTag>> where
RA: TaggedTransactionQueue<Block> + CoreAPI<Block>,
RA: TaggedTransactionQueue<Block>,
E: CallExecutor<Block, Blake2Hasher> + Send + Sync + Clone,
{
let id = BlockId::Hash(at);
@@ -604,7 +604,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
finalized: bool,
aux: Vec<(Vec<u8>, Option<Vec<u8>>)>,
) -> error::Result<ImportResult> where
RA: TaggedTransactionQueue<Block> + CoreAPI<Block>,
RA: TaggedTransactionQueue<Block>,
E: CallExecutor<Block, Blake2Hasher> + Send + Sync + Clone,
{
let parent_hash = import_headers.post().parent_hash().clone();
@@ -1058,7 +1058,7 @@ impl<B, E, Block, RA> consensus::BlockImport<Block> for Client<B, E, Block, RA>
B: backend::Backend<Block, Blake2Hasher>,
E: CallExecutor<Block, Blake2Hasher> + Clone + Send + Sync,
Block: BlockT<Hash=H256>,
RA: TaggedTransactionQueue<Block> + CoreAPI<Block>,
RA: TaggedTransactionQueue<Block>
{
type Error = Error;
@@ -213,6 +213,7 @@ pub mod tests {
_header: Header,
_authorities: Option<Vec<AuthorityId>>,
_state: NewBlockState,
_aux_ops: Vec<(Vec<u8>, Option<Vec<u8>>)>,
) -> ClientResult<()> {
Err(ClientErrorKind::Backend("Test error".into()).into())
}
@@ -347,7 +347,7 @@ macro_rules! decl_runtime_apis {
) => {
$( #[$attr] )*
#[cfg(feature = "std")]
pub trait $name < $( $generic_param_parsed $( : $generic_bound_parsed )* ),* > {
pub trait $name < $( $generic_param_parsed $( : $generic_bound_parsed )* ),* > : $crate::runtime_api::Core<Block> {
$( type $client_generic_param $( : $client_generic_bound )*; )*
$(
+2 -1
View File
@@ -23,7 +23,7 @@ pub use state_machine::OverlayedChanges;
#[doc(hidden)]
pub use runtime_primitives::{traits::Block as BlockT, generic::BlockId};
#[cfg(feature = "std")]
pub use runtime_primitives::traits::ApiRef;
use runtime_primitives::traits::ApiRef;
pub use runtime_version::ApiId;
#[doc(hidden)]
pub use rstd::slice;
@@ -32,6 +32,7 @@ use rstd::result;
pub use codec::{Encode, Decode};
#[cfg(feature = "std")]
use error;
pub use runtime_version::RuntimeVersion;
mod core;
#[macro_use]