mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
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:
@@ -251,6 +251,13 @@ Flags:
|
||||
contain sensitive information about your validator and so this flag
|
||||
should be used with caution. For Windows users, the log file
|
||||
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
|
||||
Enable the Prometheus metrics HTTP server. Disabled by default.
|
||||
--prefer-builder-proposals
|
||||
|
||||
@@ -129,6 +129,22 @@ fn use_long_timeouts_flag() {
|
||||
.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]
|
||||
fn beacon_nodes_tls_certs_flag() {
|
||||
let dir = TempDir::new().expect("Unable to create temporary directory");
|
||||
|
||||
@@ -116,6 +116,20 @@ pub struct ValidatorClient {
|
||||
)]
|
||||
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(
|
||||
long,
|
||||
value_name = "CERTIFICATE-FILES",
|
||||
|
||||
@@ -49,6 +49,8 @@ pub struct Config {
|
||||
pub init_slashing_protection: bool,
|
||||
/// If true, use longer timeouts for requests made to the beacon node.
|
||||
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.
|
||||
pub graffiti: Option<Graffiti>,
|
||||
/// Graffiti file to load per validator graffitis.
|
||||
@@ -112,6 +114,7 @@ impl Default for Config {
|
||||
disable_auto_discover: false,
|
||||
init_slashing_protection: false,
|
||||
use_long_timeouts: false,
|
||||
long_timeouts_multiplier: 1,
|
||||
graffiti: None,
|
||||
graffiti_file: None,
|
||||
http_api: <_>::default(),
|
||||
@@ -196,6 +199,7 @@ impl Config {
|
||||
config.disable_auto_discover = validator_client_config.disable_auto_discover;
|
||||
config.init_slashing_protection = validator_client_config.init_slashing_protection;
|
||||
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() {
|
||||
let mut graffiti_file = GraffitiFile::new(graffiti_file_path.into());
|
||||
|
||||
@@ -325,7 +325,7 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
get_validator_block: slot_duration / HTTP_GET_VALIDATOR_BLOCK_TIMEOUT_QUOTIENT,
|
||||
}
|
||||
} else {
|
||||
Timeouts::set_all(slot_duration)
|
||||
Timeouts::set_all(slot_duration.saturating_mul(config.long_timeouts_multiplier))
|
||||
};
|
||||
|
||||
Ok(BeaconNodeHttpClient::from_components(
|
||||
|
||||
Reference in New Issue
Block a user