diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index f0f096a659..6cda03cd99 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -181,6 +181,17 @@ dependencies = [ "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "async-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustls 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "webpki 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", + "webpki-roots 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "atty" version = "0.2.13" @@ -369,7 +380,7 @@ dependencies = [ "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb-web 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -446,7 +457,7 @@ dependencies = [ [[package]] name = "bytes" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1255,11 +1266,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1580,6 +1589,7 @@ dependencies = [ "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1594,6 +1604,17 @@ dependencies = [ "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "futures_codec" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fxhash" version = "0.2.1" @@ -1740,7 +1761,7 @@ name = "h2" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1861,7 +1882,7 @@ name = "http" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1882,7 +1903,7 @@ name = "http-body" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1951,7 +1972,7 @@ name = "hyper" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2335,372 +2356,360 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.13.2" +version = "0.14.0-alpha.1" 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.29 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core-derive 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-deflate 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-dns 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-floodsub 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-identify 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-kad 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-mdns 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-mplex 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-noise 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-ping 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-plaintext 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-secio 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-swarm 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-tcp 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-uds 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-wasm-ext 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-websocket 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-yamux 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multihash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core-derive 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-deflate 0.6.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-dns 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-floodsub 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identify 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-kad 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mdns 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mplex 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-noise 0.12.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ping 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-plaintext 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-secio 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.4.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-tcp 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-uds 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-wasm-ext 0.7.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-websocket 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-yamux 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-timer 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-core" -version = "0.13.2" +version = "0.14.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "asn1_der 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "ed25519-dalek 1.0.0-pre.3 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.6 (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.29 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "multistream-select 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multihash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "multistream-select 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rw-stream-sink 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rw-stream-sink 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.9 (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.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.7.0 (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.3 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-core-derive" -version = "0.13.0" +version = "0.14.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-deflate" -version = "0.5.0" +version = "0.6.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-dns" -version = "0.13.0" +version = "0.14.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (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.13.1" +version = "0.14.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "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.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-swarm 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.4.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.8.1 (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.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-identify" -version = "0.13.2" +version = "0.14.0-alpha.1" 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.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-swarm 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures_codec 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.4.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (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.3 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-timer 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-kad" -version = "0.13.2" +version = "0.14.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (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.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-swarm 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures_codec 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.4.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multihash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (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)", + "smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "uint 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.3.0 (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.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-mdns" -version = "0.13.1" +version = "0.14.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "async-std 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "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.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-swarm 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.4.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (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.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.7.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.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-udp 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.0.0 (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.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-mplex" -version = "0.13.0" +version = "0.14.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (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.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures_codec 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (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)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-noise" -version = "0.11.1" +version = "0.12.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)", "snow 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "x25519-dalek 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-ping" -version = "0.13.1" +version = "0.14.0-alpha.1" 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.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-swarm 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.4.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (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)", - "wasm-timer 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-plaintext" -version = "0.13.1" +version = "0.14.0-alpha.1" 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.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures_codec 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rw-stream-sink 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "rw-stream-sink 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.3.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-secio" -version = "0.13.1" +version = "0.14.0-alpha.1" 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)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "ctr 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (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.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "quicksink 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rw-stream-sink 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rw-stream-sink 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 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)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "twofish 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.57 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-futures 0.3.27 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-futures 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-swarm" -version = "0.3.0" +version = "0.4.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.0.0 (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.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-tcp" -version = "0.13.0" +version = "0.14.0-alpha.1" 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.29 (registry+https://github.com/rust-lang/crates.io-index)", + "async-std 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-timer 2.0.2 (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.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (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.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-uds" -version = "0.13.0" +version = "0.14.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "async-std 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (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.6.0" +version = "0.7.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (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.57 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-futures 0.3.27 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-futures 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-websocket" -version = "0.13.0" +version = "0.14.0-alpha.1" 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.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "async-tls 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (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.3 (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)", - "tokio-rustls 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "quicksink 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustls 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rw-stream-sink 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "soketto 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "webpki 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", "webpki-roots 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-yamux" -version = "0.13.0" +version = "0.14.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (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.2 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "yamux 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2761,14 +2770,6 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "lock_api" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "lock_api" version = "0.3.2" @@ -2958,15 +2959,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "multistream-select" -version = "0.6.1" +version = "0.7.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)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.0.0 (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.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4089,18 +4090,18 @@ dependencies = [ [[package]] name = "parity-multiaddr" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multihash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", - "unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4120,16 +4121,16 @@ dependencies = [ [[package]] name = "parity-multihash" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4215,16 +4216,6 @@ dependencies = [ "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parking_lot" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parking_lot" version = "0.9.0" @@ -4235,6 +4226,15 @@ dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parking_lot_core" version = "0.4.0" @@ -4247,21 +4247,6 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parking_lot_core" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parking_lot_core" version = "0.6.2" @@ -4276,6 +4261,19 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot_core" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "paste" version = "0.1.6" @@ -4541,6 +4539,16 @@ dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "quicksink" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "quote" version = "0.6.13" @@ -4929,12 +4937,11 @@ dependencies = [ [[package]] name = "rw-stream-sink" -version = "0.1.2" +version = "0.2.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.29 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4972,7 +4979,7 @@ dependencies = [ "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5467,17 +5474,17 @@ name = "sc-network" version = "0.8.0" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "fork-tree 2.0.0", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures_codec 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.14.0-alpha.1 (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.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5507,9 +5514,7 @@ dependencies = [ "substrate-test-client 2.0.0", "substrate-test-runtime-client 2.0.0", "tempfile 3.1.0 (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)", - "unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5521,7 +5526,7 @@ dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "lru 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5537,7 +5542,7 @@ dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (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.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5593,7 +5598,7 @@ name = "sc-peerset" version = "2.0.0" dependencies = [ "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5768,20 +5773,19 @@ dependencies = [ name = "sc-telemetry" version = "2.0.0" dependencies = [ - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "take_mut 0.2.2 (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)", ] @@ -6105,21 +6109,21 @@ dependencies = [ [[package]] name = "soketto" -version = "0.2.3" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (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)", + "smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -6259,7 +6263,7 @@ dependencies = [ "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -7175,7 +7179,7 @@ name = "tokio" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -7210,17 +7214,6 @@ dependencies = [ "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "tokio-dns-unofficial" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "tokio-executor" version = "0.1.9" @@ -7396,7 +7389,7 @@ name = "tokio-util" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -7608,9 +7601,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "unsigned-varint" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unsigned-varint" +version = "0.3.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)", - "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures_codec 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -7751,18 +7750,6 @@ dependencies = [ "wasm-bindgen-shared 0.2.57 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "js-sys 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.57 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "wasm-bindgen-futures" version = "0.4.7" @@ -7827,14 +7814,16 @@ dependencies = [ [[package]] name = "wasm-timer" -version = "0.1.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", "send_wrapper 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.57 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-futures 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -8135,18 +8124,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "yamux" -version = "0.2.2" +version = "0.4.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.29 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "nohash-hasher 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (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)", + "thiserror 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -8222,6 +8209,7 @@ dependencies = [ "checksum async-macros 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "644a5a8de80f2085a1e7e57cd1544a2a7438f6e003c0790999bd43b92a77cdb2" "checksum async-std 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "513ee3c49800679a319912340f5601afda9e72848d7dea3a48bab489e8c1a46f" "checksum async-task 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de6bd58f7b9cc49032559422595c81cbfcf04db2f2133592f70af19e258a1ced" +"checksum async-tls 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce6977f57fa68da77ffe5542950d47e9c23d65f5bc7cb0a9f8700996913eec7" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" "checksum backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)" = "924c76597f0d9ca25d762c25a4d369d51267536465dc5064bdf0eb073ed477ea" @@ -8252,7 +8240,7 @@ dependencies = [ "checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -"checksum bytes 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c85319f157e4e26c703678e68e26ab71a46c0199286fa670b21cc9fec13d895" +"checksum bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10004c15deb332055f7a4a208190aed362cf9a7c2f6ab70a305fba50e1105f38" "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" "checksum c_linked_list 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" "checksum cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "46e3374c604fb39d1a2f35ed5e4a4e30e60d01fab49446e08f1b3e9a90aef202" @@ -8363,6 +8351,7 @@ dependencies = [ "checksum futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a1de7508b218029b0f01662ed8f61b1c964b3ae99d6f25462d0f55a595109df6" "checksum futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76" "checksum futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "5ce968633c17e5f97936bd2797b6e38fb56cf16a7422319f7ec2e30d3c470e8d" +"checksum futures_codec 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a0a73299e4718f5452e45980fc1d6957a070abe308d3700b63b8673f47e1c2b3" "checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" @@ -8435,33 +8424,32 @@ dependencies = [ "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" "checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" -"checksum libp2p 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9b4674c6738fdd8b1cf7104dd046abcef78dc932fe25f8eb40f3a8e71341717d" -"checksum libp2p-core 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "01efc769c392d0d8863a7160d266f9b9f794968554f87490c8af4aa34ccaa94f" -"checksum libp2p-core-derive 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1eeb2704ac14c60f31967e351ed928b848526a5fc6db4104520020665012826f" -"checksum libp2p-deflate 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef2b0bf5d37692ac90e2bffa436bec26c0b0def6c0cab7ea85ff67a353d58aaa" -"checksum libp2p-dns 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3175fb0fc9016c95c8517a297bbdb5fb6bfbd5665bacd2eb23495d1cbdeb033" -"checksum libp2p-floodsub 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b360bbaad2560d6b8a905bd63528273d933fe54475a44def47f31e23108b3683" -"checksum libp2p-identify 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c087bcd044a6f67a994573a92a109487a902a31555e4e63bcc4ae144c45594fe" -"checksum libp2p-kad 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dcaf76a5b33b6c0203e85d450ae1855cae6860dc82eb0174ac1fee8bf68f7af5" -"checksum libp2p-mdns 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c4c2e225a7dfc571c3ad77a0a5ecccc9537afe42d72289ac9f19768567cd677d" -"checksum libp2p-mplex 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2fe584816d993dc0f893396521a3c93191d78a6f28a892b150baa714a12c3e5" -"checksum libp2p-noise 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d50494fcba7cdab08390d72b3cb9d2c72fcf178e6a0c1043855ab259d818b972" -"checksum libp2p-ping 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5b975ad345eb9bb29ddc64670664a50a8ab3e66e28357abb0f83cfc0a9ca2d78" -"checksum libp2p-plaintext 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6f07be6983e1c00e8f6a5676da54ed3a8cae7fb50f1fb6ea163414613ca656cc" -"checksum libp2p-secio 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04aa6d67a5fb2b36241a1ba54037a13deb2594cf141e43b597ce379521d530a8" -"checksum libp2p-swarm 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cd55bc9f5f9eac2bb1ff24ca3c8a655810a566ac38c7a6ee1f30aced5a62905b" -"checksum libp2p-tcp 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "234a7093d05651ab5630db926a4a42ca8978a65bab8c27c2ce2b66b200c76989" -"checksum libp2p-uds 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1e2fe0648967da3e56e4a55055c857c8c48326b66be0047d0e04c8ca60d34630" -"checksum libp2p-wasm-ext 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f7b8f2bd81fb356e81352d4513856bc21215ecf91502aa1f55b6449642a9acf" -"checksum libp2p-websocket 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d74d4fc229ad7e8d1a973178786bdcd5dadbdd7b9822c4477c8687df6f82f66" -"checksum libp2p-yamux 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1913eb7dd6eb5515957b6f1770296f6921968db87bc9b985f0e974b6657e1003" +"checksum libp2p 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0c85f850649e7533db125207d86bc2180faf7a962ea07686011031b71cbb3540" +"checksum libp2p-core 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "187ac3f588a74d48f163a8899fddafef4dc9796cad7b73ae754d9e928cebbbe7" +"checksum libp2p-core-derive 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b674da01855701636371b3d5f0e6b38bf5a74d283de705c1f66fab9980da8943" +"checksum libp2p-deflate 0.6.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f83cefe9f01a4a7012c1285e20fca4f193c46526a350679465150035afc5a97" +"checksum libp2p-dns 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "67d5a6d0905479ee4c6bcfaeab597d506f3447e5eb09b84aff1ed5e6d834b221" +"checksum libp2p-floodsub 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "462f310a152433a94d4e9766aa8366e4770084f67b9a17289a9667a7b0780714" +"checksum libp2p-identify 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8269e7b673cf0fbce1cbfedf61708e860aeb4b2ad3ca2df54586f1e810b9fbc9" +"checksum libp2p-kad 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90fdc0027f76b50b0822f489f5b8a83664b71c6087e67e8e9e53e6c255b069b3" +"checksum libp2p-mdns 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be0b7cdeb0ad2c009099eaed258ef18b308c1e3f56d8f57668a868305f1c4caa" +"checksum libp2p-mplex 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "54c2ca42c7511fddc566af2259b81749d36011fefab1e99d9bf77bdc6210a5bd" +"checksum libp2p-noise 0.12.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8ff485bebd3181fc7f0c8ca7d11dde6231c132bbfb5d26c0e3a568e1a58b450" +"checksum libp2p-ping 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9061919a24a74760610c860e67cdb44ae4fd3cffe34c3b3a916f21ec68d9d50a" +"checksum libp2p-plaintext 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e9bf4b832590e0bf7efc09ff91c2d4cda0737f29b44356ef0cc3aecc08ed54a" +"checksum libp2p-secio 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2aa7599c5413cbc3de7138d64b932a26e86f8897ef3722f18840ed12ad54ea43" +"checksum libp2p-swarm 0.4.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ea29f98b08c7a5113a787bce1a44d33fca6cf9f680f99812b50555e50baf408" +"checksum libp2p-tcp 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a4e0d1f322101d81c26782e76c523043f96fe53fa41962fd2c2193a709985186" +"checksum libp2p-uds 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d5620aca9d9f85158b934be33a25a6310f1ca6a038392498eb7f35d35063aee9" +"checksum libp2p-wasm-ext 0.7.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2dfe80dd0d2cb6412b57fffeb3db2dc36f7ea23566ed94011e0e07ff948f9624" +"checksum libp2p-websocket 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ac2a4974254a91f5291ef8493e6377380473334ba166ea0487e898364931dd61" +"checksum libp2p-yamux 0.14.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ef3277eaffc7c3a0ad0c115dcbe3cbeb0e3a953a18b959d05081835fc2cf2ff9" "checksum librocksdb-sys 6.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0a0785e816e1e11e7599388a492c61ef80ddc2afc91e313e61662cce537809be" "checksum libsecp256k1 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "df6edf84fd62aad1c93932b39324eaeda3912c1d26bc18dfaee6293848e49a50" "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" "checksum linked_hash_set 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7c91c4c7bbeb4f2f7c4e5be11e6a05bd6830bc37249c47ce1ad86ad453ff9c" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" -"checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff" "checksum lock_api 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e57b3997725d2b60dbec1297f6c2e2957cc383db1cebd6be812163f969c7d586" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" @@ -8484,7 +8472,7 @@ dependencies = [ "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum more-asserts 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" "checksum multimap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb04b9f127583ed176e163fb9ec6f3e793b87e21deedd5734a69386a18a0151" -"checksum multistream-select 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fc3ef54aab1b2e37e911bcb99e376dbe4c1e0710afcdb8428608e4f993b39c47" +"checksum multistream-select 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f938ffe420493e77c8b6cbcc3f282283f68fc889c5dcbc8e51668d5f3a01ad94" "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" @@ -8509,9 +8497,9 @@ dependencies = [ "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum parity-bytes 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0c276d76c5333b8c2579e02d49a06733a55b8282d2d9b13e8d53b6406bd7e30a" "checksum parity-multiaddr 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "045b3c7af871285146300da35b1932bb6e4639b66c7c98e85d06a32cbc4e8fa7" -"checksum parity-multiaddr 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "82afcb7461eae5d122543d8be1c57d306ed89af2d6ff7f8b0f5a3cc8f7e511bc" +"checksum parity-multiaddr 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6de20a133b50f5120c6b8284ee88c5017fb167149208b3ee2e95f8719a434dc4" "checksum parity-multihash 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df3a17dc27848fd99e4f87eb0f8c9baba6ede0a6d555400c850ca45254ef4ce3" -"checksum parity-multihash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c70cad855872dd51ce6679e823efb6434061a2c1782a1686438aabf506392cdd" +"checksum parity-multihash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70a4d7b05e51bff5ae2c29c7b8c3d889985bbd8f4e15b3542fcc1f6f9666d292" "checksum parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f9f9d99dae413590a5f37e43cd99b94d4e62a244160562899126913ea7108673" "checksum parity-scale-codec-derive 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "34e513ff3e406f3ede6796dcdc83d0b32ffb86668cea1ccf7363118abeb00476" "checksum parity-send-wrapper 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" @@ -8520,12 +8508,12 @@ dependencies = [ "checksum parity-util-mem-derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" "checksum parity-wasm 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ad52817c4d343339b3bc2e26861bd21478eda0b7509acf83505727000512ac" "checksum parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" +"checksum parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc" "checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" -"checksum parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa7767817701cce701d5585b9c4db3cdd02086398322c1d7e8bf5094a96a2ce7" "checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" -"checksum parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cb88cb1cb3790baa6776844f968fea3be44956cf184fa1be5a03341f5491278c" "checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +"checksum parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1" "checksum paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "423a519e1c6e828f1e73b720f9d9ed2fa643dce8a7737fb43235ce0b41eeaa49" "checksum paste-impl 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4214c9e912ef61bf42b81ba9a47e8aad1b2ffaf739ab162bf96d1e011f54e6c5" "checksum pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" @@ -8558,6 +8546,7 @@ dependencies = [ "checksum pwasm-utils 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quickcheck 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d5ca504a2fdaa08d3517f442fbbba91ac24d1ec4c51ea68688a038765e3b2662" +"checksum quicksink 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a8461ef7445f61fd72d8dcd0629ce724b9131b3c2eb36e83a5d3d4161c127530" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" @@ -8600,7 +8589,7 @@ dependencies = [ "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum rustls 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e" "checksum rustversion 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c48f91977f4ef3be5358c15d131d3f663f6b4d7a112555bf3bf52ad23b6659e5" -"checksum rw-stream-sink 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9cbe61c20455d3015b2bb7be39e1872310283b8e5a52f5b242b0ac7581fe78" +"checksum rw-stream-sink 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "761d4727649dc004ee5555a0779afd53963efafd2218c969a2c5e323cdf73a09" "checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" "checksum safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f7bf422d23a88c16d5090d455f182bc99c60af4df6a345c63428acf5129e347" "checksum safemem 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" @@ -8636,7 +8625,7 @@ dependencies = [ "checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" "checksum smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecf3b85f68e8abaa7555aa5abdb1153079387e60b718283d732f03897fcfc86" "checksum snow 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "afb767eee7d257ba202f0b9b08673bc13b22281632ef45267b19f13100accd2f" -"checksum soketto 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bceb1a3a15232d013d9a3b7cac9e5ce8e2313f348f01d4bc1097e5e53aa07095" +"checksum soketto 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3caa0ad6b765419f21e4cfa490ec7514a9fae4af986adef168a69477ba528671" "checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" "checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" @@ -8678,7 +8667,6 @@ dependencies = [ "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" "checksum tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d16217cad7f1b840c5a97dfb3c43b0c871fef423a6e8d2118c604e843662a443" -"checksum tokio-dns-unofficial 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "82c65483db54eb91b4ef3a9389a3364558590faf30ce473141707c0e16fda975" "checksum tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ca6df436c42b0c3330a82d855d2ef017cd793090ad550a6bc2184f4b933532ab" "checksum tokio-executor 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9ee9ceecf69145923834ea73f32ba40c790fd877b74a7817dd0b089f1eb9c7c8" "checksum tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe6dc22b08d6993916647d108a1a7d15b9cd29c4f4496c62b92c45b5041b7af" @@ -8720,6 +8708,7 @@ dependencies = [ "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f0023a96687fe169081e8adce3f65e3874426b7886e9234d490af2dc077959" +"checksum unsigned-varint 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c689459fbaeb50e56c6749275f084decfd02194ac5852e6617d95d0d3cf02eaf" "checksum untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60369ef7a31de49bcb3f6ca728d4ba7300d9a1658f94c727d4cab8c8d9f4aece" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" "checksum url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61" @@ -8737,14 +8726,13 @@ dependencies = [ "checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d" "checksum wasm-bindgen 0.2.57 (registry+https://github.com/rust-lang/crates.io-index)" = "701bc20794a7f9e8dcd85984a848f951ef6c5083322b6dd17fe880c99390f7cd" "checksum wasm-bindgen-backend 0.2.57 (registry+https://github.com/rust-lang/crates.io-index)" = "426315280d373e1a828e1c322507d51aa82e03c2fb1d654720b9e2f2368d291d" -"checksum wasm-bindgen-futures 0.3.27 (registry+https://github.com/rust-lang/crates.io-index)" = "83420b37346c311b9ed822af41ec2e82839bfe99867ec6c54e2da43b7538771c" "checksum wasm-bindgen-futures 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1de54efe80cb87a8fa1f715d60ab47a5eac6b1447dd68665300773f498c229b1" "checksum wasm-bindgen-macro 0.2.57 (registry+https://github.com/rust-lang/crates.io-index)" = "d9a8a46373db32c892de910ccca302ecdaf8262abab746324a8a4dac352fc11f" "checksum wasm-bindgen-macro-support 0.2.57 (registry+https://github.com/rust-lang/crates.io-index)" = "45d1c6c2259c0f4ef3d61ea0976ea075b6f8185497c4a5457793740c2cda6430" "checksum wasm-bindgen-shared 0.2.57 (registry+https://github.com/rust-lang/crates.io-index)" = "dd8e108ae395aae8017b091c4766101f08c635a5074e6631e0085e8a839e5810" "checksum wasm-bindgen-webidl 0.2.57 (registry+https://github.com/rust-lang/crates.io-index)" = "7a38859ace1c29c8ed75cd74940d4c96b980837179355de542a2eab3b435bb5c" "checksum wasm-gc-api 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c32691b6c7e6c14e7f8fd55361a9088b507aa49620fcd06c09b3a1082186b9" -"checksum wasm-timer 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "aa3e01d234bb71760e685cfafa5e2c96f8ad877c161a721646356651069e26ac" +"checksum wasm-timer 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "324c5e65a08699c9c4334ba136597ab22b85dccd4b65dd1e36ccf8f723a95b54" "checksum wasmi 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bf617d864d25af3587aa745529f7aaa541066c876d57e050c0d0c85c61c92aff" "checksum wasmi-validation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea78c597064ba73596099281e2f4cfc019075122a65cdda3205af94f0b264d93" "checksum wasmparser 0.39.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c702914acda5feeeffbc29e4d953e5b9ce79d8b98da4dbf18a77086e116c5470" @@ -8771,7 +8759,7 @@ dependencies = [ "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum x25519-dalek 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee1585dc1484373cbc1cee7aafda26634665cf449436fd6e24bfd1fad230538" "checksum xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" -"checksum yamux 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2758f29014c1cb7a6e74c1b1160ac8c8203be342d35b73462fc6a13cc6385423" +"checksum yamux 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "809f4388471d280173404e3d4f889e2d36004960a37d822ce5637fbef33a0ce4" "checksum zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "45af6a010d13e4cf5b54c94ba5a2b2eba5596b9e46bf5875612d332a1f2b3f86" "checksum zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" "checksum zeroize_derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" diff --git a/substrate/bin/node/cli/src/service.rs b/substrate/bin/node/cli/src/service.rs index 69b05083e8..49ccd15644 100644 --- a/substrate/bin/node/cli/src/service.rs +++ b/substrate/bin/node/cli/src/service.rs @@ -183,19 +183,16 @@ macro_rules! new_full { service.spawn_essential_task(babe); let network = service.network(); - let dht_event_stream = network.event_stream().filter_map(|e| match e { + let dht_event_stream = network.event_stream().filter_map(|e| async move { match e { Event::Dht(e) => Some(e), _ => None, - }); - let future03_dht_event_stream = dht_event_stream.compat() - .map(|x| x.expect(" never returns an error; qed")) - .boxed(); + }}).boxed(); let authority_discovery = sc_authority_discovery::AuthorityDiscovery::new( service.client(), network, sentry_nodes, service.keystore(), - future03_dht_event_stream, + dht_event_stream, ); let future01_authority_discovery = authority_discovery.map(|x| Ok(x)).compat(); diff --git a/substrate/client/authority-discovery/Cargo.toml b/substrate/client/authority-discovery/Cargo.toml index 6ad25299f0..854ebff87a 100644 --- a/substrate/client/authority-discovery/Cargo.toml +++ b/substrate/client/authority-discovery/Cargo.toml @@ -14,7 +14,7 @@ codec = { package = "parity-scale-codec", default-features = false, version = "1 derive_more = "0.99.2" futures = "0.3.1" futures-timer = "2.0" -libp2p = { version = "0.13.2", default-features = false, features = ["secp256k1", "libp2p-websocket"] } +libp2p = { version = "0.14.0-alpha.1", default-features = false, features = ["secp256k1", "libp2p-websocket"] } log = "0.4.8" prost = "0.5.0" rand = "0.7.2" diff --git a/substrate/client/network-gossip/Cargo.toml b/substrate/client/network-gossip/Cargo.toml index e5df654a03..cf8d31c6d3 100644 --- a/substrate/client/network-gossip/Cargo.toml +++ b/substrate/client/network-gossip/Cargo.toml @@ -12,7 +12,7 @@ futures01 = { package = "futures", version = "0.1.29" } futures = { version = "0.3.1", features = ["compat"] } futures-timer = "0.4.0" lru = "0.1.2" -libp2p = { version = "0.13.2", default-features = false, features = ["libp2p-websocket"] } +libp2p = { version = "0.14.0-alpha.1", default-features = false, features = ["libp2p-websocket"] } sc-network = { version = "0.8", path = "../network" } parking_lot = "0.9.0" sp-runtime = { version = "2.0.0", path = "../../primitives/runtime" } diff --git a/substrate/client/network-gossip/src/lib.rs b/substrate/client/network-gossip/src/lib.rs index bc28bbb809..f7b360f939 100644 --- a/substrate/client/network-gossip/src/lib.rs +++ b/substrate/client/network-gossip/src/lib.rs @@ -59,6 +59,7 @@ pub use self::state_machine::{TopicNotification, MessageIntent}; pub use self::state_machine::{Validator, ValidatorContext, ValidationResult}; pub use self::state_machine::DiscardAll; +use futures::prelude::*; use sc_network::{specialization::NetworkSpecialization, Event, ExHashT, NetworkService, PeerId, ReputationChange}; use sp_runtime::{traits::Block as BlockT, ConsensusEngineId}; use std::sync::Arc; @@ -97,7 +98,7 @@ pub trait Network { impl, H: ExHashT> Network for Arc> { fn event_stream(&self) -> Box + Send> { - Box::new(NetworkService::event_stream(self)) + Box::new(NetworkService::event_stream(self).map(|v| Ok::<_, ()>(v)).compat()) } fn report_peer(&self, peer_id: PeerId, reputation: ReputationChange) { diff --git a/substrate/client/network/Cargo.toml b/substrate/client/network/Cargo.toml index e143806414..d24f986f4c 100644 --- a/substrate/client/network/Cargo.toml +++ b/substrate/client/network/Cargo.toml @@ -7,22 +7,22 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -bytes = "0.4.12" +bytes = "0.5.0" derive_more = "0.99.2" either = "1.5.3" log = "0.4.8" parking_lot = "0.9.0" bitflags = "1.2.0" fnv = "1.0.6" -futures = "0.1.29" -futures03 = { package = "futures", version = "0.3.1", features = ["compat"] } +futures = "0.3.1" +futures_codec = "0.3.3" futures-timer = "0.4.0" linked-hash-map = "0.5.2" linked_hash_set = "0.1.3" lru = "0.4.0" rustc-hex = "2.0.1" rand = "0.7.2" -libp2p = { version = "0.13.2", default-features = false, features = ["libp2p-websocket"] } +libp2p = { version = "0.14.0-alpha.1", default-features = false, features = ["libp2p-websocket"] } fork-tree = { version = "2.0.0", path = "../../utils/fork-tree" } sp-consensus = { version = "0.8", path = "../../primitives/consensus/common" } sc-client = { version = "2.0.0", path = "../" } @@ -39,9 +39,7 @@ serde_json = "1.0.41" slog = { version = "2.5.2", features = ["nested-values"] } slog_derive = "0.2.0" smallvec = "0.6.10" -tokio-io = "0.1.12" -tokio = { version = "0.1.22", optional = true } -unsigned-varint = { version = "0.2.2", features = ["codec"] } +unsigned-varint = { version = "0.3.0", features = ["codec"] } sp-keyring = { version = "2.0.0", optional = true, path = "../../primitives/keyring" } substrate-test-client = { version = "2.0.0", optional = true, path = "../../test-utils/client" } substrate-test-runtime-client = { version = "2.0.0", optional = true, path = "../../test-utils/runtime/client" } @@ -57,8 +55,7 @@ sp-keyring = { version = "2.0.0", path = "../../primitives/keyring" } quickcheck = "0.9.0" rand = "0.7.2" tempfile = "3.1.0" -tokio = "0.1.22" [features] default = [] -test-helpers = ["sp-keyring", "substrate-test-runtime-client", "tokio"] +test-helpers = ["sp-keyring", "substrate-test-runtime-client"] diff --git a/substrate/client/network/src/behaviour.rs b/substrate/client/network/src/behaviour.rs index 2efdbd98b3..7cc9eee74d 100644 --- a/substrate/client/network/src/behaviour.rs +++ b/substrate/client/network/src/behaviour.rs @@ -20,7 +20,6 @@ use crate::{ }; use crate::{ExHashT, specialization::NetworkSpecialization}; use crate::protocol::{CustomMessageOutcome, Protocol}; -use futures::prelude::*; use libp2p::NetworkBehaviour; use libp2p::core::{Multiaddr, PeerId, PublicKey}; use libp2p::kad::record; @@ -29,7 +28,7 @@ use libp2p::core::{nodes::Substream, muxing::StreamMuxerBox}; use log::{debug, warn}; use sp_consensus::{BlockOrigin, import_queue::{IncomingBlock, Origin}}; use sp_runtime::{traits::{Block as BlockT, NumberFor}, Justification}; -use std::iter; +use std::{iter, task::Context, task::Poll}; use void; /// General behaviour of the network. Combines all protocols together. @@ -59,7 +58,7 @@ pub enum BehaviourOut { impl, H: ExHashT> Behaviour { /// Builds a new `Behaviour`. - pub fn new( + pub async fn new( substrate: Protocol, user_agent: String, local_public_key: PublicKey, @@ -75,7 +74,7 @@ impl, H: ExHashT> Behaviour { known_addresses, enable_mdns, allow_private_ipv4 - ), + ).await, events: Vec::new(), } } @@ -212,11 +211,11 @@ impl, H: ExHashT> NetworkBehaviourEventPr } impl, H: ExHashT> Behaviour { - fn poll(&mut self) -> Async>> { + fn poll(&mut self, _: &mut Context) -> Poll>> { if !self.events.is_empty() { - return Async::Ready(NetworkBehaviourAction::GenerateEvent(self.events.remove(0))) + return Poll::Ready(NetworkBehaviourAction::GenerateEvent(self.events.remove(0))) } - Async::NotReady + Poll::Pending } } diff --git a/substrate/client/network/src/debug_info.rs b/substrate/client/network/src/debug_info.rs index 1eebf1ffed..9cc39baae6 100644 --- a/substrate/client/network/src/debug_info.rs +++ b/substrate/client/network/src/debug_info.rs @@ -16,7 +16,6 @@ use fnv::FnvHashMap; use futures::prelude::*; -use futures03::{StreamExt as _, TryStreamExt as _}; use libp2p::Multiaddr; use libp2p::core::{ConnectedPoint, either::EitherOutput, PeerId, PublicKey}; use libp2p::swarm::{IntoProtocolsHandler, IntoProtocolsHandlerSelect, ProtocolsHandler}; @@ -25,8 +24,9 @@ use libp2p::identify::{Identify, IdentifyEvent, IdentifyInfo}; use libp2p::ping::{Ping, PingConfig, PingEvent, PingSuccess}; use log::{debug, trace, error}; use std::collections::hash_map::Entry; +use std::pin::Pin; +use std::task::{Context, Poll}; use std::time::{Duration, Instant}; -use tokio_io::{AsyncRead, AsyncWrite}; use crate::utils::interval; /// Time after we disconnect from a node before we purge its information from the cache. @@ -44,7 +44,7 @@ pub struct DebugInfoBehaviour { /// Information that we know about all nodes. nodes_info: FnvHashMap, /// Interval at which we perform garbage collection in `nodes_info`. - garbage_collect: Box + Send>, + garbage_collect: Pin + Send>>, } /// Information about a node we're connected to. @@ -76,7 +76,7 @@ impl DebugInfoBehaviour { ping: Ping::new(PingConfig::new()), identify, nodes_info: FnvHashMap::default(), - garbage_collect: Box::new(interval(GARBAGE_COLLECT_INTERVAL).map(|()| Ok(())).compat()), + garbage_collect: Box::pin(interval(GARBAGE_COLLECT_INTERVAL)), } } @@ -149,7 +149,7 @@ pub enum DebugInfoEvent { } impl NetworkBehaviour for DebugInfoBehaviour -where TSubstream: AsyncRead + AsyncWrite { +where TSubstream: AsyncRead + AsyncWrite + Unpin + Send + 'static { type ProtocolsHandler = IntoProtocolsHandlerSelect< as NetworkBehaviour>::ProtocolsHandler, as NetworkBehaviour>::ProtocolsHandler @@ -253,70 +253,71 @@ where TSubstream: AsyncRead + AsyncWrite { fn poll( &mut self, + cx: &mut Context, params: &mut impl PollParameters - ) -> Async< + ) -> Poll< NetworkBehaviourAction< <::Handler as ProtocolsHandler>::InEvent, Self::OutEvent > > { loop { - match self.ping.poll(params) { - Async::NotReady => break, - Async::Ready(NetworkBehaviourAction::GenerateEvent(ev)) => { + match self.ping.poll(cx, params) { + Poll::Pending => break, + Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)) => { if let PingEvent { peer, result: Ok(PingSuccess::Ping { rtt }) } = ev { self.handle_ping_report(&peer, rtt) } }, - Async::Ready(NetworkBehaviourAction::DialAddress { address }) => - return Async::Ready(NetworkBehaviourAction::DialAddress { address }), - Async::Ready(NetworkBehaviourAction::DialPeer { peer_id }) => - return Async::Ready(NetworkBehaviourAction::DialPeer { peer_id }), - Async::Ready(NetworkBehaviourAction::SendEvent { peer_id, event }) => - return Async::Ready(NetworkBehaviourAction::SendEvent { + Poll::Ready(NetworkBehaviourAction::DialAddress { address }) => + return Poll::Ready(NetworkBehaviourAction::DialAddress { address }), + Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id }) => + return Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id }), + Poll::Ready(NetworkBehaviourAction::SendEvent { peer_id, event }) => + return Poll::Ready(NetworkBehaviourAction::SendEvent { peer_id, event: EitherOutput::First(event) }), - Async::Ready(NetworkBehaviourAction::ReportObservedAddr { address }) => - return Async::Ready(NetworkBehaviourAction::ReportObservedAddr { address }), + Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }) => + return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }), } } loop { - match self.identify.poll(params) { - Async::NotReady => break, - Async::Ready(NetworkBehaviourAction::GenerateEvent(event)) => { + match self.identify.poll(cx, params) { + Poll::Pending => break, + Poll::Ready(NetworkBehaviourAction::GenerateEvent(event)) => { match event { IdentifyEvent::Received { peer_id, info, .. } => { self.handle_identify_report(&peer_id, &info); let event = DebugInfoEvent::Identified { peer_id, info }; - return Async::Ready(NetworkBehaviourAction::GenerateEvent(event)); + return Poll::Ready(NetworkBehaviourAction::GenerateEvent(event)); } IdentifyEvent::Error { peer_id, error } => debug!(target: "sub-libp2p", "Identification with peer {:?} failed => {}", peer_id, error), IdentifyEvent::Sent { .. } => {} } }, - Async::Ready(NetworkBehaviourAction::DialAddress { address }) => - return Async::Ready(NetworkBehaviourAction::DialAddress { address }), - Async::Ready(NetworkBehaviourAction::DialPeer { peer_id }) => - return Async::Ready(NetworkBehaviourAction::DialPeer { peer_id }), - Async::Ready(NetworkBehaviourAction::SendEvent { peer_id, event }) => - return Async::Ready(NetworkBehaviourAction::SendEvent { + Poll::Ready(NetworkBehaviourAction::DialAddress { address }) => + return Poll::Ready(NetworkBehaviourAction::DialAddress { address }), + Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id }) => + return Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id }), + Poll::Ready(NetworkBehaviourAction::SendEvent { peer_id, event }) => + return Poll::Ready(NetworkBehaviourAction::SendEvent { peer_id, event: EitherOutput::Second(event) }), - Async::Ready(NetworkBehaviourAction::ReportObservedAddr { address }) => - return Async::Ready(NetworkBehaviourAction::ReportObservedAddr { address }), + Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }) => + return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }), } } - while let Ok(Async::Ready(Some(_))) = self.garbage_collect.poll() { + while let Poll::Ready(Some(())) = self.garbage_collect.poll_next_unpin(cx) { self.nodes_info.retain(|_, node| { node.info_expire.as_ref().map(|exp| *exp >= Instant::now()).unwrap_or(true) }); } - Async::NotReady + Poll::Pending } } diff --git a/substrate/client/network/src/discovery.rs b/substrate/client/network/src/discovery.rs index 298d8e7036..11f687616e 100644 --- a/substrate/client/network/src/discovery.rs +++ b/substrate/client/network/src/discovery.rs @@ -47,7 +47,6 @@ use futures::prelude::*; use futures_timer::Delay; -use futures03::{compat::Compat, TryFutureExt as _}; use libp2p::core::{ConnectedPoint, Multiaddr, PeerId, PublicKey}; use libp2p::swarm::{ProtocolsHandler, NetworkBehaviour, NetworkBehaviourAction, PollParameters}; use libp2p::kad::{Kademlia, KademliaEvent, Quorum, Record}; @@ -62,7 +61,7 @@ use libp2p::mdns::{Mdns, MdnsEvent}; use libp2p::multiaddr::Protocol; use log::{debug, info, trace, warn}; use std::{cmp, collections::VecDeque, time::Duration}; -use tokio_io::{AsyncRead, AsyncWrite}; +use std::task::{Context, Poll}; use sp_core::hexdisplay::HexDisplay; /// Implementation of `NetworkBehaviour` that discovers the nodes on the network. @@ -76,7 +75,7 @@ pub struct DiscoveryBehaviour { #[cfg(not(target_os = "unknown"))] mdns: Toggle>>, /// Stream that fires when we need to perform the next random Kademlia query. - next_kad_random_query: Compat, + next_kad_random_query: Delay, /// After `next_kad_random_query` triggers, the next one triggers after this duration. duration_to_next_kad: Duration, /// Discovered nodes to return. @@ -94,7 +93,7 @@ impl DiscoveryBehaviour { /// Builds a new `DiscoveryBehaviour`. /// /// `user_defined` is a list of known address for nodes that never expire. - pub fn new( + pub async fn new( local_public_key: PublicKey, user_defined: Vec<(PeerId, Multiaddr)>, enable_mdns: bool, @@ -115,7 +114,7 @@ impl DiscoveryBehaviour { DiscoveryBehaviour { user_defined, kademlia, - next_kad_random_query: Delay::new(Duration::new(0, 0)).compat(), + next_kad_random_query: Delay::new(Duration::new(0, 0)), duration_to_next_kad: Duration::from_secs(1), discoveries: VecDeque::new(), local_peer_id: local_public_key.into_peer_id(), @@ -123,7 +122,7 @@ impl DiscoveryBehaviour { allow_private_ipv4, #[cfg(not(target_os = "unknown"))] mdns: if enable_mdns { - match Mdns::new() { + match Mdns::new().await { Ok(mdns) => Some(mdns).into(), Err(err) => { warn!(target: "sub-libp2p", "Failed to initialize mDNS: {:?}", err); @@ -206,7 +205,7 @@ pub enum DiscoveryOut { impl NetworkBehaviour for DiscoveryBehaviour where - TSubstream: AsyncRead + AsyncWrite, + TSubstream: AsyncRead + AsyncWrite + Unpin, { type ProtocolsHandler = as NetworkBehaviour>::ProtocolsHandler; type OutEvent = DiscoveryOut; @@ -287,8 +286,9 @@ where fn poll( &mut self, + cx: &mut Context, params: &mut impl PollParameters, - ) -> Async< + ) -> Poll< NetworkBehaviourAction< ::InEvent, Self::OutEvent, @@ -297,45 +297,35 @@ where // Immediately process the content of `discovered`. if let Some(peer_id) = self.discoveries.pop_front() { let ev = DiscoveryOut::Discovered(peer_id); - return Async::Ready(NetworkBehaviourAction::GenerateEvent(ev)); + return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)); } // Poll the stream that fires when we need to start a random Kademlia query. - loop { - match self.next_kad_random_query.poll() { - Ok(Async::NotReady) => break, - Ok(Async::Ready(_)) => { - let random_peer_id = PeerId::random(); - debug!(target: "sub-libp2p", "Libp2p <= Starting random Kademlia request for \ - {:?}", random_peer_id); + while let Poll::Ready(_) = self.next_kad_random_query.poll_unpin(cx) { + let random_peer_id = PeerId::random(); + debug!(target: "sub-libp2p", "Libp2p <= Starting random Kademlia request for \ + {:?}", random_peer_id); - self.kademlia.get_closest_peers(random_peer_id); + self.kademlia.get_closest_peers(random_peer_id); - // Schedule the next random query with exponentially increasing delay, - // capped at 60 seconds. - self.next_kad_random_query = Delay::new(self.duration_to_next_kad).compat(); - self.duration_to_next_kad = cmp::min(self.duration_to_next_kad * 2, - Duration::from_secs(60)); - }, - Err(err) => { - warn!(target: "sub-libp2p", "Kademlia query timer errored: {:?}", err); - break - } - } + // Schedule the next random query with exponentially increasing delay, + // capped at 60 seconds. + self.next_kad_random_query = Delay::new(self.duration_to_next_kad); + self.duration_to_next_kad = cmp::min(self.duration_to_next_kad * 2, + Duration::from_secs(60)); } // Poll Kademlia. - loop { - match self.kademlia.poll(params) { - Async::NotReady => break, - Async::Ready(NetworkBehaviourAction::GenerateEvent(ev)) => match ev { + while let Poll::Ready(ev) = self.kademlia.poll(cx, params) { + match ev { + NetworkBehaviourAction::GenerateEvent(ev) => match ev { KademliaEvent::UnroutablePeer { peer, .. } => { let ev = DiscoveryOut::UnroutablePeer(peer); - return Async::Ready(NetworkBehaviourAction::GenerateEvent(ev)); + return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)); } KademliaEvent::RoutingUpdated { peer, .. } => { let ev = DiscoveryOut::Discovered(peer); - return Async::Ready(NetworkBehaviourAction::GenerateEvent(ev)); + return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)); } KademliaEvent::GetClosestPeersResult(res) => { match res { @@ -369,7 +359,7 @@ where DiscoveryOut::ValueNotFound(e.into_key()) } }; - return Async::Ready(NetworkBehaviourAction::GenerateEvent(ev)); + return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)); } KademliaEvent::PutRecordResult(res) => { let ev = match res { @@ -378,7 +368,7 @@ where DiscoveryOut::ValuePutFailed(e.into_key()) } }; - return Async::Ready(NetworkBehaviourAction::GenerateEvent(ev)); + return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)); } KademliaEvent::RepublishRecordResult(res) => { match res { @@ -398,46 +388,45 @@ where warn!(target: "sub-libp2p", "Libp2p => Unhandled Kademlia event: {:?}", e) } }, - Async::Ready(NetworkBehaviourAction::DialAddress { address }) => - return Async::Ready(NetworkBehaviourAction::DialAddress { address }), - Async::Ready(NetworkBehaviourAction::DialPeer { peer_id }) => - return Async::Ready(NetworkBehaviourAction::DialPeer { peer_id }), - Async::Ready(NetworkBehaviourAction::SendEvent { peer_id, event }) => - return Async::Ready(NetworkBehaviourAction::SendEvent { peer_id, event }), - Async::Ready(NetworkBehaviourAction::ReportObservedAddr { address }) => - return Async::Ready(NetworkBehaviourAction::ReportObservedAddr { address }), + NetworkBehaviourAction::DialAddress { address } => + return Poll::Ready(NetworkBehaviourAction::DialAddress { address }), + NetworkBehaviourAction::DialPeer { peer_id } => + return Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id }), + NetworkBehaviourAction::SendEvent { peer_id, event } => + return Poll::Ready(NetworkBehaviourAction::SendEvent { peer_id, event }), + NetworkBehaviourAction::ReportObservedAddr { address } => + return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }), } } // Poll mDNS. #[cfg(not(target_os = "unknown"))] - loop { - match self.mdns.poll(params) { - Async::NotReady => break, - Async::Ready(NetworkBehaviourAction::GenerateEvent(event)) => { + while let Poll::Ready(ev) = self.mdns.poll(cx, params) { + match ev { + NetworkBehaviourAction::GenerateEvent(event) => { match event { MdnsEvent::Discovered(list) => { self.discoveries.extend(list.into_iter().map(|(peer_id, _)| peer_id)); if let Some(peer_id) = self.discoveries.pop_front() { let ev = DiscoveryOut::Discovered(peer_id); - return Async::Ready(NetworkBehaviourAction::GenerateEvent(ev)); + return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)); } }, MdnsEvent::Expired(_) => {} } }, - Async::Ready(NetworkBehaviourAction::DialAddress { address }) => - return Async::Ready(NetworkBehaviourAction::DialAddress { address }), - Async::Ready(NetworkBehaviourAction::DialPeer { peer_id }) => - return Async::Ready(NetworkBehaviourAction::DialPeer { peer_id }), - Async::Ready(NetworkBehaviourAction::SendEvent { event, .. }) => + NetworkBehaviourAction::DialAddress { address } => + return Poll::Ready(NetworkBehaviourAction::DialAddress { address }), + NetworkBehaviourAction::DialPeer { peer_id } => + return Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id }), + NetworkBehaviourAction::SendEvent { event, .. } => match event {}, // `event` is an enum with no variant - Async::Ready(NetworkBehaviourAction::ReportObservedAddr { address }) => - return Async::Ready(NetworkBehaviourAction::ReportObservedAddr { address }), + NetworkBehaviourAction::ReportObservedAddr { address } => + return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }), } } - Async::NotReady + Poll::Pending } } @@ -450,7 +439,7 @@ mod tests { use libp2p::core::transport::{Transport, MemoryTransport}; use libp2p::core::upgrade::{InboundUpgradeExt, OutboundUpgradeExt}; use libp2p::swarm::Swarm; - use std::collections::HashSet; + use std::{collections::HashSet, task::Poll}; use super::{DiscoveryBehaviour, DiscoveryOut}; #[test] @@ -469,7 +458,7 @@ mod tests { out, secio, endpoint, - libp2p::core::upgrade::Version::V1 + upgrade::Version::V1 ) }) .and_then(move |(peer_id, stream), endpoint| { @@ -477,10 +466,16 @@ mod tests { let upgrade = libp2p::yamux::Config::default() .map_inbound(move |muxer| (peer_id, muxer)) .map_outbound(move |muxer| (peer_id2, muxer)); - upgrade::apply(stream, upgrade, endpoint, libp2p::core::upgrade::Version::V1) + upgrade::apply(stream, upgrade, endpoint, upgrade::Version::V1) }); - let behaviour = DiscoveryBehaviour::new(keypair.public(), user_defined.clone(), false, true); + let behaviour = futures::executor::block_on({ + let user_defined = user_defined.clone(); + let keypair_public = keypair.public(); + async move { + DiscoveryBehaviour::new(keypair_public, user_defined, false, true).await + } + }); let mut swarm = Swarm::new(transport, behaviour, keypair.public().into_peer_id()); let listen_addr: Multiaddr = format!("/memory/{}", rand::random::()).parse().unwrap(); @@ -499,11 +494,11 @@ mod tests { .collect::>() }).collect::>(); - let fut = futures::future::poll_fn::<_, (), _>(move || { + let fut = futures::future::poll_fn(move |cx| { 'polling: loop { for swarm_n in 0..swarms.len() { - match swarms[swarm_n].0.poll().unwrap() { - Async::Ready(Some(e)) => { + match swarms[swarm_n].0.poll_next_unpin(cx) { + Poll::Ready(Some(e)) => { match e { DiscoveryOut::UnroutablePeer(other) => { // Call `add_self_reported_address` to simulate identify happening. @@ -530,12 +525,12 @@ mod tests { } if to_discover.iter().all(|l| l.is_empty()) { - Ok(Async::Ready(())) + Poll::Ready(()) } else { - Ok(Async::NotReady) + Poll::Pending } }); - tokio::runtime::Runtime::new().unwrap().block_on(fut).unwrap(); + futures::executor::block_on(fut); } } diff --git a/substrate/client/network/src/on_demand_layer.rs b/substrate/client/network/src/on_demand_layer.rs index edda140727..87f48ded67 100644 --- a/substrate/client/network/src/on_demand_layer.rs +++ b/substrate/client/network/src/on_demand_layer.rs @@ -17,10 +17,8 @@ //! On-demand requests service. use crate::protocol::light_dispatch::RequestData; -use std::collections::HashMap; -use std::sync::Arc; -use futures::{prelude::*, sync::mpsc, sync::oneshot}; -use futures03::compat::{Compat01As03, Future01CompatExt as _}; +use std::{collections::HashMap, pin::Pin, sync::Arc, task::Context, task::Poll}; +use futures::{prelude::*, channel::mpsc, channel::oneshot}; use parking_lot::Mutex; use sp_blockchain::Error as ClientError; use sc_client_api::{Fetcher, FetchChecker, RemoteHeaderRequest, @@ -84,22 +82,22 @@ impl Fetcher for OnDemand where B: BlockT, B::Header: HeaderT, { - type RemoteHeaderResult = Compat01As03>; - type RemoteReadResult = Compat01As03, Option>>>>; - type RemoteCallResult = Compat01As03>>; - type RemoteChangesResult = Compat01As03, u32)>>>; - type RemoteBodyResult = Compat01As03>>; + type RemoteHeaderResult = RemoteResponse; + type RemoteReadResult = RemoteResponse, Option>>>; + type RemoteCallResult = RemoteResponse>; + type RemoteChangesResult = RemoteResponse, u32)>>; + type RemoteBodyResult = RemoteResponse>; fn remote_header(&self, request: RemoteHeaderRequest) -> Self::RemoteHeaderResult { let (sender, receiver) = oneshot::channel(); let _ = self.requests_send.unbounded_send(RequestData::RemoteHeader(request, sender)); - RemoteResponse { receiver }.compat() + RemoteResponse { receiver } } fn remote_read(&self, request: RemoteReadRequest) -> Self::RemoteReadResult { let (sender, receiver) = oneshot::channel(); let _ = self.requests_send.unbounded_send(RequestData::RemoteRead(request, sender)); - RemoteResponse { receiver }.compat() + RemoteResponse { receiver } } fn remote_read_child( @@ -108,25 +106,25 @@ impl Fetcher for OnDemand where ) -> Self::RemoteReadResult { let (sender, receiver) = oneshot::channel(); let _ = self.requests_send.unbounded_send(RequestData::RemoteReadChild(request, sender)); - RemoteResponse { receiver }.compat() + RemoteResponse { receiver } } fn remote_call(&self, request: RemoteCallRequest) -> Self::RemoteCallResult { let (sender, receiver) = oneshot::channel(); let _ = self.requests_send.unbounded_send(RequestData::RemoteCall(request, sender)); - RemoteResponse { receiver }.compat() + RemoteResponse { receiver } } fn remote_changes(&self, request: RemoteChangesRequest) -> Self::RemoteChangesResult { let (sender, receiver) = oneshot::channel(); let _ = self.requests_send.unbounded_send(RequestData::RemoteChanges(request, sender)); - RemoteResponse { receiver }.compat() + RemoteResponse { receiver } } fn remote_body(&self, request: RemoteBodyRequest) -> Self::RemoteBodyResult { let (sender, receiver) = oneshot::channel(); let _ = self.requests_send.unbounded_send(RequestData::RemoteBody(request, sender)); - RemoteResponse { receiver }.compat() + RemoteResponse { receiver } } } @@ -136,16 +134,13 @@ pub struct RemoteResponse { } impl Future for RemoteResponse { - type Item = T; - type Error = ClientError; + type Output = Result; - fn poll(&mut self) -> Poll { - self.receiver.poll() - .map_err(|_| ClientError::RemoteFetchCancelled.into()) - .and_then(|r| match r { - Async::Ready(Ok(ready)) => Ok(Async::Ready(ready)), - Async::Ready(Err(error)) => Err(error), - Async::NotReady => Ok(Async::NotReady), - }) + fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll { + match self.receiver.poll_unpin(cx) { + Poll::Ready(Ok(res)) => Poll::Ready(res), + Poll::Ready(Err(_)) => Poll::Ready(Err(From::from(ClientError::RemoteFetchCancelled))), + Poll::Pending => Poll::Pending, + } } } diff --git a/substrate/client/network/src/protocol.rs b/substrate/client/network/src/protocol.rs index 9287312f09..983cdd25a8 100644 --- a/substrate/client/network/src/protocol.rs +++ b/substrate/client/network/src/protocol.rs @@ -19,7 +19,6 @@ use legacy_proto::{LegacyProto, LegacyProtoOut}; use crate::utils::interval; use bytes::{Bytes, BytesMut}; use futures::prelude::*; -use futures03::{StreamExt as _, TryStreamExt as _}; use libp2p::{Multiaddr, PeerId}; use libp2p::core::{ConnectedPoint, nodes::Substream, muxing::StreamMuxerBox}; use libp2p::swarm::{ProtocolsHandler, IntoProtocolsHandler}; @@ -47,7 +46,7 @@ use rustc_hex::ToHex; use std::collections::{BTreeMap, HashMap, HashSet}; use std::sync::Arc; use std::fmt::Write; -use std::{cmp, num::NonZeroUsize, time}; +use std::{cmp, num::NonZeroUsize, pin::Pin, task::Poll, time}; use log::{log, Level, trace, debug, warn, error}; use crate::chain::{Client, FinalityProofProvider}; use sc_client_api::{FetchChecker, ChangesProof, StorageProof}; @@ -124,9 +123,9 @@ mod rep { // Lock must always be taken in order declared here. pub struct Protocol, H: ExHashT> { /// Interval at which we call `tick`. - tick_timeout: Box + Send>, + tick_timeout: Pin + Send>>, /// Interval at which we call `propagate_extrinsics`. - propagate_timeout: Box + Send>, + propagate_timeout: Pin + Send>>, config: ProtocolConfig, /// Handler for light client requests. light_dispatch: LightDispatch, @@ -464,8 +463,8 @@ impl, H: ExHashT> Protocol { let behaviour = LegacyProto::new(protocol_id, versions, peerset); let protocol = Protocol { - tick_timeout: Box::new(interval(TICK_TIMEOUT).map(|v| Ok::<_, ()>(v)).compat()), - propagate_timeout: Box::new(interval(PROPAGATE_TIMEOUT).map(|v| Ok::<_, ()>(v)).compat()), + tick_timeout: Box::pin(interval(TICK_TIMEOUT)), + propagate_timeout: Box::pin(interval(PROPAGATE_TIMEOUT)), config, context_data: ContextData { peers: HashMap::new(), @@ -1884,18 +1883,19 @@ Protocol { fn poll( &mut self, + cx: &mut std::task::Context, params: &mut impl PollParameters, - ) -> Async< + ) -> Poll< NetworkBehaviourAction< <::Handler as ProtocolsHandler>::InEvent, Self::OutEvent > > { - while let Ok(Async::Ready(_)) = self.tick_timeout.poll() { + while let Poll::Ready(Some(())) = self.tick_timeout.poll_next_unpin(cx) { self.tick(); } - while let Ok(Async::Ready(_)) = self.propagate_timeout.poll() { + while let Poll::Ready(Some(())) = self.propagate_timeout.poll_next_unpin(cx) { self.propagate_extrinsics(); } @@ -1926,17 +1926,17 @@ Protocol { GenericMessage::FinalityProofRequest(r)) } - let event = match self.behaviour.poll(params) { - Async::NotReady => return Async::NotReady, - Async::Ready(NetworkBehaviourAction::GenerateEvent(ev)) => ev, - Async::Ready(NetworkBehaviourAction::DialAddress { address }) => - return Async::Ready(NetworkBehaviourAction::DialAddress { address }), - Async::Ready(NetworkBehaviourAction::DialPeer { peer_id }) => - return Async::Ready(NetworkBehaviourAction::DialPeer { peer_id }), - Async::Ready(NetworkBehaviourAction::SendEvent { peer_id, event }) => - return Async::Ready(NetworkBehaviourAction::SendEvent { peer_id, event }), - Async::Ready(NetworkBehaviourAction::ReportObservedAddr { address }) => - return Async::Ready(NetworkBehaviourAction::ReportObservedAddr { address }), + let event = match self.behaviour.poll(cx, params) { + Poll::Pending => return Poll::Pending, + Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)) => ev, + Poll::Ready(NetworkBehaviourAction::DialAddress { address }) => + return Poll::Ready(NetworkBehaviourAction::DialAddress { address }), + Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id }) => + return Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id }), + Poll::Ready(NetworkBehaviourAction::SendEvent { peer_id, event }) => + return Poll::Ready(NetworkBehaviourAction::SendEvent { peer_id, event }), + Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }) => + return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }), }; let outcome = match event { @@ -1970,9 +1970,9 @@ Protocol { }; if let CustomMessageOutcome::None = outcome { - Async::NotReady + Poll::Pending } else { - Async::Ready(NetworkBehaviourAction::GenerateEvent(outcome)) + Poll::Ready(NetworkBehaviourAction::GenerateEvent(outcome)) } } diff --git a/substrate/client/network/src/protocol/legacy_proto/behaviour.rs b/substrate/client/network/src/protocol/legacy_proto/behaviour.rs index a69622a6b3..b4047f320a 100644 --- a/substrate/client/network/src/protocol/legacy_proto/behaviour.rs +++ b/substrate/client/network/src/protocol/legacy_proto/behaviour.rs @@ -20,7 +20,6 @@ use crate::protocol::legacy_proto::upgrade::RegisteredProtocol; use bytes::BytesMut; use fnv::FnvHashMap; use futures::prelude::*; -use futures03::{compat::Compat, TryFutureExt as _, StreamExt as _, TryStreamExt as _}; use libp2p::core::{ConnectedPoint, Multiaddr, PeerId}; use libp2p::swarm::{NetworkBehaviour, NetworkBehaviourAction, PollParameters}; use log::{debug, error, trace, warn}; @@ -28,7 +27,7 @@ use rand::distributions::{Distribution as _, Uniform}; use smallvec::SmallVec; use std::{borrow::Cow, collections::hash_map::Entry, cmp, error, marker::PhantomData, mem, pin::Pin}; use std::time::{Duration, Instant}; -use tokio_io::{AsyncRead, AsyncWrite}; +use std::task::{Context, Poll}; /// Network behaviour that handles opening substreams for custom protocols with other nodes. /// @@ -103,7 +102,7 @@ enum PeerState { /// The peerset requested that we connect to this peer. We are not connected to this node. PendingRequest { /// When to actually start dialing. - timer: Compat, + timer: futures_timer::Delay, /// When the `timer` will trigger. timer_deadline: Instant, }, @@ -135,7 +134,7 @@ enum PeerState { /// state mismatch. open: bool, /// When to enable this remote. - timer: Compat, + timer: futures_timer::Delay, /// When the `timer` will trigger. timer_deadline: Instant, }, @@ -388,7 +387,7 @@ impl LegacyProto { debug!(target: "sub-libp2p", "PSM => Connect({:?}): Will start to connect at \ until {:?}", occ_entry.key(), until); *occ_entry.into_mut() = PeerState::PendingRequest { - timer: futures_timer::Delay::new_at(until.clone()).compat(), + timer: futures_timer::Delay::new_at(until.clone()), timer_deadline: until.clone(), }; }, @@ -407,7 +406,7 @@ impl LegacyProto { *occ_entry.into_mut() = PeerState::DisabledPendingEnable { connected_point: connected_point.clone(), open, - timer: futures_timer::Delay::new_at(banned.clone()).compat(), + timer: futures_timer::Delay::new_at(banned.clone()), timer_deadline: banned.clone(), }; }, @@ -616,7 +615,7 @@ impl DiscoveryNetBehaviour for LegacyProto { impl NetworkBehaviour for LegacyProto where - TSubstream: AsyncRead + AsyncWrite, + TSubstream: AsyncRead + AsyncWrite + Unpin, { type ProtocolsHandler = CustomProtoHandlerProto; type OutEvent = LegacyProtoOut; @@ -951,8 +950,9 @@ where fn poll( &mut self, + cx: &mut Context, _params: &mut impl PollParameters, - ) -> Async< + ) -> Poll< NetworkBehaviourAction< CustomProtoHandlerIn, Self::OutEvent, @@ -961,38 +961,31 @@ where // Poll for instructions from the peerset. // Note that the peerset is a *best effort* crate, and we have to use defensive programming. loop { - let mut peerset01 = futures03::stream::poll_fn(|cx| - futures03::Stream::poll_next(Pin::new(&mut self.peerset), cx) - ).map(|v| Ok::<_, ()>(v)).compat(); - match peerset01.poll() { - Ok(Async::Ready(Some(sc_peerset::Message::Accept(index)))) => { + match futures::Stream::poll_next(Pin::new(&mut self.peerset), cx) { + Poll::Ready(Some(sc_peerset::Message::Accept(index))) => { self.peerset_report_accept(index); } - Ok(Async::Ready(Some(sc_peerset::Message::Reject(index)))) => { + Poll::Ready(Some(sc_peerset::Message::Reject(index))) => { self.peerset_report_reject(index); } - Ok(Async::Ready(Some(sc_peerset::Message::Connect(id)))) => { + Poll::Ready(Some(sc_peerset::Message::Connect(id))) => { self.peerset_report_connect(id); } - Ok(Async::Ready(Some(sc_peerset::Message::Drop(id)))) => { + Poll::Ready(Some(sc_peerset::Message::Drop(id))) => { self.peerset_report_disconnect(id); } - Ok(Async::Ready(None)) => { + Poll::Ready(None) => { error!(target: "sub-libp2p", "Peerset receiver stream has returned None"); break; } - Ok(Async::NotReady) => break, - Err(err) => { - error!(target: "sub-libp2p", "Peerset receiver stream has errored: {:?}", err); - break - } + Poll::Pending => break, } } for (peer_id, peer_state) in self.peers.iter_mut() { match mem::replace(peer_state, PeerState::Poisoned) { PeerState::PendingRequest { mut timer, timer_deadline } => { - if let Ok(Async::NotReady) = timer.poll() { + if let Poll::Pending = Pin::new(&mut timer).poll(cx) { *peer_state = PeerState::PendingRequest { timer, timer_deadline }; continue; } @@ -1003,7 +996,7 @@ where } PeerState::DisabledPendingEnable { mut timer, connected_point, open, timer_deadline } => { - if let Ok(Async::NotReady) = timer.poll() { + if let Poll::Pending = Pin::new(&mut timer).poll(cx) { *peer_state = PeerState::DisabledPendingEnable { timer, connected_point, @@ -1026,9 +1019,9 @@ where } if !self.events.is_empty() { - return Async::Ready(self.events.remove(0)) + return Poll::Ready(self.events.remove(0)) } - Async::NotReady + Poll::Pending } } diff --git a/substrate/client/network/src/protocol/legacy_proto/handler.rs b/substrate/client/network/src/protocol/legacy_proto/handler.rs index 142f84d7f5..f042d1b889 100644 --- a/substrate/client/network/src/protocol/legacy_proto/handler.rs +++ b/substrate/client/network/src/protocol/legacy_proto/handler.rs @@ -17,7 +17,6 @@ use super::upgrade::{RegisteredProtocol, RegisteredProtocolEvent, RegisteredProtocolSubstream}; use bytes::BytesMut; use futures::prelude::*; -use futures03::{compat::Compat, TryFutureExt as _}; use futures_timer::Delay; use libp2p::core::{ConnectedPoint, PeerId, Endpoint}; use libp2p::core::upgrade::{InboundUpgrade, OutboundUpgrade}; @@ -31,7 +30,7 @@ use libp2p::swarm::{ use log::{debug, error}; use smallvec::{smallvec, SmallVec}; use std::{borrow::Cow, error, fmt, io, marker::PhantomData, mem, time::Duration}; -use tokio_io::{AsyncRead, AsyncWrite}; +use std::{pin::Pin, task::{Context, Poll}}; /// Implements the `IntoProtocolsHandler` trait of libp2p. /// @@ -97,7 +96,7 @@ pub struct CustomProtoHandlerProto { impl CustomProtoHandlerProto where - TSubstream: AsyncRead + AsyncWrite, + TSubstream: AsyncRead + AsyncWrite + Unpin, { /// Builds a new `CustomProtoHandlerProto`. pub fn new(protocol: RegisteredProtocol) -> Self { @@ -110,7 +109,7 @@ where impl IntoProtocolsHandler for CustomProtoHandlerProto where - TSubstream: AsyncRead + AsyncWrite, + TSubstream: AsyncRead + AsyncWrite + Unpin, { type Handler = CustomProtoHandler; @@ -125,7 +124,7 @@ where remote_peer_id: remote_peer_id.clone(), state: ProtocolState::Init { substreams: SmallVec::new(), - init_deadline: Delay::new(Duration::from_secs(5)).compat() + init_deadline: Delay::new(Duration::from_secs(5)) }, events_queue: SmallVec::new(), } @@ -152,7 +151,7 @@ pub struct CustomProtoHandler { /// /// This queue must only ever be modified to insert elements at the back, or remove the first /// element. - events_queue: SmallVec<[ProtocolsHandlerEvent; 16]>, + events_queue: SmallVec<[ProtocolsHandlerEvent; 16]>, } /// State of the handler. @@ -162,14 +161,14 @@ enum ProtocolState { /// List of substreams opened by the remote but that haven't been processed yet. substreams: SmallVec<[RegisteredProtocolSubstream; 6]>, /// Deadline after which the initialization is abnormally long. - init_deadline: Compat, + init_deadline: Delay, }, /// Handler is opening a substream in order to activate itself. /// If we are in this state, we haven't sent any `CustomProtocolOpen` yet. Opening { /// Deadline after which the opening is abnormally long. - deadline: Compat, + deadline: Delay, }, /// Normal operating mode. Contains the substreams that are open. @@ -260,7 +259,7 @@ pub enum CustomProtoHandlerOut { impl CustomProtoHandler where - TSubstream: AsyncRead + AsyncWrite, + TSubstream: AsyncRead + AsyncWrite + Unpin, { /// Enables the handler. fn enable(&mut self) { @@ -280,7 +279,7 @@ where }); } ProtocolState::Opening { - deadline: Delay::new(Duration::from_secs(60)).compat() + deadline: Delay::new(Duration::from_secs(60)) } } else { @@ -337,8 +336,8 @@ where /// Polls the state for events. Optionally returns an event to produce. #[must_use] - fn poll_state(&mut self) - -> Option> { + fn poll_state(&mut self, cx: &mut Context) + -> Option> { match mem::replace(&mut self.state, ProtocolState::Poisoned) { ProtocolState::Poisoned => { error!(target: "sub-libp2p", "Handler with {:?} is in poisoned state", @@ -348,14 +347,14 @@ where } ProtocolState::Init { substreams, mut init_deadline } => { - match init_deadline.poll() { - Ok(Async::Ready(())) => { - init_deadline = Delay::new(Duration::from_secs(60)).compat(); + match Pin::new(&mut init_deadline).poll(cx) { + Poll::Ready(Ok(())) => { + init_deadline = Delay::new(Duration::from_secs(60)); error!(target: "sub-libp2p", "Handler initialization process is too long \ with {:?}", self.remote_peer_id) }, - Ok(Async::NotReady) => {} - Err(_) => error!(target: "sub-libp2p", "Tokio timer has errored") + Poll::Pending => {} + Poll::Ready(Err(_)) => error!(target: "sub-libp2p", "Tokio timer has errored") } self.state = ProtocolState::Init { substreams, init_deadline }; @@ -363,9 +362,9 @@ where } ProtocolState::Opening { mut deadline } => { - match deadline.poll() { - Ok(Async::Ready(())) => { - deadline = Delay::new(Duration::from_secs(60)).compat(); + match Pin::new(&mut deadline).poll(cx) { + Poll::Ready(Ok(())) => { + deadline = Delay::new(Duration::from_secs(60)); let event = CustomProtoHandlerOut::ProtocolError { is_severe: true, error: "Timeout when opening protocol".to_string().into(), @@ -373,13 +372,13 @@ where self.state = ProtocolState::Opening { deadline }; Some(ProtocolsHandlerEvent::Custom(event)) }, - Ok(Async::NotReady) => { + Poll::Pending => { self.state = ProtocolState::Opening { deadline }; None }, - Err(_) => { + Poll::Ready(Err(_)) => { error!(target: "sub-libp2p", "Tokio timer has errored"); - deadline = Delay::new(Duration::from_secs(60)).compat(); + deadline = Delay::new(Duration::from_secs(60)); self.state = ProtocolState::Opening { deadline }; None }, @@ -389,9 +388,9 @@ where ProtocolState::Normal { mut substreams, mut shutdown } => { for n in (0..substreams.len()).rev() { let mut substream = substreams.swap_remove(n); - match substream.poll() { - Ok(Async::NotReady) => substreams.push(substream), - Ok(Async::Ready(Some(RegisteredProtocolEvent::Message(message)))) => { + match Pin::new(&mut substream).poll_next(cx) { + Poll::Pending => substreams.push(substream), + Poll::Ready(Some(Ok(RegisteredProtocolEvent::Message(message)))) => { let event = CustomProtoHandlerOut::CustomMessage { message }; @@ -399,7 +398,7 @@ where self.state = ProtocolState::Normal { substreams, shutdown }; return Some(ProtocolsHandlerEvent::Custom(event)); }, - Ok(Async::Ready(Some(RegisteredProtocolEvent::Clogged { messages }))) => { + Poll::Ready(Some(Ok(RegisteredProtocolEvent::Clogged { messages }))) => { let event = CustomProtoHandlerOut::Clogged { messages, }; @@ -407,7 +406,7 @@ where self.state = ProtocolState::Normal { substreams, shutdown }; return Some(ProtocolsHandlerEvent::Custom(event)); } - Ok(Async::Ready(None)) => { + Poll::Ready(None) => { shutdown.push(substream); if substreams.is_empty() { let event = CustomProtoHandlerOut::CustomProtocolClosed { @@ -420,7 +419,7 @@ where return Some(ProtocolsHandlerEvent::Custom(event)); } } - Err(err) => { + Poll::Ready(Some(Err(err))) => { if substreams.is_empty() { let event = CustomProtoHandlerOut::CustomProtocolClosed { reason: format!("Error on the last substream: {:?}", err).into(), @@ -443,12 +442,12 @@ where } ProtocolState::Disabled { mut shutdown, reenable } => { - shutdown_list(&mut shutdown); + shutdown_list(&mut shutdown, cx); // If `reenable` is `true`, that means we should open the substreams system again // after all the substreams are closed. if reenable && shutdown.is_empty() { self.state = ProtocolState::Opening { - deadline: Delay::new(Duration::from_secs(60)).compat() + deadline: Delay::new(Duration::from_secs(60)) }; Some(ProtocolsHandlerEvent::OutboundSubstreamRequest { protocol: SubstreamProtocol::new(self.protocol.clone()), @@ -524,7 +523,7 @@ where } impl ProtocolsHandler for CustomProtoHandler -where TSubstream: AsyncRead + AsyncWrite { +where TSubstream: AsyncRead + AsyncWrite + Unpin { type InEvent = CustomProtoHandlerIn; type OutEvent = CustomProtoHandlerOut; type Substream = TSubstream; @@ -585,33 +584,33 @@ where TSubstream: AsyncRead + AsyncWrite { fn poll( &mut self, + cx: &mut Context, ) -> Poll< - ProtocolsHandlerEvent, - Self::Error, + ProtocolsHandlerEvent > { // Flush the events queue if necessary. if !self.events_queue.is_empty() { let event = self.events_queue.remove(0); - return Ok(Async::Ready(event)) + return Poll::Ready(event) } // Kill the connection if needed. if let ProtocolState::KillAsap = self.state { - return Err(ConnectionKillError); + return Poll::Ready(ProtocolsHandlerEvent::Close(ConnectionKillError)); } // Process all the substreams. - if let Some(event) = self.poll_state() { - return Ok(Async::Ready(event)) + if let Some(event) = self.poll_state(cx) { + return Poll::Ready(event) } - Ok(Async::NotReady) + Poll::Pending } } impl fmt::Debug for CustomProtoHandler where - TSubstream: AsyncRead + AsyncWrite, + TSubstream: AsyncRead + AsyncWrite + Unpin, { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { f.debug_struct("CustomProtoHandler") @@ -622,15 +621,16 @@ where /// Given a list of substreams, tries to shut them down. The substreams that have been successfully /// shut down are removed from the list. fn shutdown_list - (list: &mut SmallVec>>) -where TSubstream: AsyncRead + AsyncWrite { + (list: &mut SmallVec>>, + cx: &mut Context) +where TSubstream: AsyncRead + AsyncWrite + Unpin { 'outer: for n in (0..list.len()).rev() { let mut substream = list.swap_remove(n); loop { - match substream.poll() { - Ok(Async::Ready(Some(_))) => {} - Ok(Async::NotReady) => break, - Err(_) | Ok(Async::Ready(None)) => continue 'outer, + match substream.poll_next_unpin(cx) { + Poll::Ready(Some(Ok(_))) => {} + Poll::Pending => break, + Poll::Ready(Some(Err(_))) | Poll::Ready(None) => continue 'outer, } } list.push(substream); diff --git a/substrate/client/network/src/protocol/legacy_proto/tests.rs b/substrate/client/network/src/protocol/legacy_proto/tests.rs index a57c4dd7c8..6a2174f30c 100644 --- a/substrate/client/network/src/protocol/legacy_proto/tests.rs +++ b/substrate/client/network/src/protocol/legacy_proto/tests.rs @@ -16,7 +16,7 @@ #![cfg(test)] -use futures::{future, prelude::*, try_ready}; +use futures::{prelude::*, ready}; use codec::{Encode, Decode}; use libp2p::core::nodes::Substream; use libp2p::core::{ConnectedPoint, transport::boxed::Boxed, muxing::StreamMuxerBox}; @@ -24,7 +24,7 @@ use libp2p::swarm::{Swarm, ProtocolsHandler, IntoProtocolsHandler}; use libp2p::swarm::{PollParameters, NetworkBehaviour, NetworkBehaviourAction}; use libp2p::{PeerId, Multiaddr, Transport}; use rand::seq::SliceRandom; -use std::{io, time::Duration, time::Instant}; +use std::{io, task::Context, task::Poll, time::Duration}; use crate::message::Message; use crate::protocol::legacy_proto::{LegacyProto, LegacyProtoOut}; use sp_test_primitives::Block; @@ -62,7 +62,7 @@ fn build_nodes() endpoint, libp2p::core::upgrade::Version::V1 ) - .map(|muxer| (peer_id, libp2p::core::muxing::StreamMuxerBox::new(muxer))) + .map_ok(|muxer| (peer_id, libp2p::core::muxing::StreamMuxerBox::new(muxer))) }) .timeout(Duration::from_secs(20)) .map_err(|err| io::Error::new(io::ErrorKind::Other, err)) @@ -170,14 +170,15 @@ impl NetworkBehaviour for CustomProtoWithAddr { fn poll( &mut self, + cx: &mut Context, params: &mut impl PollParameters - ) -> Async< + ) -> Poll< NetworkBehaviourAction< <::Handler as ProtocolsHandler>::InEvent, Self::OutEvent > > { - self.inner.poll(params) + self.inner.poll(cx, params) } fn inject_replaced(&mut self, peer_id: PeerId, closed_endpoint: ConnectedPoint, new_endpoint: ConnectedPoint) { @@ -216,9 +217,9 @@ fn two_nodes_transfer_lots_of_packets() { let (mut service1, mut service2) = build_nodes(); - let fut1 = future::poll_fn(move || -> io::Result<_> { + let fut1 = future::poll_fn(move |cx| -> Poll<()> { loop { - match try_ready!(service1.poll()) { + match ready!(service1.poll_next_unpin(cx)) { Some(LegacyProtoOut::CustomProtocolOpen { peer_id, .. }) => { for n in 0 .. NUM_PACKETS { service1.send_packet( @@ -233,9 +234,9 @@ fn two_nodes_transfer_lots_of_packets() { }); let mut packet_counter = 0u32; - let fut2 = future::poll_fn(move || -> io::Result<_> { + let fut2 = future::poll_fn(move |cx| { loop { - match try_ready!(service2.poll()) { + match ready!(service2.poll_next_unpin(cx)) { Some(LegacyProtoOut::CustomProtocolOpen { .. }) => {}, Some(LegacyProtoOut::CustomMessage { message, .. }) => { match Message::::decode(&mut &message[..]).unwrap() { @@ -243,7 +244,7 @@ fn two_nodes_transfer_lots_of_packets() { assert_eq!(message.len(), 1); packet_counter += 1; if packet_counter == NUM_PACKETS { - return Ok(Async::Ready(())) + return Poll::Ready(()) } }, _ => panic!(), @@ -254,8 +255,9 @@ fn two_nodes_transfer_lots_of_packets() { } }); - let combined = fut1.select(fut2).map_err(|(err, _)| err); - let _ = tokio::runtime::Runtime::new().unwrap().block_on(combined).unwrap(); + futures::executor::block_on(async move { + future::select(fut1, fut2).await; + }); } #[test] @@ -277,9 +279,9 @@ fn basic_two_nodes_requests_in_parallel() { let mut to_receive = to_send.clone(); to_send.shuffle(&mut rand::thread_rng()); - let fut1 = future::poll_fn(move || -> io::Result<_> { + let fut1 = future::poll_fn(move |cx| -> Poll<()> { loop { - match try_ready!(service1.poll()) { + match ready!(service1.poll_next_unpin(cx)) { Some(LegacyProtoOut::CustomProtocolOpen { peer_id, .. }) => { for msg in to_send.drain(..) { service1.send_packet(&peer_id, msg.encode()); @@ -290,15 +292,15 @@ fn basic_two_nodes_requests_in_parallel() { } }); - let fut2 = future::poll_fn(move || -> io::Result<_> { + let fut2 = future::poll_fn(move |cx| { loop { - match try_ready!(service2.poll()) { + match ready!(service2.poll_next_unpin(cx)) { Some(LegacyProtoOut::CustomProtocolOpen { .. }) => {}, Some(LegacyProtoOut::CustomMessage { message, .. }) => { let pos = to_receive.iter().position(|m| m.encode() == message).unwrap(); to_receive.remove(pos); if to_receive.is_empty() { - return Ok(Async::Ready(())) + return Poll::Ready(()) } } _ => panic!(), @@ -306,8 +308,9 @@ fn basic_two_nodes_requests_in_parallel() { } }); - let combined = fut1.select(fut2).map_err(|(err, _)| err); - let _ = tokio::runtime::Runtime::new().unwrap().block_on_all(combined).unwrap(); + futures::executor::block_on(async move { + future::select(fut1, fut2).await; + }); } #[test] @@ -317,9 +320,6 @@ fn reconnect_after_disconnect() { let (mut service1, mut service2) = build_nodes(); - // We use the `current_thread` runtime because it doesn't require us to have `'static` futures. - let mut runtime = tokio::runtime::current_thread::Runtime::new().unwrap(); - // For this test, the services can be in the following states. #[derive(Debug, Copy, Clone, PartialEq, Eq)] enum ServiceState { NotConnected, FirstConnec, Disconnected, ConnectedAgain } @@ -327,12 +327,12 @@ fn reconnect_after_disconnect() { let mut service2_state = ServiceState::NotConnected; // Run the events loops. - runtime.block_on(future::poll_fn(|| -> Result<_, io::Error> { + futures::executor::block_on(future::poll_fn(|cx| -> Poll> { loop { let mut service1_not_ready = false; - match service1.poll().unwrap() { - Async::Ready(Some(LegacyProtoOut::CustomProtocolOpen { .. })) => { + match service1.poll_next_unpin(cx) { + Poll::Ready(Some(LegacyProtoOut::CustomProtocolOpen { .. })) => { match service1_state { ServiceState::NotConnected => { service1_state = ServiceState::FirstConnec; @@ -344,19 +344,19 @@ fn reconnect_after_disconnect() { ServiceState::FirstConnec | ServiceState::ConnectedAgain => panic!(), } }, - Async::Ready(Some(LegacyProtoOut::CustomProtocolClosed { .. })) => { + Poll::Ready(Some(LegacyProtoOut::CustomProtocolClosed { .. })) => { match service1_state { ServiceState::FirstConnec => service1_state = ServiceState::Disconnected, ServiceState::ConnectedAgain| ServiceState::NotConnected | ServiceState::Disconnected => panic!(), } }, - Async::NotReady => service1_not_ready = true, + Poll::Pending => service1_not_ready = true, _ => panic!() } - match service2.poll().unwrap() { - Async::Ready(Some(LegacyProtoOut::CustomProtocolOpen { .. })) => { + match service2.poll_next_unpin(cx) { + Poll::Ready(Some(LegacyProtoOut::CustomProtocolOpen { .. })) => { match service2_state { ServiceState::NotConnected => { service2_state = ServiceState::FirstConnec; @@ -368,43 +368,43 @@ fn reconnect_after_disconnect() { ServiceState::FirstConnec | ServiceState::ConnectedAgain => panic!(), } }, - Async::Ready(Some(LegacyProtoOut::CustomProtocolClosed { .. })) => { + Poll::Ready(Some(LegacyProtoOut::CustomProtocolClosed { .. })) => { match service2_state { ServiceState::FirstConnec => service2_state = ServiceState::Disconnected, ServiceState::ConnectedAgain| ServiceState::NotConnected | ServiceState::Disconnected => panic!(), } }, - Async::NotReady if service1_not_ready => break, - Async::NotReady => {} + Poll::Pending if service1_not_ready => break, + Poll::Pending => {} _ => panic!() } } if service1_state == ServiceState::ConnectedAgain && service2_state == ServiceState::ConnectedAgain { - Ok(Async::Ready(())) + Poll::Ready(Ok(())) } else { - Ok(Async::NotReady) + Poll::Pending } })).unwrap(); // Do a second 3-seconds run to make sure we don't get disconnected immediately again. - let mut delay = tokio::timer::Delay::new(Instant::now() + Duration::from_secs(3)); - runtime.block_on(future::poll_fn(|| -> Result<_, io::Error> { - match service1.poll().unwrap() { - Async::NotReady => {}, + let mut delay = futures_timer::Delay::new(Duration::from_secs(3)); + futures::executor::block_on(future::poll_fn(|cx| -> Poll> { + match service1.poll_next_unpin(cx) { + Poll::Pending => {}, _ => panic!() } - match service2.poll().unwrap() { - Async::NotReady => {}, + match service2.poll_next_unpin(cx) { + Poll::Pending => {}, _ => panic!() } - if let Async::Ready(()) = delay.poll().unwrap() { - Ok(Async::Ready(())) + if let Poll::Ready(Ok(_)) = delay.poll_unpin(cx) { + Poll::Ready(Ok(())) } else { - Ok(Async::NotReady) + Poll::Pending } })).unwrap(); } diff --git a/substrate/client/network/src/protocol/legacy_proto/upgrade.rs b/substrate/client/network/src/protocol/legacy_proto/upgrade.rs index a5eef85580..c021d5917f 100644 --- a/substrate/client/network/src/protocol/legacy_proto/upgrade.rs +++ b/substrate/client/network/src/protocol/legacy_proto/upgrade.rs @@ -15,12 +15,12 @@ // along with Substrate. If not, see . use crate::config::ProtocolId; -use bytes::{Bytes, BytesMut}; +use bytes::BytesMut; +use futures::prelude::*; +use futures_codec::Framed; use libp2p::core::{Negotiated, Endpoint, UpgradeInfo, InboundUpgrade, OutboundUpgrade, upgrade::ProtocolName}; -use libp2p::tokio_codec::Framed; -use std::{collections::VecDeque, io, vec::IntoIter as VecIntoIter}; -use futures::{prelude::*, future, stream}; -use tokio_io::{AsyncRead, AsyncWrite}; +use std::{collections::VecDeque, io, pin::Pin, vec::IntoIter as VecIntoIter}; +use std::task::{Context, Poll}; use unsigned_varint::codec::UviBytes; /// Connection upgrade for a single protocol. @@ -32,7 +32,7 @@ pub struct RegisteredProtocol { id: ProtocolId, /// Base name of the protocol as advertised on the network. /// Ends with `/` so that we can append a version number behind. - base_name: Bytes, + base_name: Vec, /// List of protocol versions that we support. /// Ordered in descending order so that the best comes first. supported_versions: Vec, @@ -44,7 +44,7 @@ impl RegisteredProtocol { pub fn new(protocol: impl Into, versions: &[u8]) -> Self { let protocol = protocol.into(); - let mut base_name = Bytes::from_static(b"/substrate/"); + let mut base_name = b"/substrate/".to_vec(); base_name.extend_from_slice(protocol.as_bytes()); base_name.extend_from_slice(b"/"); @@ -78,11 +78,11 @@ pub struct RegisteredProtocolSubstream { /// the remote (listener). endpoint: Endpoint, /// Buffer of packets to send. - send_queue: VecDeque>, + send_queue: VecDeque, /// If true, we should call `poll_complete` on the inner sink. - requires_poll_complete: bool, + requires_poll_flush: bool, /// The underlying substream. - inner: stream::Fuse, UviBytes>>>, + inner: stream::Fuse, UviBytes>>, /// Version of the protocol that was negotiated. protocol_version: u8, /// If true, we have sent a "remote is clogged" event recently and shouldn't send another one @@ -119,7 +119,7 @@ impl RegisteredProtocolSubstream { return } - self.send_queue.push_back(data); + self.send_queue.push_back(From::from(&data[..])); } } @@ -138,25 +138,31 @@ pub enum RegisteredProtocolEvent { } impl Stream for RegisteredProtocolSubstream -where TSubstream: AsyncRead + AsyncWrite { - type Item = RegisteredProtocolEvent; - type Error = io::Error; +where TSubstream: AsyncRead + AsyncWrite + Unpin { + type Item = Result; - fn poll(&mut self) -> Poll, Self::Error> { + fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll> { // Flushing the local queue. - while let Some(packet) = self.send_queue.pop_front() { - match self.inner.start_send(packet)? { - AsyncSink::NotReady(packet) => { - self.send_queue.push_front(packet); - break - }, - AsyncSink::Ready => self.requires_poll_complete = true, + while !self.send_queue.is_empty() { + match Pin::new(&mut self.inner).poll_ready(cx) { + Poll::Ready(Ok(())) => {}, + Poll::Ready(Err(err)) => return Poll::Ready(Some(Err(err))), + Poll::Pending => break, + } + + if let Some(packet) = self.send_queue.pop_front() { + Pin::new(&mut self.inner).start_send(packet)?; + self.requires_poll_flush = true; } } // If we are closing, close as soon as the Sink is closed. if self.is_closing { - return Ok(self.inner.close()?.map(|()| None)) + return match Pin::new(&mut self.inner).poll_close(cx) { + Poll::Pending => Poll::Pending, + Poll::Ready(Ok(_)) => Poll::Ready(None), + Poll::Ready(Err(err)) => Poll::Ready(Some(Err(err))), + } } // Indicating that the remote is clogged if that's the case. @@ -166,9 +172,9 @@ where TSubstream: AsyncRead + AsyncWrite { // if you remove the fuse, then we will always return early from this function and // thus never read any message from the network. self.clogged_fuse = true; - return Ok(Async::Ready(Some(RegisteredProtocolEvent::Clogged { + return Poll::Ready(Some(Ok(RegisteredProtocolEvent::Clogged { messages: self.send_queue.iter() - .map(|m| m.clone()) + .map(|m| m.clone().to_vec()) .collect(), }))) } @@ -177,25 +183,25 @@ where TSubstream: AsyncRead + AsyncWrite { } // Flushing if necessary. - if self.requires_poll_complete { - if let Async::Ready(()) = self.inner.poll_complete()? { - self.requires_poll_complete = false; + if self.requires_poll_flush { + if let Poll::Ready(()) = Pin::new(&mut self.inner).poll_flush(cx)? { + self.requires_poll_flush = false; } } // Receiving incoming packets. // Note that `inner` is wrapped in a `Fuse`, therefore we can poll it forever. - match self.inner.poll()? { - Async::Ready(Some(data)) => { - Ok(Async::Ready(Some(RegisteredProtocolEvent::Message(data)))) + match Pin::new(&mut self.inner).poll_next(cx)? { + Poll::Ready(Some(data)) => { + Poll::Ready(Some(Ok(RegisteredProtocolEvent::Message(data)))) } - Async::Ready(None) => - if !self.requires_poll_complete && self.send_queue.is_empty() { - Ok(Async::Ready(None)) + Poll::Ready(None) => + if !self.requires_poll_flush && self.send_queue.is_empty() { + Poll::Ready(None) } else { - Ok(Async::NotReady) + Poll::Pending } - Async::NotReady => Ok(Async::NotReady), + Poll::Pending => Poll::Pending, } } } @@ -224,7 +230,7 @@ impl UpgradeInfo for RegisteredProtocol { #[derive(Debug, Clone)] pub struct RegisteredProtocolName { /// Protocol name, as advertised on the wire. - name: Bytes, + name: Vec, /// Version number. Stored in string form in `name`, but duplicated here for easier retrieval. version: u8, } @@ -236,10 +242,10 @@ impl ProtocolName for RegisteredProtocolName { } impl InboundUpgrade for RegisteredProtocol -where TSubstream: AsyncRead + AsyncWrite, +where TSubstream: AsyncRead + AsyncWrite + Unpin, { type Output = RegisteredProtocolSubstream; - type Future = future::FutureResult; + type Future = future::Ready>; type Error = io::Error; fn upgrade_inbound( @@ -257,7 +263,7 @@ where TSubstream: AsyncRead + AsyncWrite, is_closing: false, endpoint: Endpoint::Listener, send_queue: VecDeque::new(), - requires_poll_complete: false, + requires_poll_flush: false, inner: framed.fuse(), protocol_version: info.version, clogged_fuse: false, @@ -266,7 +272,7 @@ where TSubstream: AsyncRead + AsyncWrite, } impl OutboundUpgrade for RegisteredProtocol -where TSubstream: AsyncRead + AsyncWrite, +where TSubstream: AsyncRead + AsyncWrite + Unpin, { type Output = >::Output; type Future = >::Future; @@ -283,7 +289,7 @@ where TSubstream: AsyncRead + AsyncWrite, is_closing: false, endpoint: Endpoint::Dialer, send_queue: VecDeque::new(), - requires_poll_complete: false, + requires_poll_flush: false, inner: framed.fuse(), protocol_version: info.version, clogged_fuse: false, diff --git a/substrate/client/network/src/protocol/light_dispatch.rs b/substrate/client/network/src/protocol/light_dispatch.rs index 6b446f2075..dd94abc2a4 100644 --- a/substrate/client/network/src/protocol/light_dispatch.rs +++ b/substrate/client/network/src/protocol/light_dispatch.rs @@ -23,7 +23,7 @@ use std::collections::{HashMap, VecDeque}; use std::sync::Arc; use std::time::{Instant, Duration}; use log::{trace, info}; -use futures::sync::oneshot::{Sender as OneShotSender}; +use futures::channel::oneshot::{Sender as OneShotSender}; use linked_hash_map::{Entry, LinkedHashMap}; use sp_blockchain::Error as ClientError; use sc_client_api::{FetchChecker, RemoteHeaderRequest, @@ -680,7 +680,7 @@ pub mod tests { use std::collections::{HashMap, HashSet}; use std::sync::Arc; use std::time::Instant; - use futures::{Future, sync::oneshot}; + use futures::channel::oneshot; use sp_core::storage::ChildInfo; use sp_runtime::traits::{Block as BlockT, NumberFor, Header as HeaderT}; use sp_blockchain::{Error as ClientError, Result as ClientResult}; @@ -999,7 +999,7 @@ pub mod tests { }, tx)); receive_call_response(&mut network_interface, &mut light_dispatch, peer0.clone(), 0); - assert_eq!(response.wait().unwrap().unwrap(), vec![42]); + assert_eq!(futures::executor::block_on(response).unwrap().unwrap(), vec![42]); } #[test] @@ -1021,7 +1021,10 @@ pub mod tests { id: 0, proof: StorageProof::empty(), }); - assert_eq!(response.wait().unwrap().unwrap().remove(b":key".as_ref()).unwrap(), Some(vec![42])); + assert_eq!( + futures::executor::block_on(response).unwrap().unwrap().remove(b":key".as_ref()).unwrap(), + Some(vec![42]) + ); } #[test] @@ -1049,7 +1052,7 @@ pub mod tests { id: 0, proof: StorageProof::empty(), }); - assert_eq!(response.wait().unwrap().unwrap().remove(b":key".as_ref()).unwrap(), Some(vec![42])); + assert_eq!(futures::executor::block_on(response).unwrap().unwrap().remove(b":key".as_ref()).unwrap(), Some(vec![42])); } #[test] @@ -1078,7 +1081,7 @@ pub mod tests { proof: StorageProof::empty(), }); assert_eq!( - response.wait().unwrap().unwrap().hash(), + futures::executor::block_on(response).unwrap().unwrap().hash(), "6443a0b46e0412e626363028115a9f2cf963eeed526b8b33e5316f08b50d0dc3".parse().unwrap(), ); } @@ -1109,7 +1112,7 @@ pub mod tests { roots: vec![], roots_proof: StorageProof::empty(), }); - assert_eq!(response.wait().unwrap().unwrap(), vec![(100, 2)]); + assert_eq!(futures::executor::block_on(response).unwrap().unwrap(), vec![(100, 2)]); } #[test] diff --git a/substrate/client/network/src/service.rs b/substrate/client/network/src/service.rs index 5f18a5c10c..4e923a51a1 100644 --- a/substrate/client/network/src/service.rs +++ b/substrate/client/network/src/service.rs @@ -27,11 +27,12 @@ use std::{collections::{HashMap, HashSet}, fs, marker::PhantomData, io, path::Path}; use std::sync::{Arc, atomic::{AtomicBool, AtomicUsize, Ordering}}; +use std::pin::Pin; +use std::task::Poll; use sp_consensus::import_queue::{ImportQueue, Link}; use sp_consensus::import_queue::{BlockImportResult, BlockImportError}; -use futures::{prelude::*, sync::mpsc}; -use futures03::TryFutureExt as _; +use futures::{prelude::*, channel::mpsc}; use log::{warn, error, info}; use libp2p::{PeerId, Multiaddr, kad::record}; use libp2p::core::{transport::boxed::Boxed, muxing::StreamMuxerBox}; @@ -216,7 +217,7 @@ impl, H: ExHashT> NetworkWorker params.network_config.client_version, params.network_config.node_name ); - let behaviour = Behaviour::new( + let behaviour = futures::executor::block_on(Behaviour::new( protocol, user_agent, local_public, @@ -229,7 +230,7 @@ impl, H: ExHashT> NetworkWorker TransportConfig::MemoryOnly => false, TransportConfig::Normal { allow_private_ipv4, .. } => allow_private_ipv4, }, - ); + )); let (transport, bandwidth) = { let (config_mem, config_wasm) = match params.network_config.transport { TransportConfig::MemoryOnly => (true, None), @@ -451,7 +452,7 @@ impl, H: ExHashT> NetworkServic /// If this method is called multiple times, the events are duplicated. /// /// The stream never ends (unless the `NetworkWorker` gets shut down). - pub fn event_stream(&self) -> impl Stream { + pub fn event_stream(&self) -> impl Stream { // Note: when transitioning to stable futures, remove the `Error` entirely let (tx, rx) = mpsc::unbounded(); let _ = self.to_worker.unbounded_send(ServiceToWorkerMsg::EventStream(tx)); @@ -711,106 +712,106 @@ pub struct NetworkWorker, H: Ex } impl, H: ExHashT> Future for NetworkWorker { - type Item = (); - type Error = io::Error; + type Output = Result<(), io::Error>; + + fn poll(mut self: Pin<&mut Self>, cx: &mut std::task::Context) -> Poll { + let this = &mut *self; - fn poll(&mut self) -> Poll { // Poll the import queue for actions to perform. - let _ = futures03::future::poll_fn(|cx| { - self.import_queue.poll_actions(cx, &mut NetworkLink { - protocol: &mut self.network_service, - }); - std::task::Poll::Pending::> - }).compat().poll(); + this.import_queue.poll_actions(cx, &mut NetworkLink { + protocol: &mut this.network_service, + }); // Check for new incoming light client requests. - if let Some(light_client_rqs) = self.light_client_rqs.as_mut() { - while let Ok(Async::Ready(Some(rq))) = light_client_rqs.poll() { - self.network_service.user_protocol_mut().add_light_client_request(rq); + if let Some(light_client_rqs) = this.light_client_rqs.as_mut() { + while let Poll::Ready(Some(rq)) = light_client_rqs.poll_next_unpin(cx) { + this.network_service.user_protocol_mut().add_light_client_request(rq); } } loop { // Process the next message coming from the `NetworkService`. - let msg = match self.from_worker.poll() { - Ok(Async::Ready(Some(msg))) => msg, - Ok(Async::Ready(None)) | Err(_) => return Ok(Async::Ready(())), - Ok(Async::NotReady) => break, + let msg = match this.from_worker.poll_next_unpin(cx) { + Poll::Ready(Some(msg)) => msg, + Poll::Ready(None) => return Poll::Ready(Ok(())), + Poll::Pending => break, }; match msg { ServiceToWorkerMsg::ExecuteWithSpec(task) => { - let protocol = self.network_service.user_protocol_mut(); + let protocol = this.network_service.user_protocol_mut(); let (mut context, spec) = protocol.specialization_lock(); task(spec, &mut context); }, ServiceToWorkerMsg::AnnounceBlock(hash, data) => - self.network_service.user_protocol_mut().announce_block(hash, data), + this.network_service.user_protocol_mut().announce_block(hash, data), ServiceToWorkerMsg::RequestJustification(hash, number) => - self.network_service.user_protocol_mut().request_justification(&hash, number), + this.network_service.user_protocol_mut().request_justification(&hash, number), ServiceToWorkerMsg::PropagateExtrinsics => - self.network_service.user_protocol_mut().propagate_extrinsics(), + this.network_service.user_protocol_mut().propagate_extrinsics(), ServiceToWorkerMsg::GetValue(key) => - self.network_service.get_value(&key), + this.network_service.get_value(&key), ServiceToWorkerMsg::PutValue(key, value) => - self.network_service.put_value(key, value), + this.network_service.put_value(key, value), ServiceToWorkerMsg::AddKnownAddress(peer_id, addr) => - self.network_service.add_known_address(peer_id, addr), + this.network_service.add_known_address(peer_id, addr), ServiceToWorkerMsg::SyncFork(peer_ids, hash, number) => - self.network_service.user_protocol_mut().set_sync_fork_request(peer_ids, &hash, number), + this.network_service.user_protocol_mut().set_sync_fork_request(peer_ids, &hash, number), ServiceToWorkerMsg::EventStream(sender) => - self.event_streams.push(sender), + this.event_streams.push(sender), ServiceToWorkerMsg::WriteNotification { message, engine_id, target } => - self.network_service.user_protocol_mut().write_notification(target, engine_id, message), + this.network_service.user_protocol_mut().write_notification(target, engine_id, message), ServiceToWorkerMsg::RegisterNotifProtocol { engine_id } => { - let events = self.network_service.user_protocol_mut().register_notifications_protocol(engine_id); + let events = this.network_service.user_protocol_mut().register_notifications_protocol(engine_id); for event in events { - self.event_streams.retain(|sender| sender.unbounded_send(event.clone()).is_ok()); + this.event_streams.retain(|sender| sender.unbounded_send(event.clone()).is_ok()); } }, ServiceToWorkerMsg::DisconnectPeer(who) => - self.network_service.user_protocol_mut().disconnect_peer(&who), + this.network_service.user_protocol_mut().disconnect_peer(&who), } } loop { // Process the next action coming from the network. - let poll_value = self.network_service.poll(); + let poll_value = this.network_service.poll_next_unpin(cx); match poll_value { - Ok(Async::NotReady) => break, - Ok(Async::Ready(Some(BehaviourOut::BlockImport(origin, blocks)))) => - self.import_queue.import_blocks(origin, blocks), - Ok(Async::Ready(Some(BehaviourOut::JustificationImport(origin, hash, nb, justification)))) => - self.import_queue.import_justification(origin, hash, nb, justification), - Ok(Async::Ready(Some(BehaviourOut::FinalityProofImport(origin, hash, nb, proof)))) => - self.import_queue.import_finality_proof(origin, hash, nb, proof), - Ok(Async::Ready(Some(BehaviourOut::Event(ev)))) => { - self.event_streams.retain(|sender| sender.unbounded_send(ev.clone()).is_ok()); + Poll::Pending => break, + Poll::Ready(Some(BehaviourOut::BlockImport(origin, blocks))) => + this.import_queue.import_blocks(origin, blocks), + Poll::Ready(Some(BehaviourOut::JustificationImport(origin, hash, nb, justification))) => + this.import_queue.import_justification(origin, hash, nb, justification), + Poll::Ready(Some(BehaviourOut::FinalityProofImport(origin, hash, nb, proof))) => + this.import_queue.import_finality_proof(origin, hash, nb, proof), + Poll::Ready(Some(BehaviourOut::Event(ev))) => { + this.event_streams.retain(|sender| sender.unbounded_send(ev.clone()).is_ok()); + }, + Poll::Ready(None) => { + error!(target: "sync", "Network events stream has returned None"); + break; }, - Ok(Async::Ready(None)) => {}, - Err(err) => { - error!(target: "sync", "Error in the network: {:?}", err); - return Err(err) - } }; } // Update the variables shared with the `NetworkService`. - self.num_connected.store(self.network_service.user_protocol_mut().num_connected_peers(), Ordering::Relaxed); + this.num_connected.store(this.network_service.user_protocol_mut().num_connected_peers(), Ordering::Relaxed); { - let external_addresses = Swarm::::external_addresses(&self.network_service).cloned().collect(); - *self.external_addresses.lock() = external_addresses; + let external_addresses = Swarm::::external_addresses(&this.network_service).cloned().collect(); + *this.external_addresses.lock() = external_addresses; } - self.is_major_syncing.store(match self.network_service.user_protocol_mut().sync_state() { + this.is_major_syncing.store(match this.network_service.user_protocol_mut().sync_state() { SyncState::Idle => false, SyncState::Downloading => true, }, Ordering::Relaxed); - Ok(Async::NotReady) + Poll::Pending } } +impl, H: ExHashT> Unpin for NetworkWorker { +} + /// The libp2p swarm, customized for our needs. type Swarm = libp2p::swarm::Swarm< Boxed<(PeerId, StreamMuxerBox), io::Error>, diff --git a/substrate/client/network/src/transport.rs b/substrate/client/network/src/transport.rs index 40e8bb46ce..d632f9b75c 100644 --- a/substrate/client/network/src/transport.rs +++ b/substrate/client/network/src/transport.rs @@ -71,7 +71,11 @@ pub fn build_transport( let desktop_trans = tcp::TcpConfig::new(); let desktop_trans = websocket::WsConfig::new(desktop_trans.clone()) .or_transport(desktop_trans); - OptionalTransport::some(dns::DnsConfig::new(desktop_trans)) + OptionalTransport::some(if let Ok(dns) = dns::DnsConfig::new(desktop_trans.clone()) { + dns.boxed() + } else { + desktop_trans.map_err(dns::DnsErr::Underlying).boxed() + }) } else { OptionalTransport::none() }); @@ -91,7 +95,7 @@ pub fn build_transport( let transport = transport.and_then(move |stream, endpoint| { let upgrade = core::upgrade::SelectUpgrade::new(noise_config, secio_config); core::upgrade::apply(stream, upgrade, endpoint, upgrade::Version::V1) - .and_then(|out| match out { + .map(|out| match out? { // We negotiated noise EitherOutput::First((remote_id, out)) => { let remote_key = match remote_id { @@ -110,7 +114,7 @@ pub fn build_transport( #[cfg(target_os = "unknown")] let transport = transport.and_then(move |stream, endpoint| { core::upgrade::apply(stream, secio_config, endpoint, upgrade::Version::V1) - .and_then(|(id, stream)| Ok((stream, id))) + .map_ok(|(id, stream)| ((stream, id))) }); // Multiplexing @@ -121,7 +125,7 @@ pub fn build_transport( .map_outbound(move |muxer| (peer_id2, muxer)); core::upgrade::apply(stream, upgrade, endpoint, upgrade::Version::V1) - .map(|(id, muxer)| (id, core::muxing::StreamMuxerBox::new(muxer))) + .map_ok(|(id, muxer)| (id, core::muxing::StreamMuxerBox::new(muxer))) }) .timeout(Duration::from_secs(20)) diff --git a/substrate/client/network/src/utils.rs b/substrate/client/network/src/utils.rs index 8bbba990a7..f13505d012 100644 --- a/substrate/client/network/src/utils.rs +++ b/substrate/client/network/src/utils.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . use std::time::Duration; -use futures03::{FutureExt, Stream, StreamExt, stream::unfold}; +use futures::{FutureExt, Stream, StreamExt, stream::unfold}; use futures_timer::Delay; pub fn interval(duration: Duration) -> impl Stream + Unpin { diff --git a/substrate/client/network/test/Cargo.toml b/substrate/client/network/test/Cargo.toml index 1d37196724..381276ecfa 100644 --- a/substrate/client/network/test/Cargo.toml +++ b/substrate/client/network/test/Cargo.toml @@ -14,7 +14,7 @@ futures = "0.1.29" futures03 = { package = "futures", version = "0.3.1", features = ["compat"] } futures-timer = "0.4.0" rand = "0.7.2" -libp2p = { version = "0.13.2", default-features = false, features = ["libp2p-websocket"] } +libp2p = { version = "0.14.0-alpha.1", default-features = false, features = ["libp2p-websocket"] } sp-consensus = { version = "0.8", path = "../../../primitives/consensus/common" } sc-client = { version = "2.0.0", path = "../../" } sc-client-api = { version = "2.0.0", path = "../../api" } diff --git a/substrate/client/network/test/src/lib.rs b/substrate/client/network/test/src/lib.rs index e76e58d4af..8116fd7c94 100644 --- a/substrate/client/network/test/src/lib.rs +++ b/substrate/client/network/test/src/lib.rs @@ -22,6 +22,7 @@ mod block_import; mod sync; use std::collections::HashMap; +use std::pin::Pin; use std::sync::Arc; use libp2p::build_multiaddr; @@ -48,7 +49,7 @@ use sp_consensus::block_import::{BlockImport, ImportResult}; use sp_consensus::Error as ConsensusError; use sp_consensus::{BlockOrigin, ForkChoiceStrategy, BlockImportParams, BlockCheckParams, JustificationImport}; use futures::prelude::*; -use futures03::{StreamExt as _, TryStreamExt as _}; +use futures03::{Future as _, FutureExt as _, TryFutureExt as _, StreamExt as _, TryStreamExt as _}; use sc_network::{NetworkWorker, NetworkStateInfo, NetworkService, ReportHandle, config::ProtocolId}; use sc_network::config::{NetworkConfiguration, TransportConfig, BoxFinalityProofRequestBuilder}; use libp2p::PeerId; @@ -713,7 +714,9 @@ pub trait TestNetFactory: Sized { self.mut_peers(|peers| { for peer in peers { trace!(target: "sync", "-- Polling {}", peer.id()); - peer.network.poll().unwrap(); + futures03::future::poll_fn(|cx| Pin::new(&mut peer.network).poll(cx)) + .map(|item| Ok::<_, ()>(item)) + .compat().poll().unwrap(); trace!(target: "sync", "-- Polling complete {}", peer.id()); // We poll `imported_blocks_stream`. diff --git a/substrate/client/peerset/Cargo.toml b/substrate/client/peerset/Cargo.toml index 7a8607daee..90f44418c7 100644 --- a/substrate/client/peerset/Cargo.toml +++ b/substrate/client/peerset/Cargo.toml @@ -9,7 +9,7 @@ edition = "2018" [dependencies] futures = "0.3.1" -libp2p = { version = "0.13.2", default-features = false } +libp2p = { version = "0.14.0-alpha.1", default-features = false } log = "0.4.8" serde_json = "1.0.41" diff --git a/substrate/client/service/src/lib.rs b/substrate/client/service/src/lib.rs index dc1966f0ac..e4d6419e30 100644 --- a/substrate/client/service/src/lib.rs +++ b/substrate/client/service/src/lib.rs @@ -27,7 +27,7 @@ pub mod error; mod builder; mod status_sinks; -use std::io; +use std::{io, pin::Pin}; use std::marker::PhantomData; use std::net::SocketAddr; use std::collections::HashMap; @@ -479,7 +479,9 @@ fn build_network_future< }); // Main network polling. - if let Ok(Async::Ready(())) = network.poll().map_err(|err| { + let mut net_poll = futures03::future::poll_fn(|cx| futures03::future::Future::poll(Pin::new(&mut network), cx)) + .compat(); + if let Ok(Async::Ready(())) = net_poll.poll().map_err(|err| { warn!(target: "service", "Error in network: {:?}", err); }) { return Ok(Async::Ready(())); diff --git a/substrate/client/telemetry/Cargo.toml b/substrate/client/telemetry/Cargo.toml index 6163e90581..c536b7599b 100644 --- a/substrate/client/telemetry/Cargo.toml +++ b/substrate/client/telemetry/Cargo.toml @@ -6,18 +6,17 @@ description = "Telemetry utils" edition = "2018" [dependencies] -bytes = "0.4.12" +bytes = "0.5" parking_lot = "0.9.0" -futures01 = { package = "futures", version = "0.1" } -futures = { version = "0.3.1", features = ["compat"] } +futures = "0.3.1" futures-timer = "2.0.0" -libp2p = { version = "0.13.2", default-features = false, features = ["libp2p-websocket"] } +libp2p = { version = "0.14.0-alpha.1", default-features = false, features = ["libp2p-websocket"] } log = "0.4.8" +pin-project = "0.4.6" rand = "0.7.2" serde = { version = "1.0.101", features = ["derive"] } slog = { version = "2.5.2", features = ["nested-values"] } slog-json = { version = "2.3.0", features = ["nested-values"] } slog-scope = "4.1.2" -tokio-io = "0.1.12" take_mut = "0.2.2" void = "1.0.2" diff --git a/substrate/client/telemetry/src/lib.rs b/substrate/client/telemetry/src/lib.rs index 775e56ceb5..906df545e2 100644 --- a/substrate/client/telemetry/src/lib.rs +++ b/substrate/client/telemetry/src/lib.rs @@ -60,11 +60,12 @@ use futures::{prelude::*, channel::mpsc}; use libp2p::{Multiaddr, wasm_ext}; -use log::warn; +use log::{error, warn}; use parking_lot::Mutex; use serde::{Serialize, Deserialize}; use std::{pin::Pin, sync::Arc, task::{Context, Poll}, time::{Duration, Instant}}; +pub use libp2p::wasm_ext::ExtTransport; pub use slog_scope::with_logger; pub use slog; @@ -129,8 +130,8 @@ pub struct Telemetry { /// where we extract the telemetry registration so that it continues running during the shutdown /// process. struct TelemetryInner { - /// Worker for the telemetry. - worker: worker::TelemetryWorker, + /// Worker for the telemetry. `None` if it failed to initialize. + worker: Option, /// Receives log entries for them to be dispatched to the worker. receiver: mpsc::Receiver, } @@ -162,9 +163,17 @@ pub fn init_telemetry(config: TelemetryConfig) -> Telemetry { slog_scope::set_global_logger(root) }; + let worker = match worker::TelemetryWorker::new(endpoints, config.wasm_external_transport) { + Ok(w) => Some(w), + Err(err) => { + error!(target: "telemetry", "Failed to initialize telemetry worker: {:?}", err); + None + } + }; + Telemetry { inner: Arc::new(Mutex::new(TelemetryInner { - worker: worker::TelemetryWorker::new(endpoints, config.wasm_external_transport), + worker, receiver, })), _guard: Arc::new(guard), @@ -209,15 +218,19 @@ impl Stream for Telemetry { // The polling pattern is: poll the worker so that it processes its queue, then add one // message from the receiver (if possible), then poll the worker again, and so on. loop { - while let Poll::Ready(event) = inner.worker.poll(cx) { - // Right now we only have one possible event. This line is here in order to not - // forget to handle any possible new event type. - let worker::TelemetryWorkerEvent::Connected = event; - has_connected = true; + if let Some(worker) = inner.worker.as_mut() { + while let Poll::Ready(event) = worker.poll(cx) { + // Right now we only have one possible event. This line is here in order to not + // forget to handle any possible new event type. + let worker::TelemetryWorkerEvent::Connected = event; + has_connected = true; + } } if let Poll::Ready(Some(log_entry)) = Stream::poll_next(Pin::new(&mut inner.receiver), cx) { - log_entry.as_record_values(|rec, val| { let _ = inner.worker.log(rec, val); }); + if let Some(worker) = inner.worker.as_mut() { + log_entry.as_record_values(|rec, val| { let _ = worker.log(rec, val); }); + } } else { break; } diff --git a/substrate/client/telemetry/src/worker.rs b/substrate/client/telemetry/src/worker.rs index dc7277f74a..8f43bb612a 100644 --- a/substrate/client/telemetry/src/worker.rs +++ b/substrate/client/telemetry/src/worker.rs @@ -27,8 +27,8 @@ //! use bytes::BytesMut; -use futures::compat::Compat01As03Sink; -use libp2p::{core::transport::OptionalTransport, core::ConnectedPoint, Multiaddr, Transport, wasm_ext}; +use futures::{prelude::*, ready}; +use libp2p::{core::transport::OptionalTransport, Multiaddr, Transport, wasm_ext}; use log::{trace, warn, error}; use slog::Drain; use std::{io, pin::Pin, task::Context, task::Poll, time}; @@ -54,33 +54,16 @@ pub struct TelemetryWorker { nodes: Vec<(node::Node, u8)>, } -/// The pile of libp2p transports. -#[cfg(not(target_os = "unknown"))] -type WsTrans = libp2p::core::transport::timeout::TransportTimeout< - libp2p::core::transport::map::Map< - libp2p::core::transport::OrTransport< - libp2p::core::transport::map::Map< - OptionalTransport, - fn(wasm_ext::Connection, ConnectedPoint) -> StreamSink - >, - libp2p::websocket::framed::WsConfig> - >, - fn(libp2p::core::either::EitherOutput, - libp2p::websocket::framed::BytesConnection>, ConnectedPoint) - -> Compat01As03Sink, - libp2p::websocket::framed::BytesConnection>, BytesMut> - > ->; -#[cfg(target_os = "unknown")] -type WsTrans = libp2p::core::transport::timeout::TransportTimeout< - libp2p::core::transport::map::Map< - libp2p::core::transport::map::Map< - OptionalTransport, - fn(wasm_ext::Connection, ConnectedPoint) -> StreamSink - >, - fn(StreamSink, ConnectedPoint) - -> Compat01As03Sink, BytesMut> - > +trait StreamAndSink: Stream + Sink {} +impl, I> StreamAndSink for T {} + +type WsTrans = libp2p::core::transport::boxed::Boxed< + Pin, + Error = io::Error + > + Send>>, + io::Error >; impl TelemetryWorker { @@ -92,31 +75,48 @@ impl TelemetryWorker { pub fn new( endpoints: impl IntoIterator, wasm_external_transport: impl Into> - ) -> Self { + ) -> Result { let transport = match wasm_external_transport.into() { Some(t) => OptionalTransport::some(t), None => OptionalTransport::none() - }.map((|inner, _| StreamSink(inner)) as fn(_, _) -> _); + }.map((|inner, _| StreamSink::from(inner)) as fn(_, _) -> _); // The main transport is the `wasm_external_transport`, but if we're on desktop we add // support for TCP+WebSocket+DNS as a fallback. In practice, you're not expected to pass // 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 = libp2p::dns::DnsConfig::new(libp2p::tcp::TcpConfig::new())?; libp2p::websocket::framed::WsConfig::new(inner) + .and_then(|connec, _| { + let connec = connec + .with(|item: BytesMut| { + let item = libp2p::websocket::framed::OutgoingData::Binary(item); + future::ready(Ok::<_, io::Error>(item)) + }) + .try_filter(|item| future::ready(item.is_data())) + .map_ok(|data| BytesMut::from(data.as_ref())); + future::ready(Ok::<_, io::Error>(connec)) + }) }); let transport = transport - .map((|inner, _| Compat01As03Sink::new(inner)) as fn(_, _) -> _) - .timeout(CONNECT_TIMEOUT); + .timeout(CONNECT_TIMEOUT) + .map_err(|err| io::Error::new(io::ErrorKind::Other, err)) + .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> + }) + .boxed(); - TelemetryWorker { + Ok(TelemetryWorker { nodes: endpoints.into_iter().map(|(addr, verbosity)| { let node = node::Node::new(transport.clone(), addr); (node, verbosity) }).collect() - } + }) } /// Polls the worker for events that happened. @@ -174,7 +174,7 @@ impl TelemetryWorker { } // `send_message` returns an error if we're not connected, which we silently ignore. - let _ = node.send_message(serialized.clone()); + let _ = node.send_message(&serialized.clone()[..]); } Ok(()) @@ -186,50 +186,74 @@ impl TelemetryWorker { /// /// For some context, we put this object around the `wasm_ext::ExtTransport` in order to make sure /// that each telemetry message maps to one single call to `write` in the WASM FFI. -struct StreamSink(T); +#[pin_project::pin_project] +struct StreamSink(#[pin] T, Option); -impl futures01::Stream for StreamSink { - type Item = BytesMut; - type Error = io::Error; - - fn poll(&mut self) -> futures01::Poll, Self::Error> { - let mut buf = [0; 128]; - Ok(self.0.poll_read(&mut buf)? - .map(|n| - if n == 0 { - None - } else { - let buf: BytesMut = buf[..n].into(); - Some(buf) - } - )) +impl From for StreamSink { + fn from(inner: T) -> StreamSink { + StreamSink(inner, None) } } -impl futures01::Sink for StreamSink { - type SinkItem = BytesMut; - type SinkError = io::Error; +impl Stream for StreamSink { + type Item = Result; - fn start_send(&mut self, item: Self::SinkItem) - -> Result, io::Error> { - match self.0.write(&item[..]) { - Ok(n) if n == item.len() => Ok(futures01::AsyncSink::Ready), - Ok(_) => { + fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + let this = self.project(); + let mut buf = [0; 128]; + match ready!(AsyncRead::poll_read(this.0, cx, &mut buf)) { + Ok(0) => Poll::Ready(None), + Ok(n) => { + let buf: BytesMut = buf[..n].into(); + Poll::Ready(Some(Ok(buf))) + }, + Err(err) => Poll::Ready(Some(Err(err))), + } + } +} + +impl StreamSink { + fn poll_flush_buffer(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + let this = self.project(); + + if let Some(buffer) = this.1 { + if ready!(this.0.poll_write(cx, &buffer[..]))? != buffer.len() { error!(target: "telemetry", "Detected some internal buffering happening in the telemetry"); - Err(io::Error::new(io::ErrorKind::Other, "Internal buffering detected")) - }, - Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => - Ok(futures01::AsyncSink::NotReady(item)), - Err(err) => Err(err), + let err = io::Error::new(io::ErrorKind::Other, "Internal buffering detected"); + return Poll::Ready(Err(err)); + } } - } - fn poll_complete(&mut self) -> futures01::Poll<(), io::Error> { - match self.0.flush() { - Ok(()) => Ok(futures01::Async::Ready(())), - Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => Ok(futures01::Async::NotReady), - Err(err) => Err(err), - } + *this.1 = None; + Poll::Ready(Ok(())) + } +} + +impl Sink for StreamSink { + type Error = io::Error; + + fn poll_ready(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + ready!(StreamSink::poll_flush_buffer(self, cx))?; + Poll::Ready(Ok(())) + } + + fn start_send(self: Pin<&mut Self>, item: BytesMut) -> Result<(), Self::Error> { + let this = self.project(); + debug_assert!(this.1.is_none()); + *this.1 = Some(item); + Ok(()) + } + + fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + ready!(self.as_mut().poll_flush_buffer(cx))?; + let this = self.project(); + AsyncWrite::poll_flush(this.0, cx) + } + + fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + ready!(self.as_mut().poll_flush_buffer(cx))?; + let this = self.project(); + AsyncWrite::poll_close(this.0, cx) } } diff --git a/substrate/client/telemetry/src/worker/node.rs b/substrate/client/telemetry/src/worker/node.rs index 4f62892d93..58e9f20bd5 100644 --- a/substrate/client/telemetry/src/worker/node.rs +++ b/substrate/client/telemetry/src/worker/node.rs @@ -17,7 +17,7 @@ //! Contains the `Node` struct, which handles communications with a single telemetry endpoint. use bytes::BytesMut; -use futures::{prelude::*, compat::{Future01CompatExt as _, Compat01As03}}; +use futures::prelude::*; use futures_timer::Delay; use libp2p::Multiaddr; use libp2p::core::transport::Transport; @@ -42,7 +42,7 @@ enum NodeSocket { /// We're connected to the node. This is the normal state. Connected(NodeSocketConnected), /// We are currently dialing the node. - Dialing(Compat01As03), + Dialing(TTrans::Dial), /// A new connection should be started as soon as possible. ReconnectNow, /// Waiting before attempting to dial again. @@ -76,6 +76,9 @@ pub enum NodeEvent { pub enum ConnectionError { /// The connection timed-out. Timeout, + /// Reading from the socket returned and end-of-file, indicating that the socket has been + /// closed. + Closed, /// The sink errored. Sink(TSinkErr), } @@ -106,7 +109,7 @@ where TTrans: Clone + Unpin, TTrans::Dial: Unpin, /// Sends a WebSocket frame to the node. Returns an error if we are not connected to the node. /// /// After calling this method, you should call `poll` in order for it to be properly processed. - pub fn send_message(&mut self, payload: Vec) -> Result<(), ()> { + pub fn send_message(&mut self, payload: impl Into) -> Result<(), ()> { if let NodeSocket::Connected(NodeSocketConnected { pending, .. }) = &mut self.socket { if pending.len() <= MAX_PENDING { trace!(target: "telemetry", "Adding log entry to queue for {:?}", self.addr); @@ -163,7 +166,7 @@ where TTrans: Clone + Unpin, TTrans::Dial: Unpin, NodeSocket::ReconnectNow => match self.transport.clone().dial(self.addr.clone()) { Ok(d) => { debug!(target: "telemetry", "Started dialing {}", self.addr); - socket = NodeSocket::Dialing(d.compat()); + socket = NodeSocket::Dialing(d); } Err(err) => { warn!(target: "telemetry", "Error while dialing {}: {:?}", self.addr, err); @@ -212,10 +215,13 @@ where TTrans::Output: Sink ) -> Poll>> { while let Some(item) = self.pending.pop_front() { - if let Poll::Ready(_) = Sink::poll_ready(Pin::new(&mut self.sink), cx) { + if let Poll::Ready(result) = Sink::poll_ready(Pin::new(&mut self.sink), cx) { + if let Err(err) = result { + return Poll::Ready(Err(ConnectionError::Sink(err))) + } + let item_len = item.len(); if let Err(err) = Sink::start_send(Pin::new(&mut self.sink), item) { - self.timeout = None; return Poll::Ready(Err(ConnectionError::Sink(err))) } trace!( @@ -270,7 +276,10 @@ where TTrans::Output: Sink Poll::Ready(Some(Err(err))) => { return Poll::Ready(Err(ConnectionError::Sink(err))) }, - Poll::Pending | Poll::Ready(None) => {}, + Poll::Ready(None) => { + return Poll::Ready(Err(ConnectionError::Closed)) + }, + Poll::Pending => {}, } Poll::Pending diff --git a/substrate/primitives/consensus/common/Cargo.toml b/substrate/primitives/consensus/common/Cargo.toml index c781ce2100..d767cd2ca4 100644 --- a/substrate/primitives/consensus/common/Cargo.toml +++ b/substrate/primitives/consensus/common/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] derive_more = "0.99.2" -libp2p = { version = "0.13.2", default-features = false } +libp2p = { version = "0.14.0-alpha.1", default-features = false } log = "0.4.8" sp-core = { path= "../../core" } sp-inherents = { version = "2.0.0", path = "../../inherents" } diff --git a/substrate/utils/browser/Cargo.toml b/substrate/utils/browser/Cargo.toml index c7703474b7..b58774075b 100644 --- a/substrate/utils/browser/Cargo.toml +++ b/substrate/utils/browser/Cargo.toml @@ -9,7 +9,7 @@ edition = "2018" futures = "0.3" futures01 = { package = "futures", version = "0.1.29" } log = "0.4.8" -libp2p = { version = "0.13.2", default-features = false } +libp2p = { version = "0.14.0-alpha.1", default-features = false } console_error_panic_hook = "0.1.6" console_log = "0.1.2" js-sys = "0.3.34"