mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Make re-org strat more cautious and add more config (#4151)
## Proposed Changes This change attempts to prevent failed re-orgs by: 1. Lowering the re-org cutoff from 2s to 1s. This is informed by a failed re-org attempted by @yorickdowne's node. The failed block was requested in the 1.5-2s window due to a Vouch failure, and failed to propagate to the majority of the network before the attestation deadline at 4s. 2. Allow users to adjust their re-org cutoff depending on observed network conditions and their risk profile. The static 2 second cutoff was too rigid. 3. Add a `--proposer-reorg-disallowed-offsets` flag which can be used to prohibit reorgs at certain slots. This is intended to help workaround an issue whereby reorging blocks at slot 1 are currently taking ~1.6s to propagate on gossip rather than ~500ms. This is suspected to be due to a cache miss in current versions of Prysm, which should be fixed in their next release. ## Additional Info I'm of two minds about removing the `shuffling_stable` check which checks for blocks at slot 0 in the epoch. If we removed it users would be able to configure Lighthouse to try reorging at slot 0, which likely wouldn't work very well due to interactions with the proposer index cache. I think we could leave it for now and revisit it later.
This commit is contained in:
@@ -885,6 +885,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")
|
||||
|
||||
@@ -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 clap::ArgMatches;
|
||||
@@ -686,6 +686,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.
|
||||
|
||||
Reference in New Issue
Block a user