Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 4fb7fa6

Browse files
skunertvieira-giulia
authored andcommitted
Cleanup dependencies + dead code (#2302)
1 parent fd5786a commit 4fb7fa6

File tree

15 files changed

+50
-106
lines changed

15 files changed

+50
-106
lines changed

Cargo.lock

+2-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/relay-chain-interface/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "mas
1414
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" }
1515
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
1616

17-
tokio = { version = "1.25.0", features = ["sync"] }
1817
futures = "0.3.26"
1918
async-trait = "0.1.63"
2019
thiserror = "1.0.38"

client/relay-chain-minimal-node/Cargo.toml

-6
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,10 @@ polkadot-network-bridge = { git = "https://github.com/paritytech/polkadot", bran
1717
# substrate deps
1818
sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" }
1919
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
20-
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
2120
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
2221
sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "master" }
2322
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
24-
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
25-
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
26-
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
2723
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
28-
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" }
2924
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
3025
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
3126
sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
@@ -42,5 +37,4 @@ lru = "0.9"
4237
tracing = "0.1.37"
4338
async-trait = "0.1.63"
4439
futures = "0.3.26"
45-
url = "2.2.2"
4640
tokio = { version = "1.25.0", features = ["macros"] }

client/relay-chain-minimal-node/src/blockchain_rpc_client.rs

+11-36
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ use std::pin::Pin;
1919
use cumulus_relay_chain_interface::{RelayChainError, RelayChainResult};
2020
use cumulus_relay_chain_rpc_interface::RelayChainRpcClient;
2121
use futures::{Future, Stream, StreamExt};
22-
use polkadot_core_primitives::{Block, Hash, Header};
22+
use polkadot_core_primitives::{Block, BlockNumber, Hash, Header};
2323
use polkadot_overseer::RuntimeApiSubsystemClient;
24-
use polkadot_service::{AuxStore, HeaderBackend};
2524
use sc_authority_discovery::AuthorityDiscovery;
26-
2725
use sp_api::{ApiError, RuntimeApiInfo};
28-
use sp_blockchain::Info;
26+
use sp_blockchain::{HeaderBackend, Info};
27+
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor};
2928

3029
#[derive(Clone)]
3130
pub struct BlockChainRpcClient {
@@ -46,34 +45,12 @@ impl BlockChainRpcClient {
4645

4746
pub async fn block_get_hash(
4847
&self,
49-
number: Option<polkadot_service::BlockNumber>,
48+
number: Option<BlockNumber>,
5049
) -> Result<Option<Hash>, RelayChainError> {
5150
self.rpc_client.chain_get_block_hash(number).await
5251
}
5352
}
5453

55-
// Implementation required by Availability-Distribution subsystem
56-
// but never called in our case.
57-
impl AuxStore for BlockChainRpcClient {
58-
fn insert_aux<
59-
'a,
60-
'b: 'a,
61-
'c: 'a,
62-
I: IntoIterator<Item = &'a (&'c [u8], &'c [u8])>,
63-
D: IntoIterator<Item = &'a &'b [u8]>,
64-
>(
65-
&self,
66-
_insert: I,
67-
_delete: D,
68-
) -> sp_blockchain::Result<()> {
69-
unimplemented!("Not supported on the RPC collator")
70-
}
71-
72-
fn get_aux(&self, _key: &[u8]) -> sp_blockchain::Result<Option<Vec<u8>>> {
73-
unimplemented!("Not supported on the RPC collator")
74-
}
75-
}
76-
7754
#[async_trait::async_trait]
7855
impl RuntimeApiSubsystemClient for BlockChainRpcClient {
7956
async fn validators(
@@ -359,8 +336,8 @@ fn block_local<T>(fut: impl Future<Output = T>) -> T {
359336
impl HeaderBackend<Block> for BlockChainRpcClient {
360337
fn header(
361338
&self,
362-
hash: <Block as polkadot_service::BlockT>::Hash,
363-
) -> sp_blockchain::Result<Option<<Block as polkadot_service::BlockT>::Header>> {
339+
hash: <Block as BlockT>::Hash,
340+
) -> sp_blockchain::Result<Option<<Block as BlockT>::Header>> {
364341
Ok(block_local(self.rpc_client.chain_get_header(Some(hash)))?)
365342
}
366343

@@ -389,7 +366,7 @@ impl HeaderBackend<Block> for BlockChainRpcClient {
389366

390367
fn status(
391368
&self,
392-
hash: <Block as polkadot_service::BlockT>::Hash,
369+
hash: <Block as BlockT>::Hash,
393370
) -> sp_blockchain::Result<sp_blockchain::BlockStatus> {
394371
if self.header(hash)?.is_some() {
395372
Ok(sc_client_api::blockchain::BlockStatus::InChain)
@@ -400,19 +377,17 @@ impl HeaderBackend<Block> for BlockChainRpcClient {
400377

401378
fn number(
402379
&self,
403-
hash: <Block as polkadot_service::BlockT>::Hash,
404-
) -> sp_blockchain::Result<
405-
Option<<<Block as polkadot_service::BlockT>::Header as polkadot_service::HeaderT>::Number>,
406-
> {
380+
hash: <Block as BlockT>::Hash,
381+
) -> sp_blockchain::Result<Option<<<Block as BlockT>::Header as HeaderT>::Number>> {
407382
let result = block_local(self.rpc_client.chain_get_header(Some(hash)))?
408383
.map(|maybe_header| maybe_header.number);
409384
Ok(result)
410385
}
411386

412387
fn hash(
413388
&self,
414-
number: polkadot_service::NumberFor<Block>,
415-
) -> sp_blockchain::Result<Option<<Block as polkadot_service::BlockT>::Hash>> {
389+
number: NumberFor<Block>,
390+
) -> sp_blockchain::Result<Option<<Block as BlockT>::Hash>> {
416391
Ok(block_local(self.rpc_client.chain_get_block_hash(number.into()))?)
417392
}
418393
}

client/relay-chain-minimal-node/src/collator_overseer.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
1616

17-
use cumulus_relay_chain_interface::RelayChainError;
17+
use futures::{select, StreamExt};
1818
use lru::LruCache;
19+
use std::sync::Arc;
20+
1921
use polkadot_node_network_protocol::{
2022
peer_set::PeerSetProtocolNames,
2123
request_response::{
@@ -25,8 +27,8 @@ use polkadot_node_network_protocol::{
2527
};
2628
use polkadot_node_subsystem_util::metrics::{prometheus::Registry, Metrics};
2729
use polkadot_overseer::{
28-
BlockInfo, DummySubsystem, MetricsTrait, Overseer, OverseerHandle, OverseerMetrics, SpawnGlue,
29-
KNOWN_LEAVES_CACHE_SIZE,
30+
BlockInfo, DummySubsystem, Handle, MetricsTrait, Overseer, OverseerHandle, OverseerMetrics,
31+
SpawnGlue, KNOWN_LEAVES_CACHE_SIZE,
3032
};
3133
use polkadot_primitives::CollatorPair;
3234
use polkadot_service::{
@@ -37,18 +39,16 @@ use polkadot_service::{
3739
},
3840
Error, OverseerConnector,
3941
};
42+
4043
use sc_authority_discovery::Service as AuthorityDiscoveryService;
4144
use sc_network::NetworkStateInfo;
42-
43-
use std::sync::Arc;
45+
use sc_service::TaskManager;
46+
use sp_runtime::traits::Block as BlockT;
4447

4548
use cumulus_primitives_core::relay_chain::{Block, Hash as PHash};
46-
47-
use polkadot_service::{Handle, TaskManager};
49+
use cumulus_relay_chain_interface::RelayChainError;
4850

4951
use crate::BlockChainRpcClient;
50-
use futures::{select, StreamExt};
51-
use sp_runtime::traits::Block as BlockT;
5252

5353
/// Arguments passed for overseer construction.
5454
pub(crate) struct CollatorOverseerGenArgs<'a> {

client/relay-chain-minimal-node/src/lib.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ use polkadot_primitives::CollatorPair;
3030
use sc_authority_discovery::Service as AuthorityDiscoveryService;
3131
use sc_network::{Event, NetworkService};
3232
use sc_network_common::service::NetworkEventStream;
33-
use std::sync::Arc;
34-
35-
use polkadot_service::{Configuration, TaskManager};
33+
use sc_service::{Configuration, TaskManager};
34+
use sp_runtime::{app_crypto::Pair, traits::Block as BlockT};
3635

3736
use futures::StreamExt;
38-
39-
use sp_runtime::{app_crypto::Pair, traits::Block as BlockT};
37+
use std::sync::Arc;
4038

4139
mod collator_overseer;
4240

client/relay-chain-minimal-node/src/network.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
1616

1717
use polkadot_core_primitives::{Block, Hash};
18-
use polkadot_service::{BlockT, NumberFor};
18+
use sp_runtime::traits::{Block as BlockT, NumberFor};
1919

2020
use sc_network::NetworkService;
2121

client/relay-chain-rpc-interface/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66

77

88
[dependencies]
9-
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
9+
polkadot-overseer = { git = "https://github.com/paritytech/polkadot", branch = "master" }
1010

1111
cumulus-primitives-core = { path = "../../primitives/core" }
1212
cumulus-relay-chain-interface = { path = "../relay-chain-interface" }
@@ -19,6 +19,8 @@ sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "
1919
sp-storage = { git = "https://github.com/paritytech/substrate", branch = "master" }
2020
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
2121
sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
22+
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
23+
2224
tokio = { version = "1.25.0", features = ["sync"] }
2325

2426
futures = "0.3.26"

client/relay-chain-rpc-interface/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ use cumulus_primitives_core::{
2525
};
2626
use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult};
2727
use futures::{FutureExt, Stream, StreamExt};
28-
use polkadot_service::Handle;
28+
use polkadot_overseer::Handle;
29+
2930
use sc_client_api::StorageProof;
3031
use sp_core::sp_std::collections::btree_map::BTreeMap;
3132
use sp_state_machine::StorageValue;

client/relay-chain-rpc-interface/src/reconnecting_ws_client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use jsonrpsee::{
3737
ws_client::WsClientBuilder,
3838
};
3939
use lru::LruCache;
40-
use polkadot_service::TaskManager;
40+
use sc_service::TaskManager;
4141
use std::{num::NonZeroUsize, sync::Arc};
4242
use tokio::sync::mpsc::{
4343
channel as tokio_channel, Receiver as TokioReceiver, Sender as TokioSender,

0 commit comments

Comments
 (0)