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

Companion for paritytech/substrate#12264 #5973

Merged
merged 14 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from 9 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
1 change: 1 addition & 0 deletions node/network/protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ polkadot-node-primitives = { path = "../../primitives" }
polkadot-node-jaeger = { path = "../../jaeger" }
parity-scale-codec = { version = "3.1.5", 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::v2::Hash;
use sc_network::{
use sc_network_common::{
config::{NonDefaultSetConfig, SetConfig},
ProtocolName,
protocol::ProtocolName,
};
use std::{
collections::{hash_map::Entry, HashMap},
Expand Down Expand Up @@ -80,15 +80,15 @@ impl PeerSet {
notifications_protocol: protocol,
fallback_names,
max_notification_size,
set_config: sc_network::config::SetConfig {
set_config: sc_network_common::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::config::NonReservedPeerMode::Accept,
non_reserved_mode: sc_network_common::config::NonReservedPeerMode::Accept,
},
},
PeerSet::Collation => NonDefaultSetConfig {
Expand All @@ -101,9 +101,9 @@ impl PeerSet {
out_peers: 0,
reserved_nodes: Vec::new(),
non_reserved_mode: if is_authority == IsAuthority::Yes {
sc_network::config::NonReservedPeerMode::Accept
sc_network_common::config::NonReservedPeerMode::Accept
} else {
sc_network::config::NonReservedPeerMode::Deny
sc_network_common::config::NonReservedPeerMode::Deny
},
},
},
Expand Down Expand Up @@ -188,7 +188,7 @@ impl<T> IndexMut<PeerSet> for PerPeerSet<T> {
pub fn peer_sets_info(
is_authority: IsAuthority,
peerset_protocol_names: &PeerSetProtocolNames,
) -> Vec<sc_network::config::NonDefaultSetConfig> {
) -> Vec<sc_network_common::config::NonDefaultSetConfig> {
PeerSet::iter()
.map(|s| s.get_info(is_authority, &peerset_protocol_names))
.collect()
Expand Down
3 changes: 2 additions & 1 deletion node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ where
grandpa_hard_forks,
));

let (network, system_rpc_tx, network_starter) =
let (network, system_rpc_tx, tx_handler_controller, network_starter) =
service::build_network(service::BuildNetworkParams {
config: &config,
client: client.clone(),
Expand Down Expand Up @@ -968,6 +968,7 @@ where
transaction_pool: transaction_pool.clone(),
task_manager: &mut task_manager,
system_rpc_tx,
tx_handler_controller,
telemetry: telemetry.as_mut(),
})?;

Expand Down
7 changes: 5 additions & 2 deletions node/test/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ use polkadot_test_runtime::{
use sc_chain_spec::ChainSpec;
use sc_client_api::execution_extensions::ExecutionStrategies;
use sc_network::{
config::{NetworkConfiguration, TransportConfig},
config::NetworkConfiguration,
multiaddr,
};
use sc_network_common::service::NetworkStateInfo;
use sc_network_common::{
service::NetworkStateInfo,
config::TransportConfig,
};
use sc_service::{
config::{
DatabaseSource, KeystoreConfig, MultiaddrWithPeerId, WasmExecutionMethod,
Expand Down