Skip to content

Commit

Permalink
Merge of #5500
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Apr 12, 2024
2 parents d30ba97 + 908d5c6 commit bc9c827
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 29 deletions.
8 changes: 1 addition & 7 deletions beacon_node/http_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ pub struct Config {
pub listen_port: u16,
pub allow_origin: Option<String>,
pub tls_config: Option<TlsConfig>,
pub allow_sync_stalled: bool,
pub spec_fork_name: Option<ForkName>,
pub data_dir: PathBuf,
pub sse_capacity_multiplier: usize,
Expand All @@ -162,7 +161,6 @@ impl Default for Config {
listen_port: 5052,
allow_origin: None,
tls_config: None,
allow_sync_stalled: false,
spec_fork_name: None,
data_dir: PathBuf::from(DEFAULT_ROOT_DIR),
sse_capacity_multiplier: 1,
Expand Down Expand Up @@ -321,7 +319,6 @@ pub fn serve<T: BeaconChainTypes>(
shutdown: impl Future<Output = ()> + Send + Sync + 'static,
) -> Result<HttpServer, Error> {
let config = ctx.config.clone();
let allow_sync_stalled = config.allow_sync_stalled;
let log = ctx.log.clone();

// Configure CORS.
Expand Down Expand Up @@ -482,10 +479,7 @@ pub fn serve<T: BeaconChainTypes>(
| SyncState::SyncTransition
| SyncState::BackFillSyncing { .. } => Ok(()),
SyncState::Synced => Ok(()),
SyncState::Stalled if allow_sync_stalled => Ok(()),
SyncState::Stalled => Err(warp_utils::reject::not_synced(
"sync is stalled".to_string(),
)),
SyncState::Stalled => Ok(()),
}
},
);
Expand Down
9 changes: 4 additions & 5 deletions beacon_node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,9 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.long("http-spec-fork")
.requires("enable_http")
.value_name("FORK")
.help("Serve the spec for a specific hard fork on /eth/v1/config/spec. It should \
not be necessary to set this flag.")
.help("This flag is deprecated and has no effect.")
.takes_value(true)
.hidden(true)
)
.arg(
Arg::with_name("http-enable-tls")
Expand Down Expand Up @@ -425,9 +425,8 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
Arg::with_name("http-allow-sync-stalled")
.long("http-allow-sync-stalled")
.requires("enable_http")
.help("Forces the HTTP to indicate that the node is synced when sync is actually \
stalled. This is useful for very small testnets. TESTING ONLY. DO NOT USE ON \
MAINNET.")
.help("This flag is deprecated and has no effect.")
.hidden(true)
)
.arg(
Arg::with_name("http-sse-capacity-multiplier")
Expand Down
14 changes: 11 additions & 3 deletions beacon_node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,12 @@ pub fn get_config<E: EthSpec>(
client_config.http_api.allow_origin = Some(allow_origin.to_string());
}

if let Some(fork_name) = clap_utils::parse_optional(cli_args, "http-spec-fork")? {
client_config.http_api.spec_fork_name = Some(fork_name);
if cli_args.is_present("http-spec-fork") {
warn!(
log,
"Ignoring --http-spec-fork";
"info" => "this flag is deprecated and will be removed"
);
}

if cli_args.is_present("http-enable-tls") {
Expand All @@ -148,7 +152,11 @@ pub fn get_config<E: EthSpec>(
}

if cli_args.is_present("http-allow-sync-stalled") {
client_config.http_api.allow_sync_stalled = true;
warn!(
log,
"Ignoring --http-allow-sync-stalled";
"info" => "this flag is deprecated and will be removed"
);
}

client_config.http_api.sse_capacity_multiplier =
Expand Down
6 changes: 0 additions & 6 deletions book/src/help_bn.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ FLAGS:
enables --http and --validator-monitor-auto and enables SSE logging.
-h, --help Prints help information
--http Enable the RESTful HTTP API server. Disabled by default.
--http-allow-sync-stalled Forces the HTTP to indicate that the node is synced when sync is actually
stalled. This is useful for very small testnets. TESTING ONLY. DO NOT USE
ON MAINNET.
--http-enable-tls Serves the RESTful HTTP API server over TLS. This feature is currently
experimental.
--import-all-attestations Import and aggregate all attestations, regardless of validator
Expand Down Expand Up @@ -280,9 +277,6 @@ OPTIONS:
--http-port <PORT>
Set the listen TCP port for the RESTful HTTP API server.
--http-spec-fork <FORK>
Serve the spec for a specific hard fork on /eth/v1/config/spec. It should not be necessary to set this flag.
--http-sse-capacity-multiplier <N>
Multiplier to apply to the length of HTTP server-sent-event (SSE) channels. Increasing this value can
prevent messages from being dropped.
Expand Down
10 changes: 5 additions & 5 deletions lighthouse/tests/beacon_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::string::ToString;
use std::time::Duration;
use tempfile::TempDir;
use types::non_zero_usize::new_non_zero_usize;
use types::{Address, Checkpoint, Epoch, ExecutionBlockHash, ForkName, Hash256, MainnetEthSpec};
use types::{Address, Checkpoint, Epoch, ExecutionBlockHash, Hash256, MainnetEthSpec};
use unused_port::{unused_tcp4_port, unused_tcp6_port, unused_udp4_port, unused_udp6_port};

const DEFAULT_ETH1_ENDPOINT: &str = "http://localhost:8545/";
Expand Down Expand Up @@ -1583,14 +1583,15 @@ fn http_allow_origin_all_flag() {
.run_with_zero_port()
.with_config(|config| assert_eq!(config.http_api.allow_origin, Some("*".to_string())));
}

#[test]
fn http_allow_sync_stalled_flag() {
CommandLineTest::new()
.flag("http", None)
.flag("http-allow-sync-stalled", None)
.run_with_zero_port()
.with_config(|config| assert_eq!(config.http_api.allow_sync_stalled, true));
.run_with_zero_port();
}

#[test]
fn http_enable_beacon_processor() {
CommandLineTest::new()
Expand Down Expand Up @@ -1642,8 +1643,7 @@ fn http_spec_fork_override() {
CommandLineTest::new()
.flag("http", None)
.flag("http-spec-fork", Some("altair"))
.run_with_zero_port()
.with_config(|config| assert_eq!(config.http_api.spec_fork_name, Some(ForkName::Altair)));
.run_with_zero_port();
}

// Tests for Metrics flags.
Expand Down
1 change: 0 additions & 1 deletion scripts/local_testnet/beacon_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,4 @@ exec $lighthouse_binary \
--target-peers $((BN_COUNT - 1)) \
--execution-endpoint $execution_endpoint \
--execution-jwt $execution_jwt \
--http-allow-sync-stalled \
$BN_ARGS
2 changes: 0 additions & 2 deletions testing/simulator/src/sync_sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ fn syncing_sim(
beacon_config.dummy_eth1_backend = true;
beacon_config.sync_eth1_chain = true;

beacon_config.http_api.allow_sync_stalled = true;

beacon_config.network.enr_address = (Some(Ipv4Addr::LOCALHOST), None);

// Generate the directories and keystores required for the validator clients.
Expand Down

0 comments on commit bc9c827

Please sign in to comment.