Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade libp2p to 0.52.4 #1631

Merged
merged 58 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
13f140e
Upgrade libp2p to 0.52.3
altonen Sep 11, 2023
01aac35
Temporarily stop using `V1Lazy`
altonen Sep 19, 2023
a3fbe78
Implement auxiliary address store for `DiscoveryBehaviour`
altonen Sep 19, 2023
9bc5509
Set Kademlia to server mode by default
altonen Sep 19, 2023
5a78cb6
".git/.scripts/commands/fmt/fmt.sh"
Sep 19, 2023
b7d2041
Fix warnings
altonen Sep 19, 2023
26a8b9a
Update substrate/client/network/src/discovery.rs
altonen Sep 19, 2023
3afa3bc
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
altonen Sep 22, 2023
7aea01d
Apply review comments
altonen Sep 23, 2023
d35cb99
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
altonen Sep 23, 2023
8293e72
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
altonen Oct 16, 2023
d5fd70b
Fix stuff
altonen Oct 16, 2023
d234dc4
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
altonen Oct 17, 2023
59b1568
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
altonen Oct 19, 2023
1c5312c
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
altonen Oct 20, 2023
a482f91
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
altonen Oct 30, 2023
b3a4c89
wip
altonen Oct 30, 2023
d7ab2f5
Fix external address detection
altonen Oct 31, 2023
20d8717
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
altonen Oct 31, 2023
522d468
Fix docs
altonen Nov 1, 2023
0434969
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
altonen Nov 1, 2023
d2ece5d
Fix deprecation warning for UI tests
altonen Nov 1, 2023
8c1fd17
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
altonen Nov 1, 2023
728f92a
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
altonen Nov 2, 2023
742124d
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
altonen Nov 2, 2023
5e1c083
Test
altonen Nov 2, 2023
3c815cb
test
altonen Nov 3, 2023
24c05ba
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
altonen Nov 9, 2023
7d9b7c1
Merge remote-tracking branch 'origin/master' into dm-upgrade-libp2p
dmitry-markin Apr 2, 2024
f3e3a69
Fix external address discovery
dmitry-markin Apr 5, 2024
7331f17
Fix clippy
dmitry-markin Apr 5, 2024
fcd1ec9
Remove unneded `#[allow(deprecated)]`
dmitry-markin Apr 5, 2024
04073fb
Fix rustdoc
dmitry-markin Apr 5, 2024
d70c2fa
Make taplo happy
dmitry-markin Apr 5, 2024
bfe2a1a
(empty) kick CI
dmitry-markin Apr 10, 2024
40cc1e9
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
dmitry-markin May 30, 2024
e382259
Upgrade libp2p upgrade PR on latest master (#4682)
dmitry-markin Jun 4, 2024
a6257c8
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
dmitry-markin Jun 5, 2024
189de98
Upgrade libp2p to 0.52.4 (#4698)
dmitry-markin Jun 5, 2024
9efe825
Remove aux address store in `Discovery`
dmitry-markin Jun 5, 2024
a695d67
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
dmitry-markin Jun 5, 2024
e15a524
Enable `Notifications` handler tests
dmitry-markin Jun 12, 2024
b1d2acd
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
dmitry-markin Jun 12, 2024
a4e834d
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
dmitry-markin Jun 17, 2024
30664bc
Replace deprecated `SwarmBuilder` with `Swarm::new` in tests
dmitry-markin Jun 18, 2024
98596ed
Cleanup unrelated changes
dmitry-markin Jun 18, 2024
51bdea0
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
dmitry-markin Jun 18, 2024
4478dd8
Cleanup unrelated changes in sc-service
dmitry-markin Jun 18, 2024
20cd00e
Add PRDoc
dmitry-markin Jun 18, 2024
762cad5
minor: fix typo in PRDoc
dmitry-markin Jun 18, 2024
87784a6
Bump curve25519-dalek 4.1.2 -> 4.1.3
dmitry-markin Jun 19, 2024
09f4b33
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
dmitry-markin Jun 19, 2024
1f748b6
Apply suggestions from code review
dmitry-markin Jun 21, 2024
0f447da
Revert unrelated changes in mixnet
dmitry-markin Jun 21, 2024
01d6649
Remove `multiaddr` dependency from `sc-mixnet`
dmitry-markin Jun 21, 2024
bd61aff
Remove unneded `libp2p` dependencies in other crates
dmitry-markin Jun 21, 2024
d54d484
Merge remote-tracking branch 'origin/master' into altonen-upgrade-libp2p
dmitry-markin Jun 24, 2024
6e5b4ef
minor: rustfmt
dmitry-markin Jun 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,827 changes: 518 additions & 1,309 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion polkadot/node/network/bridge/src/validator_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl<N: Network, AD: AuthorityDiscovery> Service<N, AD> {
fn extract_peer_ids(multiaddr: impl Iterator<Item = Multiaddr>) -> HashSet<PeerId> {
multiaddr
.filter_map(|mut addr| match addr.pop() {
Some(multiaddr::Protocol::P2p(key)) => PeerId::from_multihash(key).ok(),
Some(multiaddr::Protocol::P2p(peer_id)) => Some(peer_id),
_ => None,
})
.collect()
Expand Down
4 changes: 2 additions & 2 deletions substrate/client/authority-discovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features =
futures = "0.3.21"
futures-timer = "3.0.1"
ip_network = "0.4.1"
libp2p = { version = "0.51.3", features = ["kad", "ed25519"] }
multihash = { version = "0.17.0", default-features = false, features = ["std", "sha2"] }
libp2p = { version = "0.52.3", features = ["kad", "ed25519"] }
multihash-codetable = { version = "0.1.0", features = ["sha2", "digest"] }
log = "0.4.17"
prost = "0.11"
rand = "0.8.5"
Expand Down
2 changes: 1 addition & 1 deletion substrate/client/authority-discovery/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn get_addresses_and_authority_id() {
let remote_addr = "/ip6/2001:db8:0:0:0:0:0:2/tcp/30333"
.parse::<Multiaddr>()
.unwrap()
.with(Protocol::P2p(remote_peer_id.into()));
.with(Protocol::P2p(remote_peer_id));

let test_api = Arc::new(TestApi { authorities: vec![] });

Expand Down
8 changes: 4 additions & 4 deletions substrate/client/authority-discovery/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ use futures::{channel::mpsc, future, stream::Fuse, FutureExt, Stream, StreamExt}
use addr_cache::AddrCache;
use codec::{Decode, Encode};
use ip_network::IpNetwork;
use libp2p::{core::multiaddr, identity::PublicKey, multihash::Multihash, Multiaddr, PeerId};
use multihash::{Code, MultihashDigest};
use libp2p::{core::multiaddr, identity::PublicKey, Multiaddr};
use multihash_codetable::{Code, MultihashDigest};

use log::{debug, error, log_enabled};
use prometheus_endpoint::{register, Counter, CounterVec, Gauge, Opts, U64};
Expand Down Expand Up @@ -304,7 +304,7 @@ where
}

fn addresses_to_publish(&self) -> impl Iterator<Item = Multiaddr> {
let peer_id: Multihash = self.network.local_peer_id().into();
let peer_id = self.network.local_peer_id();
let publish_non_global_ips = self.publish_non_global_ips;
self.network
.external_addresses()
Expand Down Expand Up @@ -529,7 +529,7 @@ where
.map_err(Error::ParsingMultiaddress)?;

let get_peer_id = |a: &Multiaddr| match a.iter().last() {
Some(multiaddr::Protocol::P2p(key)) => PeerId::from_multihash(key).ok(),
Some(multiaddr::Protocol::P2p(peer_id)) => Some(peer_id),
_ => None,
};

Expand Down
25 changes: 12 additions & 13 deletions substrate/client/authority-discovery/src/worker/addr_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ impl AddrCache {

fn peer_id_from_multiaddr(addr: &Multiaddr) -> Option<PeerId> {
addr.iter().last().and_then(|protocol| {
if let Protocol::P2p(multihash) = protocol {
PeerId::from_multihash(multihash).ok()
if let Protocol::P2p(peer_id) = protocol {
Some(peer_id)
} else {
None
}
Expand All @@ -178,7 +178,8 @@ fn addresses_to_peer_ids(addresses: &HashSet<Multiaddr>) -> HashSet<PeerId> {
mod tests {
use super::*;

use libp2p::multihash::{self, Multihash};
use libp2p::multihash::Multihash;
use multihash_codetable::Code;
use quickcheck::{Arbitrary, Gen, QuickCheck, TestResult};

use sp_authority_discovery::{AuthorityId, AuthorityPair};
Expand All @@ -200,14 +201,13 @@ mod tests {
impl Arbitrary for TestMultiaddr {
fn arbitrary(g: &mut Gen) -> Self {
let seed = (0..32).map(|_| u8::arbitrary(g)).collect::<Vec<_>>();
let peer_id = PeerId::from_multihash(
Multihash::wrap(multihash::Code::Sha2_256.into(), &seed).unwrap(),
)
.unwrap();
let peer_id =
PeerId::from_multihash(Multihash::wrap(Code::Sha2_256.into(), &seed).unwrap())
.unwrap();
let multiaddr = "/ip6/2001:db8:0:0:0:0:0:2/tcp/30333"
.parse::<Multiaddr>()
.unwrap()
.with(Protocol::P2p(peer_id.into()));
.with(Protocol::P2p(peer_id));

TestMultiaddr(multiaddr)
}
Expand All @@ -219,10 +219,9 @@ mod tests {
impl Arbitrary for TestMultiaddrsSamePeerCombo {
fn arbitrary(g: &mut Gen) -> Self {
let seed = (0..32).map(|_| u8::arbitrary(g)).collect::<Vec<_>>();
let peer_id = PeerId::from_multihash(
Multihash::wrap(multihash::Code::Sha2_256.into(), &seed).unwrap(),
)
.unwrap();
let peer_id =
PeerId::from_multihash(Multihash::wrap(Code::Sha2_256.into(), &seed).unwrap())
.unwrap();
let multiaddr1 = "/ip6/2001:db8:0:0:0:0:0:2/tcp/30333"
.parse::<Multiaddr>()
.unwrap()
Expand Down Expand Up @@ -367,7 +366,7 @@ mod tests {
let mut addr_cache = AddrCache::new();

let peer_id = PeerId::random();
let addr = Multiaddr::empty().with(Protocol::P2p(peer_id.into()));
let addr = Multiaddr::empty().with(Protocol::P2p(peer_id));

let authority_id0 = AuthorityPair::generate().0.public();
let authority_id1 = AuthorityPair::generate().0.public();
Expand Down
6 changes: 3 additions & 3 deletions substrate/client/authority-discovery/src/worker/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ fn dont_stop_polling_dht_event_stream_after_bogus_event() {
let peer_id = PeerId::random();
let address: Multiaddr = "/ip6/2001:db8:0:0:0:0:0:1/tcp/30333".parse().unwrap();

address.with(multiaddr::Protocol::P2p(peer_id.into()))
address.with(multiaddr::Protocol::P2p(peer_id))
};
let remote_key_store = MemoryKeystore::new();
let remote_public_key: AuthorityId = remote_key_store
Expand Down Expand Up @@ -526,7 +526,7 @@ impl DhtValueFoundTester {
let address: Multiaddr =
format!("/ip6/2001:db8:0:0:0:0:0:{:x}/tcp/30333", idx).parse().unwrap();

address.with(multiaddr::Protocol::P2p(peer_id.into()))
address.with(multiaddr::Protocol::P2p(peer_id))
}

fn process_value_found(
Expand Down Expand Up @@ -749,7 +749,7 @@ fn lookup_throttling() {
let peer_id = PeerId::random();
let address: Multiaddr = "/ip6/2001:db8:0:0:0:0:0:1/tcp/30333".parse().unwrap();

address.with(multiaddr::Protocol::P2p(peer_id.into()))
address.with(multiaddr::Protocol::P2p(peer_id))
};
let remote_key_store = MemoryKeystore::new();
let remote_public_keys: Vec<AuthorityId> = (0..20)
Expand Down
2 changes: 1 addition & 1 deletion substrate/client/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ chrono = "0.4.27"
clap = { version = "4.4.4", features = ["derive", "string"] }
fdlimit = "0.2.1"
futures = "0.3.21"
libp2p-identity = { version = "0.1.3", features = ["peerid", "ed25519"]}
libp2p-identity = { version = "0.2.3", features = ["peerid", "ed25519"]}
log = "0.4.17"
names = { version = "0.13.0", default-features = false }
parity-scale-codec = "3.6.1"
Expand Down
2 changes: 1 addition & 1 deletion substrate/client/consensus/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
async-trait = "0.1.57"
futures = { version = "0.3.21", features = ["thread-pool"] }
futures-timer = "3.0.1"
libp2p-identity = { version = "0.1.3", features = ["peerid", "ed25519"] }
libp2p-identity = { version = "0.2.3", features = ["peerid", "ed25519"] }
log = "0.4.17"
mockall = "0.11.3"
parking_lot = "0.12.1"
Expand Down
3 changes: 2 additions & 1 deletion substrate/client/network-gossip/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ targets = ["x86_64-unknown-linux-gnu"]
ahash = "0.8.2"
futures = "0.3.21"
futures-timer = "3.0.1"
libp2p = "0.51.3"
libp2p-identity = { version = "0.2.3", features = ["peerid", "ed25519"] }
multiaddr = "0.18.0"
log = "0.4.17"
schnellru = "0.2.1"
tracing = "0.1.29"
Expand Down
5 changes: 3 additions & 2 deletions substrate/client/network-gossip/src/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use futures::{
channel::mpsc::{channel, Receiver, Sender},
prelude::*,
};
use libp2p::PeerId;
use libp2p_identity::PeerId;
use log::trace;
use prometheus_endpoint::Registry;
use sp_runtime::traits::Block as BlockT;
Expand Down Expand Up @@ -327,12 +327,13 @@ impl<B: BlockT> futures::future::FusedFuture for GossipEngine<B> {
#[cfg(test)]
mod tests {
use super::*;
use crate::{multiaddr::Multiaddr, ValidationResult, ValidatorContext};
use crate::{ValidationResult, ValidatorContext};
use futures::{
channel::mpsc::{unbounded, UnboundedSender},
executor::{block_on, block_on_stream},
future::poll_fn,
};
use multiaddr::Multiaddr;
use quickcheck::{Arbitrary, Gen, QuickCheck};
use sc_network::{
config::MultiaddrWithPeerId, NetworkBlock, NetworkEventStream, NetworkNotification,
Expand Down
6 changes: 3 additions & 3 deletions substrate/client/network-gossip/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ pub use self::{
validator::{DiscardAll, MessageIntent, ValidationResult, Validator, ValidatorContext},
};

use libp2p::{multiaddr, PeerId};
use libp2p_identity::PeerId;
use multiaddr::{Multiaddr, Protocol};
use sc_network::{
types::ProtocolName, NetworkBlock, NetworkEventStream, NetworkNotification, NetworkPeers,
};
Expand All @@ -82,8 +83,7 @@ mod validator;
/// Abstraction over a network.
pub trait Network<B: BlockT>: NetworkPeers + NetworkEventStream + NetworkNotification {
fn add_set_reserved(&self, who: PeerId, protocol: ProtocolName) {
let addr =
iter::once(multiaddr::Protocol::P2p(who.into())).collect::<multiaddr::Multiaddr>();
let addr = Multiaddr::empty().with(Protocol::P2p(who));
let result = self.add_peers_to_reserved_set(protocol, iter::once(addr).collect());
if let Err(err) = result {
log::error!(target: "gossip", "add_set_reserved failed: {}", err);
Expand Down
4 changes: 2 additions & 2 deletions substrate/client/network-gossip/src/state_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use crate::{MessageIntent, Network, ValidationResult, Validator, ValidatorContext};

use ahash::AHashSet;
use libp2p::PeerId;
use libp2p_identity::PeerId;
use schnellru::{ByLength, LruMap};

use prometheus_endpoint::{register, Counter, PrometheusError, Registry, U64};
Expand Down Expand Up @@ -521,8 +521,8 @@ impl Metrics {
#[cfg(test)]
mod tests {
use super::*;
use crate::multiaddr::Multiaddr;
use futures::prelude::*;
use multiaddr::Multiaddr;
use sc_network::{
config::MultiaddrWithPeerId, event::Event, NetworkBlock, NetworkEventStream,
NetworkNotification, NetworkPeers, NotificationSenderError,
Expand Down
2 changes: 1 addition & 1 deletion substrate/client/network-gossip/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use libp2p::PeerId;
use libp2p_identity::PeerId;
use sc_network_common::role::ObservedRole;
use sp_runtime::traits::Block as BlockT;

Expand Down
7 changes: 5 additions & 2 deletions substrate/client/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ fnv = "1.0.6"
futures = "0.3.21"
futures-timer = "3.0.2"
ip_network = "0.4.1"
libp2p = { version = "0.51.3", features = ["dns", "identify", "kad", "macros", "mdns", "noise", "ping", "tcp", "tokio", "yamux", "websocket", "request-response"] }
libp2p = { version = "0.52.3", features = ["dns", "identify", "kad", "macros", "mdns", "noise", "ping", "tcp", "tokio", "yamux", "websocket", "request-response"] }
# libp2p-kad = "0.44.2"
linked_hash_set = "0.1.3"
log = "0.4.17"
mockall = "0.11.3"
Expand All @@ -47,12 +48,14 @@ sp-arithmetic = { path = "../../primitives/arithmetic" }
sp-blockchain = { path = "../../primitives/blockchain" }
sp-core = { path = "../../primitives/core" }
sp-runtime = { path = "../../primitives/runtime" }
void = "1"
wasm-timer = "0.2"
schnellru = "0.2.1"

[dev-dependencies]
assert_matches = "1.3"
mockall = "0.11.3"
multistream-select = "0.12.1"
multistream-select = "0.13.0"
rand = "0.8.5"
tempfile = "3.1.0"
tokio = { version = "1.22.0", features = ["macros"] }
Expand Down
2 changes: 1 addition & 1 deletion substrate/client/network/bitswap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ prost-build = "0.11"
async-channel = "1.8.0"
cid = "0.9.0"
futures = "0.3.21"
libp2p-identity = { version = "0.1.3", features = ["peerid"] }
libp2p-identity = { version = "0.2.3", features = ["peerid"] }
log = "0.4.17"
prost = "0.11"
thiserror = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion substrate/client/network/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ codec = { package = "parity-scale-codec", version = "3.6.1", features = [
"derive",
] }
futures = "0.3.21"
libp2p-identity = { version = "0.1.3", features = ["peerid"] }
libp2p-identity = { version = "0.2.3", features = ["peerid"] }
sc-consensus = { path = "../../consensus/common" }
sp-consensus = { path = "../../../primitives/consensus/common" }
sp-consensus-grandpa = { path = "../../../primitives/consensus/grandpa" }
Expand Down
2 changes: 1 addition & 1 deletion substrate/client/network/light/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ codec = { package = "parity-scale-codec", version = "3.6.1", features = [
"derive",
] }
futures = "0.3.21"
libp2p-identity = { version = "0.1.3", features = ["peerid"] }
libp2p-identity = { version = "0.2.3", features = ["peerid"] }
log = "0.4.16"
prost = "0.11"
sp-blockchain = { path = "../../../primitives/blockchain" }
Expand Down
18 changes: 14 additions & 4 deletions substrate/client/network/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ use crate::{
use bytes::Bytes;
use futures::channel::oneshot;
use libp2p::{
core::Multiaddr, identify::Info as IdentifyInfo, identity::PublicKey, kad::RecordKey,
swarm::NetworkBehaviour, PeerId,
connection_limits::ConnectionLimits, core::Multiaddr, identify::Info as IdentifyInfo,
identity::PublicKey, kad::RecordKey, swarm::NetworkBehaviour, PeerId,
};

use parking_lot::Mutex;
Expand All @@ -43,8 +43,10 @@ pub use crate::request_responses::{InboundFailure, OutboundFailure, RequestId, R

/// General behaviour of the network. Combines all protocols together.
#[derive(NetworkBehaviour)]
#[behaviour(out_event = "BehaviourOut")]
#[behaviour(to_swarm = "BehaviourOut")]
pub struct Behaviour<B: BlockT> {
/// Connection limits.
connection_limits: libp2p::connection_limits::Behaviour,
bkchr marked this conversation as resolved.
Show resolved Hide resolved
/// All the substrate-specific protocols.
substrate: Protocol<B>,
/// Periodically pings and identifies the nodes we are connected to, and store information in a
Expand Down Expand Up @@ -173,6 +175,7 @@ impl<B: BlockT> Behaviour<B> {
request_response_protocols: Vec<ProtocolConfig>,
peer_store_handle: PeerStoreHandle,
external_addresses: Arc<Mutex<HashSet<Multiaddr>>>,
connection_limits: ConnectionLimits,
) -> Result<Self, request_responses::RegisterError> {
Ok(Self {
substrate,
Expand All @@ -186,6 +189,7 @@ impl<B: BlockT> Behaviour<B> {
request_response_protocols.into_iter(),
Box::new(peer_store_handle),
)?,
connection_limits: libp2p::connection_limits::Behaviour::new(connection_limits),
})
}

Expand Down Expand Up @@ -253,7 +257,7 @@ impl<B: BlockT> Behaviour<B> {
pub fn add_self_reported_address_to_dht(
&mut self,
peer_id: &PeerId,
supported_protocols: &[impl AsRef<[u8]>],
supported_protocols: &[impl AsRef<str>],
addr: Multiaddr,
) {
self.discovery.add_self_reported_address(peer_id, supported_protocols, addr);
Expand Down Expand Up @@ -357,3 +361,9 @@ impl From<DiscoveryOut> for BehaviourOut {
}
}
}

impl From<void::Void> for BehaviourOut {
fn from(e: void::Void) -> Self {
void::unreachable(e)
}
}
Loading