mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 22:45:40 +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:
@@ -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;
|
||||
@@ -330,12 +330,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,
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
@@ -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);
|
||||
|
||||
@@ -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};
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user