Companion for paritytech/substrate#12264 (#5973)

* Companion for paritytech/substrate#12198

* Use `ProtocolName` from sc-network-common

* Update node service

* Revert Cargo.lock changes

* Fix node service test

* cargo-fmt

* disable cancel-pipeline-test-linux-stable to check companion

* update lockfile for {"substrate"}

Co-authored-by: alvicsam <alvicsam@gmail.com>
Co-authored-by: parity-processbot <>
This commit is contained in:
Aaro Altonen
2022-09-26 16:15:41 +03:00
committed by GitHub
parent 5dd7026383
commit 2a9800f20a
6 changed files with 211 additions and 186 deletions
@@ -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},
@@ -80,7 +80,7 @@ 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
@@ -88,7 +88,7 @@ impl PeerSet {
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 {
@@ -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
},
},
},
@@ -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()