From be732a2d680c7246728e89612d07fe9f420dccea Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 15 Aug 2019 16:41:39 +0200 Subject: [PATCH] Update to libp2p 0.12 (#3408) --- substrate/Cargo.lock | 217 ++++++++----------- substrate/core/consensus/common/Cargo.toml | 2 +- substrate/core/network/Cargo.toml | 2 +- substrate/core/network/src/behaviour.rs | 6 +- substrate/core/network/src/discovery.rs | 15 +- substrate/core/network/src/lib.rs | 8 +- substrate/core/network/src/protocol/event.rs | 10 +- substrate/core/network/src/service.rs | 10 +- substrate/core/peerset/Cargo.toml | 2 +- substrate/core/telemetry/Cargo.toml | 2 +- 10 files changed, 122 insertions(+), 152 deletions(-) diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 032f36da3c..e9fbf3555a 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -172,15 +172,6 @@ dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "bigint" -version = "4.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "bindgen" version = "0.47.3" @@ -583,11 +574,6 @@ dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "crunchy" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "crunchy" version = "0.2.2" @@ -1580,32 +1566,32 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core-derive 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-deflate 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-dns 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-floodsub 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-identify 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-kad 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-mdns 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-mplex 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-noise 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-ping 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-plaintext 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-ratelimit 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-secio 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-swarm 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-tcp 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-uds 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-wasm-ext 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-websocket 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-yamux 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core-derive 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-deflate 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-dns 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-floodsub 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identify 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-kad 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mdns 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mplex 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-noise 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ping 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-plaintext 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ratelimit 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-secio 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-tcp 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-uds 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-wasm-ext 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-websocket 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-yamux 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multihash 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1618,7 +1604,7 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "asn1_der 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1631,7 +1617,7 @@ dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "multistream-select 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "multistream-select 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multihash 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1653,7 +1639,7 @@ dependencies = [ [[package]] name = "libp2p-core-derive" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1662,29 +1648,29 @@ dependencies = [ [[package]] name = "libp2p-deflate" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "flate2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-dns" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-dns-unofficial 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-floodsub" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1692,8 +1678,8 @@ dependencies = [ "cuckoofilter 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-swarm 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1702,13 +1688,13 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-swarm 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1722,17 +1708,16 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bigint 4.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-swarm 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multihash 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1742,6 +1727,7 @@ dependencies = [ "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-timer 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1749,14 +1735,14 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "dns-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-swarm 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1771,13 +1757,13 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1787,14 +1773,14 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "curve25519-dalek 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1807,13 +1793,13 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-swarm 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1824,23 +1810,23 @@ dependencies = [ [[package]] name = "libp2p-plaintext" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-ratelimit" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aio-limited 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1848,7 +1834,7 @@ dependencies = [ [[package]] name = "libp2p-secio" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1858,7 +1844,7 @@ dependencies = [ "hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "parity-send-wrapper 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1876,11 +1862,11 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1889,39 +1875,39 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "get_if_addrs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "ipnet 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tk-listen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-uds" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-wasm-ext" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-send-wrapper 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1930,12 +1916,12 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "rw-stream-sink 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "soketto 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1948,11 +1934,11 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "yamux 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2199,14 +2185,13 @@ dependencies = [ [[package]] name = "multistream-select" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4484,7 +4469,7 @@ dependencies = [ "derive_more 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-preview 0.3.0-alpha.17 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4687,7 +4672,7 @@ dependencies = [ "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "futures-preview 0.3.0-alpha.17 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "linked_hash_set 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4761,7 +4746,7 @@ name = "substrate-peerset" version = "2.0.0" dependencies = [ "futures-preview 0.3.0-alpha.17 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4977,7 +4962,7 @@ dependencies = [ "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "futures-preview 0.3.0-alpha.17 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5265,17 +5250,6 @@ dependencies = [ "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "tk-listen" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "tokio" version = "0.1.22" @@ -6105,7 +6079,6 @@ dependencies = [ "checksum base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" -"checksum bigint 4.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ebecac13b3c745150d7b6c3ea7572d372f09d627c2077e893bf26c5c7f70d282" "checksum bindgen 0.47.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df683a55b54b41d5ea8ebfaebb5aa7e6b84e3f3006a78f010dadc9ca88469260" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5da9b3d9f6f585199287a473f4f8dfab6566cf827d15c00c219f53c645687ead" @@ -6152,7 +6125,6 @@ dependencies = [ "checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9" "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" "checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" -"checksum crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda" "checksum crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" "checksum crypto-mac 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "779015233ac67d65098614aec748ac1c756ab6677fa2e14cf8b37c08dfed1198" "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" @@ -6263,27 +6235,27 @@ dependencies = [ "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" "checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" -"checksum libp2p 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18b3404dae1e3110caaae14b2d59bf7254b1e988ed7ed38da59c005bed711e7d" -"checksum libp2p-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efa1b75b0b388c0f33bc2e2f5d385885f9ed77f622802895b68ac8397aaef2de" -"checksum libp2p-core-derive 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "954fe45edba727b76196abff0d3894116c32a07e4f8173a8f26caf3484add4c0" -"checksum libp2p-deflate 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "56b77964eaf8ba7019df8de2a02f2241ee240011d6de69f4991baf174ad42d2e" -"checksum libp2p-dns 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0c2625c6acd4073403f1107e4e038efa02ba5de54de0d08567a2cc338560d63f" -"checksum libp2p-floodsub 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d14e6c61c6e69f291261c8ec001b85a2c6426f2074183a40c337c29ed7939bd1" -"checksum libp2p-identify 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34ba4b8d4e27f4848a6b121604d98818a8527f4269948ba77dfe49f0f1c3dc8f" -"checksum libp2p-kad 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "93384ee24fe137bf3afa8263b8d9e63c6bd6c92aad7cc50949fdba2b90db93a4" -"checksum libp2p-mdns 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd24b59da234647e15c34054158b6853a505301d5888719593e6fcd7841c39d9" -"checksum libp2p-mplex 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b101952e8dfdc5c902f1063cd8bfbb80e735857a16d387033ae8180df578009" -"checksum libp2p-noise 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1dd3313a8216b92e3ae5a24034d6fc35bf9671e9f4ad4b2ce445291852508b77" -"checksum libp2p-ping 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0c803a4d21c97e14eb8b5019cc32242e296f1d1835de8664e5464d7dc31f068d" -"checksum libp2p-plaintext 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fbac75c9683aa5997887420007ea2cf47ab9b68584b4edfa2b20598c9d509273" -"checksum libp2p-ratelimit 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7abef2e38e9d4bb5036724d325dd0518007e32d73d5171334d4d5355995bb4d8" -"checksum libp2p-secio 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "33c208e7c74c15c72e7092503d6772ed5b2add2155e08234ae10169769e3135c" -"checksum libp2p-swarm 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8788a19e54240ba632ec0913bb951e7fd744f4e6151b2dc1a8b44d80b2947830" -"checksum libp2p-tcp 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "180543c45126c4eec42f35594e169a8d7c891253bc127297ca7781c05ad8bce6" -"checksum libp2p-uds 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffaf9dfc24beaf7ad5be01a6eabe67842cd02575da68a08ebe11b5a8821fc4a9" -"checksum libp2p-wasm-ext 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "35307568a484cce18eae7516201ecbbfc3fb7e17c7f235d407690aee6adaa046" -"checksum libp2p-websocket 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2e6c6d86998e66848f16b65e89896d94fa3825e218d2fc44cbc6b84e8ef97bb9" -"checksum libp2p-yamux 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1c03b89d025c7b01c966348e4d618b1ec4b95f3c09749ca9f2b2c98240aabfe6" +"checksum libp2p 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4183fb4be621d97baebbbe0c499d6ae337e9e6ec955f9fa3cb29e55547dfacdb" +"checksum libp2p-core 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a7ebd9d597299512e096cc1bd58e955c03ef28f33214a33b9c7e4ace109ff41" +"checksum libp2p-core-derive 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baffb3527eac95b717e5ebcd6539007152019a06b00548352cbd74474c07db27" +"checksum libp2p-deflate 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "84bb91afe976893b9822103522cc178bd66eb7aa8e54c69ddd9e1825a3d894ab" +"checksum libp2p-dns 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b43d79936984b46a5ef4d7b070eaf786f6fab2d1a57e07646306b492e38b2d7f" +"checksum libp2p-floodsub 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "798615b01761454818788dafe61b4fe2bda4306bfa5378cbe8715f57b752235f" +"checksum libp2p-identify 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0a630d5ab928403e426672187514884a9ed0ea2065970ef0ec64971770be6d5" +"checksum libp2p-kad 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66d2214dd47fa67878eaf0d76d19fd129eff65c45f83617829eb177b7285f97" +"checksum libp2p-mdns 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cbd443101542670935b6e6863b7bb88c10ac04393062e662201a3c104d80ae00" +"checksum libp2p-mplex 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "59f283e603b078aa88e65c66c5d4f842f67bfbe4d016b0ae345b7e3bb78fe0af" +"checksum libp2p-noise 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ab3c7b36cde3bfe18a1d7a0a5693361115066365d32c60f210acc8224b88017" +"checksum libp2p-ping 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "006bbfcb7d6ca7e617cb2924d99fff0e391d4c6e42e7047e226692c8c3e1f6a0" +"checksum libp2p-plaintext 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4e673668e5ef47689ca832c33f2dc1e321ede245ee50b6084e4c45cce10fff6" +"checksum libp2p-ratelimit 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "838538f6df5941626047903d14edc3112afb2807fc139535a8ca78469ccaf1ac" +"checksum libp2p-secio 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a99533cb55b9554d2927ad8a220c87b4e0bbfdec22b738eb6030b03e6a722fa1" +"checksum libp2p-swarm 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "541f66cc794e522fb8072d35dba6be3fe4c3ffeadbed39bf4a6939d0695b4134" +"checksum libp2p-tcp 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4e56f7c7e31d303898d51b293f8d95dcb99e6293fefebe184df03e82dd37571" +"checksum libp2p-uds 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "180fa5ceb2f986786b4fca9582f6ffb98772db2e44df07c800693c97205e3310" +"checksum libp2p-wasm-ext 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a806f0e4985ae2dbac2cbebadb72d586ffe2e1f62a265f5e019e57a3f02aa481" +"checksum libp2p-websocket 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e0dd3cb203aaa1736a38cdd157709153f90bfaed06b87f4dc3ebb62b5d79a643" +"checksum libp2p-yamux 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a37bed07c8ee0ceeecdfb90d703aa6b1cec99a69b4157e5f7f2c03acacbfca15" "checksum librocksdb-sys 5.18.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d19778314deaa7048f2ea7d07b8aa12e1c227acebe975a37eeab6d2f8c74e41b" "checksum libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "688e8d65e495567c2c35ea0001b26b9debf0b4ea11f8cccc954233b75fc3428a" "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" @@ -6310,7 +6282,7 @@ dependencies = [ "checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -"checksum multistream-select 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f989d40aab0ed0d83c1cdb4856b5790e980b96548d1a921f280e985eb049f38d" +"checksum multistream-select 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51a032ec01abdbe99a1165cd3e518bdd4bd7ca509a59ae9adf186d240399b90c" "checksum names 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef320dab323286b50fb5cdda23f61c796a72a89998ab565ca32525c5c556f2da" "checksum native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b2df1a4c22fd44a62147fd8f13dd0f95c9d8ca7b2610299b2a2f9cf8964274e" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" @@ -6469,7 +6441,6 @@ dependencies = [ "checksum tiny-bip39 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c1c5676413eaeb1ea35300a0224416f57abc3bd251657e0fafc12c47ff98c060" "checksum tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2" "checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20" -"checksum tk-listen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5462b0f968c0457efe38fcd2df7e487096b992419e4f5337b06775a614bbda4b" "checksum tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" "checksum tokio-buf 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46" "checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" diff --git a/substrate/core/consensus/common/Cargo.toml b/substrate/core/consensus/common/Cargo.toml index 46c8121207..32930d5d7b 100644 --- a/substrate/core/consensus/common/Cargo.toml +++ b/substrate/core/consensus/common/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] derive_more = "0.14.0" -libp2p = { version = "0.11.0", default-features = false } +libp2p = { version = "0.12.0", default-features = false } log = "0.4" primitives = { package = "substrate-primitives", path= "../../primitives" } inherents = { package = "substrate-inherents", path = "../../inherents" } diff --git a/substrate/core/network/Cargo.toml b/substrate/core/network/Cargo.toml index dac6ecdd72..00dc04254d 100644 --- a/substrate/core/network/Cargo.toml +++ b/substrate/core/network/Cargo.toml @@ -22,7 +22,7 @@ linked_hash_set = "0.1.3" lru-cache = "0.1.1" rustc-hex = "2.0" rand = "0.6" -libp2p = { version = "0.11.0", default-features = false, features = ["secp256k1", "libp2p-websocket"] } +libp2p = { version = "0.12.0", default-features = false, features = ["secp256k1", "libp2p-websocket"] } fork-tree = { path = "../../core/utils/fork-tree" } consensus = { package = "substrate-consensus-common", path = "../../core/consensus/common" } client = { package = "substrate-client", path = "../../core/client" } diff --git a/substrate/core/network/src/behaviour.rs b/substrate/core/network/src/behaviour.rs index f2144c89a5..2471cbcaaf 100644 --- a/substrate/core/network/src/behaviour.rs +++ b/substrate/core/network/src/behaviour.rs @@ -23,9 +23,9 @@ use crate::protocol::{CustomMessageOutcome, Protocol}; use futures::prelude::*; use libp2p::NetworkBehaviour; use libp2p::core::{Multiaddr, PeerId, PublicKey}; +use libp2p::kad::record; use libp2p::swarm::{NetworkBehaviourAction, NetworkBehaviourEventProcess}; use libp2p::core::{nodes::Substream, muxing::StreamMuxerBox}; -use libp2p::multihash::Multihash; use log::warn; use sr_primitives::traits::Block as BlockT; use std::iter; @@ -101,12 +101,12 @@ impl, H: ExHashT> Behaviour { } /// Start querying a record from the DHT. Will later produce either a `ValueFound` or a `ValueNotFound` event. - pub fn get_value(&mut self, key: &Multihash) { + pub fn get_value(&mut self, key: &record::Key) { self.discovery.get_value(key); } /// Starts putting a record into DHT. Will later produce either a `ValuePut` or a `ValuePutFailed` event. - pub fn put_value(&mut self, key: Multihash, value: Vec) { + pub fn put_value(&mut self, key: record::Key, value: Vec) { self.discovery.put_value(key, value); } } diff --git a/substrate/core/network/src/discovery.rs b/substrate/core/network/src/discovery.rs index 9fa6b2a80f..a9cf61d040 100644 --- a/substrate/core/network/src/discovery.rs +++ b/substrate/core/network/src/discovery.rs @@ -52,14 +52,13 @@ use libp2p::core::{ConnectedPoint, Multiaddr, PeerId, PublicKey}; use libp2p::swarm::{ProtocolsHandler, NetworkBehaviour, NetworkBehaviourAction, PollParameters}; use libp2p::kad::{Kademlia, KademliaEvent, Quorum, Record}; use libp2p::kad::GetClosestPeersError; -use libp2p::kad::record::store::MemoryStore; +use libp2p::kad::record::{self, store::MemoryStore}; #[cfg(not(target_os = "unknown"))] use libp2p::{swarm::toggle::Toggle}; #[cfg(not(target_os = "unknown"))] use libp2p::core::{nodes::Substream, muxing::StreamMuxerBox}; #[cfg(not(target_os = "unknown"))] use libp2p::mdns::{Mdns, MdnsEvent}; -use libp2p::multihash::Multihash; use libp2p::multiaddr::Protocol; use log::{debug, info, trace, warn}; use std::{cmp, collections::VecDeque, time::Duration}; @@ -159,7 +158,7 @@ impl DiscoveryBehaviour { /// Start fetching a record from the DHT. /// /// A corresponding `ValueFound` or `ValueNotFound` event will later be generated. - pub fn get_value(&mut self, key: &Multihash) { + pub fn get_value(&mut self, key: &record::Key) { self.kademlia.get_record(key, Quorum::One) } @@ -167,7 +166,7 @@ impl DiscoveryBehaviour { /// `get_value`. /// /// A corresponding `ValuePut` or `ValuePutFailed` event will later be generated. - pub fn put_value(&mut self, key: Multihash, value: Vec) { + pub fn put_value(&mut self, key: record::Key, value: Vec) { self.kademlia.put_record(Record::new(key, value), Quorum::All); } } @@ -187,16 +186,16 @@ pub enum DiscoveryOut { UnroutablePeer(PeerId), /// The DHT yeided results for the record request, grouped in (key, value) pairs. - ValueFound(Vec<(Multihash, Vec)>), + ValueFound(Vec<(record::Key, Vec)>), /// The record requested was not found in the DHT. - ValueNotFound(Multihash), + ValueNotFound(record::Key), /// The record with a given key was successfully inserted into the DHT. - ValuePut(Multihash), + ValuePut(record::Key), /// Inserting a value into the DHT failed. - ValuePutFailed(Multihash), + ValuePutFailed(record::Key), } impl NetworkBehaviour for DiscoveryBehaviour diff --git a/substrate/core/network/src/lib.rs b/substrate/core/network/src/lib.rs index e5714c66f2..e797ffb208 100644 --- a/substrate/core/network/src/lib.rs +++ b/substrate/core/network/src/lib.rs @@ -286,8 +286,8 @@ pub enum NetworkStatePeerEndpoint { Dialing(Multiaddr), /// We are listening. Listening { - /// Address we're listening on that received the connection. - listen_addr: Multiaddr, + /// Local address of the connection. + local_addr: Multiaddr, /// Address data is sent back to. send_back_addr: Multiaddr, }, @@ -298,9 +298,9 @@ impl From for NetworkStatePeerEndpoint { match endpoint { ConnectedPoint::Dialer { address } => NetworkStatePeerEndpoint::Dialing(address), - ConnectedPoint::Listener { listen_addr, send_back_addr } => + ConnectedPoint::Listener { local_addr, send_back_addr } => NetworkStatePeerEndpoint::Listening { - listen_addr, + local_addr, send_back_addr } } diff --git a/substrate/core/network/src/protocol/event.rs b/substrate/core/network/src/protocol/event.rs index 2edbb0fbf7..c0c26da515 100644 --- a/substrate/core/network/src/protocol/event.rs +++ b/substrate/core/network/src/protocol/event.rs @@ -17,21 +17,21 @@ //! Network event types. These are are not the part of the protocol, but rather //! events that happen on the network like DHT get/put results received. -use libp2p::multihash::Multihash; +use libp2p::kad::record::Key; /// Events generated by DHT as a response to get_value and put_value requests. pub enum DhtEvent { /// The value was found. - ValueFound(Vec<(Multihash, Vec)>), + ValueFound(Vec<(Key, Vec)>), /// The requested record has not been found in the DHT. - ValueNotFound(Multihash), + ValueNotFound(Key), /// The record has been successfully inserted into the DHT. - ValuePut(Multihash), + ValuePut(Key), /// An error has occured while putting a record into the DHT. - ValuePutFailed(Multihash), + ValuePutFailed(Key), } /// Type for events generated by networking layer. diff --git a/substrate/core/network/src/service.rs b/substrate/core/network/src/service.rs index d5ba8db7ae..c3f773e232 100644 --- a/substrate/core/network/src/service.rs +++ b/substrate/core/network/src/service.rs @@ -33,7 +33,7 @@ use consensus::import_queue::{BlockImportResult, BlockImportError}; use futures::{prelude::*, sync::mpsc}; use futures03::TryFutureExt as _; use log::{warn, error, info}; -use libp2p::{PeerId, Multiaddr, multihash::Multihash}; +use libp2p::{PeerId, Multiaddr, kad::record}; use libp2p::core::{transport::boxed::Boxed, muxing::StreamMuxerBox}; use libp2p::swarm::NetworkBehaviour; use parking_lot::Mutex; @@ -456,7 +456,7 @@ impl, H: ExHashT> NetworkServic /// /// This will generate either a `ValueFound` or a `ValueNotFound` event and pass it to /// `on_event` on the network specialization. - pub fn get_value(&self, key: &Multihash) { + pub fn get_value(&self, key: &record::Key) { let _ = self .to_worker .unbounded_send(ServerToWorkerMsg::GetValue(key.clone())); @@ -466,7 +466,7 @@ impl, H: ExHashT> NetworkServic /// /// This will generate either a `ValuePut` or a `ValuePutFailed` event and pass it to /// `on_event` on the network specialization. - pub fn put_value(&self, key: Multihash, value: Vec) { + pub fn put_value(&self, key: record::Key, value: Vec) { let _ = self .to_worker .unbounded_send(ServerToWorkerMsg::PutValue(key, value)); @@ -584,8 +584,8 @@ enum ServerToWorkerMsg> { ExecuteWithSpec(Box) + Send>), ExecuteWithGossip(Box, &mut dyn Context) + Send>), GossipConsensusMessage(B::Hash, ConsensusEngineId, Vec, GossipMessageRecipient), - GetValue(Multihash), - PutValue(Multihash, Vec), + GetValue(record::Key), + PutValue(record::Key, Vec), AddKnownAddress(PeerId, Multiaddr), } diff --git a/substrate/core/peerset/Cargo.toml b/substrate/core/peerset/Cargo.toml index 7bf0617a9e..1bd9d3f17b 100644 --- a/substrate/core/peerset/Cargo.toml +++ b/substrate/core/peerset/Cargo.toml @@ -9,7 +9,7 @@ edition = "2018" [dependencies] futures-preview = "=0.3.0-alpha.17" -libp2p = { version = "0.11.0", default-features = false } +libp2p = { version = "0.12.0", default-features = false } linked-hash-map = "0.5" log = "0.4" lru-cache = "0.1.2" diff --git a/substrate/core/telemetry/Cargo.toml b/substrate/core/telemetry/Cargo.toml index d4332eb9ec..1afc4fd40c 100644 --- a/substrate/core/telemetry/Cargo.toml +++ b/substrate/core/telemetry/Cargo.toml @@ -11,7 +11,7 @@ parking_lot = "0.9.0" futures01 = { package = "futures", version = "0.1" } futures-preview = { version = "=0.3.0-alpha.17", features = ["compat"] } futures-timer = "0.2.1" -libp2p = { version = "0.11.0", default-features = false, features = ["libp2p-websocket"] } +libp2p = { version = "0.12.0", default-features = false, features = ["libp2p-websocket"] } log = "0.4" rand = "0.6" serde = { version = "1.0.81", features = ["derive"] }