mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 20:22:02 +00:00
Undo some CLI flag breakages (#5902)
* Undo some CLI breakages * Update CLI book docs
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -356,7 +356,7 @@ Options:
|
||||
--slasher-backend <DATABASE>
|
||||
Set the database backend to be used by the slasher. [possible values:
|
||||
lmdb, disabled]
|
||||
--slasher-broadcast <slasher-broadcast>
|
||||
--slasher-broadcast [<slasher-broadcast>]
|
||||
Broadcast slashings found by the slasher to the rest of the network
|
||||
[Enabled by default]. [default: true]
|
||||
--slasher-chunk-size <EPOCHS>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -412,6 +412,17 @@ impl Config {
|
||||
config.enable_latency_measurement_service =
|
||||
!cli_args.get_flag("disable-latency-measurement-service");
|
||||
|
||||
if cli_args
|
||||
.get_one::<String>("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 {
|
||||
|
||||
Reference in New Issue
Block a user