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:
Roman Borschel
2020-11-27 15:29:18 +01:00
committed by GitHub
parent 4f97481da7
commit b4ee48ee18
23 changed files with 167 additions and 127 deletions
@@ -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()