mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 22:34:45 +00:00
Add builder header timeout flag (#5857)
* fix bitvector test random impl * add a new flag that allows for configuring the timeout for get builder header api calls * make cli * add upper limit check, changes based on feedback * update cli * capitalization * cli fix
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use clap::{builder::ArgPredicate, crate_version, Arg, ArgAction, ArgGroup, Command};
|
||||
use clap_utils::{get_color_style, FLAG_HEADER};
|
||||
use strum::VariantNames;
|
||||
@@ -855,6 +857,32 @@ pub fn cli_app() -> Command {
|
||||
.action(ArgAction::Set)
|
||||
.display_order(0)
|
||||
)
|
||||
.arg(
|
||||
Arg::new("builder-header-timeout")
|
||||
.long("builder-header-timeout")
|
||||
.value_name("MILLISECONDS")
|
||||
.help("Defines a timeout value (in milliseconds) to use when \
|
||||
fetching a block header from the builder API.")
|
||||
.default_value("1000")
|
||||
.value_parser(|timeout: &str| {
|
||||
match timeout
|
||||
.parse::<u64>()
|
||||
.ok()
|
||||
.map(Duration::from_millis)
|
||||
{
|
||||
Some(val) => {
|
||||
if val > Duration::from_secs(3) {
|
||||
return Err("builder-header-timeout cannot exceed 3000ms")
|
||||
}
|
||||
Ok(timeout.to_string())
|
||||
},
|
||||
None => Err("builder-header-timeout must be a number"),
|
||||
}
|
||||
})
|
||||
.requires("builder")
|
||||
.action(ArgAction::Set)
|
||||
.display_order(0)
|
||||
)
|
||||
/* Deneb settings */
|
||||
.arg(
|
||||
Arg::new("trusted-setup-file-override")
|
||||
|
||||
@@ -329,6 +329,10 @@ pub fn get_config<E: EthSpec>(
|
||||
|
||||
el_config.builder_user_agent =
|
||||
clap_utils::parse_optional(cli_args, "builder-user-agent")?;
|
||||
|
||||
el_config.builder_header_timeout =
|
||||
clap_utils::parse_optional(cli_args, "builder-header-timeout")?
|
||||
.map(Duration::from_millis);
|
||||
}
|
||||
|
||||
if parse_flag(cli_args, "builder-profit-threshold") {
|
||||
|
||||
Reference in New Issue
Block a user