From 333df556c6ccadf79b89a26a20b3cd30415eb51b Mon Sep 17 00:00:00 2001 From: Alexander Uvizhev Date: Mon, 20 Nov 2023 09:36:52 +0000 Subject: [PATCH] bring --disable-run-on-all flag back with deprecation notice --- lighthouse/tests/validator_client.rs | 19 +++++++++++++++++++ validator_client/src/cli.rs | 12 ++++++++++++ validator_client/src/config.rs | 10 +++++++++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/lighthouse/tests/validator_client.rs b/lighthouse/tests/validator_client.rs index 62f3a7d075e..32866cc4f26 100644 --- a/lighthouse/tests/validator_client.rs +++ b/lighthouse/tests/validator_client.rs @@ -493,6 +493,25 @@ fn monitoring_endpoint() { assert_eq!(api_conf.update_period_secs, Some(30)); }); } + +#[test] +fn disable_run_on_all_flag() { + CommandLineTest::new() + .flag("disable-run-on-all", None) + .run() + .with_config(|config| { + assert_eq!(config.broadcast_topics, vec![]); + }); + // --broadcast flag takes precedence + CommandLineTest::new() + .flag("disable-run-on-all", None) + .flag("broadcast", Some("attestations")) + .run() + .with_config(|config| { + assert_eq!(config.broadcast_topics, vec![ApiTopic::Attestations]); + }); +} + #[test] fn no_broadcast_flag() { CommandLineTest::new().run().with_config(|config| { diff --git a/validator_client/src/cli.rs b/validator_client/src/cli.rs index f5177de3871..69c97dea6bf 100644 --- a/validator_client/src/cli.rs +++ b/validator_client/src/cli.rs @@ -26,6 +26,18 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> { ) .takes_value(true), ) + // TODO remove this flag in a future release + .arg( + Arg::with_name("disable-run-on-all") + .long("disable-run-on-all") + .value_name("DISABLE_RUN_ON_ALL") + .help("DEPRECATED. Use --broadcast. \ + By default, Lighthouse publishes attestation, sync committee subscriptions \ + and proposer preparation messages to all beacon nodes provided in the \ + `--beacon-nodes flag`. This option changes that behaviour such that these \ + api calls only go out to the first available and synced beacon node") + .takes_value(false), + ) .arg( Arg::with_name("broadcast") .long("broadcast") diff --git a/validator_client/src/config.rs b/validator_client/src/config.rs index f75ab1ae710..26c2bccd3e7 100644 --- a/validator_client/src/config.rs +++ b/validator_client/src/config.rs @@ -10,7 +10,7 @@ use directory::{ use eth2::types::Graffiti; use sensitive_url::SensitiveUrl; use serde::{Deserialize, Serialize}; -use slog::{info, Logger}; +use slog::{info, warn, Logger}; use std::fs; use std::net::IpAddr; use std::path::PathBuf; @@ -222,6 +222,14 @@ impl Config { config.beacon_nodes_tls_certs = Some(tls_certs.split(',').map(PathBuf::from).collect()); } + if cli_args.is_present("disable-run-on-all") { + warn!( + log, + "The --disable-run-on-all flag is deprecated"; + "msg" => "please use --broadcast instead" + ); + config.broadcast_topics = vec![]; + } if let Some(broadcast_topics) = cli_args.value_of("broadcast") { config.broadcast_topics = broadcast_topics .split(',')