Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge queue: embarking unstable (adfa512) and [#6129 + #6134] together #6135

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion beacon_node/http_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2888,7 +2888,7 @@ pub fn serve<T: BeaconChainTypes>(
.map_err(warp_utils::reject::beacon_chain_error)?;

let syncing_data = api_types::SyncingData {
is_syncing: network_globals.sync_state.read().is_syncing(),
is_syncing: !network_globals.sync_state.read().is_synced(),
is_optimistic: Some(is_optimistic),
el_offline: Some(el_offline),
head_slot,
Expand Down
42 changes: 39 additions & 3 deletions beacon_node/http_api/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use http_api::{
test_utils::{create_api_server, ApiServer},
BlockId, StateId,
};
use lighthouse_network::{Enr, EnrExt, PeerId};
use lighthouse_network::{types::SyncState, Enr, EnrExt, PeerId};
use network::NetworkReceivers;
use proto_array::ExecutionStatus;
use sensitive_url::SensitiveUrl;
Expand Down Expand Up @@ -62,6 +62,7 @@ const SKIPPED_SLOTS: &[u64] = &[
];

struct ApiTester {
ctx: Arc<http_api::Context<EphemeralHarnessType<E>>>,
harness: Arc<BeaconChainHarness<EphemeralHarnessType<E>>>,
chain: Arc<BeaconChain<EphemeralHarnessType<E>>>,
client: BeaconNodeHttpClient,
Expand Down Expand Up @@ -253,7 +254,7 @@ impl ApiTester {
let log = null_logger().unwrap();

let ApiServer {
ctx: _,
ctx,
server,
listening_socket,
network_rx,
Expand Down Expand Up @@ -284,6 +285,7 @@ impl ApiTester {
);

Self {
ctx,
harness: Arc::new(harness),
chain,
client,
Expand Down Expand Up @@ -350,7 +352,7 @@ impl ApiTester {
let log = null_logger().unwrap();

let ApiServer {
ctx: _,
ctx,
server,
listening_socket,
network_rx,
Expand All @@ -371,6 +373,7 @@ impl ApiTester {
);

Self {
ctx,
harness,
chain,
client,
Expand Down Expand Up @@ -2168,6 +2171,37 @@ impl ApiTester {
self
}

pub async fn test_get_node_syncing_stalled(self) -> Self {
// Set sync status to stalled.
*self
.ctx
.network_globals
.as_ref()
.unwrap()
.sync_state
.write() = SyncState::Stalled;

let is_syncing = self
.client
.get_node_syncing()
.await
.unwrap()
.data
.is_syncing;
assert_eq!(is_syncing, true);

// Reset sync state.
*self
.ctx
.network_globals
.as_ref()
.unwrap()
.sync_state
.write() = SyncState::Synced;

self
}

pub async fn test_get_node_identity(self) -> Self {
let result = self.client.get_node_identity().await.unwrap().data;

Expand Down Expand Up @@ -6123,6 +6157,8 @@ async fn node_get() {
.await
.test_get_node_syncing()
.await
.test_get_node_syncing_stalled()
.await
.test_get_node_identity()
.await
.test_get_node_health()
Expand Down
3 changes: 3 additions & 0 deletions testing/simulator/src/basic_sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub fn run_basic_sim(matches: &ArgMatches) -> Result<(), String> {
.unwrap_or(&String::from("0"))
.parse::<usize>()
.unwrap_or(0);
// extra beacon node added with delay
let extra_nodes: usize = 1;
println!("PROPOSER-NODES: {}", proposer_nodes);
let validators_per_node = matches
.get_one::<String>("validators-per-node")
Expand Down Expand Up @@ -133,6 +135,7 @@ pub fn run_basic_sim(matches: &ArgMatches) -> Result<(), String> {
LocalNetworkParams {
validator_count: total_validator_count,
node_count,
extra_nodes,
proposer_nodes,
genesis_delay,
},
Expand Down
1 change: 1 addition & 0 deletions testing/simulator/src/fallback_sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ pub fn run_fallback_sim(matches: &ArgMatches) -> Result<(), String> {
LocalNetworkParams {
validator_count: total_validator_count,
node_count,
extra_nodes: 0,
proposer_nodes: 0,
genesis_delay,
},
Expand Down
3 changes: 2 additions & 1 deletion testing/simulator/src/local_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub struct LocalNetworkParams {
pub validator_count: usize,
pub node_count: usize,
pub proposer_nodes: usize,
pub extra_nodes: usize,
pub genesis_delay: u64,
}

Expand All @@ -38,7 +39,7 @@ fn default_client_config(network_params: LocalNetworkParams, genesis_time: u64)
genesis_time,
};
beacon_config.network.target_peers =
network_params.node_count + network_params.proposer_nodes - 1;
network_params.node_count + network_params.proposer_nodes + network_params.extra_nodes - 1;
beacon_config.network.enr_address = (Some(Ipv4Addr::LOCALHOST), None);
beacon_config.network.enable_light_client_server = true;
beacon_config.network.discv5_config.enable_packet_filter = false;
Expand Down
Loading