Create network_utils crate (#7761)

Anchor currently depends on `lighthouse_network` for a few types and utilities that live within. As we use our own libp2p behaviours, we actually do not use the core logic in that crate. This makes us transitively depend on a bunch of unneeded crates (even a whole separate libp2p if the versions mismatch!)


  Move things we require into it's own lightweight crate.


Co-Authored-By: Daniel Knopik <daniel@dknopik.de>
This commit is contained in:
Daniel Knopik
2025-09-10 14:59:24 +02:00
committed by GitHub
parent caa1df6fc3
commit ee1b6bc81b
42 changed files with 198 additions and 169 deletions

View File

@@ -57,6 +57,7 @@ lighthouse_tracing = { workspace = true }
lighthouse_version = { workspace = true }
logging = { workspace = true }
metrics = { workspace = true }
network_utils = { workspace = true }
opentelemetry = { workspace = true }
opentelemetry-otlp = { workspace = true }
opentelemetry_sdk = { workspace = true }
@@ -70,7 +71,6 @@ tracing = { workspace = true }
tracing-opentelemetry = { workspace = true }
tracing-subscriber = { workspace = true }
types = { workspace = true }
unused_port = { workspace = true }
validator_client = { workspace = true }
validator_manager = { path = "../validator_manager" }

View File

@@ -10,6 +10,9 @@ use beacon_node::{
};
use beacon_processor::BeaconProcessorConfig;
use lighthouse_network::PeerId;
use network_utils::unused_port::{
unused_tcp4_port, unused_tcp6_port, unused_udp4_port, unused_udp6_port,
};
use std::fs::File;
use std::io::{Read, Write};
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
@@ -22,7 +25,6 @@ use std::time::Duration;
use tempfile::TempDir;
use types::non_zero_usize::new_non_zero_usize;
use types::{Address, Checkpoint, Epoch, Hash256, MainnetEthSpec};
use unused_port::{unused_tcp4_port, unused_tcp6_port, unused_udp4_port, unused_udp6_port};
const DEFAULT_EXECUTION_ENDPOINT: &str = "http://localhost:8551/";
const DEFAULT_EXECUTION_JWT_SECRET_KEY: &str =

View File

@@ -3,8 +3,8 @@ use boot_node::config::BootNodeConfigSerialization;
use crate::exec::{CommandLineTestExec, CompletedTest};
use clap::ArgMatches;
use clap_utils::get_eth2_network_config;
use lighthouse_network::Enr;
use lighthouse_network::discovery::ENR_FILENAME;
use lighthouse_network::{Enr, discovery::ENR_FILENAME};
use network_utils::unused_port::unused_udp4_port;
use std::fs::File;
use std::io::Write;
use std::net::Ipv4Addr;
@@ -12,7 +12,6 @@ use std::path::{Path, PathBuf};
use std::process::Command;
use std::str::FromStr;
use tempfile::TempDir;
use unused_port::unused_udp4_port;
const IP_ADDRESS: &str = "192.168.2.108";