mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 04:37:13 +00:00
Deprecate some reorg-related CLI flags and read from spec (#9177)
- #9123 Co-Authored-By: Tan Chee Keong <tanck@sigmaprime.io> Co-Authored-By: chonghe <44791194+chong-he@users.noreply.github.com>
This commit is contained in:
@@ -1331,8 +1331,7 @@ pub fn cli_app() -> Command {
|
||||
.long("proposer-reorg-threshold")
|
||||
.action(ArgAction::Set)
|
||||
.value_name("PERCENT")
|
||||
.help("Percentage of head vote weight below which to attempt a proposer reorg. \
|
||||
Default: 20%")
|
||||
.help("DEPRECATED. This flag has no effect.")
|
||||
.conflicts_with("disable-proposer-reorgs")
|
||||
.display_order(0)
|
||||
)
|
||||
@@ -1340,8 +1339,7 @@ pub fn cli_app() -> Command {
|
||||
Arg::new("proposer-reorg-parent-threshold")
|
||||
.long("proposer-reorg-parent-threshold")
|
||||
.value_name("PERCENT")
|
||||
.help("Percentage of parent vote weight above which to attempt a proposer reorg. \
|
||||
Default: 160%")
|
||||
.help("DEPRECATED. This flag has no effect.")
|
||||
.conflicts_with("disable-proposer-reorgs")
|
||||
.action(ArgAction::Set)
|
||||
.display_order(0)
|
||||
@@ -1351,8 +1349,7 @@ pub fn cli_app() -> Command {
|
||||
.long("proposer-reorg-epochs-since-finalization")
|
||||
.action(ArgAction::Set)
|
||||
.value_name("EPOCHS")
|
||||
.help("Maximum number of epochs since finalization at which proposer reorgs are \
|
||||
allowed. Default: 2")
|
||||
.help("DEPRECATED. This flag has no effect.")
|
||||
.conflicts_with("disable-proposer-reorgs")
|
||||
.display_order(0)
|
||||
)
|
||||
@@ -1361,10 +1358,7 @@ pub fn cli_app() -> Command {
|
||||
.long("proposer-reorg-cutoff")
|
||||
.value_name("MILLISECONDS")
|
||||
.action(ArgAction::Set)
|
||||
.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)")
|
||||
.help("DEPRECATED. This flag has no effect.")
|
||||
.conflicts_with("disable-proposer-reorgs")
|
||||
.display_order(0)
|
||||
)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
use account_utils::{STDIN_INPUTS_FLAG, read_input_from_user};
|
||||
use beacon_chain::chain_config::{
|
||||
DEFAULT_PREPARE_PAYLOAD_LOOKAHEAD_FACTOR, DEFAULT_RE_ORG_HEAD_THRESHOLD,
|
||||
DEFAULT_RE_ORG_MAX_EPOCHS_SINCE_FINALIZATION, DEFAULT_RE_ORG_PARENT_THRESHOLD,
|
||||
DisallowedReOrgOffsets, INVALID_HOLESKY_BLOCK_ROOT, ReOrgThreshold,
|
||||
DEFAULT_PREPARE_PAYLOAD_LOOKAHEAD_FACTOR, DisallowedReOrgOffsets, INVALID_HOLESKY_BLOCK_ROOT,
|
||||
};
|
||||
use beacon_chain::custody_context::NodeCustodyType;
|
||||
use beacon_chain::graffiti_calculator::GraffitiOrigin;
|
||||
@@ -753,41 +751,39 @@ pub fn get_config<E: EthSpec>(
|
||||
.individual_tracking_threshold = count;
|
||||
}
|
||||
|
||||
if cli_args.get_flag("disable-proposer-reorgs") {
|
||||
client_config.chain.re_org_head_threshold = None;
|
||||
client_config.chain.re_org_parent_threshold = None;
|
||||
} else {
|
||||
client_config.chain.re_org_head_threshold = Some(
|
||||
clap_utils::parse_optional(cli_args, "proposer-reorg-threshold")?
|
||||
.map(ReOrgThreshold)
|
||||
.unwrap_or(DEFAULT_RE_ORG_HEAD_THRESHOLD),
|
||||
);
|
||||
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")?;
|
||||
client_config.chain.disable_proposer_reorg = cli_args.get_flag("disable-proposer-reorgs");
|
||||
|
||||
client_config.chain.re_org_parent_threshold = Some(
|
||||
clap_utils::parse_optional(cli_args, "proposer-reorg-parent-threshold")?
|
||||
.map(ReOrgThreshold)
|
||||
.unwrap_or(DEFAULT_RE_ORG_PARENT_THRESHOLD),
|
||||
);
|
||||
if clap_utils::parse_optional::<u64>(cli_args, "proposer-reorg-threshold")?.is_some() {
|
||||
warn!("The proposer-reorg-threshold flag is deprecated");
|
||||
}
|
||||
|
||||
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:?}"))?;
|
||||
}
|
||||
if clap_utils::parse_optional::<u64>(cli_args, "proposer-reorg-epochs-since-finalization")?
|
||||
.is_some()
|
||||
{
|
||||
warn!("The proposer-reorg-epochs-since-finalization flag is deprecated");
|
||||
}
|
||||
|
||||
if clap_utils::parse_optional::<u64>(cli_args, "proposer-reorg-cutoff")?.is_some() {
|
||||
warn!("The proposer-reorg-cutoff flag is deprecated");
|
||||
}
|
||||
|
||||
if clap_utils::parse_optional::<u64>(cli_args, "proposer-reorg-parent-threshold")?.is_some() {
|
||||
warn!("The proposer-reorg-parent-threshold flag is deprecated");
|
||||
}
|
||||
|
||||
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:?}"))?;
|
||||
}
|
||||
|
||||
client_config.chain.prepare_payload_lookahead =
|
||||
|
||||
Reference in New Issue
Block a user