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

@@ -153,6 +153,7 @@ pub struct Config {
#[serde(with = "eth2::types::serde_status_code")]
pub duplicate_block_status_code: StatusCode,
pub enable_light_client_server: bool,
pub target_peers: usize,
}
impl Default for Config {
@@ -169,6 +170,7 @@ impl Default for Config {
enable_beacon_processor: true,
duplicate_block_status_code: StatusCode::ACCEPTED,
enable_light_client_server: false,
target_peers: 100,
}
}
}
@@ -2934,8 +2936,16 @@ pub fn serve<T: BeaconChainTypes>(
let is_optimistic = head_execution_status.is_optimistic_or_invalid();
// When determining sync status, make an exception for single-node
// testnets with 0 peers.
let sync_state = network_globals.sync_state.read();
let is_synced = sync_state.is_synced()
|| (sync_state.is_stalled()
&& network_globals.config.target_peers == 0);
drop(sync_state);
let syncing_data = api_types::SyncingData {
is_syncing: !network_globals.sync_state.read().is_synced(),
is_syncing: !is_synced,
is_optimistic,
el_offline,
head_slot,