Add --long-timeouts-multiplier CLI flag (#7047)

Adds the `--long-timeouts-multiplier` flag.
Allows granular control for VC timeouts which has proved useful in Holesky.
This commit is contained in:
Mac L
2025-03-05 05:52:57 +04:00
committed by GitHub
parent 80cd8bd911
commit 29a295a134
5 changed files with 42 additions and 1 deletions

View File

@@ -251,6 +251,13 @@ Flags:
contain sensitive information about your validator and so this flag contain sensitive information about your validator and so this flag
should be used with caution. For Windows users, the log file should be used with caution. For Windows users, the log file
permissions will be inherited from the parent folder. permissions will be inherited from the parent folder.
--long-timeouts-multiplier <LONG_TIMEOUTS_MULTIPLIER>
If present, the validator client will use a multiplier for the timeout
when making requests to the beacon node. This only takes effect when
the `--use-long-timeouts` flag is present. The timeouts will be the
slot duration multiplied by this value. This flag is generally not
recommended, longer timeouts can cause missed duties when fallbacks
are used. [default: 1]
--metrics --metrics
Enable the Prometheus metrics HTTP server. Disabled by default. Enable the Prometheus metrics HTTP server. Disabled by default.
--prefer-builder-proposals --prefer-builder-proposals

View File

@@ -129,6 +129,22 @@ fn use_long_timeouts_flag() {
.with_config(|config| assert!(config.use_long_timeouts)); .with_config(|config| assert!(config.use_long_timeouts));
} }
#[test]
fn long_timeouts_multiplier_flag_default() {
CommandLineTest::new()
.run()
.with_config(|config| assert_eq!(config.long_timeouts_multiplier, 1));
}
#[test]
fn long_timeouts_multiplier_flag() {
CommandLineTest::new()
.flag("use-long-timeouts", None)
.flag("long-timeouts-multiplier", Some("10"))
.run()
.with_config(|config| assert_eq!(config.long_timeouts_multiplier, 10));
}
#[test] #[test]
fn beacon_nodes_tls_certs_flag() { fn beacon_nodes_tls_certs_flag() {
let dir = TempDir::new().expect("Unable to create temporary directory"); let dir = TempDir::new().expect("Unable to create temporary directory");

View File

@@ -116,6 +116,20 @@ pub struct ValidatorClient {
)] )]
pub use_long_timeouts: bool, pub use_long_timeouts: bool,
#[clap(
long,
requires = "use_long_timeouts",
default_value_t = 1,
help = "If present, the validator client will use a multiplier for the timeout \
when making requests to the beacon node. This only takes effect when \
the `--use-long-timeouts` flag is present. The timeouts will be the slot \
duration multiplied by this value. This flag is generally not recommended, \
longer timeouts can cause missed duties when fallbacks are used.",
display_order = 0,
help_heading = FLAG_HEADER,
)]
pub long_timeouts_multiplier: u32,
#[clap( #[clap(
long, long,
value_name = "CERTIFICATE-FILES", value_name = "CERTIFICATE-FILES",

View File

@@ -49,6 +49,8 @@ pub struct Config {
pub init_slashing_protection: bool, pub init_slashing_protection: bool,
/// If true, use longer timeouts for requests made to the beacon node. /// If true, use longer timeouts for requests made to the beacon node.
pub use_long_timeouts: bool, pub use_long_timeouts: bool,
/// Multiplier to use for long timeouts.
pub long_timeouts_multiplier: u32,
/// Graffiti to be inserted everytime we create a block. /// Graffiti to be inserted everytime we create a block.
pub graffiti: Option<Graffiti>, pub graffiti: Option<Graffiti>,
/// Graffiti file to load per validator graffitis. /// Graffiti file to load per validator graffitis.
@@ -112,6 +114,7 @@ impl Default for Config {
disable_auto_discover: false, disable_auto_discover: false,
init_slashing_protection: false, init_slashing_protection: false,
use_long_timeouts: false, use_long_timeouts: false,
long_timeouts_multiplier: 1,
graffiti: None, graffiti: None,
graffiti_file: None, graffiti_file: None,
http_api: <_>::default(), http_api: <_>::default(),
@@ -196,6 +199,7 @@ impl Config {
config.disable_auto_discover = validator_client_config.disable_auto_discover; config.disable_auto_discover = validator_client_config.disable_auto_discover;
config.init_slashing_protection = validator_client_config.init_slashing_protection; config.init_slashing_protection = validator_client_config.init_slashing_protection;
config.use_long_timeouts = validator_client_config.use_long_timeouts; config.use_long_timeouts = validator_client_config.use_long_timeouts;
config.long_timeouts_multiplier = validator_client_config.long_timeouts_multiplier;
if let Some(graffiti_file_path) = validator_client_config.graffiti_file.as_ref() { if let Some(graffiti_file_path) = validator_client_config.graffiti_file.as_ref() {
let mut graffiti_file = GraffitiFile::new(graffiti_file_path.into()); let mut graffiti_file = GraffitiFile::new(graffiti_file_path.into());

View File

@@ -325,7 +325,7 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
get_validator_block: slot_duration / HTTP_GET_VALIDATOR_BLOCK_TIMEOUT_QUOTIENT, get_validator_block: slot_duration / HTTP_GET_VALIDATOR_BLOCK_TIMEOUT_QUOTIENT,
} }
} else { } else {
Timeouts::set_all(slot_duration) Timeouts::set_all(slot_duration.saturating_mul(config.long_timeouts_multiplier))
}; };
Ok(BeaconNodeHttpClient::from_components( Ok(BeaconNodeHttpClient::from_components(