Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Add HeaderBackend trait to BuildParachainContext for cumulus validati…
Browse files Browse the repository at this point in the history
…on (#1153)
  • Loading branch information
cecton authored May 26, 2020
1 parent 6e1a3d0 commit 3be9444
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ use std::pin::Pin;
use futures::{future, Future, Stream, FutureExt, TryFutureExt, StreamExt, task::Spawn};
use log::warn;
use sc_client_api::{StateBackend, BlockchainEvents};
use sp_blockchain::HeaderBackend;
use sp_core::Pair;
use polkadot_primitives::{
BlockId, Hash, Block,
Expand Down Expand Up @@ -128,7 +129,7 @@ pub trait BuildParachainContext {
network: impl Network + Clone + 'static,
) -> Result<Self::ParachainContext, ()>
where
Client: ProvideRuntimeApi<Block> + Send + Sync + BlockchainEvents<Block> + 'static,
Client: ProvideRuntimeApi<Block> + HeaderBackend<Block> + BlockchainEvents<Block> + Send + Sync + 'static,
Client::Api: RuntimeApiCollection<Extrinsic>,
<Client::Api as ApiExt<Block>>::StateBackend: StateBackend<HashFor<Block>>,
Extrinsic: codec::Codec + Send + Sync + 'static,
Expand Down
7 changes: 4 additions & 3 deletions service/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@

//! Polkadot Client meta trait

use sc_client_api::BlockchainEvents;
use sp_api::{ProvideRuntimeApi, ConstructRuntimeApi, CallApiAt};
use sp_blockchain::HeaderBackend;
use sp_runtime::traits::Block as BlockT;
use sc_client_api::Backend as BackendT;
use sc_client_api::{Backend as BackendT, BlockchainEvents};

/// Polkadot client abstraction, this super trait only pulls in functionality required for
/// polkadot internal crates like polkadot-collator.
pub trait PolkadotClient<Block, Backend, Runtime>:
BlockchainEvents<Block> + Sized + Send + Sync
+ ProvideRuntimeApi<Block, Api = Runtime::RuntimeApi>
+ HeaderBackend<Block>
+ CallApiAt<
Block,
Error = sp_blockchain::Error,
Expand All @@ -42,7 +43,7 @@ impl<Block, Backend, Runtime, Client> PolkadotClient<Block, Backend, Runtime> fo
Block: BlockT,
Runtime: ConstructRuntimeApi<Block, Self>,
Backend: BackendT<Block>,
Client: BlockchainEvents<Block> + ProvideRuntimeApi<Block, Api = Runtime::RuntimeApi>
Client: BlockchainEvents<Block> + ProvideRuntimeApi<Block, Api = Runtime::RuntimeApi> + HeaderBackend<Block>
+ Sized + Send + Sync
+ CallApiAt<
Block,
Expand Down

0 comments on commit 3be9444

Please sign in to comment.