Switch libp2p sigp gossipsub fork (#4999)

* switch libp2p source to sigp fork

* Shift the connection closing inside RPC behaviour

* Tag specific commits

* Add slow peer scoring

* Fix test

* Use default yamux config

* Pin discv5 to our libp2p fork and cargo update

* Upgrade libp2p to enable yamux gains

* Add a comment specifying the branch being used

* cleanup build output from within container
(prevents CI warnings related to fs permissions)

* Remove revision tags add branches for testing, will revert back once we're happy

* Update to latest rust-libp2p version

* Pin forks

* Update cargo.lock

* Re-pin to panic-free rust

---------

Co-authored-by: Age Manning <Age@AgeManning.com>
Co-authored-by: Pawan Dhananjay <pawandhananjay@gmail.com>
Co-authored-by: antondlr <anton@delaruelle.net>
Co-authored-by: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
João Oliveira
2024-01-10 05:26:52 +00:00
committed by GitHub
parent be79f74c6d
commit 38df87c3c5
17 changed files with 1057 additions and 987 deletions

View File

@@ -1,8 +1,7 @@
use beacon_node::{get_data_dir, set_network_config};
use clap::ArgMatches;
use eth2_network_config::Eth2NetworkConfig;
use lighthouse_network::discovery::create_enr_builder_from_config;
use lighthouse_network::discv5::{enr::CombinedKey, Discv5Config, Enr};
use lighthouse_network::discv5::{self, enr::CombinedKey, Enr};
use lighthouse_network::{
discovery::{load_enr_from_disk, use_or_load_enr},
load_private_key, CombinedKeyExt, NetworkConfig,
@@ -20,7 +19,7 @@ pub struct BootNodeConfig<T: EthSpec> {
pub boot_nodes: Vec<Enr>,
pub local_enr: Enr,
pub local_key: CombinedKey,
pub discv5_config: Discv5Config,
pub discv5_config: discv5::Config,
phantom: PhantomData<T>,
}
@@ -130,8 +129,25 @@ impl<T: EthSpec> BootNodeConfig<T> {
// Build the local ENR
let mut local_enr = {
let enable_tcp = false;
let mut builder = create_enr_builder_from_config(&network_config, enable_tcp);
let (maybe_ipv4_address, maybe_ipv6_address) = network_config.enr_address;
let mut builder = discv5::Enr::builder();
if let Some(ip) = maybe_ipv4_address {
builder.ip4(ip);
}
if let Some(ip) = maybe_ipv6_address {
builder.ip6(ip);
}
if let Some(udp4_port) = network_config.enr_udp4_port {
builder.udp4(udp4_port.get());
}
if let Some(udp6_port) = network_config.enr_udp6_port {
builder.udp6(udp6_port.get());
}
// If we know of the ENR field, add it to the initial construction
if let Some(enr_fork_bytes) = enr_fork {
builder.add_value("eth2", &enr_fork_bytes);
@@ -157,7 +173,7 @@ impl<T: EthSpec> BootNodeConfig<T> {
/// The set of configuration parameters that can safely be (de)serialized.
///
/// Its fields are a subset of the fields of `BootNodeConfig`, some of them are copied from `Discv5Config`.
/// Its fields are a subset of the fields of `BootNodeConfig`, some of them are copied from `discv5::Config`.
#[derive(Serialize, Deserialize)]
pub struct BootNodeConfigSerialization {
pub ipv4_listen_socket: Option<SocketAddrV4>,

View File

@@ -5,7 +5,7 @@ use crate::config::BootNodeConfigSerialization;
use clap::ArgMatches;
use eth2_network_config::Eth2NetworkConfig;
use lighthouse_network::{
discv5::{enr::NodeId, Discv5, Discv5Event},
discv5::{self, enr::NodeId, Discv5},
EnrExt, Eth2Enr,
};
use slog::info;
@@ -144,17 +144,17 @@ pub async fn run<T: EthSpec>(
}
Some(event) = event_stream.recv() => {
match event {
Discv5Event::Discovered(_enr) => {
discv5::Event::Discovered(_enr) => {
// An ENR has bee obtained by the server
// Ignore these events here
}
Discv5Event::EnrAdded { .. } => {} // Ignore
Discv5Event::TalkRequest(_) => {} // Ignore
Discv5Event::NodeInserted { .. } => {} // Ignore
Discv5Event::SocketUpdated(socket_addr) => {
discv5::Event::EnrAdded { .. } => {} // Ignore
discv5::Event::TalkRequest(_) => {} // Ignore
discv5::Event::NodeInserted { .. } => {} // Ignore
discv5::Event::SocketUpdated(socket_addr) => {
info!(log, "Advertised socket address updated"; "socket_addr" => %socket_addr);
}
Discv5Event::SessionEstablished{ .. } => {} // Ignore
discv5::Event::SessionEstablished{ .. } => {} // Ignore
}
}
}