Improve single-node testnet support and Arc NetworkConfig/ChainSpec (#6396)

* Arc ChainSpec and NetworkConfig

* Fix release tests

* Fix lint

* Merge remote-tracking branch 'origin/unstable' into single-node-testnet
This commit is contained in:
Michael Sproul
2024-09-24 10:16:18 +10:00
committed by GitHub
parent d84df5799c
commit 1447eeb40b
66 changed files with 340 additions and 250 deletions

View File

@@ -28,7 +28,7 @@ use lighthouse_network::service::api_types::{
SyncRequestId,
};
use lighthouse_network::types::SyncState;
use lighthouse_network::{NetworkGlobals, Request};
use lighthouse_network::{NetworkConfig, NetworkGlobals, Request};
use slog::info;
use slot_clock::{ManualSlotClock, SlotClock, TestingSlotClock};
use store::MemoryStore;
@@ -116,7 +116,7 @@ impl TestRig {
// Initialise a new beacon chain
let harness = BeaconChainHarness::<EphemeralHarnessType<E>>::builder(E)
.spec(spec)
.spec(Arc::new(spec))
.logger(log.clone())
.deterministic_keypairs(1)
.fresh_ephemeral_store()
@@ -132,9 +132,11 @@ impl TestRig {
let (network_tx, network_rx) = mpsc::unbounded_channel();
// TODO(das): make the generation of the ENR use the deterministic rng to have consistent
// column assignments
let network_config = Arc::new(NetworkConfig::default());
let globals = Arc::new(NetworkGlobals::new_test_globals(
Vec::new(),
&log,
network_config,
chain.spec.clone(),
));
let (beacon_processor, beacon_processor_rx) = NetworkBeaconProcessor::null_for_testing(

View File

@@ -51,8 +51,7 @@ use beacon_chain::block_verification_types::RpcBlock;
use beacon_chain::{BeaconChain, BeaconChainTypes};
use lighthouse_network::rpc::GoodbyeReason;
use lighthouse_network::service::api_types::Id;
use lighthouse_network::PeerId;
use lighthouse_network::SyncInfo;
use lighthouse_network::{PeerId, SyncInfo};
use lru_cache::LRUTimeCache;
use slog::{crit, debug, trace, warn};
use std::collections::HashMap;
@@ -399,7 +398,7 @@ mod tests {
use beacon_processor::WorkEvent as BeaconWorkEvent;
use lighthouse_network::service::api_types::SyncRequestId;
use lighthouse_network::{
rpc::StatusMessage, service::api_types::AppRequestId, NetworkGlobals,
rpc::StatusMessage, service::api_types::AppRequestId, NetworkConfig, NetworkGlobals,
};
use slog::{o, Drain};
use slot_clock::TestingSlotClock;
@@ -692,9 +691,11 @@ mod tests {
log.new(o!("component" => "range")),
);
let (network_tx, network_rx) = mpsc::unbounded_channel();
let network_config = Arc::new(NetworkConfig::default());
let globals = Arc::new(NetworkGlobals::new_test_globals(
Vec::new(),
&log,
network_config,
chain.spec.clone(),
));
let (network_beacon_processor, beacon_processor_rx) =