Skip to content

Commit

Permalink
*: Update to libp2p v0.30.0 (paritytech#7508)
Browse files Browse the repository at this point in the history
* *: Update to libp2p v0.30.0

* Cargo.lock: Update

* *: Update to libp2p v0.30.1
  • Loading branch information
mxinden authored and darkfriend77 committed Jan 11, 2021
1 parent c1e7579 commit 69a3b32
Show file tree
Hide file tree
Showing 16 changed files with 148 additions and 129 deletions.
223 changes: 121 additions & 102 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/node/browser-testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "Apache-2.0"

[dependencies]
futures-timer = "3.0.2"
libp2p = { version = "0.29.1", default-features = false }
libp2p = { version = "0.30.1", default-features = false }
jsonrpc-core = "15.0.0"
serde = "1.0.106"
serde_json = "1.0.48"
Expand Down
2 changes: 1 addition & 1 deletion client/authority-discovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ derive_more = "0.99.2"
either = "1.5.3"
futures = "0.3.4"
futures-timer = "3.0.1"
libp2p = { version = "0.29.1", default-features = false, features = ["kad"] }
libp2p = { version = "0.30.1", default-features = false, features = ["kad"] }
log = "0.4.8"
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0"}
prost = "0.6.1"
Expand Down
2 changes: 1 addition & 1 deletion client/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ansi_term = "0.12.1"
tokio = { version = "0.2.21", features = [ "signal", "rt-core", "rt-threaded", "blocking" ] }
futures = "0.3.4"
fdlimit = "0.2.1"
libp2p = "0.29.1"
libp2p = "0.30.1"
parity-scale-codec = "1.3.0"
hex = "0.4.2"
rand = "0.7.3"
Expand Down
2 changes: 1 addition & 1 deletion client/network-gossip/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
futures = "0.3.4"
futures-timer = "3.0.1"
libp2p = { version = "0.29.1", default-features = false }
libp2p = { version = "0.30.1", default-features = false }
log = "0.4.8"
lru = "0.4.3"
sc-network = { version = "0.8.0", path = "../network" }
Expand Down
4 changes: 2 additions & 2 deletions client/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ wasm-timer = "0.2"
zeroize = "1.0.0"

[dependencies.libp2p]
version = "0.29.1"
version = "0.30.1"
default-features = false
features = ["identify", "kad", "mdns-async-std", "mplex", "noise", "ping", "request-response", "tcp-async-std", "websocket", "yamux"]

[dev-dependencies]
assert_matches = "1.3"
libp2p = { version = "0.29.1", default-features = false }
libp2p = { version = "0.30.1", default-features = false }
quickcheck = "0.9.0"
rand = "0.7.2"
sp-keyring = { version = "2.0.0", path = "../../primitives/keyring" }
Expand Down
16 changes: 8 additions & 8 deletions client/network/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ use futures::prelude::*;
use futures_timer::Delay;
use ip_network::IpNetwork;
use libp2p::core::{connection::{ConnectionId, ListenerId}, ConnectedPoint, Multiaddr, PeerId, PublicKey};
use libp2p::swarm::{NetworkBehaviour, NetworkBehaviourAction, PollParameters, ProtocolsHandler};
use libp2p::swarm::protocols_handler::multi::MultiHandler;
use libp2p::swarm::{NetworkBehaviour, NetworkBehaviourAction, PollParameters, ProtocolsHandler, IntoProtocolsHandler};
use libp2p::swarm::protocols_handler::multi::IntoMultiHandler;
use libp2p::kad::{Kademlia, KademliaBucketInserts, KademliaConfig, KademliaEvent, QueryResult, Quorum, Record};
use libp2p::kad::GetClosestPeersError;
use libp2p::kad::handler::KademliaHandler;
use libp2p::kad::handler::KademliaHandlerProto;
use libp2p::kad::QueryId;
use libp2p::kad::record::{self, store::{MemoryStore, RecordStore}};
#[cfg(not(target_os = "unknown"))]
Expand Down Expand Up @@ -444,14 +444,14 @@ pub enum DiscoveryOut {
}

impl NetworkBehaviour for DiscoveryBehaviour {
type ProtocolsHandler = MultiHandler<ProtocolId, KademliaHandler<QueryId>>;
type ProtocolsHandler = IntoMultiHandler<ProtocolId, KademliaHandlerProto<QueryId>>;
type OutEvent = DiscoveryOut;

fn new_handler(&mut self) -> Self::ProtocolsHandler {
let iter = self.kademlias.iter_mut()
.map(|(p, k)| (p.clone(), NetworkBehaviour::new_handler(k)));

MultiHandler::try_from_iter(iter)
IntoMultiHandler::try_from_iter(iter)
.expect("There can be at most one handler per `ProtocolId` and \
protocol names contain the `ProtocolId` so no two protocol \
names in `self.kademlias` can be equal which is the only error \
Expand Down Expand Up @@ -534,7 +534,7 @@ impl NetworkBehaviour for DiscoveryBehaviour {
&mut self,
peer_id: PeerId,
connection: ConnectionId,
(pid, event): <Self::ProtocolsHandler as ProtocolsHandler>::OutEvent,
(pid, event): <<Self::ProtocolsHandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::OutEvent,
) {
if let Some(kad) = self.kademlias.get_mut(&pid) {
return kad.inject_event(peer_id, connection, event)
Expand Down Expand Up @@ -598,7 +598,7 @@ impl NetworkBehaviour for DiscoveryBehaviour {
params: &mut impl PollParameters,
) -> Poll<
NetworkBehaviourAction<
<Self::ProtocolsHandler as ProtocolsHandler>::InEvent,
<<Self::ProtocolsHandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::InEvent,
Self::OutEvent,
>,
> {
Expand Down Expand Up @@ -816,7 +816,7 @@ mod tests {
let transport = MemoryTransport
.upgrade(upgrade::Version::V1)
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
.multiplex(yamux::Config::default())
.multiplex(yamux::YamuxConfig::default())
.boxed();

let behaviour = {
Expand Down
2 changes: 1 addition & 1 deletion client/network/src/light_client_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ mod tests {
let transport = MemoryTransport::default()
.upgrade(upgrade::Version::V1)
.authenticate(NoiseConfig::xx(dh_key).into_authenticated())
.multiplex(yamux::Config::default())
.multiplex(yamux::YamuxConfig::default())
.boxed();
Swarm::new(transport, LightClientHandler::new(cf, client, checker, ps), local_peer)
}
Expand Down
2 changes: 1 addition & 1 deletion client/network/src/protocol/generic_proto/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn build_nodes() -> (Swarm<CustomProtoWithAddr>, Swarm<CustomProtoWithAddr>) {
let transport = MemoryTransport
.upgrade(upgrade::Version::V1)
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
.multiplex(yamux::Config::default())
.multiplex(yamux::YamuxConfig::default())
.timeout(Duration::from_secs(20))
.boxed();

Expand Down
4 changes: 2 additions & 2 deletions client/network/src/request_responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ mod tests {
let transport = MemoryTransport
.upgrade(upgrade::Version::V1)
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
.multiplex(libp2p::yamux::Config::default())
.multiplex(libp2p::yamux::YamuxConfig::default())
.boxed();

let behaviour = {
Expand Down Expand Up @@ -783,7 +783,7 @@ mod tests {
let transport = MemoryTransport
.upgrade(upgrade::Version::V1)
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
.multiplex(libp2p::yamux::Config::default())
.multiplex(libp2p::yamux::YamuxConfig::default())
.boxed();

let behaviour = {
Expand Down
8 changes: 4 additions & 4 deletions client/network/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ pub fn build_transport(

let multiplexing_config = {
let mut mplex_config = mplex::MplexConfig::new();
mplex_config.max_buffer_len_behaviour(mplex::MaxBufferBehaviour::Block);
mplex_config.max_buffer_len(usize::MAX);
mplex_config.set_max_buffer_behaviour(mplex::MaxBufferBehaviour::Block);
mplex_config.set_max_buffer_size(usize::MAX);

let mut yamux_config = libp2p::yamux::Config::default();
let mut yamux_config = libp2p::yamux::YamuxConfig::default();
// Enable proper flow-control: window updates are only sent when
// buffered data has been consumed.
yamux_config.set_window_update_mode(libp2p::yamux::WindowUpdateMode::OnRead);
yamux_config.set_window_update_mode(libp2p::yamux::WindowUpdateMode::on_read());

core::upgrade::SelectUpgrade::new(yamux_config, mplex_config)
};
Expand Down
2 changes: 1 addition & 1 deletion client/network/test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ parking_lot = "0.10.0"
futures = "0.3.4"
futures-timer = "3.0.1"
rand = "0.7.2"
libp2p = { version = "0.29.1", default-features = false }
libp2p = { version = "0.30.1", default-features = false }
sp-consensus = { version = "0.8.0", path = "../../../primitives/consensus/common" }
sc-consensus = { version = "0.8.0", path = "../../../client/consensus/common" }
sc-client-api = { version = "2.0.0", path = "../../api" }
Expand Down
2 changes: 1 addition & 1 deletion client/peerset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
futures = "0.3.4"
libp2p = { version = "0.29.1", default-features = false }
libp2p = { version = "0.30.1", default-features = false }
sp-utils = { version = "2.0.0", path = "../../primitives/utils"}
log = "0.4.8"
serde_json = "1.0.41"
Expand Down
2 changes: 1 addition & 1 deletion client/telemetry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ parking_lot = "0.10.0"
futures = "0.3.4"
futures-timer = "3.0.1"
wasm-timer = "0.2.0"
libp2p = { version = "0.29.1", default-features = false, features = ["dns", "tcp-async-std", "wasm-ext", "websocket"] }
libp2p = { version = "0.30.1", default-features = false, features = ["dns", "tcp-async-std", "wasm-ext", "websocket"] }
log = "0.4.8"
pin-project = "0.4.6"
rand = "0.7.2"
Expand Down
2 changes: 1 addition & 1 deletion primitives/consensus/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
thiserror = "1.0.21"
libp2p = { version = "0.29.1", default-features = false }
libp2p = { version = "0.30.1", default-features = false }
log = "0.4.8"
sp-core = { path= "../../core", version = "2.0.0"}
sp-inherents = { version = "2.0.0", path = "../../inherents" }
Expand Down
2 changes: 1 addition & 1 deletion utils/browser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
futures = { version = "0.3", features = ["compat"] }
futures01 = { package = "futures", version = "0.1.29" }
log = "0.4.8"
libp2p-wasm-ext = { version = "0.23", features = ["websocket"] }
libp2p-wasm-ext = { version = "0.24", features = ["websocket"] }
console_error_panic_hook = "0.1.6"
console_log = "0.1.2"
js-sys = "0.3.34"
Expand Down

0 comments on commit 69a3b32

Please sign in to comment.