Revert "chore: update libp2p to 0.52.1 (#14429)" (#14722)

* Revert "chore: update libp2p to 0.52.1 (#14429)"

This reverts commit 59d8b86450.

* Fix dependencies

* Update dependencies

* Update Cargo.lock
This commit is contained in:
Aaro Altonen
2023-08-16 13:06:13 +03:00
committed by GitHub
parent d160818a9f
commit dd1b29c2f8
39 changed files with 2171 additions and 1275 deletions
+4 -14
View File
@@ -30,8 +30,8 @@ use crate::{
use bytes::Bytes;
use futures::channel::oneshot;
use libp2p::{
connection_limits::ConnectionLimits, core::Multiaddr, identify::Info as IdentifyInfo,
identity::PublicKey, kad::RecordKey, swarm::NetworkBehaviour, PeerId,
core::Multiaddr, identify::Info as IdentifyInfo, identity::PublicKey, kad::RecordKey,
swarm::NetworkBehaviour, PeerId,
};
use parking_lot::Mutex;
@@ -43,7 +43,7 @@ pub use crate::request_responses::{InboundFailure, OutboundFailure, RequestId, R
/// General behaviour of the network. Combines all protocols together.
#[derive(NetworkBehaviour)]
#[behaviour(to_swarm = "BehaviourOut")]
#[behaviour(out_event = "BehaviourOut")]
pub struct Behaviour<B: BlockT> {
/// All the substrate-specific protocols.
substrate: Protocol<B>,
@@ -52,8 +52,6 @@ pub struct Behaviour<B: BlockT> {
peer_info: peer_info::PeerInfoBehaviour,
/// Discovers nodes of the network.
discovery: DiscoveryBehaviour,
/// Connection limits.
connection_limits: libp2p::connection_limits::Behaviour,
/// Generic request-response protocols.
request_responses: request_responses::RequestResponsesBehaviour,
}
@@ -174,7 +172,6 @@ impl<B: BlockT> Behaviour<B> {
disco_config: DiscoveryConfig,
request_response_protocols: Vec<ProtocolConfig>,
peer_store_handle: PeerStoreHandle,
connection_limits: ConnectionLimits,
external_addresses: Arc<Mutex<HashSet<Multiaddr>>>,
) -> Result<Self, request_responses::RegisterError> {
Ok(Self {
@@ -185,7 +182,6 @@ impl<B: BlockT> Behaviour<B> {
external_addresses,
),
discovery: disco_config.finish(),
connection_limits: libp2p::connection_limits::Behaviour::new(connection_limits),
request_responses: request_responses::RequestResponsesBehaviour::new(
request_response_protocols.into_iter(),
Box::new(peer_store_handle),
@@ -257,7 +253,7 @@ impl<B: BlockT> Behaviour<B> {
pub fn add_self_reported_address_to_dht(
&mut self,
peer_id: &PeerId,
supported_protocols: &[impl AsRef<str>],
supported_protocols: &[impl AsRef<[u8]>],
addr: Multiaddr,
) {
self.discovery.add_self_reported_address(peer_id, supported_protocols, addr);
@@ -361,9 +357,3 @@ impl From<DiscoveryOut> for BehaviourOut {
}
}
}
impl From<void::Void> for BehaviourOut {
fn from(e: void::Void) -> Self {
void::unreachable(e)
}
}