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:
Eitan Seri-Levi
2024-05-31 05:35:57 +02:00
committed by GitHub
parent bbe9242811
commit fbc230e118
7 changed files with 80 additions and 8 deletions

View File

@@ -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")