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

Commit 3e4cb69

Browse files
authored
* Move configs * Start using `NetworkService` traits from `sc-network` * Fix stuff * Remove `sc-network-common` as dependency * update lockfile for {"substrate"} --------- Co-authored-by: parity-processbot <>
1 parent 70598a1 commit 3e4cb69

File tree

9 files changed

+212
-212
lines changed

9 files changed

+212
-212
lines changed

Cargo.lock

Lines changed: 193 additions & 188 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/network/bridge/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ gum = { package = "tracing-gum", path = "../../gum" }
1212
polkadot-primitives = { path = "../../../primitives" }
1313
parity-scale-codec = { version = "3.3.0", default-features = false, features = ["derive"] }
1414
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
15-
sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "master" }
1615
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
1716
polkadot-node-metrics = { path = "../../metrics"}
1817
polkadot-node-network-protocol = { path = "../protocol" }

node/network/bridge/src/network.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,9 @@ use futures::{prelude::*, stream::BoxStream};
2222
use parity_scale_codec::Encode;
2323

2424
use sc_network::{
25-
multiaddr::Multiaddr, Event as NetworkEvent, IfDisconnected, NetworkService, OutboundFailure,
26-
RequestFailure,
27-
};
28-
use sc_network_common::{
29-
config::parse_addr,
30-
protocol::ProtocolName,
31-
service::{NetworkEventStream, NetworkNotification, NetworkPeers, NetworkRequest},
25+
config::parse_addr, multiaddr::Multiaddr, types::ProtocolName, Event as NetworkEvent,
26+
IfDisconnected, NetworkEventStream, NetworkNotification, NetworkPeers, NetworkRequest,
27+
NetworkService, OutboundFailure, RequestFailure,
3228
};
3329

3430
use polkadot_node_network_protocol::{
@@ -193,8 +189,9 @@ impl Network for Arc<NetworkService<Block, Hash>> {
193189
match pending_response
194190
.send(Err(RequestFailure::Network(OutboundFailure::DialFailure)))
195191
{
196-
Err(_) =>
197-
gum::debug!(target: LOG_TARGET, "Sending failed request response failed."),
192+
Err(_) => {
193+
gum::debug!(target: LOG_TARGET, "Sending failed request response failed.")
194+
},
198195
Ok(_) => {},
199196
}
200197
return

node/network/protocol/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ polkadot-node-primitives = { path = "../../primitives" }
1313
polkadot-node-jaeger = { path = "../../jaeger" }
1414
parity-scale-codec = { version = "3.3.0", default-features = false, features = ["derive"] }
1515
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
16-
sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "master" }
1716
sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" }
1817
strum = { version = "0.24", features = ["derive"] }
1918
futures = "0.3.21"

node/network/protocol/src/peer_set.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
1919
use derive_more::Display;
2020
use polkadot_primitives::Hash;
21-
use sc_network_common::{
21+
use sc_network::{
2222
config::{NonDefaultSetConfig, SetConfig},
23-
protocol::ProtocolName,
23+
types::ProtocolName,
2424
};
2525
use std::{
2626
collections::{hash_map::Entry, HashMap},
@@ -81,15 +81,15 @@ impl PeerSet {
8181
fallback_names,
8282
max_notification_size,
8383
handshake: None,
84-
set_config: sc_network_common::config::SetConfig {
84+
set_config: SetConfig {
8585
// we allow full nodes to connect to validators for gossip
8686
// to ensure any `MIN_GOSSIP_PEERS` always include reserved peers
8787
// we limit the amount of non-reserved slots to be less
8888
// than `MIN_GOSSIP_PEERS` in total
8989
in_peers: super::MIN_GOSSIP_PEERS as u32 / 2 - 1,
9090
out_peers: super::MIN_GOSSIP_PEERS as u32 / 2 - 1,
9191
reserved_nodes: Vec::new(),
92-
non_reserved_mode: sc_network_common::config::NonReservedPeerMode::Accept,
92+
non_reserved_mode: sc_network::config::NonReservedPeerMode::Accept,
9393
},
9494
},
9595
PeerSet::Collation => NonDefaultSetConfig {
@@ -103,9 +103,9 @@ impl PeerSet {
103103
out_peers: 0,
104104
reserved_nodes: Vec::new(),
105105
non_reserved_mode: if is_authority == IsAuthority::Yes {
106-
sc_network_common::config::NonReservedPeerMode::Accept
106+
sc_network::config::NonReservedPeerMode::Accept
107107
} else {
108-
sc_network_common::config::NonReservedPeerMode::Deny
108+
sc_network::config::NonReservedPeerMode::Deny
109109
},
110110
},
111111
},
@@ -190,7 +190,7 @@ impl<T> IndexMut<PeerSet> for PerPeerSet<T> {
190190
pub fn peer_sets_info(
191191
is_authority: IsAuthority,
192192
peerset_protocol_names: &PeerSetProtocolNames,
193-
) -> Vec<sc_network_common::config::NonDefaultSetConfig> {
193+
) -> Vec<NonDefaultSetConfig> {
194194
PeerSet::iter()
195195
.map(|s| s.get_info(is_authority, &peerset_protocol_names))
196196
.collect()

node/service/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -961,8 +961,7 @@ where
961961

962962
let authority_discovery_service = if auth_or_collator || overseer_enable_anyways {
963963
use futures::StreamExt;
964-
use sc_network::Event;
965-
use sc_network_common::service::NetworkEventStream;
964+
use sc_network::{Event, NetworkEventStream};
966965

967966
let authority_discovery_role = if role.is_authority() {
968967
sc_authority_discovery::Role::PublishAndDiscover(keystore_container.keystore())

node/service/src/overseer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use polkadot_primitives::runtime_api::ParachainHost;
4242
use sc_authority_discovery::Service as AuthorityDiscoveryService;
4343
use sc_client_api::AuxStore;
4444
use sc_keystore::LocalKeystore;
45-
use sc_network_common::service::NetworkStateInfo;
45+
use sc_network::NetworkStateInfo;
4646
use sp_api::ProvideRuntimeApi;
4747
use sp_blockchain::HeaderBackend;
4848
use sp_consensus_babe::BabeApi;

node/test/service/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas
4545
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
4646
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
4747
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
48-
sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "master" }
4948
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
5049
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
5150
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }

node/test/service/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ use polkadot_test_runtime::{
3737
};
3838
use sc_chain_spec::ChainSpec;
3939
use sc_client_api::execution_extensions::ExecutionStrategies;
40-
use sc_network::{config::NetworkConfiguration, multiaddr};
41-
use sc_network_common::{config::TransportConfig, service::NetworkStateInfo};
40+
use sc_network::{
41+
config::{NetworkConfiguration, TransportConfig},
42+
multiaddr, NetworkStateInfo,
43+
};
4244
use sc_service::{
4345
config::{
4446
DatabaseSource, KeystoreConfig, MultiaddrWithPeerId, WasmExecutionMethod,

0 commit comments

Comments
 (0)