Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Merge commit cab9865 (conflicts)
Browse files Browse the repository at this point in the history
  • Loading branch information
cecton committed Oct 30, 2020
2 parents fe28d76 + cab9865 commit ab089f9
Show file tree
Hide file tree
Showing 18 changed files with 297 additions and 244 deletions.
463 changes: 259 additions & 204 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.28.1", default-features = false }
libp2p = { version = "0.29.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.28.1", default-features = false, features = ["kad"] }
libp2p = { version = "0.29.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 @@ -20,7 +20,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.28.1"
libp2p = "0.29.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.28.1", default-features = false }
libp2p = { version = "0.29.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 @@ -62,13 +62,13 @@ wasm-timer = "0.2"
zeroize = "1.0.0"

[dependencies.libp2p]
version = "0.28.1"
version = "0.29.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.28.1", default-features = false }
libp2p = { version = "0.29.1", default-features = false }
quickcheck = "0.9.0"
rand = "0.7.2"
sp-keyring = { version = "2.0.0", path = "../../primitives/keyring" }
Expand Down
3 changes: 2 additions & 1 deletion client/network/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,8 @@ mod tests {
let transport = MemoryTransport
.upgrade(upgrade::Version::V1)
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
.multiplex(yamux::Config::default());
.multiplex(yamux::Config::default())
.boxed();

let behaviour = {
let mut config = DiscoveryConfig::new(keypair.public());
Expand Down
4 changes: 1 addition & 3 deletions client/network/src/light_client_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ mod tests {
connection::ConnectionId,
identity,
muxing::{StreamMuxerBox, SubstreamRef},
transport::{Transport, boxed::Boxed, memory::MemoryTransport},
transport::{Transport, Boxed, memory::MemoryTransport},
upgrade
},
noise::{self, Keypair, X25519, NoiseConfig},
Expand Down Expand Up @@ -1356,8 +1356,6 @@ mod tests {
.upgrade(upgrade::Version::V1)
.authenticate(NoiseConfig::xx(dh_key).into_authenticated())
.multiplex(yamux::Config::default())
.map(|(peer, muxer), _| (peer, StreamMuxerBox::new(muxer)))
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
.boxed();
Swarm::new(transport, LightClientHandler::new(cf, client, checker, ps), local_peer)
}
Expand Down
3 changes: 0 additions & 3 deletions client/network/src/protocol/generic_proto/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use libp2p::{PeerId, Multiaddr, Transport};
use libp2p::core::{
connection::{ConnectionId, ListenerId},
ConnectedPoint,
muxing,
transport::MemoryTransport,
upgrade
};
Expand Down Expand Up @@ -56,9 +55,7 @@ fn build_nodes() -> (Swarm<CustomProtoWithAddr>, Swarm<CustomProtoWithAddr>) {
.upgrade(upgrade::Version::V1)
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
.multiplex(yamux::Config::default())
.map(|(peer, muxer), _| (peer, muxing::StreamMuxerBox::new(muxer)))
.timeout(Duration::from_secs(20))
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))
.boxed();

let (peerset, _) = sc_peerset::Peerset::from_config(sc_peerset::PeersetConfig {
Expand Down
6 changes: 4 additions & 2 deletions client/network/src/request_responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,8 @@ 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::Config::default())
.boxed();

let behaviour = {
let (tx, mut rx) = mpsc::channel(64);
Expand Down Expand Up @@ -782,7 +783,8 @@ 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::Config::default())
.boxed();

let behaviour = {
let (tx, mut rx) = mpsc::channel(64);
Expand Down
15 changes: 6 additions & 9 deletions client/network/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
use libp2p::{
InboundUpgradeExt, OutboundUpgradeExt, PeerId, Transport,
core::{
self, either::EitherOutput, muxing::StreamMuxerBox,
transport::{boxed::Boxed, OptionalTransport}, upgrade
self, either::{EitherOutput, EitherTransport}, muxing::StreamMuxerBox,
transport::{Boxed, OptionalTransport}, upgrade
},
mplex, identity, bandwidth, wasm_ext, noise
};
#[cfg(not(target_os = "unknown"))]
use libp2p::{tcp, dns, websocket};
use std::{io, sync::Arc, time::Duration};
use std::{sync::Arc, time::Duration};

pub use self::bandwidth::BandwidthSinks;

Expand All @@ -41,7 +41,7 @@ pub fn build_transport(
keypair: identity::Keypair,
memory_only: bool,
wasm_external_transport: Option<wasm_ext::ExtTransport>,
) -> (Boxed<(PeerId, StreamMuxerBox), io::Error>, Arc<BandwidthSinks>) {
) -> (Boxed<(PeerId, StreamMuxerBox)>, Arc<BandwidthSinks>) {
// Build the base layer of the transport.
let transport = if let Some(t) = wasm_external_transport {
OptionalTransport::some(t)
Expand All @@ -54,9 +54,9 @@ pub fn build_transport(
let desktop_trans = websocket::WsConfig::new(desktop_trans.clone())
.or_transport(desktop_trans);
OptionalTransport::some(if let Ok(dns) = dns::DnsConfig::new(desktop_trans.clone()) {
dns.boxed()
EitherTransport::Left(dns)
} else {
desktop_trans.map_err(dns::DnsErr::Underlying).boxed()
EitherTransport::Right(desktop_trans.map_err(dns::DnsErr::Underlying))
})
} else {
OptionalTransport::none()
Expand Down Expand Up @@ -113,15 +113,12 @@ pub fn build_transport(
yamux_config.set_window_update_mode(libp2p::yamux::WindowUpdateMode::OnRead);

core::upgrade::SelectUpgrade::new(yamux_config, mplex_config)
.map_inbound(move |muxer| core::muxing::StreamMuxerBox::new(muxer))
.map_outbound(move |muxer| core::muxing::StreamMuxerBox::new(muxer))
};

let transport = transport.upgrade(upgrade::Version::V1)
.authenticate(authentication_config)
.multiplex(multiplexing_config)
.timeout(Duration::from_secs(20))
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))
.boxed();

(transport, bandwidth)
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.28.1", default-features = false }
libp2p = { version = "0.29.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.28.1", default-features = false }
libp2p = { version = "0.29.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.11.0"
futures = "0.3.4"
futures-timer = "3.0.1"
wasm-timer = "0.2.0"
libp2p = { version = "0.28.1", default-features = false, features = ["dns", "tcp-async-std", "wasm-ext", "websocket"] }
libp2p = { version = "0.29.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
23 changes: 13 additions & 10 deletions client/telemetry/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
//!
use futures::{prelude::*, ready};
use libp2p::{core::transport::OptionalTransport, Multiaddr, Transport, wasm_ext};
use libp2p::{
core::transport::{OptionalTransport, timeout::TransportTimeout},
Multiaddr,
Transport,
wasm_ext
};
use log::{trace, error};
use parking_lot::Mutex;
use std::{io, pin::Pin, sync::Arc, task::Context, task::Poll, time};
Expand Down Expand Up @@ -61,13 +66,12 @@ pub struct TelemetryWorker {
pub trait StreamAndSink<I>: Stream + Sink<I> {}
impl<T: ?Sized + Stream + Sink<I>, I> StreamAndSink<I> for T {}

pub type WsTrans = libp2p::core::transport::boxed::Boxed<
pub type WsTrans = libp2p::core::transport::Boxed<
Pin<Box<dyn StreamAndSink<
Vec<u8>,
Item = Result<Vec<u8>, io::Error>,
Error = io::Error
> + Send>>,
io::Error
> + Send>>
>;

impl TelemetryWorker {
Expand Down Expand Up @@ -106,16 +110,15 @@ impl TelemetryWorker {
})
});

let transport = transport
.timeout(CONNECT_TIMEOUT)
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))
.map(|out, _| {
let transport = TransportTimeout::new(
transport.map(|out, _| {
let out = out
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))
.sink_map_err(|err| io::Error::new(io::ErrorKind::Other, err));
Box::pin(out) as Pin<Box<_>>
})
.boxed();
}),
CONNECT_TIMEOUT
).boxed();

Ok(TelemetryWorker {
nodes: endpoints.into_iter().map(|(addr, verbosity)| {
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.28.1", default-features = false }
libp2p = { version = "0.29.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 primitives/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dyn-clonable = { version = "0.9.0", optional = true }
thiserror = { version = "1.0.21", optional = true }

# full crypto
ed25519-dalek = { version = "1.0.0-pre.4", default-features = false, features = ["u64_backend", "alloc"], optional = true }
ed25519-dalek = { version = "1.0.1", default-features = false, features = ["u64_backend", "alloc"], optional = true }
blake2-rfc = { version = "0.2.18", default-features = false, optional = true }
tiny-keccak = { version = "2.0.1", features = ["keccak"], optional = true }
schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false, optional = true }
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.22", features = ["websocket"] }
libp2p-wasm-ext = { version = "0.23", 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 ab089f9

Please sign in to comment.