mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 07:01:05 +00:00
Upgrade libp2p to 0.46.1 (#11787)
* Update libp2p to 0.46.0 * Update libp2p to 0.46.1 * Fix telemetry initialization * Fix tests
This commit is contained in:
@@ -22,7 +22,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
|
||||
futures = "0.3.21"
|
||||
futures-timer = "3.0.1"
|
||||
ip_network = "0.4.1"
|
||||
libp2p = { version = "0.45.1", default-features = false, features = ["kad"] }
|
||||
libp2p = { version = "0.46.1", default-features = false, features = ["kad"] }
|
||||
log = "0.4.17"
|
||||
prost = "0.10"
|
||||
rand = "0.7.2"
|
||||
|
||||
@@ -18,7 +18,7 @@ clap = { version = "3.1.18", features = ["derive"] }
|
||||
fdlimit = "0.2.1"
|
||||
futures = "0.3.21"
|
||||
hex = "0.4.2"
|
||||
libp2p = "0.45.1"
|
||||
libp2p = "0.46.1"
|
||||
log = "0.4.17"
|
||||
names = { version = "0.13.0", default-features = false }
|
||||
parity-scale-codec = "3.0.0"
|
||||
|
||||
@@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
async-trait = "0.1.42"
|
||||
futures = { version = "0.3.21", features = ["thread-pool"] }
|
||||
futures-timer = "3.0.1"
|
||||
libp2p = { version = "0.45.1", default-features = false }
|
||||
libp2p = { version = "0.46.1", default-features = false }
|
||||
log = "0.4.17"
|
||||
parking_lot = "0.12.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
||||
@@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
ahash = "0.7.6"
|
||||
futures = "0.3.21"
|
||||
futures-timer = "3.0.1"
|
||||
libp2p = { version = "0.45.1", default-features = false }
|
||||
libp2p = { version = "0.46.1", default-features = false }
|
||||
log = "0.4.17"
|
||||
lru = "0.7.5"
|
||||
tracing = "0.1.29"
|
||||
|
||||
@@ -29,7 +29,7 @@ futures = "0.3.21"
|
||||
futures-timer = "3.0.2"
|
||||
hex = "0.4.0"
|
||||
ip_network = "0.4.1"
|
||||
libp2p = "0.45.1"
|
||||
libp2p = "0.46.1"
|
||||
linked_hash_set = "0.1.3"
|
||||
linked-hash-map = "0.5.4"
|
||||
log = "0.4.17"
|
||||
|
||||
@@ -21,6 +21,6 @@ codec = { package = "parity-scale-codec", version = "3.0.0", features = [
|
||||
"derive",
|
||||
] }
|
||||
futures = "0.3.21"
|
||||
libp2p = "0.45.1"
|
||||
libp2p = "0.46.1"
|
||||
smallvec = "1.8.0"
|
||||
sc-peerset = { version = "4.0.0-dev", path = "../../peerset" }
|
||||
|
||||
@@ -21,7 +21,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", features = [
|
||||
"derive",
|
||||
] }
|
||||
futures = "0.3.21"
|
||||
libp2p = "0.45.1"
|
||||
libp2p = "0.46.1"
|
||||
log = "0.4.16"
|
||||
prost = "0.10"
|
||||
sp-blockchain = { version = "4.0.0-dev", path = "../../../primitives/blockchain" }
|
||||
|
||||
@@ -52,8 +52,8 @@ use futures_timer::Delay;
|
||||
use ip_network::IpNetwork;
|
||||
use libp2p::{
|
||||
core::{
|
||||
connection::{ConnectionId, ListenerId},
|
||||
ConnectedPoint, Multiaddr, PeerId, PublicKey,
|
||||
connection::ConnectionId, transport::ListenerId, ConnectedPoint, Multiaddr, PeerId,
|
||||
PublicKey,
|
||||
},
|
||||
kad::{
|
||||
handler::KademliaHandlerProto,
|
||||
@@ -1030,7 +1030,7 @@ mod tests {
|
||||
let noise_keys =
|
||||
noise::Keypair::<noise::X25519Spec>::new().into_authentic(&keypair).unwrap();
|
||||
|
||||
let transport = MemoryTransport
|
||||
let transport = MemoryTransport::new()
|
||||
.upgrade(upgrade::Version::V1)
|
||||
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
|
||||
.multiplex(yamux::YamuxConfig::default())
|
||||
|
||||
@@ -21,9 +21,8 @@ use fnv::FnvHashMap;
|
||||
use futures::prelude::*;
|
||||
use libp2p::{
|
||||
core::{
|
||||
connection::{ConnectionId, ListenerId},
|
||||
either::EitherOutput,
|
||||
ConnectedPoint, PeerId, PublicKey,
|
||||
connection::ConnectionId, either::EitherOutput, transport::ListenerId, ConnectedPoint,
|
||||
PeerId, PublicKey,
|
||||
},
|
||||
identify::{Identify, IdentifyConfig, IdentifyEvent, IdentifyInfo},
|
||||
ping::{Ping, PingConfig, PingEvent, PingSuccess},
|
||||
|
||||
@@ -27,10 +27,7 @@ use bytes::Bytes;
|
||||
use codec::{Decode, DecodeAll, Encode};
|
||||
use futures::{channel::oneshot, prelude::*};
|
||||
use libp2p::{
|
||||
core::{
|
||||
connection::{ConnectionId, ListenerId},
|
||||
ConnectedPoint,
|
||||
},
|
||||
core::{connection::ConnectionId, transport::ListenerId, ConnectedPoint},
|
||||
request_response::OutboundFailure,
|
||||
swarm::{
|
||||
ConnectionHandler, IntoConnectionHandler, NetworkBehaviour, NetworkBehaviourAction,
|
||||
|
||||
@@ -23,8 +23,8 @@ use crate::protocol::notifications::{Notifications, NotificationsOut, ProtocolCo
|
||||
use futures::prelude::*;
|
||||
use libp2p::{
|
||||
core::{
|
||||
connection::{ConnectionId, ListenerId},
|
||||
transport::MemoryTransport,
|
||||
connection::ConnectionId,
|
||||
transport::{ListenerId, MemoryTransport},
|
||||
upgrade, ConnectedPoint,
|
||||
},
|
||||
identity, noise,
|
||||
@@ -56,7 +56,7 @@ fn build_nodes() -> (Swarm<CustomProtoWithAddr>, Swarm<CustomProtoWithAddr>) {
|
||||
let noise_keys =
|
||||
noise::Keypair::<noise::X25519Spec>::new().into_authentic(&keypair).unwrap();
|
||||
|
||||
let transport = MemoryTransport
|
||||
let transport = MemoryTransport::new()
|
||||
.upgrade(upgrade::Version::V1)
|
||||
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
|
||||
.multiplex(yamux::YamuxConfig::default())
|
||||
|
||||
@@ -40,10 +40,7 @@ use futures::{
|
||||
prelude::*,
|
||||
};
|
||||
use libp2p::{
|
||||
core::{
|
||||
connection::{ConnectionId, ListenerId},
|
||||
ConnectedPoint, Multiaddr, PeerId,
|
||||
},
|
||||
core::{connection::ConnectionId, transport::ListenerId, ConnectedPoint, Multiaddr, PeerId},
|
||||
request_response::{
|
||||
handler::RequestResponseHandler, ProtocolSupport, RequestResponse, RequestResponseCodec,
|
||||
RequestResponseConfig, RequestResponseEvent, RequestResponseMessage, ResponseChannel,
|
||||
@@ -968,7 +965,7 @@ mod tests {
|
||||
let noise_keys =
|
||||
noise::Keypair::<noise::X25519Spec>::new().into_authentic(&keypair).unwrap();
|
||||
|
||||
let transport = MemoryTransport
|
||||
let transport = MemoryTransport::new()
|
||||
.upgrade(upgrade::Version::V1)
|
||||
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
|
||||
.multiplex(libp2p::yamux::YamuxConfig::default())
|
||||
|
||||
@@ -54,16 +54,17 @@ pub fn build_transport(
|
||||
) -> (Boxed<(PeerId, StreamMuxerBox)>, Arc<BandwidthSinks>) {
|
||||
// Build the base layer of the transport.
|
||||
let transport = if !memory_only {
|
||||
let desktop_trans = tcp::TcpConfig::new().nodelay(true);
|
||||
let tcp_config = tcp::GenTcpConfig::new().nodelay(true);
|
||||
let desktop_trans = tcp::TcpTransport::new(tcp_config.clone());
|
||||
let desktop_trans = websocket::WsConfig::new(desktop_trans)
|
||||
.or_transport(tcp::TcpConfig::new().nodelay(true));
|
||||
.or_transport(tcp::TcpTransport::new(tcp_config.clone()));
|
||||
let dns_init = futures::executor::block_on(dns::DnsConfig::system(desktop_trans));
|
||||
EitherTransport::Left(if let Ok(dns) = dns_init {
|
||||
EitherTransport::Left(dns)
|
||||
} else {
|
||||
let desktop_trans = tcp::TcpConfig::new().nodelay(true);
|
||||
let desktop_trans = tcp::TcpTransport::new(tcp_config.clone());
|
||||
let desktop_trans = websocket::WsConfig::new(desktop_trans)
|
||||
.or_transport(tcp::TcpConfig::new().nodelay(true));
|
||||
.or_transport(tcp::TcpTransport::new(tcp_config));
|
||||
EitherTransport::Right(desktop_trans.map_err(dns::DnsErr::Transport))
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", features = [
|
||||
] }
|
||||
either = "1.5.3"
|
||||
futures = "0.3.21"
|
||||
libp2p = "0.45.1"
|
||||
libp2p = "0.46.1"
|
||||
log = "0.4.17"
|
||||
lru = "0.7.5"
|
||||
prost = "0.10"
|
||||
|
||||
@@ -17,7 +17,7 @@ async-std = "1.11.0"
|
||||
async-trait = "0.1.50"
|
||||
futures = "0.3.21"
|
||||
futures-timer = "3.0.1"
|
||||
libp2p = { version = "0.45.1", default-features = false }
|
||||
libp2p = { version = "0.46.1", default-features = false }
|
||||
log = "0.4.17"
|
||||
parking_lot = "0.12.0"
|
||||
rand = "0.7.2"
|
||||
|
||||
@@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
futures = "0.3.21"
|
||||
libp2p = { version = "0.45.1", default-features = false }
|
||||
libp2p = { version = "0.46.1", default-features = false }
|
||||
log = "0.4.17"
|
||||
serde_json = "1.0.79"
|
||||
wasm-timer = "0.2"
|
||||
|
||||
@@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
[dependencies]
|
||||
chrono = "0.4.19"
|
||||
futures = "0.3.21"
|
||||
libp2p = { version = "0.45.1", default-features = false, features = ["dns-async-std", "tcp-async-io", "wasm-ext", "websocket"] }
|
||||
libp2p = { version = "0.46.1", default-features = false, features = ["dns-async-std", "tcp-async-io", "wasm-ext", "websocket"] }
|
||||
log = "0.4.17"
|
||||
parking_lot = "0.12.0"
|
||||
pin-project = "1.0.10"
|
||||
|
||||
@@ -31,7 +31,8 @@ const CONNECT_TIMEOUT: Duration = Duration::from_secs(20);
|
||||
|
||||
pub(crate) fn initialize_transport() -> Result<WsTrans, io::Error> {
|
||||
let transport = {
|
||||
let inner = block_on(libp2p::dns::DnsConfig::system(libp2p::tcp::TcpConfig::new()))?;
|
||||
let tcp_transport = libp2p::tcp::TcpTransport::new(libp2p::tcp::GenTcpConfig::new());
|
||||
let inner = block_on(libp2p::dns::DnsConfig::system(tcp_transport))?;
|
||||
libp2p::websocket::framed::WsConfig::new(inner).and_then(|connec, _| {
|
||||
let connec = connec
|
||||
.with(|item| {
|
||||
|
||||
Reference in New Issue
Block a user