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:
Roman
2022-07-12 21:00:00 +04:00
committed by GitHub
parent 47b27c292f
commit 1902dc169d
19 changed files with 151 additions and 274 deletions
+3 -3
View File
@@ -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())
+2 -3
View File
@@ -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},
+1 -4
View File
@@ -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())
+5 -4
View File
@@ -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 {