diff --git a/beacon_node/src/cli.rs b/beacon_node/src/cli.rs index dbfda2d530..40a343a7fe 100644 --- a/beacon_node/src/cli.rs +++ b/beacon_node/src/cli.rs @@ -1101,6 +1101,8 @@ pub fn cli_app() -> Command { [Enabled by default].") .action(ArgAction::Set) .default_value("true") + .num_args(0..=1) + .default_missing_value("true") .display_order(0) ) .arg( diff --git a/book/src/help_bn.md b/book/src/help_bn.md index b458842e08..8bbbd3eb6b 100644 --- a/book/src/help_bn.md +++ b/book/src/help_bn.md @@ -356,7 +356,7 @@ Options: --slasher-backend Set the database backend to be used by the slasher. [possible values: lmdb, disabled] - --slasher-broadcast + --slasher-broadcast [] Broadcast slashings found by the slasher to the rest of the network [Enabled by default]. [default: true] --slasher-chunk-size diff --git a/lighthouse/tests/beacon_node.rs b/lighthouse/tests/beacon_node.rs index f8e1182e89..73badac913 100644 --- a/lighthouse/tests/beacon_node.rs +++ b/lighthouse/tests/beacon_node.rs @@ -2178,6 +2178,21 @@ fn slasher_broadcast_flag_no_default() { }); } #[test] +fn slasher_broadcast_flag_no_argument() { + CommandLineTest::new() + .flag("slasher", None) + .flag("slasher-max-db-size", Some("1")) + .flag("slasher-broadcast", None) + .run_with_zero_port() + .with_config(|config| { + let slasher_config = config + .slasher + .as_ref() + .expect("Unable to parse Slasher config"); + assert!(slasher_config.broadcast); + }); +} +#[test] fn slasher_broadcast_flag_true() { CommandLineTest::new() .flag("slasher", None) diff --git a/lighthouse/tests/validator_client.rs b/lighthouse/tests/validator_client.rs index 9ca6ab4333..3e85375971 100644 --- a/lighthouse/tests/validator_client.rs +++ b/lighthouse/tests/validator_client.rs @@ -593,7 +593,7 @@ fn wrong_broadcast_flag() { } #[test] -fn latency_measurement_service() { +fn disable_latency_measurement_service() { CommandLineTest::new() .flag("disable-latency-measurement-service", None) .run() @@ -601,6 +601,16 @@ fn latency_measurement_service() { assert!(!config.enable_latency_measurement_service); }); } +#[test] +fn latency_measurement_service() { + // This flag is DEPRECATED so has no effect, but should still be accepted. + CommandLineTest::new() + .flag("latency-measurement-service", Some("false")) + .run() + .with_config(|config| { + assert!(config.enable_latency_measurement_service); + }); +} #[test] fn validator_registration_batch_size() { diff --git a/validator_client/src/cli.rs b/validator_client/src/cli.rs index 66b467c1e2..24f9f41415 100644 --- a/validator_client/src/cli.rs +++ b/validator_client/src/cli.rs @@ -406,6 +406,15 @@ pub fn cli_app() -> Command { .help_heading(FLAG_HEADER) .display_order(0) ) + .arg( + Arg::new("latency-measurement-service") + .long("latency-measurement-service") + .help("DEPRECATED") + .action(ArgAction::Set) + .help_heading(FLAG_HEADER) + .display_order(0) + .hide(true) + ) .arg( Arg::new("validator-registration-batch-size") .long("validator-registration-batch-size") diff --git a/validator_client/src/config.rs b/validator_client/src/config.rs index eb47fcf31a..3edab712b3 100644 --- a/validator_client/src/config.rs +++ b/validator_client/src/config.rs @@ -412,6 +412,17 @@ impl Config { config.enable_latency_measurement_service = !cli_args.get_flag("disable-latency-measurement-service"); + if cli_args + .get_one::("latency-measurement-service") + .is_some() + { + warn!( + log, + "latency-measurement-service flag"; + "note" => "deprecated flag has no effect and should be removed" + ); + } + config.validator_registration_batch_size = parse_required(cli_args, "validator-registration-batch-size")?; if config.validator_registration_batch_size == 0 {