mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 21:34:46 +00:00
Add test flag to override SYNC_TOLERANCE_EPOCHS for range sync testing (#7030)
Related to #6880, an issue that's usually observed on local devnets with small number of nodes. When testing range sync, I usually shutdown a node for some period of time and restart it again. However, if it's within `SYNC_TOLERANCE_EPOCHS` (8), Lighthouse would consider the node as synced, and if it may attempt to produce a block if requested by a validator - on a local devnet, nodes frequently produce blocks - when this happens, the node ends up producing a block that would revert finality and would get disconnected from peers immediately. ### Usage Run Lighthouse BN with this flag to override: ``` --sync-tolerance--epoch 0 ```
This commit is contained in:
@@ -1509,6 +1509,19 @@ pub fn cli_app() -> Command {
|
||||
.help_heading(FLAG_HEADER)
|
||||
.display_order(0)
|
||||
)
|
||||
.arg(
|
||||
Arg::new("sync-tolerance-epochs")
|
||||
.long("sync-tolerance-epochs")
|
||||
.help("Overrides the default SYNC_TOLERANCE_EPOCHS. This flag is not intended \
|
||||
for production and MUST only be used in TESTING only. This is primarily used \
|
||||
for testing range sync, to prevent the node from producing a block before the \
|
||||
node is synced with the network which may result in the node getting \
|
||||
disconnected from peers immediately.")
|
||||
.hide(true)
|
||||
.requires("enable_http")
|
||||
.action(ArgAction::Set)
|
||||
.display_order(0)
|
||||
)
|
||||
.arg(
|
||||
Arg::new("gui")
|
||||
.long("gui")
|
||||
|
||||
@@ -8,7 +8,7 @@ use beacon_chain::graffiti_calculator::GraffitiOrigin;
|
||||
use beacon_chain::TrustedSetup;
|
||||
use clap::{parser::ValueSource, ArgMatches, Id};
|
||||
use clap_utils::flags::DISABLE_MALLOC_TUNING_FLAG;
|
||||
use clap_utils::{parse_flag, parse_required};
|
||||
use clap_utils::{parse_flag, parse_optional, parse_required};
|
||||
use client::{ClientConfig, ClientGenesis};
|
||||
use directory::{DEFAULT_BEACON_NODE_DIR, DEFAULT_NETWORK_DIR, DEFAULT_ROOT_DIR};
|
||||
use environment::RuntimeContext;
|
||||
@@ -174,6 +174,9 @@ pub fn get_config<E: EthSpec>(
|
||||
|
||||
client_config.http_api.duplicate_block_status_code =
|
||||
parse_required(cli_args, "http-duplicate-block-status")?;
|
||||
|
||||
client_config.http_api.sync_tolerance_epochs =
|
||||
parse_optional(cli_args, "sync-tolerance-epochs")?;
|
||||
}
|
||||
|
||||
if cli_args.get_flag("light-client-server") {
|
||||
|
||||
Reference in New Issue
Block a user