Merge remote-tracking branch 'origin/unstable' into tree-states

This commit is contained in:
Michael Sproul
2022-05-24 10:01:05 +10:00
237 changed files with 8506 additions and 3598 deletions

View File

@@ -438,6 +438,13 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.requires("merge")
.takes_value(true)
)
.arg(
Arg::with_name("payload-builders")
.long("payload-builders")
.help("The URL of a service compatible with the MEV-boost API.")
.requires("merge")
.takes_value(true)
)
/*
* Database.
@@ -448,7 +455,7 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.value_name("SLOT_COUNT")
.help("Specifies how often a freezer DB restore point should be stored. \
Cannot be changed after initialization. \
[default: 2048 (mainnet) or 64 (minimal)]")
[default: 8192 (mainnet) or 64 (minimal)]")
.takes_value(true)
)
.arg(
@@ -693,4 +700,13 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
experimental as it may obscure performance issues.")
.takes_value(false)
)
.arg(
Arg::with_name("fork-choice-before-proposal-timeout")
.long("fork-choice-before-proposal-timeout")
.help("Set the maximum number of milliseconds to wait for fork choice before \
proposing a block. You can prevent waiting at all by setting the timeout \
to 0, however you risk proposing atop the wrong parent block.")
.default_value("250")
.takes_value(true)
)
}

View File

@@ -250,6 +250,14 @@ pub fn get_config<E: EthSpec>(
el_config.execution_endpoints = client_config.eth1.endpoints.clone();
}
if let Some(endpoints) = cli_args.value_of("payload-builders") {
el_config.builder_endpoints = endpoints
.split(',')
.map(SensitiveUrl::parse)
.collect::<Result<_, _>>()
.map_err(|e| format!("payload-builders contains an invalid URL {:?}", e))?;
}
if let Some(secrets) = cli_args.value_of("jwt-secrets") {
let secret_files: Vec<_> = secrets.split(',').map(PathBuf::from).collect();
if !secret_files.is_empty() && secret_files.len() != el_config.execution_endpoints.len()
@@ -276,7 +284,9 @@ pub fn get_config<E: EthSpec>(
client_config.freezer_db_path = Some(PathBuf::from(freezer_dir));
}
client_config.store.slots_per_restore_point = get_slots_per_restore_point::<E>(cli_args)?;
let (sprp, sprp_explicit) = get_slots_per_restore_point::<E>(cli_args)?;
client_config.store.slots_per_restore_point = sprp;
client_config.store.slots_per_restore_point_set_explicitly = sprp_explicit;
if let Some(block_cache_size) = clap_utils::parse_optional(cli_args, "block-cache-size")? {
client_config.store.block_cache_size = block_cache_size;
@@ -575,6 +585,12 @@ pub fn get_config<E: EthSpec>(
client_config.chain.enable_lock_timeouts = false;
}
if let Some(timeout) =
clap_utils::parse_optional(cli_args, "fork-choice-before-proposal-timeout")?
{
client_config.chain.fork_choice_before_proposal_timeout_ms = timeout;
}
Ok(client_config)
}
@@ -809,15 +825,20 @@ pub fn get_data_dir(cli_args: &ArgMatches) -> PathBuf {
}
/// Get the `slots_per_restore_point` value to use for the database.
pub fn get_slots_per_restore_point<E: EthSpec>(cli_args: &ArgMatches) -> Result<u64, String> {
///
/// Return `(sprp, set_explicitly)` where `set_explicitly` is `true` if the user provided the value.
pub fn get_slots_per_restore_point<E: EthSpec>(
cli_args: &ArgMatches,
) -> Result<(u64, bool), String> {
if let Some(slots_per_restore_point) =
clap_utils::parse_optional(cli_args, "slots-per-restore-point")?
{
Ok(slots_per_restore_point)
Ok((slots_per_restore_point, true))
} else {
Ok(std::cmp::min(
let default = std::cmp::min(
E::slots_per_historical_root() as u64,
store::config::DEFAULT_SLOTS_PER_RESTORE_POINT,
))
);
Ok((default, false))
}
}