diff --git a/polkadot/collator/src/lib.rs b/polkadot/collator/src/lib.rs
index 49ccbcc29c..300ebeb723 100644
--- a/polkadot/collator/src/lib.rs
+++ b/polkadot/collator/src/lib.rs
@@ -71,9 +71,9 @@ pub use polkadot_validation::SignedStatement;
pub use polkadot_primitives::parachain::CollatorId;
pub use sc_network::PeerId;
pub use service::RuntimeApiCollection;
-use sc_service::ClientProvider;
pub use sc_cli::SubstrateCli;
use sp_api::{ConstructRuntimeApi, ApiExt, HashFor};
+use polkadot_service::PolkadotClient;
const COLLATION_TIMEOUT: Duration = Duration::from_secs(30);
@@ -200,7 +200,7 @@ pub async fn collate
(
Ok(collation)
}
-fn build_collator_service(
+fn build_collator_service(
spawner: SP,
handles: polkadot_service::FullNodeHandles,
client: Arc,
@@ -209,10 +209,9 @@ fn build_collator_service(
build_parachain_context: P,
) -> Result + Send + 'static, polkadot_service::Error>
where
- C: ClientProvider<
+ C: PolkadotClient<
service::Block,
service::TFullBackend,
- service::TFullCallExecutor,
R
> + 'static,
R: ConstructRuntimeApi + Sync + Send,
@@ -226,7 +225,6 @@ fn build_collator_service(
StateBackend = as service::Backend>::State,
>
+ Sync + Send,
- E: sc_executor::NativeExecutionDispatch + 'static,
P: BuildParachainContext,
P::ParachainContext: Send + 'static,
::ProduceCandidate: Send,
diff --git a/polkadot/service/src/client.rs b/polkadot/service/src/client.rs
new file mode 100644
index 0000000000..f4d6fe62dc
--- /dev/null
+++ b/polkadot/service/src/client.rs
@@ -0,0 +1,52 @@
+// Copyright 2017-2020 Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot. If not, see .
+
+//! Polkadot Client meta trait
+
+use sc_client_api::BlockchainEvents;
+use sp_api::{ProvideRuntimeApi, ConstructRuntimeApi, CallApiAt};
+use sp_runtime::traits::Block as BlockT;
+use sc_client_api::Backend as BackendT;
+
+/// Polkadot client abstraction, this super trait only pulls in functionality required for
+/// polkadot internal crates like polkadot-collator.
+pub trait PolkadotClient:
+ BlockchainEvents + Sized + Send + Sync
+ + ProvideRuntimeApi
+ + CallApiAt<
+ Block,
+ Error = sp_blockchain::Error,
+ StateBackend = Backend ::State
+ >
+ where
+ Block: BlockT,
+ Backend: BackendT,
+ Runtime: ConstructRuntimeApi
+{}
+
+impl PolkadotClient for Client
+ where
+ Block: BlockT,
+ Runtime: ConstructRuntimeApi,
+ Backend: BackendT,
+ Client: BlockchainEvents + ProvideRuntimeApi
+ + Sized + Send + Sync
+ + CallApiAt<
+ Block,
+ Error = sp_blockchain::Error,
+ StateBackend = Backend ::State
+ >
+{}
diff --git a/polkadot/service/src/lib.rs b/polkadot/service/src/lib.rs
index 5a684fae6a..06e8d35242 100644
--- a/polkadot/service/src/lib.rs
+++ b/polkadot/service/src/lib.rs
@@ -18,6 +18,7 @@
pub mod chain_spec;
mod grandpa_support;
+mod client;
use std::sync::Arc;
use std::time::Duration;
@@ -51,6 +52,7 @@ pub use polkadot_runtime;
pub use kusama_runtime;
pub use westend_runtime;
use prometheus_endpoint::Registry;
+pub use self::client::PolkadotClient;
native_executor_instance!(
pub PolkadotExecutor,
@@ -580,10 +582,9 @@ pub fn polkadot_new_full(
)
-> Result<(
impl AbstractService,
- Arc,
- TFullCallExecutor,
polkadot_runtime::RuntimeApi
>>,
FullNodeHandles,
@@ -614,10 +615,9 @@ pub fn kusama_new_full(
grandpa_pause: Option<(u32, u32)>,
) -> Result<(
impl AbstractService,
- Arc,
- TFullCallExecutor,
kusama_runtime::RuntimeApi
>
>,
@@ -650,10 +650,9 @@ pub fn westend_new_full(
)
-> Result<(
impl AbstractService,
- Arc,
- TFullCallExecutor,
westend_runtime::RuntimeApi
>>,
FullNodeHandles,