From c5819c9e78ac9923e10a88847ed575335f31e202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= <bkchr@users.noreply.github.com> Date: Fri, 11 Jun 2021 11:56:14 +0100 Subject: [PATCH] Use polkadot-client instead of polkadot service where possible (#489) --- cumulus/Cargo.lock | 11 ++++------- cumulus/client/consensus/aura/Cargo.toml | 2 +- cumulus/client/consensus/aura/src/lib.rs | 18 +++++++++--------- .../client/consensus/relay-chain/Cargo.toml | 2 +- .../client/consensus/relay-chain/src/lib.rs | 18 +++++++++--------- cumulus/client/network/Cargo.toml | 2 +- cumulus/client/network/src/lib.rs | 18 +++++++++--------- cumulus/client/pov-recovery/Cargo.toml | 3 --- .../primitives/parachain-inherent/Cargo.toml | 4 ++-- .../parachain-inherent/src/client_side.rs | 2 +- 10 files changed, 37 insertions(+), 43 deletions(-) diff --git a/cumulus/Cargo.lock b/cumulus/Cargo.lock index 096cf62b3d6..6d34b3fca95 100644 --- a/cumulus/Cargo.lock +++ b/cumulus/Cargo.lock @@ -1445,7 +1445,7 @@ dependencies = [ "futures 0.3.14", "parity-scale-codec", "parking_lot 0.10.2", - "polkadot-service", + "polkadot-client", "sc-client-api", "sc-consensus-aura", "sc-consensus-slots", @@ -1508,7 +1508,7 @@ dependencies = [ "futures 0.3.14", "parity-scale-codec", "parking_lot 0.10.2", - "polkadot-service", + "polkadot-client", "sc-client-api", "sp-api", "sp-block-builder", @@ -1532,10 +1532,10 @@ dependencies = [ "futures-timer 3.0.2", "parity-scale-codec", "parking_lot 0.10.2", + "polkadot-client", "polkadot-node-primitives", "polkadot-parachain", "polkadot-primitives", - "polkadot-service", "polkadot-statement-table", "polkadot-test-client", "sc-cli", @@ -1565,10 +1565,7 @@ dependencies = [ "polkadot-node-primitives", "polkadot-node-subsystem", "polkadot-overseer", - "polkadot-parachain", "polkadot-primitives", - "polkadot-service", - "polkadot-statement-table", "polkadot-test-client", "rand 0.8.3", "sc-cli", @@ -1762,7 +1759,7 @@ dependencies = [ "async-trait", "cumulus-primitives-core", "parity-scale-codec", - "polkadot-service", + "polkadot-client", "sc-client-api", "sp-api", "sp-core", diff --git a/cumulus/client/consensus/aura/Cargo.toml b/cumulus/client/consensus/aura/Cargo.toml index dcfd2956a3f..ed62a384654 100644 --- a/cumulus/client/consensus/aura/Cargo.toml +++ b/cumulus/client/consensus/aura/Cargo.toml @@ -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" } # 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-client-consensus-common = { path = "../common" } diff --git a/cumulus/client/consensus/aura/src/lib.rs b/cumulus/client/consensus/aura/src/lib.rs index 638c08bec23..2e7ef612e4b 100644 --- a/cumulus/client/consensus/aura/src/lib.rs +++ b/cumulus/client/consensus/aura/src/lib.rs @@ -31,7 +31,7 @@ use cumulus_primitives_core::{ PersistedValidationData, }; use futures::lock::Mutex; -use polkadot_service::ClientHandle; +use polkadot_client::ClientHandle; use sc_client_api::{backend::AuxStore, Backend, BlockOf}; use sc_consensus_slots::{BackoffAuthoringBlocksStrategy, SlotInfo}; use sc_telemetry::TelemetryHandle; @@ -243,7 +243,7 @@ pub struct BuildAuraConsensusParams<PF, BI, RBackend, CIDP, Client, BS, SO> { pub proposer_factory: PF, pub create_inherent_data_providers: CIDP, 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 para_client: Arc<Client>, pub backoff_authoring_blocks: Option<BS>, @@ -334,8 +334,8 @@ where /// Aura consensus builder. /// /// Builds a [`AuraConsensus`] for a parachain. As this requires -/// a concrete relay chain client instance, the builder takes a [`polkadot_service::Client`] -/// that wraps this concrete instance. By using [`polkadot_service::ExecuteWithClient`] +/// a concrete relay chain client instance, the builder takes a [`polkadot_client::Client`] +/// that wraps this concrete instance. By using [`polkadot_client::ExecuteWithClient`] /// the builder gets access to this concrete instance. struct AuraConsensusBuilder<P, Block, PF, BI, RBackend, CIDP, Client, SO, BS, Error> { _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, block_import: BI, relay_chain_backend: Arc<RBackend>, - relay_chain_client: polkadot_service::Client, + relay_chain_client: polkadot_client::Client, para_client: Arc<Client>, backoff_authoring_blocks: Option<BS>, sync_oracle: SO, @@ -399,7 +399,7 @@ where proposer_factory: PF, block_import: BI, create_inherent_data_providers: CIDP, - relay_chain_client: polkadot_service::Client, + relay_chain_client: polkadot_client::Client, relay_chain_backend: Arc<RBackend>, para_client: Arc<Client>, 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> where Block: BlockT, @@ -481,8 +481,8 @@ where <Api as sp_api::ApiExt<PBlock>>::StateBackend: sp_api::StateBackend<HashFor<PBlock>>, PBackend: Backend<PBlock>, PBackend::State: sp_api::StateBackend<sp_runtime::traits::BlakeTwo256>, - Api: polkadot_service::RuntimeApiCollection<StateBackend = PBackend::State>, - PClient: polkadot_service::AbstractClient<PBlock, PBackend, Api = Api> + 'static, + Api: polkadot_client::RuntimeApiCollection<StateBackend = PBackend::State>, + PClient: polkadot_client::AbstractClient<PBlock, PBackend, Api = Api> + 'static, { Box::new(AuraConsensus::new::<P, _, _, _, _, _, _>( self.para_client, diff --git a/cumulus/client/consensus/relay-chain/Cargo.toml b/cumulus/client/consensus/relay-chain/Cargo.toml index db69dd59ce6..cb782025b71 100644 --- a/cumulus/client/consensus/relay-chain/Cargo.toml +++ b/cumulus/client/consensus/relay-chain/Cargo.toml @@ -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" } # 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-client-consensus-common = { path = "../common" } diff --git a/cumulus/client/consensus/relay-chain/src/lib.rs b/cumulus/client/consensus/relay-chain/src/lib.rs index 971d9b33a0f..4384042c9c9 100644 --- a/cumulus/client/consensus/relay-chain/src/lib.rs +++ b/cumulus/client/consensus/relay-chain/src/lib.rs @@ -41,7 +41,7 @@ use cumulus_primitives_core::{ ParaId, PersistedValidationData, }; use parking_lot::Mutex; -use polkadot_service::ClientHandle; +use polkadot_client::ClientHandle; use sc_client_api::Backend; use sp_api::ProvideRuntimeApi; use sp_consensus::{ @@ -237,7 +237,7 @@ pub struct BuildRelayChainConsensusParams<PF, BI, RBackend, CIDP> { pub proposer_factory: PF, pub create_inherent_data_providers: CIDP, pub block_import: BI, - pub relay_chain_client: polkadot_service::Client, + pub relay_chain_client: polkadot_client::Client, pub relay_chain_backend: Arc<RBackend>, } @@ -283,8 +283,8 @@ where /// Relay chain consensus builder. /// /// Builds a [`RelayChainConsensus`] for a parachain. As this requires -/// a concrete relay chain client instance, the builder takes a [`polkadot_service::Client`] -/// that wraps this concrete instanace. By using [`polkadot_service::ExecuteWithClient`] +/// a concrete relay chain client instance, the builder takes a [`polkadot_client::Client`] +/// that wraps this concrete instanace. By using [`polkadot_client::ExecuteWithClient`] /// the builder gets access to this concrete instance. struct RelayChainConsensusBuilder<Block, PF, BI, RBackend, CIDP> { para_id: ParaId, @@ -293,7 +293,7 @@ struct RelayChainConsensusBuilder<Block, PF, BI, RBackend, CIDP> { create_inherent_data_providers: CIDP, block_import: BI, 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> @@ -318,7 +318,7 @@ where proposer_factory: PF, block_import: BI, create_inherent_data_providers: CIDP, - relay_chain_client: polkadot_service::Client, + relay_chain_client: polkadot_client::Client, relay_chain_backend: Arc<RBackend>, ) -> 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> where Block: BlockT, @@ -362,8 +362,8 @@ where <Api as sp_api::ApiExt<PBlock>>::StateBackend: sp_api::StateBackend<HashFor<PBlock>>, PBackend: Backend<PBlock>, PBackend::State: sp_api::StateBackend<sp_runtime::traits::BlakeTwo256>, - Api: polkadot_service::RuntimeApiCollection<StateBackend = PBackend::State>, - PClient: polkadot_service::AbstractClient<PBlock, PBackend, Api = Api> + 'static, + Api: polkadot_client::RuntimeApiCollection<StateBackend = PBackend::State>, + PClient: polkadot_client::AbstractClient<PBlock, PBackend, Api = Api> + 'static, { Box::new(RelayChainConsensus::new( self.para_id, diff --git a/cumulus/client/network/Cargo.toml b/cumulus/client/network/Cargo.toml index f7a9d5a4cdd..a63d9a90e5f 100644 --- a/cumulus/client/network/Cargo.toml +++ b/cumulus/client/network/Cargo.toml @@ -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-statement-table = { 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" } # other deps diff --git a/cumulus/client/network/src/lib.rs b/cumulus/client/network/src/lib.rs index a0d6959df18..685007e1806 100644 --- a/cumulus/client/network/src/lib.rs +++ b/cumulus/client/network/src/lib.rs @@ -39,7 +39,7 @@ use polkadot_primitives::v1::{ Block as PBlock, Hash as PHash, CandidateReceipt, CompactStatement, Id as ParaId, OccupiedCoreAssumption, ParachainHost, UncheckedSigned, SigningContext, }; -use polkadot_service::ClientHandle; +use polkadot_client::ClientHandle; use codec::{Decode, Encode}; use futures::{ @@ -414,7 +414,7 @@ where /// /// Returns a boxed [`BlockAnnounceValidator`]. pub fn build_block_announce_validator<Block: BlockT, B>( - relay_chain_client: polkadot_service::Client, + relay_chain_client: polkadot_client::Client, para_id: ParaId, relay_chain_sync_oracle: Box<dyn SyncOracle + Send>, relay_chain_backend: Arc<B>, @@ -436,12 +436,12 @@ where /// Block announce validator builder. /// /// Builds a [`BlockAnnounceValidator`] for a parachain. As this requires -/// a concrete relay chain client instance, the builder takes a [`polkadot_service::Client`] -/// that wraps this concrete instanace. By using [`polkadot_service::ExecuteWithClient`] +/// a concrete relay chain client instance, the builder takes a [`polkadot_client::Client`] +/// that wraps this concrete instanace. By using [`polkadot_client::ExecuteWithClient`] /// the builder gets access to this concrete instance. struct BlockAnnounceValidatorBuilder<Block, B> { phantom: PhantomData<Block>, - relay_chain_client: polkadot_service::Client, + relay_chain_client: polkadot_client::Client, para_id: ParaId, relay_chain_sync_oracle: Box<dyn SyncOracle + Send>, relay_chain_backend: Arc<B>, @@ -455,7 +455,7 @@ where { /// Create a new instance of the builder. fn new( - relay_chain_client: polkadot_service::Client, + relay_chain_client: polkadot_client::Client, para_id: ParaId, relay_chain_sync_oracle: Box<dyn SyncOracle + Send>, 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> where B: Backend<PBlock> + Send + 'static, @@ -490,8 +490,8 @@ where sp_api::StateBackend<sp_runtime::traits::BlakeTwo256>, PBackend: Backend<PBlock>, PBackend::State: sp_api::StateBackend<sp_runtime::traits::BlakeTwo256>, - Api: polkadot_service::RuntimeApiCollection<StateBackend = PBackend::State>, - PClient: polkadot_service::AbstractClient<PBlock, PBackend, Api = Api> + 'static, + Api: polkadot_client::RuntimeApiCollection<StateBackend = PBackend::State>, + PClient: polkadot_client::AbstractClient<PBlock, PBackend, Api = Api> + 'static, { Box::new(BlockAnnounceValidator::new( client.clone(), diff --git a/cumulus/client/pov-recovery/Cargo.toml b/cumulus/client/pov-recovery/Cargo.toml index 8fdfcafbe7c..0af05ea452f 100644 --- a/cumulus/client/pov-recovery/Cargo.toml +++ b/cumulus/client/pov-recovery/Cargo.toml @@ -16,10 +16,7 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas # Polkadot deps 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-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-node-subsystem = { git = "https://github.com/paritytech/polkadot", branch = "master" } diff --git a/cumulus/primitives/parachain-inherent/Cargo.toml b/cumulus/primitives/parachain-inherent/Cargo.toml index 5f344978369..eccb234143c 100644 --- a/cumulus/primitives/parachain-inherent/Cargo.toml +++ b/cumulus/primitives/parachain-inherent/Cargo.toml @@ -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 } # 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-primitives-core = { path = "../core", default-features = false } @@ -41,5 +41,5 @@ std = [ "sp-runtime", "sc-client-api", "sp-api", - "polkadot-service", + "polkadot-client", ] diff --git a/cumulus/primitives/parachain-inherent/src/client_side.rs b/cumulus/primitives/parachain-inherent/src/client_side.rs index 787782b3554..7f183639a36 100644 --- a/cumulus/primitives/parachain-inherent/src/client_side.rs +++ b/cumulus/primitives/parachain-inherent/src/client_side.rs @@ -26,7 +26,7 @@ use cumulus_primitives_core::{ }, InboundDownwardMessage, InboundHrmpMessage, ParaId, PersistedValidationData, }; -use polkadot_service::{Client, ClientHandle, ExecuteWithClient}; +use polkadot_client::{Client, ClientHandle, ExecuteWithClient}; use sc_client_api::Backend; use sp_api::ProvideRuntimeApi; use sp_runtime::generic::BlockId; -- GitLab