Merge branch 'unstable' into eip4844

This commit is contained in:
Pawan Dhananjay
2023-04-21 14:13:25 -07:00
62 changed files with 778 additions and 280 deletions

View File

@@ -240,6 +240,14 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.help("Disables the discv5 discovery protocol. The node will not search for new peers or participate in the discovery protocol.")
.takes_value(false),
)
.arg(
Arg::with_name("disable-peer-scoring")
.long("disable-peer-scoring")
.help("Disables peer scoring in lighthouse. WARNING: This is a dev only flag is only meant to be used in local testing scenarios \
Using this flag on a real network may cause your node to become eclipsed and see a different view of the network")
.takes_value(false)
.hidden(true),
)
.arg(
Arg::with_name("trusted-peers")
.long("trusted-peers")
@@ -919,6 +927,28 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
allowed. Default: 2")
.conflicts_with("disable-proposer-reorgs")
)
.arg(
Arg::with_name("proposer-reorg-cutoff")
.long("proposer-reorg-cutoff")
.value_name("MILLISECONDS")
.help("Maximum delay after the start of the slot at which to propose a reorging \
block. Lower values can prevent failed reorgs by ensuring the block has \
ample time to propagate and be processed by the network. The default is \
1/12th of a slot (1 second on mainnet)")
.conflicts_with("disable-proposer-reorgs")
)
.arg(
Arg::with_name("proposer-reorg-disallowed-offsets")
.long("proposer-reorg-disallowed-offsets")
.value_name("N1,N2,...")
.help("Comma-separated list of integer offsets which can be used to avoid \
proposing reorging blocks at certain slots. An offset of N means that \
reorging proposals will not be attempted at any slot such that \
`slot % SLOTS_PER_EPOCH == N`. By default only re-orgs at offset 0 will be \
avoided. Any offsets supplied with this flag will impose additional \
restrictions.")
.conflicts_with("disable-proposer-reorgs")
)
.arg(
Arg::with_name("prepare-payload-lookahead")
.long("prepare-payload-lookahead")
@@ -1012,6 +1042,15 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.default_value("0")
.takes_value(true)
)
.arg(
Arg::with_name("builder-user-agent")
.long("builder-user-agent")
.value_name("STRING")
.help("The HTTP user agent to send alongside requests to the builder URL. The \
default is Lighthouse's version string.")
.requires("builder")
.takes_value(true)
)
.arg(
Arg::with_name("count-unrealized")
.long("count-unrealized")

View File

@@ -1,5 +1,5 @@
use beacon_chain::chain_config::{
ReOrgThreshold, DEFAULT_PREPARE_PAYLOAD_LOOKAHEAD_FACTOR,
DisallowedReOrgOffsets, ReOrgThreshold, DEFAULT_PREPARE_PAYLOAD_LOOKAHEAD_FACTOR,
DEFAULT_RE_ORG_MAX_EPOCHS_SINCE_FINALIZATION, DEFAULT_RE_ORG_THRESHOLD,
};
use beacon_chain::TrustedSetup;
@@ -330,6 +330,9 @@ pub fn get_config<E: EthSpec>(
let payload_builder =
parse_only_one_value(endpoint, SensitiveUrl::parse, "--builder", log)?;
el_config.builder_url = Some(payload_builder);
el_config.builder_user_agent =
clap_utils::parse_optional(cli_args, "builder-user-agent")?;
}
// Set config values from parse values.
@@ -723,6 +726,23 @@ pub fn get_config<E: EthSpec>(
client_config.chain.re_org_max_epochs_since_finalization =
clap_utils::parse_optional(cli_args, "proposer-reorg-epochs-since-finalization")?
.unwrap_or(DEFAULT_RE_ORG_MAX_EPOCHS_SINCE_FINALIZATION);
client_config.chain.re_org_cutoff_millis =
clap_utils::parse_optional(cli_args, "proposer-reorg-cutoff")?;
if let Some(disallowed_offsets_str) =
clap_utils::parse_optional::<String>(cli_args, "proposer-reorg-disallowed-offsets")?
{
let disallowed_offsets = disallowed_offsets_str
.split(',')
.map(|s| {
s.parse()
.map_err(|e| format!("invalid disallowed-offsets: {e:?}"))
})
.collect::<Result<Vec<u64>, _>>()?;
client_config.chain.re_org_disallowed_offsets =
DisallowedReOrgOffsets::new::<E>(disallowed_offsets)
.map_err(|e| format!("invalid disallowed-offsets: {e:?}"))?;
}
}
// Note: This overrides any previous flags that enable this option.
@@ -1045,6 +1065,10 @@ pub fn set_network_config(
.collect::<Result<Vec<Multiaddr>, _>>()?;
}
if cli_args.is_present("disable-peer-scoring") {
config.disable_peer_scoring = true;
}
if let Some(trusted_peers_str) = cli_args.value_of("trusted-peers") {
config.trusted_peers = trusted_peers_str
.split(',')