Update to libp2p-0.36 (#8420)

* Update to libp2p-0.36

* Some more Cargo.lock updates.
This commit is contained in:
Roman Borschel
2021-03-24 19:29:35 +01:00
committed by GitHub
parent 9a72134188
commit e1570b9ab4
15 changed files with 246 additions and 75 deletions
@@ -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"
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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" }
+3 -3
View File
@@ -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" }
+2 -2
View File
@@ -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};
@@ -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
},
+3 -2
View File
@@ -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()
+1 -1
View File
@@ -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" }
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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"
+2 -1
View File
@@ -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},
@@ -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| {