mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 15:11:03 +00:00
chore: update libp2p to 0.52.1 (#14429)
* update libp2p to 0.52.0 * proto name now must implement `AsRef<str>` * update libp2p version everywhere * ToSwarm, FromBehaviour, ToBehaviour also LocalProtocolsChange and RemoteProtocolsChange * new NetworkBehaviour invariants * replace `Vec<u8>` with `StreamProtocol` * rename ConnectionHandlerEvent::Custom to NotifyBehaviour * remove DialError & ListenError invariants also fix pending_events * use connection_limits::Behaviour See https://github.com/libp2p/rust-libp2p/pull/3885 * impl `void::Void` for `BehaviourOut` also use `Behaviour::with_codec` * KademliaHandler no longer public * fix StreamProtocol construction * update libp2p-identify to 0.2.0 * remove non-existing methods from PollParameters rename ConnectionHandlerUpgrErr to StreamUpgradeError * `P2p` now contains `PeerId`, not `Multihash` * use multihash-codetable crate * update Cargo.lock * reformat text * comment out tests for now * remove `.into()` from P2p * confirm observed addr manually See https://github.com/libp2p/rust-libp2p/blob/master/protocols/identify/CHANGELOG.md#0430 * remove SwarmEvent::Banned since we're not using `ban_peer_id`, this can be safely removed. we may want to introduce `libp2p::allow_block_list` module in the future. * fix imports * replace `libp2p` with smaller deps in network-gossip * bring back tests * finish rewriting tests * uncomment handler tests * Revert "uncomment handler tests" This reverts commit 720a06815887f4e10767c62b58864a7ec3a48e50. * add a fixme * update Cargo.lock * remove extra From * make void uninhabited * fix discovery test * use autonat protocols confirming external addresses manually is unsafe in open networks * fix SyncNotificationsClogged invariant * only set server mode manually in tests doubt that we need to set it on node since we're adding public addresses * address @dmitry-markin comments * remove autonat * removed unused var * fix EOL * update smallvec and sha2 in attempt to compile polkadot * bump k256 in attempt to build cumulus --------- Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -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 sc_network_common::role::{ObservedRole, Roles};
|
||||
@@ -42,7 +42,7 @@ 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> {
|
||||
/// All the substrate-specific protocols.
|
||||
substrate: Protocol<B>,
|
||||
@@ -51,6 +51,8 @@ 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,
|
||||
}
|
||||
@@ -171,11 +173,13 @@ impl<B: BlockT> Behaviour<B> {
|
||||
disco_config: DiscoveryConfig,
|
||||
request_response_protocols: Vec<ProtocolConfig>,
|
||||
peerset: PeersetHandle,
|
||||
connection_limits: ConnectionLimits,
|
||||
) -> Result<Self, request_responses::RegisterError> {
|
||||
Ok(Self {
|
||||
substrate,
|
||||
peer_info: peer_info::PeerInfoBehaviour::new(user_agent, local_public_key),
|
||||
discovery: disco_config.finish(),
|
||||
connection_limits: libp2p::connection_limits::Behaviour::new(connection_limits),
|
||||
request_responses: request_responses::RequestResponsesBehaviour::new(
|
||||
request_response_protocols.into_iter(),
|
||||
peerset,
|
||||
@@ -247,7 +251,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);
|
||||
@@ -351,3 +355,9 @@ impl From<DiscoveryOut> for BehaviourOut {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<void::Void> for BehaviourOut {
|
||||
fn from(e: void::Void) -> Self {
|
||||
void::unreachable(e)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user