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

WIP

Forked at: e9164236
Parent branch: origin/rococo-branch
parent fb886551
......@@ -356,7 +356,7 @@ impl<P> polkadot_service::ExecuteWithClient for BuildCollationWork<P>
pub fn build_collator_service<P>(
spawner: SpawnTaskHandle,
handles: FullNodeHandles,
client: impl polkadot_service::YaExecuteWithClient,
client: impl YaExecuteWithClient,
para_id: ParaId,
key: Arc<CollatorPair>,
build_parachain_context: P,
......
......@@ -26,7 +26,7 @@ use polkadot_primitives::v0::{
Block, Hash, CollatorId, Id as ParaId,
};
use polkadot_runtime_common::{parachains, registrar, BlockHashCount};
use polkadot_service::{new_full, FullNodeHandles, AbstractClient};
use polkadot_service::{new_full, FullNodeHandles, AbstractClient, YaExecuteWithClient, ExecuteWithClient};
use polkadot_test_runtime::{RestrictFunctionality, Runtime, SignedExtra, SignedPayload, VERSION};
use sc_chain_spec::ChainSpec;
use sc_client_api::{execution_extensions::ExecutionStrategies, BlockchainEvents};
......@@ -88,6 +88,19 @@ pub fn polkadot_test_new_full(
Ok((task_manager, client, handles, network, rpc_handlers))
}
// TODO: that comes from service, make it public?
type FullClient<RuntimeApi, Executor> = service::TFullClient<Block, RuntimeApi, Executor>;
/// A wrapper for the test client that implements YaExecuteWithClient.
pub struct TestClient(Arc<FullClient<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>>);
// TODO: that comes from service, make it public?
type FullBackend = service::TFullBackend<Block>;
impl YaExecuteWithClient for TestClient {
fn execute_with<T: ExecuteWithClient>(&self, t: T) -> T::Output {
T::execute_with_client::<_, _, FullBackend>(t, self.0.clone())
}
}
/// Create a Polkadot `Configuration`. By default an in-memory socket will be used, therefore you need to provide boot
/// nodes if you want the future node to be connected to other nodes. The `storage_update_func` can be used to make
/// adjustements to the runtime before the node starts.
......
......@@ -122,6 +122,7 @@ pub trait ExecuteWithClient {
/// Yet Another ExecuteWithClient
pub trait YaExecuteWithClient {
/// Execute the given something with the client.
fn execute_with<T: ExecuteWithClient>(&self, t: T) -> T::Output;
}
......@@ -137,7 +138,6 @@ pub enum Client {
}
impl YaExecuteWithClient for Client {
/// Execute the given something with the client.
fn execute_with<T: ExecuteWithClient>(&self, t: T) -> T::Output {
match self {
Self::Polkadot(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