mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Bump libp2p to address inconsistency in mesh peer tracking (#2493)
## Issue Addressed - Resolves #2457 - Resolves #2443 ## Proposed Changes Target the (presently unreleased) head of `libp2p/rust-libp2p:master` in order to obtain the fix from https://github.com/libp2p/rust-libp2p/pull/2175. Additionally: - `libsecp256k1` needed to be upgraded to satisfy the new version of `libp2p`. - There were also a handful of minor changes to `eth2_libp2p` to suit some interface changes. - Two `cargo audit --ignore` flags were remove due to libp2p upgrades. ## Additional Info NA
This commit is contained in:
@@ -42,13 +42,15 @@ regex = "1.3.9"
|
||||
strum = { version = "0.20", features = ["derive"] }
|
||||
superstruct = "0.2.0"
|
||||
|
||||
# TODO: remove the rev-reference and go back to release versions once there is a release that
|
||||
# includes the following PR:
|
||||
#
|
||||
# https://github.com/libp2p/rust-libp2p/pull/2175
|
||||
[dependencies.libp2p]
|
||||
#version = "0.39.1"
|
||||
#default-features = false
|
||||
# TODO: Update once https://github.com/libp2p/rust-libp2p/pull/2103 and
|
||||
# https://github.com/libp2p/rust-libp2p/pull/2137 are merged upstream.
|
||||
git = "https://github.com/sigp/rust-libp2p"
|
||||
rev = "75fd53ec5407a58ae1ff600fd1c68ea49079364a"
|
||||
git = "https://github.com/libp2p/rust-libp2p"
|
||||
rev = "ce23cbe76a0382b6fcb0e49f1b2612df86f6465d"
|
||||
features = ["websocket", "identify", "mplex", "yamux", "noise", "gossipsub", "dns-tokio", "tcp-tokio"]
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -203,7 +203,7 @@ impl CombinedKeyPublicExt for CombinedPublicKey {
|
||||
libp2p::core::identity::secp256k1::PublicKey::decode(&pk_bytes)
|
||||
.expect("valid public key"),
|
||||
);
|
||||
PeerId::from_public_key(libp2p_pk)
|
||||
PeerId::from_public_key(&libp2p_pk)
|
||||
}
|
||||
Self::Ed25519(pk) => {
|
||||
let pk_bytes = pk.to_bytes();
|
||||
@@ -211,7 +211,7 @@ impl CombinedKeyPublicExt for CombinedPublicKey {
|
||||
libp2p::core::identity::ed25519::PublicKey::decode(&pk_bytes)
|
||||
.expect("valid public key"),
|
||||
);
|
||||
PeerId::from_public_key(libp2p_pk)
|
||||
PeerId::from_public_key(&libp2p_pk)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -283,7 +283,7 @@ mod tests {
|
||||
let libp2p_sk = libp2p::identity::secp256k1::SecretKey::from_bytes(sk_bytes).unwrap();
|
||||
let secp256k1_kp: libp2p::identity::secp256k1::Keypair = libp2p_sk.into();
|
||||
let libp2p_kp = Keypair::Secp256k1(secp256k1_kp);
|
||||
let peer_id = libp2p_kp.public().into_peer_id();
|
||||
let peer_id = libp2p_kp.public().to_peer_id();
|
||||
|
||||
let enr = discv5::enr::EnrBuilder::new("v4")
|
||||
.build(&secret_key)
|
||||
@@ -304,7 +304,7 @@ mod tests {
|
||||
let libp2p_sk = libp2p::identity::ed25519::SecretKey::from_bytes(sk_bytes).unwrap();
|
||||
let ed25519_kp: libp2p::identity::ed25519::Keypair = libp2p_sk.into();
|
||||
let libp2p_kp = Keypair::Ed25519(ed25519_kp);
|
||||
let peer_id = libp2p_kp.public().into_peer_id();
|
||||
let peer_id = libp2p_kp.public().to_peer_id();
|
||||
|
||||
let enr = discv5::enr::EnrBuilder::new("v4").build(&keypair).unwrap();
|
||||
let node_id = peer_id_to_node_id(&peer_id).unwrap();
|
||||
|
||||
@@ -59,6 +59,7 @@ type InboundProcessingOutput<TSpec> = (
|
||||
type HandlerEvent<T> = Result<RPCReceived<T>, HandlerErr>;
|
||||
|
||||
/// An error encountered by the handler.
|
||||
#[derive(Debug)]
|
||||
pub enum HandlerErr {
|
||||
/// An error occurred for this peer's request. This can occur during protocol negotiation,
|
||||
/// message passing, or if the handler identifies that we are sending an error response to the peer.
|
||||
|
||||
@@ -143,7 +143,7 @@ impl<TSpec: EthSpec> Service<TSpec> {
|
||||
.with_max_established_outgoing(Some(
|
||||
(config.target_peers as f32 * (1.0 + PEER_EXCESS_FACTOR)) as u32,
|
||||
))
|
||||
.with_max_established_total(Some(
|
||||
.with_max_established(Some(
|
||||
(config.target_peers as f32 * (1.0 + PEER_EXCESS_FACTOR)) as u32,
|
||||
))
|
||||
.with_max_established_per_peer(Some(MAX_CONNECTIONS_PER_PEER));
|
||||
|
||||
Reference in New Issue
Block a user