mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-19 04:42:34 +00:00
Merge remote-tracking branch 'origin/unstable' into tree-states
This commit is contained in:
@@ -382,6 +382,35 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
||||
stalled. This is useful for very small testnets. TESTING ONLY. DO NOT USE ON \
|
||||
MAINNET.")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("http-sse-capacity-multiplier")
|
||||
.long("http-sse-capacity-multiplier")
|
||||
.takes_value(true)
|
||||
.default_value("1")
|
||||
.value_name("N")
|
||||
.help("Multiplier to apply to the length of HTTP server-sent-event (SSE) channels. \
|
||||
Increasing this value can prevent messages from being dropped.")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("http-duplicate-block-status")
|
||||
.long("http-duplicate-block-status")
|
||||
.takes_value(true)
|
||||
.default_value("202")
|
||||
.value_name("STATUS_CODE")
|
||||
.help("Status code to send when a block that is already known is POSTed to the \
|
||||
HTTP API.")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("http-enable-beacon-processor")
|
||||
.long("http-enable-beacon-processor")
|
||||
.value_name("BOOLEAN")
|
||||
.help("The beacon processor is a scheduler which provides quality-of-service and \
|
||||
DoS protection. When set to \"true\", HTTP API requests will be queued and scheduled \
|
||||
alongside other tasks. When set to \"false\", HTTP API responses will be executed \
|
||||
immediately.")
|
||||
.takes_value(true)
|
||||
.default_value("true")
|
||||
)
|
||||
/* Prometheus metrics HTTP server related arguments */
|
||||
.arg(
|
||||
Arg::with_name("metrics")
|
||||
@@ -1152,7 +1181,6 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
||||
.arg(
|
||||
Arg::with_name("gui")
|
||||
.long("gui")
|
||||
.hidden(true)
|
||||
.help("Enable the graphical user interface and all its requirements. \
|
||||
This enables --http and --validator-monitor-auto and enables SSE logging.")
|
||||
.takes_value(false)
|
||||
@@ -1194,4 +1222,55 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
||||
.help("Don't use this flag unless you know what you're doing. Go back and download a \
|
||||
stable Lighthouse release")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("beacon-processor-max-workers")
|
||||
.long("beacon-processor-max-workers")
|
||||
.value_name("INTEGER")
|
||||
.help("Specifies the maximum concurrent tasks for the task scheduler. Increasing \
|
||||
this value may increase resource consumption. Reducing the value \
|
||||
may result in decreased resource usage and diminished performance. The \
|
||||
default value is the number of logical CPU cores on the host.")
|
||||
.takes_value(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("beacon-processor-work-queue-len")
|
||||
.long("beacon-processor-work-queue-len")
|
||||
.value_name("INTEGER")
|
||||
.help("Specifies the length of the inbound event queue. \
|
||||
Higher values may prevent messages from being dropped while lower values \
|
||||
may help protect the node from becoming overwhelmed.")
|
||||
.default_value("16384")
|
||||
.takes_value(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("beacon-processor-reprocess-queue-len")
|
||||
.long("beacon-processor-reprocess-queue-len")
|
||||
.value_name("INTEGER")
|
||||
.help("Specifies the length of the queue for messages requiring delayed processing. \
|
||||
Higher values may prevent messages from being dropped while lower values \
|
||||
may help protect the node from becoming overwhelmed.")
|
||||
.default_value("12288")
|
||||
.takes_value(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("beacon-processor-attestation-batch-size")
|
||||
.long("beacon-processor-attestation-batch-size")
|
||||
.value_name("INTEGER")
|
||||
.help("Specifies the number of gossip attestations in a signature verification batch. \
|
||||
Higher values may reduce CPU usage in a healthy network whilst lower values may \
|
||||
increase CPU usage in an unhealthy or hostile network.")
|
||||
.default_value("64")
|
||||
.takes_value(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("beacon-processor-aggregate-batch-size")
|
||||
.long("beacon-processor-aggregate-batch-size")
|
||||
.value_name("INTEGER")
|
||||
.help("Specifies the number of gossip aggregate attestations in a signature \
|
||||
verification batch. \
|
||||
Higher values may reduce CPU usage in a healthy network while lower values may \
|
||||
increase CPU usage in an unhealthy or hostile network.")
|
||||
.default_value("64")
|
||||
.takes_value(true)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ use beacon_chain::chain_config::{
|
||||
};
|
||||
use clap::ArgMatches;
|
||||
use clap_utils::flags::DISABLE_MALLOC_TUNING_FLAG;
|
||||
use clap_utils::parse_required;
|
||||
use client::{ClientConfig, ClientGenesis};
|
||||
use directory::{DEFAULT_BEACON_NODE_DIR, DEFAULT_NETWORK_DIR, DEFAULT_ROOT_DIR};
|
||||
use environment::RuntimeContext;
|
||||
@@ -149,6 +150,15 @@ pub fn get_config<E: EthSpec>(
|
||||
client_config.http_api.allow_sync_stalled = true;
|
||||
}
|
||||
|
||||
client_config.http_api.sse_capacity_multiplier =
|
||||
parse_required(cli_args, "http-sse-capacity-multiplier")?;
|
||||
|
||||
client_config.http_api.enable_beacon_processor =
|
||||
parse_required(cli_args, "http-enable-beacon-processor")?;
|
||||
|
||||
client_config.http_api.duplicate_block_status_code =
|
||||
parse_required(cli_args, "http-duplicate-block-status")?;
|
||||
|
||||
if let Some(cache_size) = clap_utils::parse_optional(cli_args, "shuffling-cache-size")? {
|
||||
client_config.chain.shuffling_cache_size = cache_size;
|
||||
}
|
||||
@@ -345,6 +355,9 @@ pub fn get_config<E: EthSpec>(
|
||||
el_config.default_datadir = client_config.data_dir().clone();
|
||||
el_config.builder_profit_threshold =
|
||||
clap_utils::parse_required(cli_args, "builder-profit-threshold")?;
|
||||
el_config.always_prefer_builder_payload =
|
||||
cli_args.is_present("always-prefer-builder-payload");
|
||||
|
||||
let execution_timeout_multiplier =
|
||||
clap_utils::parse_required(cli_args, "execution-timeout-multiplier")?;
|
||||
el_config.execution_timeout_multiplier = Some(execution_timeout_multiplier);
|
||||
@@ -499,9 +512,30 @@ pub fn get_config<E: EthSpec>(
|
||||
client_config.chain.checkpoint_sync_url_timeout =
|
||||
clap_utils::parse_required::<u64>(cli_args, "checkpoint-sync-url-timeout")?;
|
||||
|
||||
client_config.genesis = if let Some(genesis_state_bytes) =
|
||||
eth2_network_config.genesis_state_bytes.clone()
|
||||
{
|
||||
client_config.genesis_state_url_timeout =
|
||||
clap_utils::parse_required(cli_args, "genesis-state-url-timeout")
|
||||
.map(Duration::from_secs)?;
|
||||
|
||||
let genesis_state_url_opt =
|
||||
clap_utils::parse_optional::<String>(cli_args, "genesis-state-url")?;
|
||||
let checkpoint_sync_url_opt =
|
||||
clap_utils::parse_optional::<String>(cli_args, "checkpoint-sync-url")?;
|
||||
|
||||
// If the `--genesis-state-url` is defined, use that to download the
|
||||
// genesis state bytes. If it's not defined, try `--checkpoint-sync-url`.
|
||||
client_config.genesis_state_url = if let Some(genesis_state_url) = genesis_state_url_opt {
|
||||
Some(genesis_state_url)
|
||||
} else if let Some(checkpoint_sync_url) = checkpoint_sync_url_opt {
|
||||
// If the checkpoint sync URL is going to be used to download the
|
||||
// genesis state, adopt the timeout from the checkpoint sync URL too.
|
||||
client_config.genesis_state_url_timeout =
|
||||
Duration::from_secs(client_config.chain.checkpoint_sync_url_timeout);
|
||||
Some(checkpoint_sync_url)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
client_config.genesis = if eth2_network_config.genesis_state_is_known() {
|
||||
// Set up weak subjectivity sync, or start from the hardcoded genesis state.
|
||||
if let (Some(initial_state_path), Some(initial_block_path)) = (
|
||||
cli_args.value_of("checkpoint-state"),
|
||||
@@ -523,7 +557,6 @@ pub fn get_config<E: EthSpec>(
|
||||
let anchor_block_bytes = read(initial_block_path)?;
|
||||
|
||||
ClientGenesis::WeakSubjSszBytes {
|
||||
genesis_state_bytes,
|
||||
anchor_state_bytes,
|
||||
anchor_block_bytes,
|
||||
}
|
||||
@@ -531,17 +564,9 @@ pub fn get_config<E: EthSpec>(
|
||||
let url = SensitiveUrl::parse(remote_bn_url)
|
||||
.map_err(|e| format!("Invalid checkpoint sync URL: {:?}", e))?;
|
||||
|
||||
ClientGenesis::CheckpointSyncUrl {
|
||||
genesis_state_bytes,
|
||||
url,
|
||||
}
|
||||
ClientGenesis::CheckpointSyncUrl { url }
|
||||
} else {
|
||||
// Note: re-serializing the genesis state is not so efficient, however it avoids adding
|
||||
// trait bounds to the `ClientGenesis` enum. This would have significant flow-on
|
||||
// effects.
|
||||
ClientGenesis::SszBytes {
|
||||
genesis_state_bytes,
|
||||
}
|
||||
ClientGenesis::GenesisState
|
||||
}
|
||||
} else {
|
||||
if cli_args.is_present("checkpoint-state") || cli_args.is_present("checkpoint-sync-url") {
|
||||
@@ -622,8 +647,10 @@ pub fn get_config<E: EthSpec>(
|
||||
};
|
||||
}
|
||||
|
||||
client_config.chain.max_network_size =
|
||||
lighthouse_network::gossip_max_size(spec.bellatrix_fork_epoch.is_some());
|
||||
client_config.chain.max_network_size = lighthouse_network::gossip_max_size(
|
||||
spec.bellatrix_fork_epoch.is_some(),
|
||||
spec.gossip_max_size as usize,
|
||||
);
|
||||
|
||||
if cli_args.is_present("slasher") {
|
||||
let slasher_dir = if let Some(slasher_dir) = cli_args.value_of("slasher-dir") {
|
||||
@@ -833,13 +860,9 @@ pub fn get_config<E: EthSpec>(
|
||||
if cli_args.is_present("genesis-backfill") {
|
||||
client_config.chain.genesis_backfill = true;
|
||||
}
|
||||
// Payload selection configs
|
||||
if cli_args.is_present("always-prefer-builder-payload") {
|
||||
client_config.always_prefer_builder_payload = true;
|
||||
}
|
||||
|
||||
// Backfill sync rate-limiting
|
||||
client_config.chain.enable_backfill_rate_limiting =
|
||||
client_config.beacon_processor.enable_backfill_rate_limiting =
|
||||
!cli_args.is_present("disable-backfill-rate-limiting");
|
||||
|
||||
if let Some(path) = clap_utils::parse_optional(cli_args, "invalid-gossip-verified-blocks-path")?
|
||||
@@ -853,6 +876,28 @@ pub fn get_config<E: EthSpec>(
|
||||
client_config.chain.progressive_balances_mode = progressive_balances_mode;
|
||||
}
|
||||
|
||||
if let Some(max_workers) = clap_utils::parse_optional(cli_args, "beacon-processor-max-workers")?
|
||||
{
|
||||
client_config.beacon_processor.max_workers = max_workers;
|
||||
}
|
||||
|
||||
if client_config.beacon_processor.max_workers == 0 {
|
||||
return Err("--beacon-processor-max-workers must be a non-zero value".to_string());
|
||||
}
|
||||
|
||||
client_config.beacon_processor.max_work_event_queue_len =
|
||||
clap_utils::parse_required(cli_args, "beacon-processor-work-queue-len")?;
|
||||
client_config.beacon_processor.max_scheduled_work_queue_len =
|
||||
clap_utils::parse_required(cli_args, "beacon-processor-reprocess-queue-len")?;
|
||||
client_config
|
||||
.beacon_processor
|
||||
.max_gossip_attestation_batch_size =
|
||||
clap_utils::parse_required(cli_args, "beacon-processor-attestation-batch-size")?;
|
||||
client_config
|
||||
.beacon_processor
|
||||
.max_gossip_aggregate_batch_size =
|
||||
clap_utils::parse_required(cli_args, "beacon-processor-aggregate-batch-size")?;
|
||||
|
||||
Ok(client_config)
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ impl<E: EthSpec> ProductionBeaconNode<E> {
|
||||
let builder = ClientBuilder::new(context.eth_spec_instance.clone())
|
||||
.runtime_context(context)
|
||||
.chain_spec(spec)
|
||||
.beacon_processor(client_config.beacon_processor.clone())
|
||||
.http_api_config(client_config.http_api.clone())
|
||||
.disk_store(&db_path, &freezer_db_path, store_config, log.clone())?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user