Commit e056a020 authored by Cecile Tonglet's avatar Cecile Tonglet
Browse files

WIP

Forked at: e9164236
Parent branch: origin/rococo-branch
parent 4ce072ac
......@@ -75,8 +75,10 @@ use polkadot_service_new::{
};
use sc_service::SpawnTaskHandle;
use sp_core::traits::SpawnNamed;
use sp_runtime::traits::BlakeTwo256;
use sp_runtime::traits::{Block as BlockT, BlakeTwo256};
use consensus_common::SyncOracle;
use sc_client_api::{Backend as BackendT, BlockchainEvents};
use sp_blockchain::HeaderBackend;
const COLLATION_TIMEOUT: Duration = Duration::from_secs(30);
......@@ -117,14 +119,20 @@ pub trait BuildParachainContext {
type ParachainContext: self::ParachainContext;
/// Build the `ParachainContext`.
fn build<SP>(
fn build<SP, Client, Block, Backend>(
self,
client: polkadot_service::Client,
client: Client,
spawner: SP,
network: impl Network + SyncOracle + Clone + 'static,
) -> Result<Self::ParachainContext, ()>
where
SP: SpawnNamed + Clone + Send + Sync + 'static;
SP: SpawnNamed + Clone + Send + Sync + 'static,
Block: BlockT,
Backend: BackendT<Block>,
Backend::State: sp_api::StateBackend<BlakeTwo256>,
Client: polkadot_service::AbstractClient<Block, Backend>,
Client::Api: RuntimeApiCollection<StateBackend = Backend::State>,
;
}
/// Parachain context needed for collation.
......@@ -233,7 +241,16 @@ impl<P> polkadot_service::ExecuteWithClient for BuildCollationWork<P>
Backend: sc_client_api::Backend<Block>,
Backend::State: sp_api::StateBackend<BlakeTwo256>,
Api: RuntimeApiCollection<StateBackend = Backend::State>,
Client: AbstractClient<Block, Backend, Api = Api> + 'static
Client: AbstractClient<Block, Backend, Api = Api> + 'static,
/*
Client: BlockchainEvents<Block> + sp_api::ProvideRuntimeApi<Block> + HeaderBackend<Block>
+ Sized + Send + Sync
+ sp_api::CallApiAt<
Block,
Error = sp_blockchain::Error,
StateBackend = Backend::State
>,
*/
{
let polkadot_network = self.handles
.polkadot_network
......
......@@ -78,6 +78,8 @@ pub trait AbstractClient<Block, Backend>:
Self::Api: RuntimeApiCollection<StateBackend = Backend::State>,
{}
//impl<Block, Backend, Client> AbstractClient<Block, Backend> for Arc<Client> {}
impl<Block, Backend, Client> AbstractClient<Block, Backend> for Client
where
Block: BlockT,
......@@ -127,6 +129,7 @@ pub enum Client {
Westend(Arc<crate::FullClient<westend_runtime::RuntimeApi, crate::WestendExecutor>>),
Kusama(Arc<crate::FullClient<kusama_runtime::RuntimeApi, crate::KusamaExecutor>>),
Rococo(Arc<crate::FullClient<rococo_runtime::RuntimeApi, crate::RococoExecutor>>),
//Test(Arc<crate::FullClient<polkadot_test_runtime::RuntimeApi, polkadot_test_service::RococoExecutor>>),
}
impl Client {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment