mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 19:37:56 +00:00
Upgrade to libp2p-0.31. (#7606)
* Upgrade to libp2p-0.31. * Address line width. * Add generous incoming connection limit. * Remove old noise configuration.
This commit is contained in:
Generated
+77
-68
@@ -323,7 +323,7 @@ dependencies = [
|
||||
"futures-io",
|
||||
"rustls",
|
||||
"webpki",
|
||||
"webpki-roots",
|
||||
"webpki-roots 0.20.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -489,17 +489,6 @@ dependencies = [
|
||||
"constant_time_eq",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "blake2s_simd"
|
||||
version = "0.5.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e461a7034e85b211a4acb57ee2e6730b32912b06c08cc242243c39fc21ae6a2"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"arrayvec 0.5.2",
|
||||
"constant_time_eq",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.7.3"
|
||||
@@ -2876,9 +2865,9 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
|
||||
|
||||
[[package]]
|
||||
name = "libp2p"
|
||||
version = "0.30.1"
|
||||
version = "0.31.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3c2b4c99f8798be90746fc226acf95d3e6cff0655883634cc30dab1f64f438b"
|
||||
checksum = "24966e73cc5624a6cf14b025365f67cb6da436b4d6337ed84d198063ba74451d"
|
||||
dependencies = [
|
||||
"atomic",
|
||||
"bytes 0.5.6",
|
||||
@@ -2905,7 +2894,6 @@ dependencies = [
|
||||
"libp2p-wasm-ext",
|
||||
"libp2p-websocket",
|
||||
"libp2p-yamux",
|
||||
"multihash",
|
||||
"parity-multiaddr",
|
||||
"parking_lot 0.11.1",
|
||||
"pin-project 1.0.2",
|
||||
@@ -2915,12 +2903,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-core"
|
||||
version = "0.24.0"
|
||||
version = "0.25.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b8186060d6bd415e4e928e6cb44c4fe7e7a7dd53437bd936ce7e5f421e45a51"
|
||||
checksum = "28d92fab5df60c9705e05750d9ecee6a5af15aed1e3fa86e09fd3dd07ec5dc8e"
|
||||
dependencies = [
|
||||
"asn1_der",
|
||||
"bs58",
|
||||
"bytes 0.5.6",
|
||||
"ed25519-dalek",
|
||||
"either",
|
||||
"fnv",
|
||||
@@ -2949,9 +2938,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-core-derive"
|
||||
version = "0.20.2"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f753d9324cd3ec14bf04b8a8cd0d269c87f294153d6bf2a84497a63a5ad22213"
|
||||
checksum = "f4bc40943156e42138d22ed3c57ff0e1a147237742715937622a99b10fbe0156"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
@@ -2959,9 +2948,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-deflate"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34aea69349e70a58ef9ecd21ac12c5eaa36255ac6986828079d26393f9e618cb"
|
||||
checksum = "5a579d7dd506d0620ba88ccc1754436b7de35ed6c884234f9a226bbfce382640"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"futures 0.3.8",
|
||||
@@ -2970,9 +2959,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-dns"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0baeff71fb5cb1fe1604f74a712a44b66a8c5900f4022411a1d550f09d6bb776"
|
||||
checksum = "15dea5933f570844d7b5222b12b58f7bd52e9ca38cd65a1bd4f35341f053f012"
|
||||
dependencies = [
|
||||
"futures 0.3.8",
|
||||
"libp2p-core",
|
||||
@@ -2981,9 +2970,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-floodsub"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db0f925a45f310b678e70faf71a10023b829d02eb9cc2628a63de928936f3ade"
|
||||
checksum = "23070a0838bd9a8adb27e6eba477eeb650c498f9d139383dd0135d20a8170253"
|
||||
dependencies = [
|
||||
"cuckoofilter",
|
||||
"fnv",
|
||||
@@ -2999,9 +2988,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-gossipsub"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "efeb65567174974f551a91f9f5719445b6695cad56f6a7a47a27111f37efb6b8"
|
||||
checksum = "65e8f3aa0906fbad435dac23c177eef3cdfaaf62609791bd7f54f8553edcfdf9"
|
||||
dependencies = [
|
||||
"base64 0.13.0",
|
||||
"byteorder",
|
||||
@@ -3025,9 +3014,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-identify"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e074124669840484de564901d47f2d0892e73f6d8ee7c37e9c2644af1b217bf4"
|
||||
checksum = "802fb973a7e0dde3fb9a2113a62bad90338ebe01983b706e1d576d0c2af93cda"
|
||||
dependencies = [
|
||||
"futures 0.3.8",
|
||||
"libp2p-core",
|
||||
@@ -3041,9 +3030,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-kad"
|
||||
version = "0.25.0"
|
||||
version = "0.26.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78a2653b2e3254a3bbeb66bfc3f0dca7d6cba6aa2a96791db114003dec1b5394"
|
||||
checksum = "6506b7b7982f7626fc96a91bc61be4b1fe7ae9ac23824f0ecefcce21cb39238c"
|
||||
dependencies = [
|
||||
"arrayvec 0.5.2",
|
||||
"bytes 0.5.6",
|
||||
@@ -3054,7 +3043,6 @@ dependencies = [
|
||||
"libp2p-core",
|
||||
"libp2p-swarm",
|
||||
"log",
|
||||
"multihash",
|
||||
"prost",
|
||||
"prost-build",
|
||||
"rand 0.7.3",
|
||||
@@ -3068,9 +3056,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-mdns"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "786b068098794322239f8f04df88a52daeb7863b2e77501c4d85d32e0a8f2d26"
|
||||
checksum = "4458ec36b5ab2662fb4d5c8bb9b6e1591da0ab6efe8881c7a7670ef033bc8937"
|
||||
dependencies = [
|
||||
"async-std",
|
||||
"data-encoding",
|
||||
@@ -3090,9 +3078,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-mplex"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed764eab613a8fb6b7dcf6c796f55a06fef2270e528329903e25cd3311b99663"
|
||||
checksum = "ae2132b14045009b0f8e577a06e1459592ef0a89dedc58f3d4baf4eac956837b"
|
||||
dependencies = [
|
||||
"bytes 0.5.6",
|
||||
"futures 0.3.8",
|
||||
@@ -3108,9 +3096,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-noise"
|
||||
version = "0.26.0"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb441fb015ec16690099c5d910fcba271d357763b3dcb784db7b27bbb0b68372"
|
||||
checksum = "b9610a524bef4db383cd96b4ec3ec4722eafa72c7242fa89990b74166760583d"
|
||||
dependencies = [
|
||||
"bytes 0.5.6",
|
||||
"curve25519-dalek 3.0.0",
|
||||
@@ -3130,9 +3118,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-ping"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82e5c50936cfdbe96a514e8992f304fa44cd3a681b6f779505f1ae62b3474705"
|
||||
checksum = "659adf89356e04f65398bb74ee791b269e63da9e41b37f8dc19eaacd12487bfe"
|
||||
dependencies = [
|
||||
"futures 0.3.8",
|
||||
"libp2p-core",
|
||||
@@ -3145,9 +3133,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-plaintext"
|
||||
version = "0.24.1"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21026557c335d3639591f247b19b7536195772034ec7e9c463137227f95eaaa1"
|
||||
checksum = "96dfe26270c91d4ff095030d1fcadd602f3fd84968ebd592829916d0715798a6"
|
||||
dependencies = [
|
||||
"bytes 0.5.6",
|
||||
"futures 0.3.8",
|
||||
@@ -3176,9 +3164,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-request-response"
|
||||
version = "0.5.0"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dd9a1e0e6563dec1c9e702f7e68bdaa43da62a84536aa06372d3fed3e25d4ca"
|
||||
checksum = "1e952dcc9d2d7e7e45ae8bfcff255723091bd43e3e9a7741a0af8a17fe55b3ed"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes 0.5.6",
|
||||
@@ -3196,9 +3184,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-swarm"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "565f0e06674b4033c978471e4083d5aaa8e03cef0719a0ec0905aaeaad39a919"
|
||||
checksum = "de333c483f27d02ecf7b6cef814a36f5e1876f15139eefb00225c405350e1c22"
|
||||
dependencies = [
|
||||
"either",
|
||||
"futures 0.3.8",
|
||||
@@ -3212,9 +3200,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-tcp"
|
||||
version = "0.24.0"
|
||||
version = "0.25.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33f3dce259c0d3127af5167f45c275b6c047320efdd0e40fde947482487af0a3"
|
||||
checksum = "bc28c9ad6dc43f4c3950411cf808639d90307a076330e7996e5e94e70279bde0"
|
||||
dependencies = [
|
||||
"async-std",
|
||||
"futures 0.3.8",
|
||||
@@ -3228,9 +3216,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-uds"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e0aba04370a00d8d0236e350bc862926c1b42542a169aa6a481e660e5b990fe"
|
||||
checksum = "9d821208d4b9af4b293a56dde470edd9f9fac8bb94a51f4f5327cc29a471b3f3"
|
||||
dependencies = [
|
||||
"async-std",
|
||||
"futures 0.3.8",
|
||||
@@ -3240,9 +3228,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-wasm-ext"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c703816f4170477a375b49c56d349e535ce68388f81ba1d9a3c8e2517effa82"
|
||||
checksum = "1e6ef400b231ba78e866b860445480ca21ee447e03034138c6d57cf2969d6bf4"
|
||||
dependencies = [
|
||||
"futures 0.3.8",
|
||||
"js-sys",
|
||||
@@ -3254,9 +3242,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-websocket"
|
||||
version = "0.25.0"
|
||||
version = "0.26.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d5e7268a959748040a0cf7456ad655be55b87f0ceda03bdb5b53674726b28f7"
|
||||
checksum = "a5736e2fccdcea6e728bbaf903bddc113be223313ce2c756ad9fe43b5a2b0f06"
|
||||
dependencies = [
|
||||
"async-tls",
|
||||
"either",
|
||||
@@ -3269,14 +3257,14 @@ dependencies = [
|
||||
"soketto",
|
||||
"url 2.2.0",
|
||||
"webpki",
|
||||
"webpki-roots",
|
||||
"webpki-roots 0.21.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-yamux"
|
||||
version = "0.27.0"
|
||||
version = "0.28.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a0798cbb58535162c40858493d09af06eac42a26e4966e58de0df701f559348"
|
||||
checksum = "3be7ac000fa3e42ac09a6e658e48de34ac8ef9fff64a4e6e6b08dcc8f4b0e5f6"
|
||||
dependencies = [
|
||||
"futures 0.3.8",
|
||||
"libp2p-core",
|
||||
@@ -3644,19 +3632,31 @@ checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238"
|
||||
|
||||
[[package]]
|
||||
name = "multihash"
|
||||
version = "0.11.4"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "567122ab6492f49b59def14ecc36e13e64dca4188196dd0cd41f9f3f979f3df6"
|
||||
checksum = "fb63389ee5fcd4df3f8727600f4a0c3df53c541f0ed4e8b50a9ae51a80fc1efe"
|
||||
dependencies = [
|
||||
"blake2b_simd",
|
||||
"blake2s_simd",
|
||||
"digest 0.9.0",
|
||||
"sha-1 0.9.2",
|
||||
"generic-array 0.14.4",
|
||||
"multihash-derive",
|
||||
"sha2 0.9.2",
|
||||
"sha3",
|
||||
"unsigned-varint",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multihash-derive"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f5653449cd45d502a53480ee08d7a599e8f4893d2bacb33c63d65bc20af6c1a"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multimap"
|
||||
version = "0.8.2"
|
||||
@@ -3665,9 +3665,9 @@ checksum = "1255076139a83bb467426e7f8d0134968a8118844faa755985e077cf31850333"
|
||||
|
||||
[[package]]
|
||||
name = "multistream-select"
|
||||
version = "0.8.5"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93faf2e41f9ee62fb01680ed48f3cc26652352327aa2e59869070358f6b7dd75"
|
||||
checksum = "46e19fd46149acdd3600780ebaa09f6ae4e7f2ddbafec64aab54cf75aafd1746"
|
||||
dependencies = [
|
||||
"bytes 0.5.6",
|
||||
"futures 0.3.8",
|
||||
@@ -5186,9 +5186,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "parity-multiaddr"
|
||||
version = "0.9.6"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43244a26dc1ddd3097216bb12eaa6cf8a07b060c72718d9ebd60fd297d6401df"
|
||||
checksum = "2f51a30667591b14f96068b2d12f1306d07a41ebd98239d194356d4d9707ac16"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"bs58",
|
||||
@@ -9740,7 +9740,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"rand 0.7.3",
|
||||
"rand 0.3.23",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
@@ -10309,6 +10309,15 @@ dependencies = [
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82015b7e0b8bad8185994674a13a93306bea76cf5a16c5a181382fd3a5ec2376"
|
||||
dependencies = [
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wepoll-sys"
|
||||
version = "3.0.1"
|
||||
|
||||
@@ -8,7 +8,7 @@ license = "Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
futures-timer = "3.0.2"
|
||||
libp2p = { version = "0.30.1", default-features = false }
|
||||
libp2p = { version = "0.31.1", default-features = false }
|
||||
jsonrpc-core = "15.0.0"
|
||||
serde = "1.0.106"
|
||||
serde_json = "1.0.48"
|
||||
|
||||
@@ -23,7 +23,7 @@ derive_more = "0.99.2"
|
||||
either = "1.5.3"
|
||||
futures = "0.3.4"
|
||||
futures-timer = "3.0.1"
|
||||
libp2p = { version = "0.30.1", default-features = false, features = ["kad"] }
|
||||
libp2p = { version = "0.31.1", default-features = false, features = ["kad"] }
|
||||
log = "0.4.8"
|
||||
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0"}
|
||||
prost = "0.6.1"
|
||||
|
||||
@@ -31,7 +31,7 @@ pub enum Error {
|
||||
/// Failed to verify a dht payload with the given signature.
|
||||
VerifyingDhtPayload,
|
||||
/// Failed to hash the authority id to be used as a dht key.
|
||||
HashingAuthorityId(libp2p::core::multiaddr::multihash::EncodeError),
|
||||
HashingAuthorityId(libp2p::core::multiaddr::multihash::Error),
|
||||
/// Failed calling into the Substrate runtime.
|
||||
CallingRuntime(sp_blockchain::Error),
|
||||
/// Received a dht record with a key that does not match any in-flight awaited keys.
|
||||
|
||||
@@ -28,7 +28,7 @@ use futures::{FutureExt, Stream, StreamExt, stream::Fuse};
|
||||
use addr_cache::AddrCache;
|
||||
use async_trait::async_trait;
|
||||
use codec::Decode;
|
||||
use libp2p::{core::multiaddr, multihash::Multihash};
|
||||
use libp2p::{core::multiaddr, multihash::{Multihash, Hasher}};
|
||||
use log::{debug, error, log_enabled};
|
||||
use prometheus_endpoint::{Counter, CounterVec, Gauge, Opts, U64, register};
|
||||
use prost::Message;
|
||||
|
||||
@@ -139,7 +139,7 @@ fn peer_id_from_multiaddr(addr: &Multiaddr) -> Option<PeerId> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use libp2p::multihash;
|
||||
use libp2p::multihash::{self, Multihash};
|
||||
use quickcheck::{Arbitrary, Gen, QuickCheck, TestResult};
|
||||
use rand::Rng;
|
||||
|
||||
@@ -163,7 +163,7 @@ mod tests {
|
||||
fn arbitrary<G: Gen>(g: &mut G) -> Self {
|
||||
let seed: [u8; 32] = g.gen();
|
||||
let peer_id = PeerId::from_multihash(
|
||||
multihash::wrap(multihash::Code::Sha2_256, &seed)
|
||||
Multihash::wrap(multihash::Code::Sha2_256.into(), &seed).unwrap()
|
||||
).unwrap();
|
||||
let multiaddr = "/ip6/2001:db8:0:0:0:0:0:2/tcp/30333".parse::<Multiaddr>()
|
||||
.unwrap()
|
||||
|
||||
@@ -21,7 +21,7 @@ ansi_term = "0.12.1"
|
||||
tokio = { version = "0.2.21", features = [ "signal", "rt-core", "rt-threaded", "blocking" ] }
|
||||
futures = "0.3.4"
|
||||
fdlimit = "0.2.1"
|
||||
libp2p = "0.30.1"
|
||||
libp2p = "0.31.1"
|
||||
parity-scale-codec = "1.3.0"
|
||||
hex = "0.4.2"
|
||||
rand = "0.7.3"
|
||||
|
||||
@@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
[dependencies]
|
||||
futures = "0.3.4"
|
||||
futures-timer = "3.0.1"
|
||||
libp2p = { version = "0.30.1", default-features = false }
|
||||
libp2p = { version = "0.31.1", default-features = false }
|
||||
log = "0.4.8"
|
||||
lru = "0.6.1"
|
||||
sc-network = { version = "0.8.0", path = "../network" }
|
||||
|
||||
@@ -64,13 +64,13 @@ wasm-timer = "0.2"
|
||||
zeroize = "1.0.0"
|
||||
|
||||
[dependencies.libp2p]
|
||||
version = "0.30.1"
|
||||
version = "0.31.1"
|
||||
default-features = false
|
||||
features = ["identify", "kad", "mdns-async-std", "mplex", "noise", "ping", "request-response", "tcp-async-std", "websocket", "yamux"]
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.3"
|
||||
libp2p = { version = "0.30.1", default-features = false }
|
||||
libp2p = { version = "0.31.1", default-features = false }
|
||||
quickcheck = "0.9.0"
|
||||
rand = "0.7.2"
|
||||
sp-keyring = { version = "2.0.0", path = "../../primitives/keyring" }
|
||||
|
||||
@@ -736,8 +736,8 @@ impl NetworkBehaviour for DiscoveryBehaviour {
|
||||
handler,
|
||||
event: (pid.clone(), event)
|
||||
}),
|
||||
NetworkBehaviourAction::ReportObservedAddr { address } =>
|
||||
return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }),
|
||||
NetworkBehaviourAction::ReportObservedAddr { address, score } =>
|
||||
return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address, score }),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -767,8 +767,8 @@ impl NetworkBehaviour for DiscoveryBehaviour {
|
||||
return Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id, condition }),
|
||||
NetworkBehaviourAction::NotifyHandler { event, .. } =>
|
||||
match event {}, // `event` is an enum with no variant
|
||||
NetworkBehaviourAction::ReportObservedAddr { address } =>
|
||||
return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }),
|
||||
NetworkBehaviourAction::ReportObservedAddr { address, score } =>
|
||||
return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address, score }),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -283,6 +283,9 @@ use sp_runtime::traits::{Block as BlockT, NumberFor};
|
||||
/// two peers, the per-peer connection limit is not set to 1 but 2.
|
||||
const MAX_CONNECTIONS_PER_PEER: usize = 2;
|
||||
|
||||
/// The maximum number of concurrent established connections that were incoming.
|
||||
const MAX_CONNECTIONS_ESTABLISHED_INCOMING: u32 = 10_000;
|
||||
|
||||
/// Minimum Requirements for a Hash within Networking
|
||||
pub trait ExHashT: std::hash::Hash + Eq + std::fmt::Debug + Clone + Send + Sync + 'static {}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ use libp2p::{
|
||||
upgrade::{OutboundUpgrade, read_one, write_one}
|
||||
},
|
||||
swarm::{
|
||||
AddressRecord,
|
||||
NegotiatedSubstream,
|
||||
NetworkBehaviour,
|
||||
NetworkBehaviourAction,
|
||||
@@ -1463,7 +1464,7 @@ mod tests {
|
||||
impl PollParameters for EmptyPollParams {
|
||||
type SupportedProtocolsIter = iter::Empty<Vec<u8>>;
|
||||
type ListenedAddressesIter = iter::Empty<Multiaddr>;
|
||||
type ExternalAddressesIter = iter::Empty<Multiaddr>;
|
||||
type ExternalAddressesIter = iter::Empty<AddressRecord>;
|
||||
|
||||
fn supported_protocols(&self) -> Self::SupportedProtocolsIter {
|
||||
iter::empty()
|
||||
|
||||
@@ -304,8 +304,8 @@ impl NetworkBehaviour for PeerInfoBehaviour {
|
||||
handler,
|
||||
event: EitherOutput::First(event)
|
||||
}),
|
||||
Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }) =>
|
||||
return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }),
|
||||
Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address, score }) =>
|
||||
return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address, score }),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,8 +334,8 @@ impl NetworkBehaviour for PeerInfoBehaviour {
|
||||
handler,
|
||||
event: EitherOutput::Second(event)
|
||||
}),
|
||||
Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }) =>
|
||||
return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }),
|
||||
Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address, score }) =>
|
||||
return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address, score }),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1489,8 +1489,8 @@ impl<B: BlockT, H: ExHashT> NetworkBehaviour for Protocol<B, H> {
|
||||
return Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id, condition }),
|
||||
Poll::Ready(NetworkBehaviourAction::NotifyHandler { peer_id, handler, event }) =>
|
||||
return Poll::Ready(NetworkBehaviourAction::NotifyHandler { peer_id, handler, event }),
|
||||
Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }) =>
|
||||
return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address }),
|
||||
Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address, score }) =>
|
||||
return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { address, score }),
|
||||
};
|
||||
|
||||
let outcome = match event {
|
||||
|
||||
@@ -398,9 +398,9 @@ impl NetworkBehaviour for RequestResponsesBehaviour {
|
||||
event: ((*protocol).to_string(), event),
|
||||
})
|
||||
}
|
||||
NetworkBehaviourAction::ReportObservedAddr { address } => {
|
||||
NetworkBehaviourAction::ReportObservedAddr { address, score } => {
|
||||
return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr {
|
||||
address,
|
||||
address, score,
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
@@ -39,15 +39,40 @@ use crate::{
|
||||
},
|
||||
on_demand_layer::AlwaysBadChecker,
|
||||
light_client_handler, block_requests,
|
||||
protocol::{self, event::Event, NotifsHandlerError, NotificationsSink, Ready, sync::SyncState, PeerInfo, Protocol},
|
||||
protocol::{
|
||||
self,
|
||||
NotifsHandlerError,
|
||||
NotificationsSink,
|
||||
PeerInfo,
|
||||
Protocol,
|
||||
Ready,
|
||||
event::Event,
|
||||
sync::SyncState,
|
||||
},
|
||||
transport, ReputationChange,
|
||||
};
|
||||
use futures::{channel::oneshot, prelude::*};
|
||||
use libp2p::{PeerId, multiaddr, Multiaddr};
|
||||
use libp2p::core::{ConnectedPoint, Executor, connection::{ConnectionError, PendingConnectionError}, either::EitherError};
|
||||
use libp2p::core::{
|
||||
ConnectedPoint,
|
||||
Executor,
|
||||
connection::{
|
||||
ConnectionLimits,
|
||||
ConnectionError,
|
||||
PendingConnectionError
|
||||
},
|
||||
either::EitherError,
|
||||
upgrade
|
||||
};
|
||||
use libp2p::kad::record;
|
||||
use libp2p::ping::handler::PingFailure;
|
||||
use libp2p::swarm::{NetworkBehaviour, SwarmBuilder, SwarmEvent, protocols_handler::NodeHandlerWrapperError};
|
||||
use libp2p::swarm::{
|
||||
AddressScore,
|
||||
NetworkBehaviour,
|
||||
SwarmBuilder,
|
||||
SwarmEvent,
|
||||
protocols_handler::NodeHandlerWrapperError
|
||||
};
|
||||
use log::{error, info, trace, warn};
|
||||
use metrics::{Metrics, MetricSources, Histogram, HistogramVec};
|
||||
use parking_lot::Mutex;
|
||||
@@ -332,7 +357,11 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkWorker<B, H> {
|
||||
transport::build_transport(local_identity, config_mem, config_wasm)
|
||||
};
|
||||
let mut builder = SwarmBuilder::new(transport, behaviour, local_peer_id.clone())
|
||||
.peer_connection_limit(crate::MAX_CONNECTIONS_PER_PEER)
|
||||
.connection_limits(ConnectionLimits::default()
|
||||
.with_max_established_per_peer(Some(crate::MAX_CONNECTIONS_PER_PEER as u32))
|
||||
.with_max_established_incoming(Some(crate::MAX_CONNECTIONS_ESTABLISHED_INCOMING))
|
||||
)
|
||||
.substream_upgrade_protocol_override(upgrade::Version::V1Lazy)
|
||||
.notify_handler_buffer_size(NonZeroUsize::new(32).expect("32 != 0; qed"))
|
||||
.connection_event_buffer_size(1024);
|
||||
if let Some(spawner) = params.executor {
|
||||
@@ -368,7 +397,7 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkWorker<B, H> {
|
||||
|
||||
// Add external addresses.
|
||||
for addr in ¶ms.network_config.public_addresses {
|
||||
Swarm::<B, H>::add_external_address(&mut swarm, addr.clone());
|
||||
Swarm::<B, H>::add_external_address(&mut swarm, addr.clone(), AddressScore::Infinite);
|
||||
}
|
||||
|
||||
let external_addresses = Arc::new(Mutex::new(Vec::new()));
|
||||
@@ -551,10 +580,17 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkWorker<B, H> {
|
||||
.collect()
|
||||
};
|
||||
|
||||
let peer_id = Swarm::<B, H>::local_peer_id(&swarm).to_base58();
|
||||
let listened_addresses = Swarm::<B, H>::listeners(&swarm).cloned().collect();
|
||||
let external_addresses = Swarm::<B, H>::external_addresses(&swarm)
|
||||
.map(|r| &r.addr)
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
NetworkState {
|
||||
peer_id: Swarm::<B, H>::local_peer_id(&swarm).to_base58(),
|
||||
listened_addresses: Swarm::<B, H>::listeners(&swarm).cloned().collect(),
|
||||
external_addresses: Swarm::<B, H>::external_addresses(&swarm).cloned().collect(),
|
||||
peer_id,
|
||||
listened_addresses,
|
||||
external_addresses,
|
||||
connected_peers,
|
||||
not_connected_peers,
|
||||
peerset: swarm.user_protocol_mut().peerset_debug_info(),
|
||||
@@ -1660,7 +1696,10 @@ impl<B: BlockT + 'static, H: ExHashT> Future for NetworkWorker<B, H> {
|
||||
// Update the variables shared with the `NetworkService`.
|
||||
this.num_connected.store(num_connected_peers, Ordering::Relaxed);
|
||||
{
|
||||
let external_addresses = Swarm::<B, H>::external_addresses(&this.network_service).cloned().collect();
|
||||
let external_addresses = Swarm::<B, H>::external_addresses(&this.network_service)
|
||||
.map(|r| &r.addr)
|
||||
.cloned()
|
||||
.collect();
|
||||
*this.external_addresses.lock() = external_addresses;
|
||||
}
|
||||
|
||||
@@ -1687,7 +1726,9 @@ impl<B: BlockT + 'static, H: ExHashT> Future for NetworkWorker<B, H> {
|
||||
}
|
||||
metrics.peerset_num_discovered.set(this.network_service.user_protocol().num_discovered_peers() as u64);
|
||||
metrics.peerset_num_requested.set(this.network_service.user_protocol().requested_peers().count() as u64);
|
||||
metrics.pending_connections.set(Swarm::network_info(&this.network_service).num_connections_pending as u64);
|
||||
metrics.pending_connections.set(
|
||||
Swarm::network_info(&this.network_service).connection_counters().num_pending() as u64
|
||||
);
|
||||
}
|
||||
|
||||
Poll::Pending
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use libp2p::{
|
||||
InboundUpgradeExt, OutboundUpgradeExt, PeerId, Transport,
|
||||
PeerId, Transport,
|
||||
core::{
|
||||
self, either::{EitherOutput, EitherTransport}, muxing::StreamMuxerBox,
|
||||
self, either::EitherTransport, muxing::StreamMuxerBox,
|
||||
transport::{Boxed, OptionalTransport}, upgrade
|
||||
},
|
||||
mplex, identity, bandwidth, wasm_ext, noise
|
||||
@@ -74,11 +74,7 @@ pub fn build_transport(
|
||||
// For more information about these two panics, see in "On the Importance of
|
||||
// Checking Cryptographic Protocols for Faults" by Dan Boneh, Richard A. DeMillo,
|
||||
// and Richard J. Lipton.
|
||||
let noise_keypair_legacy = noise::Keypair::<noise::X25519>::new().into_authentic(&keypair)
|
||||
.expect("can only fail in case of a hardware bug; since this signing is performed only \
|
||||
once and at initialization, we're taking the bet that the inconvenience of a very \
|
||||
rare panic here is basically zero");
|
||||
let noise_keypair_spec = noise::Keypair::<noise::X25519Spec>::new().into_authentic(&keypair)
|
||||
let noise_keypair = noise::Keypair::<noise::X25519Spec>::new().into_authentic(&keypair)
|
||||
.expect("can only fail in case of a hardware bug; since this signing is performed only \
|
||||
once and at initialization, we're taking the bet that the inconvenience of a very \
|
||||
rare panic here is basically zero");
|
||||
@@ -87,19 +83,9 @@ pub fn build_transport(
|
||||
let mut noise_legacy = noise::LegacyConfig::default();
|
||||
noise_legacy.recv_legacy_handshake = true;
|
||||
|
||||
let mut xx_config = noise::NoiseConfig::xx(noise_keypair_spec);
|
||||
let mut xx_config = noise::NoiseConfig::xx(noise_keypair);
|
||||
xx_config.set_legacy_config(noise_legacy.clone());
|
||||
let mut ix_config = noise::NoiseConfig::ix(noise_keypair_legacy);
|
||||
ix_config.set_legacy_config(noise_legacy);
|
||||
|
||||
let extract_peer_id = |result| match result {
|
||||
EitherOutput::First((peer_id, o)) => (peer_id, EitherOutput::First(o)),
|
||||
EitherOutput::Second((peer_id, o)) => (peer_id, EitherOutput::Second(o)),
|
||||
};
|
||||
|
||||
core::upgrade::SelectUpgrade::new(xx_config.into_authenticated(), ix_config.into_authenticated())
|
||||
.map_inbound(extract_peer_id)
|
||||
.map_outbound(extract_peer_id)
|
||||
xx_config.into_authenticated()
|
||||
};
|
||||
|
||||
let multiplexing_config = {
|
||||
@@ -115,7 +101,7 @@ pub fn build_transport(
|
||||
core::upgrade::SelectUpgrade::new(yamux_config, mplex_config)
|
||||
};
|
||||
|
||||
let transport = transport.upgrade(upgrade::Version::V1)
|
||||
let transport = transport.upgrade(upgrade::Version::V1Lazy)
|
||||
.authenticate(authentication_config)
|
||||
.multiplex(multiplexing_config)
|
||||
.timeout(Duration::from_secs(20))
|
||||
|
||||
@@ -19,7 +19,7 @@ parking_lot = "0.10.0"
|
||||
futures = "0.3.4"
|
||||
futures-timer = "3.0.1"
|
||||
rand = "0.7.2"
|
||||
libp2p = { version = "0.30.1", default-features = false }
|
||||
libp2p = { version = "0.31.1", default-features = false }
|
||||
sp-consensus = { version = "0.8.0", path = "../../../primitives/consensus/common" }
|
||||
sc-consensus = { version = "0.8.0", path = "../../../client/consensus/common" }
|
||||
sc-client-api = { version = "2.0.0", path = "../../api" }
|
||||
|
||||
@@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
futures = "0.3.4"
|
||||
libp2p = { version = "0.30.1", default-features = false }
|
||||
libp2p = { version = "0.31.1", default-features = false }
|
||||
sp-utils = { version = "2.0.0", path = "../../primitives/utils"}
|
||||
log = "0.4.8"
|
||||
serde_json = "1.0.41"
|
||||
|
||||
@@ -19,7 +19,7 @@ parking_lot = "0.10.0"
|
||||
futures = "0.3.4"
|
||||
futures-timer = "3.0.1"
|
||||
wasm-timer = "0.2.5"
|
||||
libp2p = { version = "0.30.1", default-features = false, features = ["dns", "tcp-async-std", "wasm-ext", "websocket"] }
|
||||
libp2p = { version = "0.31.1", default-features = false, features = ["dns", "tcp-async-std", "wasm-ext", "websocket"] }
|
||||
log = "0.4.8"
|
||||
pin-project = "0.4.6"
|
||||
rand = "0.7.2"
|
||||
|
||||
@@ -16,4 +16,4 @@ frame-support-procedural-tools-derive = { version = "2.0.0", path = "./derive" }
|
||||
proc-macro2 = "1.0.6"
|
||||
quote = "1.0.3"
|
||||
syn = { version = "1.0.7", features = ["full", "visit"] }
|
||||
proc-macro-crate = "0.1.4"
|
||||
proc-macro-crate = "0.1.5"
|
||||
|
||||
@@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
thiserror = "1.0.21"
|
||||
libp2p = { version = "0.30.1", default-features = false }
|
||||
libp2p = { version = "0.31.1", default-features = false }
|
||||
log = "0.4.8"
|
||||
sp-core = { path= "../../core", version = "2.0.0"}
|
||||
sp-inherents = { version = "2.0.0", path = "../../inherents" }
|
||||
|
||||
@@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
futures = { version = "0.3", features = ["compat"] }
|
||||
futures01 = { package = "futures", version = "0.1.29" }
|
||||
log = "0.4.8"
|
||||
libp2p-wasm-ext = { version = "0.24", features = ["websocket"] }
|
||||
libp2p-wasm-ext = { version = "0.25", features = ["websocket"] }
|
||||
console_error_panic_hook = "0.1.6"
|
||||
console_log = "0.1.2"
|
||||
js-sys = "0.3.34"
|
||||
|
||||
Reference in New Issue
Block a user