Companion for paritytech/substrate#13592 (#6869)

* 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 <>
This commit is contained in:
Aaro Altonen
2023-03-14 14:52:15 +02:00
committed by GitHub
parent 5565bb9dbc
commit 0e1c932c42
9 changed files with 212 additions and 212 deletions
+193 -188
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -12,7 +12,6 @@ gum = { package = "tracing-gum", path = "../../gum" }
polkadot-primitives = { path = "../../../primitives" } polkadot-primitives = { path = "../../../primitives" }
parity-scale-codec = { version = "3.3.0", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.3.0", default-features = false, features = ["derive"] }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
polkadot-node-metrics = { path = "../../metrics"} polkadot-node-metrics = { path = "../../metrics"}
polkadot-node-network-protocol = { path = "../protocol" } polkadot-node-network-protocol = { path = "../protocol" }
+6 -9
View File
@@ -22,13 +22,9 @@ use futures::{prelude::*, stream::BoxStream};
use parity_scale_codec::Encode; use parity_scale_codec::Encode;
use sc_network::{ use sc_network::{
multiaddr::Multiaddr, Event as NetworkEvent, IfDisconnected, NetworkService, OutboundFailure, config::parse_addr, multiaddr::Multiaddr, types::ProtocolName, Event as NetworkEvent,
RequestFailure, IfDisconnected, NetworkEventStream, NetworkNotification, NetworkPeers, NetworkRequest,
}; NetworkService, OutboundFailure, RequestFailure,
use sc_network_common::{
config::parse_addr,
protocol::ProtocolName,
service::{NetworkEventStream, NetworkNotification, NetworkPeers, NetworkRequest},
}; };
use polkadot_node_network_protocol::{ use polkadot_node_network_protocol::{
@@ -193,8 +189,9 @@ impl Network for Arc<NetworkService<Block, Hash>> {
match pending_response match pending_response
.send(Err(RequestFailure::Network(OutboundFailure::DialFailure))) .send(Err(RequestFailure::Network(OutboundFailure::DialFailure)))
{ {
Err(_) => Err(_) => {
gum::debug!(target: LOG_TARGET, "Sending failed request response failed."), gum::debug!(target: LOG_TARGET, "Sending failed request response failed.")
},
Ok(_) => {}, Ok(_) => {},
} }
return return
@@ -13,7 +13,6 @@ polkadot-node-primitives = { path = "../../primitives" }
polkadot-node-jaeger = { path = "../../jaeger" } polkadot-node-jaeger = { path = "../../jaeger" }
parity-scale-codec = { version = "3.3.0", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.3.0", default-features = false, features = ["derive"] }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" }
strum = { version = "0.24", features = ["derive"] } strum = { version = "0.24", features = ["derive"] }
futures = "0.3.21" futures = "0.3.21"
@@ -18,9 +18,9 @@
use derive_more::Display; use derive_more::Display;
use polkadot_primitives::Hash; use polkadot_primitives::Hash;
use sc_network_common::{ use sc_network::{
config::{NonDefaultSetConfig, SetConfig}, config::{NonDefaultSetConfig, SetConfig},
protocol::ProtocolName, types::ProtocolName,
}; };
use std::{ use std::{
collections::{hash_map::Entry, HashMap}, collections::{hash_map::Entry, HashMap},
@@ -81,7 +81,7 @@ impl PeerSet {
fallback_names, fallback_names,
max_notification_size, max_notification_size,
handshake: None, handshake: None,
set_config: sc_network_common::config::SetConfig { set_config: SetConfig {
// we allow full nodes to connect to validators for gossip // we allow full nodes to connect to validators for gossip
// to ensure any `MIN_GOSSIP_PEERS` always include reserved peers // to ensure any `MIN_GOSSIP_PEERS` always include reserved peers
// we limit the amount of non-reserved slots to be less // we limit the amount of non-reserved slots to be less
@@ -89,7 +89,7 @@ impl PeerSet {
in_peers: super::MIN_GOSSIP_PEERS as u32 / 2 - 1, in_peers: super::MIN_GOSSIP_PEERS as u32 / 2 - 1,
out_peers: super::MIN_GOSSIP_PEERS as u32 / 2 - 1, out_peers: super::MIN_GOSSIP_PEERS as u32 / 2 - 1,
reserved_nodes: Vec::new(), reserved_nodes: Vec::new(),
non_reserved_mode: sc_network_common::config::NonReservedPeerMode::Accept, non_reserved_mode: sc_network::config::NonReservedPeerMode::Accept,
}, },
}, },
PeerSet::Collation => NonDefaultSetConfig { PeerSet::Collation => NonDefaultSetConfig {
@@ -103,9 +103,9 @@ impl PeerSet {
out_peers: 0, out_peers: 0,
reserved_nodes: Vec::new(), reserved_nodes: Vec::new(),
non_reserved_mode: if is_authority == IsAuthority::Yes { non_reserved_mode: if is_authority == IsAuthority::Yes {
sc_network_common::config::NonReservedPeerMode::Accept sc_network::config::NonReservedPeerMode::Accept
} else { } else {
sc_network_common::config::NonReservedPeerMode::Deny sc_network::config::NonReservedPeerMode::Deny
}, },
}, },
}, },
@@ -190,7 +190,7 @@ impl<T> IndexMut<PeerSet> for PerPeerSet<T> {
pub fn peer_sets_info( pub fn peer_sets_info(
is_authority: IsAuthority, is_authority: IsAuthority,
peerset_protocol_names: &PeerSetProtocolNames, peerset_protocol_names: &PeerSetProtocolNames,
) -> Vec<sc_network_common::config::NonDefaultSetConfig> { ) -> Vec<NonDefaultSetConfig> {
PeerSet::iter() PeerSet::iter()
.map(|s| s.get_info(is_authority, &peerset_protocol_names)) .map(|s| s.get_info(is_authority, &peerset_protocol_names))
.collect() .collect()
+1 -2
View File
@@ -961,8 +961,7 @@ where
let authority_discovery_service = if auth_or_collator || overseer_enable_anyways { let authority_discovery_service = if auth_or_collator || overseer_enable_anyways {
use futures::StreamExt; use futures::StreamExt;
use sc_network::Event; use sc_network::{Event, NetworkEventStream};
use sc_network_common::service::NetworkEventStream;
let authority_discovery_role = if role.is_authority() { let authority_discovery_role = if role.is_authority() {
sc_authority_discovery::Role::PublishAndDiscover(keystore_container.keystore()) sc_authority_discovery::Role::PublishAndDiscover(keystore_container.keystore())
+1 -1
View File
@@ -42,7 +42,7 @@ use polkadot_primitives::runtime_api::ParachainHost;
use sc_authority_discovery::Service as AuthorityDiscoveryService; use sc_authority_discovery::Service as AuthorityDiscoveryService;
use sc_client_api::AuxStore; use sc_client_api::AuxStore;
use sc_keystore::LocalKeystore; use sc_keystore::LocalKeystore;
use sc_network_common::service::NetworkStateInfo; use sc_network::NetworkStateInfo;
use sp_api::ProvideRuntimeApi; use sp_api::ProvideRuntimeApi;
use sp_blockchain::HeaderBackend; use sp_blockchain::HeaderBackend;
use sp_consensus_babe::BabeApi; use sp_consensus_babe::BabeApi;
-1
View File
@@ -45,7 +45,6 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
+4 -2
View File
@@ -37,8 +37,10 @@ use polkadot_test_runtime::{
}; };
use sc_chain_spec::ChainSpec; use sc_chain_spec::ChainSpec;
use sc_client_api::execution_extensions::ExecutionStrategies; use sc_client_api::execution_extensions::ExecutionStrategies;
use sc_network::{config::NetworkConfiguration, multiaddr}; use sc_network::{
use sc_network_common::{config::TransportConfig, service::NetworkStateInfo}; config::{NetworkConfiguration, TransportConfig},
multiaddr, NetworkStateInfo,
};
use sc_service::{ use sc_service::{
config::{ config::{
DatabaseSource, KeystoreConfig, MultiaddrWithPeerId, WasmExecutionMethod, DatabaseSource, KeystoreConfig, MultiaddrWithPeerId, WasmExecutionMethod,