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 1 commit
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
25 changes: 24 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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
16 changes: 7 additions & 9 deletions node/network/protocol/src/peer_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@

use derive_more::Display;
use polkadot_primitives::v2::Hash;
use sc_network::{
config::{NonDefaultSetConfig, SetConfig},
ProtocolName,
};
use sc_network::ProtocolName;
altonen marked this conversation as resolved.
Show resolved Hide resolved
use sc_network_common::config::{NonDefaultSetConfig, SetConfig};
use std::{
collections::{hash_map::Entry, HashMap},
ops::{Index, IndexMut},
Expand Down Expand Up @@ -80,15 +78,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 +99,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 +186,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