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

Companion for paritytech/substrate#13592 #6869

Merged
merged 6 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
381 changes: 193 additions & 188 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion node/network/bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ gum = { package = "tracing-gum", path = "../../gum" }
polkadot-primitives = { path = "../../../primitives" }
parity-scale-codec = { version = "3.3.0", default-features = false, features = ["derive"] }
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" }
polkadot-node-metrics = { path = "../../metrics"}
polkadot-node-network-protocol = { path = "../protocol" }
Expand Down
15 changes: 6 additions & 9 deletions node/network/bridge/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@ use futures::{prelude::*, stream::BoxStream};
use parity_scale_codec::Encode;

use sc_network::{
multiaddr::Multiaddr, Event as NetworkEvent, IfDisconnected, NetworkService, OutboundFailure,
RequestFailure,
};
use sc_network_common::{
config::parse_addr,
protocol::ProtocolName,
service::{NetworkEventStream, NetworkNotification, NetworkPeers, NetworkRequest},
config::parse_addr, multiaddr::Multiaddr, types::ProtocolName, Event as NetworkEvent,
IfDisconnected, NetworkEventStream, NetworkNotification, NetworkPeers, NetworkRequest,
NetworkService, OutboundFailure, RequestFailure,
};

use polkadot_node_network_protocol::{
Expand Down Expand Up @@ -193,8 +189,9 @@ impl Network for Arc<NetworkService<Block, Hash>> {
match pending_response
.send(Err(RequestFailure::Network(OutboundFailure::DialFailure)))
{
Err(_) =>
gum::debug!(target: LOG_TARGET, "Sending failed request response failed."),
Err(_) => {
gum::debug!(target: LOG_TARGET, "Sending failed request response failed.")
},
Ok(_) => {},
}
return
Expand Down
1 change: 0 additions & 1 deletion node/network/protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ polkadot-node-primitives = { path = "../../primitives" }
polkadot-node-jaeger = { path = "../../jaeger" }
parity-scale-codec = { version = "3.3.0", default-features = false, features = ["derive"] }
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" }
strum = { version = "0.24", features = ["derive"] }
futures = "0.3.21"
Expand Down
14 changes: 7 additions & 7 deletions node/network/protocol/src/peer_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

use derive_more::Display;
use polkadot_primitives::Hash;
use sc_network_common::{
use sc_network::{
config::{NonDefaultSetConfig, SetConfig},
protocol::ProtocolName,
types::ProtocolName,
};
use std::{
collections::{hash_map::Entry, HashMap},
Expand Down Expand Up @@ -81,15 +81,15 @@ impl PeerSet {
fallback_names,
max_notification_size,
handshake: None,
set_config: sc_network_common::config::SetConfig {
set_config: SetConfig {
// we allow full nodes to connect to validators for gossip
// to ensure any `MIN_GOSSIP_PEERS` always include reserved peers
// we limit the amount of non-reserved slots to be less
// than `MIN_GOSSIP_PEERS` in total
in_peers: super::MIN_GOSSIP_PEERS as u32 / 2 - 1,
out_peers: super::MIN_GOSSIP_PEERS as u32 / 2 - 1,
reserved_nodes: Vec::new(),
non_reserved_mode: sc_network_common::config::NonReservedPeerMode::Accept,
non_reserved_mode: sc_network::config::NonReservedPeerMode::Accept,
},
},
PeerSet::Collation => NonDefaultSetConfig {
Expand All @@ -103,9 +103,9 @@ impl PeerSet {
out_peers: 0,
reserved_nodes: Vec::new(),
non_reserved_mode: if is_authority == IsAuthority::Yes {
sc_network_common::config::NonReservedPeerMode::Accept
sc_network::config::NonReservedPeerMode::Accept
} else {
sc_network_common::config::NonReservedPeerMode::Deny
sc_network::config::NonReservedPeerMode::Deny
},
},
},
Expand Down Expand Up @@ -190,7 +190,7 @@ impl<T> IndexMut<PeerSet> for PerPeerSet<T> {
pub fn peer_sets_info(
is_authority: IsAuthority,
peerset_protocol_names: &PeerSetProtocolNames,
) -> Vec<sc_network_common::config::NonDefaultSetConfig> {
) -> Vec<NonDefaultSetConfig> {
PeerSet::iter()
.map(|s| s.get_info(is_authority, &peerset_protocol_names))
.collect()
Expand Down
3 changes: 1 addition & 2 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -961,8 +961,7 @@ where

let authority_discovery_service = if auth_or_collator || overseer_enable_anyways {
use futures::StreamExt;
use sc_network::Event;
use sc_network_common::service::NetworkEventStream;
use sc_network::{Event, NetworkEventStream};

let authority_discovery_role = if role.is_authority() {
sc_authority_discovery::Role::PublishAndDiscover(keystore_container.keystore())
Expand Down
2 changes: 1 addition & 1 deletion node/service/src/overseer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use polkadot_primitives::runtime_api::ParachainHost;
use sc_authority_discovery::Service as AuthorityDiscoveryService;
use sc_client_api::AuxStore;
use sc_keystore::LocalKeystore;
use sc_network_common::service::NetworkStateInfo;
use sc_network::NetworkStateInfo;
use sp_api::ProvideRuntimeApi;
use sp_blockchain::HeaderBackend;
use sp_consensus_babe::BabeApi;
Expand Down
1 change: 0 additions & 1 deletion node/test/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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-executor = { 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-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand Down
6 changes: 4 additions & 2 deletions node/test/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ use polkadot_test_runtime::{
};
use sc_chain_spec::ChainSpec;
use sc_client_api::execution_extensions::ExecutionStrategies;
use sc_network::{config::NetworkConfiguration, multiaddr};
use sc_network_common::{config::TransportConfig, service::NetworkStateInfo};
use sc_network::{
config::{NetworkConfiguration, TransportConfig},
multiaddr, NetworkStateInfo,
};
use sc_service::{
config::{
DatabaseSource, KeystoreConfig, MultiaddrWithPeerId, WasmExecutionMethod,
Expand Down