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

Update to libp2p-0.36 #8420

Merged
2 commits merged into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
281 changes: 225 additions & 56 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.35.1", default-features = false }
libp2p = { version = "0.36.0", 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 bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ try-runtime-cli = { version = "0.9.0", optional = true, path = "../../../utils/f
wasm-bindgen = { version = "0.2.57", optional = true }
wasm-bindgen-futures = { version = "0.4.18", optional = true }
browser-utils = { package = "substrate-browser-utils", path = "../../../utils/browser", optional = true, version = "0.9.0"}
libp2p-wasm-ext = { version = "0.27", features = ["websocket"], optional = true }
libp2p-wasm-ext = { version = "0.28", features = ["websocket"], optional = true }

[target.'cfg(target_arch="x86_64")'.dependencies]
node-executor = { version = "2.0.0", path = "../executor", features = [ "wasmtime" ] }
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 @@ -23,7 +23,7 @@ derive_more = "0.99.2"
either = "1.5.3"
futures = "0.3.9"
futures-timer = "3.0.1"
libp2p = { version = "0.35.1", default-features = false, features = ["kad"] }
libp2p = { version = "0.36.0", default-features = false, features = ["kad"] }
log = "0.4.8"
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.9.0"}
prost = "0.7"
Expand Down
2 changes: 1 addition & 1 deletion client/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ regex = "1.4.2"
tokio = { version = "0.2.21", features = [ "signal", "rt-core", "rt-threaded", "blocking" ] }
futures = "0.3.9"
fdlimit = "0.2.1"
libp2p = "0.35.1"
libp2p = "0.36.0"
parity-scale-codec = "2.0.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.9"
futures-timer = "3.0.1"
libp2p = { version = "0.35.1", default-features = false }
libp2p = { version = "0.36.0", default-features = false }
log = "0.4.8"
lru = "0.6.5"
prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.9.0", path = "../../utils/prometheus" }
Expand Down
6 changes: 3 additions & 3 deletions client/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ wasm-timer = "0.2"
zeroize = "1.2.0"

[dependencies.libp2p]
version = "0.35.1"
version = "0.36.0"

[target.'cfg(target_os = "unknown")'.dependencies.libp2p]
version = "0.35.1"
version = "0.36.0"
default-features = false
features = ["identify", "kad", "mdns", "mplex", "noise", "ping", "request-response", "tcp-async-io", "websocket", "yamux"]


[dev-dependencies]
assert_matches = "1.3"
libp2p = { version = "0.35.1", default-features = false }
libp2p = { version = "0.36.0", default-features = false }
quickcheck = "1.0.3"
rand = "0.7.2"
sp-keyring = { version = "3.0.0", path = "../../primitives/keyring" }
Expand Down
4 changes: 2 additions & 2 deletions client/network/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ use libp2p::kad::handler::KademliaHandlerProto;
use libp2p::kad::QueryId;
use libp2p::kad::record::{self, store::{MemoryStore, RecordStore}};
#[cfg(not(target_os = "unknown"))]
use libp2p::mdns::{Mdns, MdnsEvent};
use libp2p::mdns::{Mdns, MdnsConfig, MdnsEvent};
use libp2p::multiaddr::Protocol;
use log::{debug, info, trace, warn};
use std::{cmp, collections::{HashMap, HashSet, VecDeque}, io, num::NonZeroUsize, time::Duration};
Expand Down Expand Up @@ -220,7 +220,7 @@ impl DiscoveryConfig {
discovery_only_if_under_num,
#[cfg(not(target_os = "unknown"))]
mdns: if enable_mdns {
MdnsWrapper::Instantiating(Mdns::new().boxed())
MdnsWrapper::Instantiating(Mdns::new(MdnsConfig::default()).boxed())
} else {
MdnsWrapper::Disabled
},
Expand Down
5 changes: 3 additions & 2 deletions client/network/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ pub fn build_transport(
let desktop_trans = tcp::TcpConfig::new().nodelay(true);
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()) {
let dns_init = futures::executor::block_on(dns::DnsConfig::system(desktop_trans.clone()));
OptionalTransport::some(if let Ok(dns) = dns_init {
EitherTransport::Left(dns)
} else {
EitherTransport::Right(desktop_trans.map_err(dns::DnsErr::Underlying))
EitherTransport::Right(desktop_trans.map_err(dns::DnsErr::Transport))
})
} else {
OptionalTransport::none()
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 @@ -20,7 +20,7 @@ parking_lot = "0.11.1"
futures = "0.3.9"
futures-timer = "3.0.1"
rand = "0.7.2"
libp2p = { version = "0.35.1", default-features = false }
libp2p = { version = "0.36.0", default-features = false }
sp-consensus = { version = "0.9.0", path = "../../../primitives/consensus/common" }
sc-consensus = { version = "0.9.0", path = "../../consensus/common" }
sc-client-api = { version = "3.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.9"
libp2p = { version = "0.35.1", default-features = false }
libp2p = { version = "0.36.0", default-features = false }
sp-utils = { version = "3.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 @@ -18,7 +18,7 @@ targets = ["x86_64-unknown-linux-gnu"]
parking_lot = "0.11.1"
futures = "0.3.9"
wasm-timer = "0.2.5"
libp2p = { version = "0.35.1", default-features = false, features = ["dns", "tcp-async-io", "wasm-ext", "websocket"] }
libp2p = { version = "0.36.0", default-features = false, features = ["dns-async-std", "tcp-async-io", "wasm-ext", "websocket"] }
log = "0.4.8"
pin-project = "1.0.4"
rand = "0.7.2"
Expand Down
3 changes: 2 additions & 1 deletion client/telemetry/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use futures::{
executor::block_on,
prelude::*,
ready,
task::{Context, Poll},
Expand Down Expand Up @@ -47,7 +48,7 @@ pub(crate) fn initialize_transport(
// an external transport on desktop and the fallback is used all the time.
#[cfg(not(target_os = "unknown"))]
let transport = transport.or_transport({
let inner = libp2p::dns::DnsConfig::new(libp2p::tcp::TcpConfig::new())?;
let inner = block_on(libp2p::dns::DnsConfig::system(libp2p::tcp::TcpConfig::new()))?;
libp2p::websocket::framed::WsConfig::new(inner).and_then(|connec, _| {
let connec = connec
.with(|item| {
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.35.1", default-features = false }
libp2p = { version = "0.36.0", default-features = false }
log = "0.4.8"
sp-core = { path= "../../core", version = "3.0.0"}
sp-inherents = { version = "3.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.27", features = ["websocket"] }
libp2p-wasm-ext = { version = "0.28", features = ["websocket"] }
console_error_panic_hook = "0.1.6"
js-sys = "0.3.34"
wasm-bindgen = "0.2.57"
Expand Down