mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-22 19:41:07 +00:00
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:
@@ -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" }
|
||||
|
||||
@@ -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::{
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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},
|
||||
@@ -81,7 +81,7 @@ 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
|
||||
@@ -89,7 +89,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_common::config::NonReservedPeerMode::Accept,
|
||||
non_reserved_mode: sc_network::config::NonReservedPeerMode::Accept,
|
||||
},
|
||||
},
|
||||
PeerSet::Collation => NonDefaultSetConfig {
|
||||
@@ -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
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user