Use polkadot-client instead of polkadot service where possible (#489)

This commit is contained in:
Bastian Köcher
2021-06-11 11:56:14 +01:00
committed by GitHub
parent 11a0bca6d7
commit 2f88be0874
10 changed files with 37 additions and 43 deletions
Generated
+4 -7
View File
@@ -1445,7 +1445,7 @@ dependencies = [
"futures 0.3.14", "futures 0.3.14",
"parity-scale-codec", "parity-scale-codec",
"parking_lot 0.10.2", "parking_lot 0.10.2",
"polkadot-service", "polkadot-client",
"sc-client-api", "sc-client-api",
"sc-consensus-aura", "sc-consensus-aura",
"sc-consensus-slots", "sc-consensus-slots",
@@ -1508,7 +1508,7 @@ dependencies = [
"futures 0.3.14", "futures 0.3.14",
"parity-scale-codec", "parity-scale-codec",
"parking_lot 0.10.2", "parking_lot 0.10.2",
"polkadot-service", "polkadot-client",
"sc-client-api", "sc-client-api",
"sp-api", "sp-api",
"sp-block-builder", "sp-block-builder",
@@ -1532,10 +1532,10 @@ dependencies = [
"futures-timer 3.0.2", "futures-timer 3.0.2",
"parity-scale-codec", "parity-scale-codec",
"parking_lot 0.10.2", "parking_lot 0.10.2",
"polkadot-client",
"polkadot-node-primitives", "polkadot-node-primitives",
"polkadot-parachain", "polkadot-parachain",
"polkadot-primitives", "polkadot-primitives",
"polkadot-service",
"polkadot-statement-table", "polkadot-statement-table",
"polkadot-test-client", "polkadot-test-client",
"sc-cli", "sc-cli",
@@ -1565,10 +1565,7 @@ dependencies = [
"polkadot-node-primitives", "polkadot-node-primitives",
"polkadot-node-subsystem", "polkadot-node-subsystem",
"polkadot-overseer", "polkadot-overseer",
"polkadot-parachain",
"polkadot-primitives", "polkadot-primitives",
"polkadot-service",
"polkadot-statement-table",
"polkadot-test-client", "polkadot-test-client",
"rand 0.8.3", "rand 0.8.3",
"sc-cli", "sc-cli",
@@ -1762,7 +1759,7 @@ dependencies = [
"async-trait", "async-trait",
"cumulus-primitives-core", "cumulus-primitives-core",
"parity-scale-codec", "parity-scale-codec",
"polkadot-service", "polkadot-client",
"sc-client-api", "sc-client-api",
"sp-api", "sp-api",
"sp-core", "sp-core",
+1 -1
View File
@@ -24,7 +24,7 @@ sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "mast
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" } substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Polkadot dependencies # Polkadot dependencies
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-client = { git = "https://github.com/paritytech/polkadot", branch = "master" }
# Cumulus dependencies # Cumulus dependencies
cumulus-client-consensus-common = { path = "../common" } cumulus-client-consensus-common = { path = "../common" }
+9 -9
View File
@@ -31,7 +31,7 @@ use cumulus_primitives_core::{
PersistedValidationData, PersistedValidationData,
}; };
use futures::lock::Mutex; use futures::lock::Mutex;
use polkadot_service::ClientHandle; use polkadot_client::ClientHandle;
use sc_client_api::{backend::AuxStore, Backend, BlockOf}; use sc_client_api::{backend::AuxStore, Backend, BlockOf};
use sc_consensus_slots::{BackoffAuthoringBlocksStrategy, SlotInfo}; use sc_consensus_slots::{BackoffAuthoringBlocksStrategy, SlotInfo};
use sc_telemetry::TelemetryHandle; use sc_telemetry::TelemetryHandle;
@@ -243,7 +243,7 @@ pub struct BuildAuraConsensusParams<PF, BI, RBackend, CIDP, Client, BS, SO> {
pub proposer_factory: PF, pub proposer_factory: PF,
pub create_inherent_data_providers: CIDP, pub create_inherent_data_providers: CIDP,
pub block_import: BI, pub block_import: BI,
pub relay_chain_client: polkadot_service::Client, pub relay_chain_client: polkadot_client::Client,
pub relay_chain_backend: Arc<RBackend>, pub relay_chain_backend: Arc<RBackend>,
pub para_client: Arc<Client>, pub para_client: Arc<Client>,
pub backoff_authoring_blocks: Option<BS>, pub backoff_authoring_blocks: Option<BS>,
@@ -334,8 +334,8 @@ where
/// Aura consensus builder. /// Aura consensus builder.
/// ///
/// Builds a [`AuraConsensus`] for a parachain. As this requires /// Builds a [`AuraConsensus`] for a parachain. As this requires
/// a concrete relay chain client instance, the builder takes a [`polkadot_service::Client`] /// a concrete relay chain client instance, the builder takes a [`polkadot_client::Client`]
/// that wraps this concrete instance. By using [`polkadot_service::ExecuteWithClient`] /// that wraps this concrete instance. By using [`polkadot_client::ExecuteWithClient`]
/// the builder gets access to this concrete instance. /// the builder gets access to this concrete instance.
struct AuraConsensusBuilder<P, Block, PF, BI, RBackend, CIDP, Client, SO, BS, Error> { struct AuraConsensusBuilder<P, Block, PF, BI, RBackend, CIDP, Client, SO, BS, Error> {
_phantom: PhantomData<(Block, Error, P)>, _phantom: PhantomData<(Block, Error, P)>,
@@ -343,7 +343,7 @@ struct AuraConsensusBuilder<P, Block, PF, BI, RBackend, CIDP, Client, SO, BS, Er
create_inherent_data_providers: CIDP, create_inherent_data_providers: CIDP,
block_import: BI, block_import: BI,
relay_chain_backend: Arc<RBackend>, relay_chain_backend: Arc<RBackend>,
relay_chain_client: polkadot_service::Client, relay_chain_client: polkadot_client::Client,
para_client: Arc<Client>, para_client: Arc<Client>,
backoff_authoring_blocks: Option<BS>, backoff_authoring_blocks: Option<BS>,
sync_oracle: SO, sync_oracle: SO,
@@ -399,7 +399,7 @@ where
proposer_factory: PF, proposer_factory: PF,
block_import: BI, block_import: BI,
create_inherent_data_providers: CIDP, create_inherent_data_providers: CIDP,
relay_chain_client: polkadot_service::Client, relay_chain_client: polkadot_client::Client,
relay_chain_backend: Arc<RBackend>, relay_chain_backend: Arc<RBackend>,
para_client: Arc<Client>, para_client: Arc<Client>,
backoff_authoring_blocks: Option<BS>, backoff_authoring_blocks: Option<BS>,
@@ -434,7 +434,7 @@ where
} }
} }
impl<Block, PF, BI, RBackend, CIDP, Client, SO, BS, P, Error> polkadot_service::ExecuteWithClient impl<Block, PF, BI, RBackend, CIDP, Client, SO, BS, P, Error> polkadot_client::ExecuteWithClient
for AuraConsensusBuilder<P, Block, PF, BI, RBackend, CIDP, Client, SO, BS, Error> for AuraConsensusBuilder<P, Block, PF, BI, RBackend, CIDP, Client, SO, BS, Error>
where where
Block: BlockT, Block: BlockT,
@@ -481,8 +481,8 @@ where
<Api as sp_api::ApiExt<PBlock>>::StateBackend: sp_api::StateBackend<HashFor<PBlock>>, <Api as sp_api::ApiExt<PBlock>>::StateBackend: sp_api::StateBackend<HashFor<PBlock>>,
PBackend: Backend<PBlock>, PBackend: Backend<PBlock>,
PBackend::State: sp_api::StateBackend<sp_runtime::traits::BlakeTwo256>, PBackend::State: sp_api::StateBackend<sp_runtime::traits::BlakeTwo256>,
Api: polkadot_service::RuntimeApiCollection<StateBackend = PBackend::State>, Api: polkadot_client::RuntimeApiCollection<StateBackend = PBackend::State>,
PClient: polkadot_service::AbstractClient<PBlock, PBackend, Api = Api> + 'static, PClient: polkadot_client::AbstractClient<PBlock, PBackend, Api = Api> + 'static,
{ {
Box::new(AuraConsensus::new::<P, _, _, _, _, _, _>( Box::new(AuraConsensus::new::<P, _, _, _, _, _, _>(
self.para_client, self.para_client,
+1 -1
View File
@@ -18,7 +18,7 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" } substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Polkadot dependencies # Polkadot dependencies
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-client = { git = "https://github.com/paritytech/polkadot", branch = "master" }
# Cumulus dependencies # Cumulus dependencies
cumulus-client-consensus-common = { path = "../common" } cumulus-client-consensus-common = { path = "../common" }
+9 -9
View File
@@ -41,7 +41,7 @@ use cumulus_primitives_core::{
ParaId, PersistedValidationData, ParaId, PersistedValidationData,
}; };
use parking_lot::Mutex; use parking_lot::Mutex;
use polkadot_service::ClientHandle; use polkadot_client::ClientHandle;
use sc_client_api::Backend; use sc_client_api::Backend;
use sp_api::ProvideRuntimeApi; use sp_api::ProvideRuntimeApi;
use sp_consensus::{ use sp_consensus::{
@@ -237,7 +237,7 @@ pub struct BuildRelayChainConsensusParams<PF, BI, RBackend, CIDP> {
pub proposer_factory: PF, pub proposer_factory: PF,
pub create_inherent_data_providers: CIDP, pub create_inherent_data_providers: CIDP,
pub block_import: BI, pub block_import: BI,
pub relay_chain_client: polkadot_service::Client, pub relay_chain_client: polkadot_client::Client,
pub relay_chain_backend: Arc<RBackend>, pub relay_chain_backend: Arc<RBackend>,
} }
@@ -283,8 +283,8 @@ where
/// Relay chain consensus builder. /// Relay chain consensus builder.
/// ///
/// Builds a [`RelayChainConsensus`] for a parachain. As this requires /// Builds a [`RelayChainConsensus`] for a parachain. As this requires
/// a concrete relay chain client instance, the builder takes a [`polkadot_service::Client`] /// a concrete relay chain client instance, the builder takes a [`polkadot_client::Client`]
/// that wraps this concrete instanace. By using [`polkadot_service::ExecuteWithClient`] /// that wraps this concrete instanace. By using [`polkadot_client::ExecuteWithClient`]
/// the builder gets access to this concrete instance. /// the builder gets access to this concrete instance.
struct RelayChainConsensusBuilder<Block, PF, BI, RBackend, CIDP> { struct RelayChainConsensusBuilder<Block, PF, BI, RBackend, CIDP> {
para_id: ParaId, para_id: ParaId,
@@ -293,7 +293,7 @@ struct RelayChainConsensusBuilder<Block, PF, BI, RBackend, CIDP> {
create_inherent_data_providers: CIDP, create_inherent_data_providers: CIDP,
block_import: BI, block_import: BI,
relay_chain_backend: Arc<RBackend>, relay_chain_backend: Arc<RBackend>,
relay_chain_client: polkadot_service::Client, relay_chain_client: polkadot_client::Client,
} }
impl<Block, PF, BI, RBackend, CIDP> RelayChainConsensusBuilder<Block, PF, BI, RBackend, CIDP> impl<Block, PF, BI, RBackend, CIDP> RelayChainConsensusBuilder<Block, PF, BI, RBackend, CIDP>
@@ -318,7 +318,7 @@ where
proposer_factory: PF, proposer_factory: PF,
block_import: BI, block_import: BI,
create_inherent_data_providers: CIDP, create_inherent_data_providers: CIDP,
relay_chain_client: polkadot_service::Client, relay_chain_client: polkadot_client::Client,
relay_chain_backend: Arc<RBackend>, relay_chain_backend: Arc<RBackend>,
) -> Self { ) -> Self {
Self { Self {
@@ -338,7 +338,7 @@ where
} }
} }
impl<Block, PF, BI, RBackend, CIDP> polkadot_service::ExecuteWithClient impl<Block, PF, BI, RBackend, CIDP> polkadot_client::ExecuteWithClient
for RelayChainConsensusBuilder<Block, PF, BI, RBackend, CIDP> for RelayChainConsensusBuilder<Block, PF, BI, RBackend, CIDP>
where where
Block: BlockT, Block: BlockT,
@@ -362,8 +362,8 @@ where
<Api as sp_api::ApiExt<PBlock>>::StateBackend: sp_api::StateBackend<HashFor<PBlock>>, <Api as sp_api::ApiExt<PBlock>>::StateBackend: sp_api::StateBackend<HashFor<PBlock>>,
PBackend: Backend<PBlock>, PBackend: Backend<PBlock>,
PBackend::State: sp_api::StateBackend<sp_runtime::traits::BlakeTwo256>, PBackend::State: sp_api::StateBackend<sp_runtime::traits::BlakeTwo256>,
Api: polkadot_service::RuntimeApiCollection<StateBackend = PBackend::State>, Api: polkadot_client::RuntimeApiCollection<StateBackend = PBackend::State>,
PClient: polkadot_service::AbstractClient<PBlock, PBackend, Api = Api> + 'static, PClient: polkadot_client::AbstractClient<PBlock, PBackend, Api = Api> + 'static,
{ {
Box::new(RelayChainConsensus::new( Box::new(RelayChainConsensus::new(
self.para_id, self.para_id,
+1 -1
View File
@@ -18,7 +18,7 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-statement-table = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-statement-table = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-node-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-node-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-client = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" }
# other deps # other deps
+9 -9
View File
@@ -39,7 +39,7 @@ use polkadot_primitives::v1::{
Block as PBlock, Hash as PHash, CandidateReceipt, CompactStatement, Id as ParaId, Block as PBlock, Hash as PHash, CandidateReceipt, CompactStatement, Id as ParaId,
OccupiedCoreAssumption, ParachainHost, UncheckedSigned, SigningContext, OccupiedCoreAssumption, ParachainHost, UncheckedSigned, SigningContext,
}; };
use polkadot_service::ClientHandle; use polkadot_client::ClientHandle;
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use futures::{ use futures::{
@@ -414,7 +414,7 @@ where
/// ///
/// Returns a boxed [`BlockAnnounceValidator`]. /// Returns a boxed [`BlockAnnounceValidator`].
pub fn build_block_announce_validator<Block: BlockT, B>( pub fn build_block_announce_validator<Block: BlockT, B>(
relay_chain_client: polkadot_service::Client, relay_chain_client: polkadot_client::Client,
para_id: ParaId, para_id: ParaId,
relay_chain_sync_oracle: Box<dyn SyncOracle + Send>, relay_chain_sync_oracle: Box<dyn SyncOracle + Send>,
relay_chain_backend: Arc<B>, relay_chain_backend: Arc<B>,
@@ -436,12 +436,12 @@ where
/// Block announce validator builder. /// Block announce validator builder.
/// ///
/// Builds a [`BlockAnnounceValidator`] for a parachain. As this requires /// Builds a [`BlockAnnounceValidator`] for a parachain. As this requires
/// a concrete relay chain client instance, the builder takes a [`polkadot_service::Client`] /// a concrete relay chain client instance, the builder takes a [`polkadot_client::Client`]
/// that wraps this concrete instanace. By using [`polkadot_service::ExecuteWithClient`] /// that wraps this concrete instanace. By using [`polkadot_client::ExecuteWithClient`]
/// the builder gets access to this concrete instance. /// the builder gets access to this concrete instance.
struct BlockAnnounceValidatorBuilder<Block, B> { struct BlockAnnounceValidatorBuilder<Block, B> {
phantom: PhantomData<Block>, phantom: PhantomData<Block>,
relay_chain_client: polkadot_service::Client, relay_chain_client: polkadot_client::Client,
para_id: ParaId, para_id: ParaId,
relay_chain_sync_oracle: Box<dyn SyncOracle + Send>, relay_chain_sync_oracle: Box<dyn SyncOracle + Send>,
relay_chain_backend: Arc<B>, relay_chain_backend: Arc<B>,
@@ -455,7 +455,7 @@ where
{ {
/// Create a new instance of the builder. /// Create a new instance of the builder.
fn new( fn new(
relay_chain_client: polkadot_service::Client, relay_chain_client: polkadot_client::Client,
para_id: ParaId, para_id: ParaId,
relay_chain_sync_oracle: Box<dyn SyncOracle + Send>, relay_chain_sync_oracle: Box<dyn SyncOracle + Send>,
relay_chain_backend: Arc<B>, relay_chain_backend: Arc<B>,
@@ -475,7 +475,7 @@ where
} }
} }
impl<Block: BlockT, B> polkadot_service::ExecuteWithClient impl<Block: BlockT, B> polkadot_client::ExecuteWithClient
for BlockAnnounceValidatorBuilder<Block, B> for BlockAnnounceValidatorBuilder<Block, B>
where where
B: Backend<PBlock> + Send + 'static, B: Backend<PBlock> + Send + 'static,
@@ -490,8 +490,8 @@ where
sp_api::StateBackend<sp_runtime::traits::BlakeTwo256>, sp_api::StateBackend<sp_runtime::traits::BlakeTwo256>,
PBackend: Backend<PBlock>, PBackend: Backend<PBlock>,
PBackend::State: sp_api::StateBackend<sp_runtime::traits::BlakeTwo256>, PBackend::State: sp_api::StateBackend<sp_runtime::traits::BlakeTwo256>,
Api: polkadot_service::RuntimeApiCollection<StateBackend = PBackend::State>, Api: polkadot_client::RuntimeApiCollection<StateBackend = PBackend::State>,
PClient: polkadot_service::AbstractClient<PBlock, PBackend, Api = Api> + 'static, PClient: polkadot_client::AbstractClient<PBlock, PBackend, Api = Api> + 'static,
{ {
Box::new(BlockAnnounceValidator::new( Box::new(BlockAnnounceValidator::new(
client.clone(), client.clone(),
-3
View File
@@ -16,10 +16,7 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas
# Polkadot deps # Polkadot deps
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-statement-table = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-node-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-node-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-overseer = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-overseer = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-node-subsystem = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-node-subsystem = { git = "https://github.com/paritytech/polkadot", branch = "master" }
+2 -2
View File
@@ -16,7 +16,7 @@ sp-trie = { git = "https://github.com/paritytech/substrate", default-features =
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
# Polkadot dependencies # Polkadot dependencies
polkadot-service = { git = "https://github.com/paritytech/polkadot", optional = true, branch = "master" } polkadot-client = { git = "https://github.com/paritytech/polkadot", optional = true, branch = "master" }
# Cumulus dependencies # Cumulus dependencies
cumulus-primitives-core = { path = "../core", default-features = false } cumulus-primitives-core = { path = "../core", default-features = false }
@@ -41,5 +41,5 @@ std = [
"sp-runtime", "sp-runtime",
"sc-client-api", "sc-client-api",
"sp-api", "sp-api",
"polkadot-service", "polkadot-client",
] ]
@@ -26,7 +26,7 @@ use cumulus_primitives_core::{
}, },
InboundDownwardMessage, InboundHrmpMessage, ParaId, PersistedValidationData, InboundDownwardMessage, InboundHrmpMessage, ParaId, PersistedValidationData,
}; };
use polkadot_service::{Client, ClientHandle, ExecuteWithClient}; use polkadot_client::{Client, ClientHandle, ExecuteWithClient};
use sc_client_api::Backend; use sc_client_api::Backend;
use sp_api::ProvideRuntimeApi; use sp_api::ProvideRuntimeApi;
use sp_runtime::generic::BlockId; use sp_runtime::generic::BlockId;