Add --ignore-unviable-attestations and deprecate --disable-last-epoch-targets (#16094)

This PR introduces flag `--ignore-unviable-attestations` (replaces and
deprecates `--disable-last-epoch-targets`) to drop attestations whose
target state is not viable; default remains to process them unless
explicitly enabled.
This commit is contained in:
terence
2025-12-05 10:03:04 -05:00
committed by GitHub
parent a2b84c9320
commit 7a70abbd15
5 changed files with 21 additions and 10 deletions

View File

@@ -240,7 +240,7 @@ func (f *ForkChoice) IsViableForCheckpoint(cp *forkchoicetypes.Checkpoint) (bool
if node.slot == epochStart { if node.slot == epochStart {
return true, nil return true, nil
} }
if !features.Get().DisableLastEpochTargets { if !features.Get().IgnoreUnviableAttestations {
// Allow any node from the checkpoint epoch - 1 to be viable. // Allow any node from the checkpoint epoch - 1 to be viable.
nodeEpoch := slots.ToEpoch(node.slot) nodeEpoch := slots.ToEpoch(node.slot)
if nodeEpoch+1 == cp.Epoch { if nodeEpoch+1 == cp.Epoch {

View File

@@ -0,0 +1,2 @@
### Changed
- Introduced flag `--ignore-unviable-attestations` (replaces and deprecates `--disable-last-epoch-targets`) to drop attestations whose target state is not viable; default remains to process them unless explicitly enabled.

View File

@@ -71,7 +71,7 @@ type Flags struct {
DisableResourceManager bool // Disables running the node with libp2p's resource manager. DisableResourceManager bool // Disables running the node with libp2p's resource manager.
DisableStakinContractCheck bool // Disables check for deposit contract when proposing blocks DisableStakinContractCheck bool // Disables check for deposit contract when proposing blocks
DisableLastEpochTargets bool // Disables processing of states for attestations to old blocks. IgnoreUnviableAttestations bool // Ignore attestations whose target state is not viable (avoids lagging-node DoS).
EnableVerboseSigVerification bool // EnableVerboseSigVerification specifies whether to verify individual signature if batch verification fails EnableVerboseSigVerification bool // EnableVerboseSigVerification specifies whether to verify individual signature if batch verification fails
@@ -281,9 +281,11 @@ func ConfigureBeaconChain(ctx *cli.Context) error {
logEnabled(blacklistRoots) logEnabled(blacklistRoots)
cfg.BlacklistedRoots = parseBlacklistedRoots(ctx.StringSlice(blacklistRoots.Name)) cfg.BlacklistedRoots = parseBlacklistedRoots(ctx.StringSlice(blacklistRoots.Name))
} }
if ctx.IsSet(disableLastEpochTargets.Name) {
logEnabled(disableLastEpochTargets) cfg.IgnoreUnviableAttestations = false
cfg.DisableLastEpochTargets = true if ctx.IsSet(ignoreUnviableAttestations.Name) && ctx.Bool(ignoreUnviableAttestations.Name) {
logEnabled(ignoreUnviableAttestations)
cfg.IgnoreUnviableAttestations = true
} }
if ctx.IsSet(EnableStateDiff.Name) { if ctx.IsSet(EnableStateDiff.Name) {

View File

@@ -25,4 +25,6 @@ var upcomingDeprecation = []cli.Flag{
// deprecatedBeaconFlags contains flags that are still used by other components // deprecatedBeaconFlags contains flags that are still used by other components
// and therefore cannot be added to deprecatedFlags // and therefore cannot be added to deprecatedFlags
var deprecatedBeaconFlags = []cli.Flag{} var deprecatedBeaconFlags = []cli.Flag{
deprecatedDisableLastEpochTargets,
}

View File

@@ -201,10 +201,15 @@ var (
Usage: "(Work in progress): Enables the web portal for the validator client.", Usage: "(Work in progress): Enables the web portal for the validator client.",
Value: false, Value: false,
} }
// disableLastEpochTargets is a flag to disable processing of attestations for old blocks. // deprecatedDisableLastEpochTargets is a flag to disable processing of attestations for old blocks.
disableLastEpochTargets = &cli.BoolFlag{ deprecatedDisableLastEpochTargets = &cli.BoolFlag{
Name: "disable-last-epoch-targets", Name: "disable-last-epoch-targets",
Usage: "Disables processing of last epoch targets.", Usage: "Deprecated: disables processing of last epoch targets.",
}
// ignoreUnviableAttestations flag to skip attestations whose target state is not viable with respect to head (from lagging nodes).
ignoreUnviableAttestations = &cli.BoolFlag{
Name: "ignore-unviable-attestations",
Usage: "Ignores attestations whose target state is not viable with respect to the current head (avoid expensive state replay from lagging attesters).",
} }
) )
@@ -251,6 +256,7 @@ var BeaconChainFlags = combinedFlags([]cli.Flag{
disableStakinContractCheck, disableStakinContractCheck,
SaveFullExecutionPayloads, SaveFullExecutionPayloads,
enableStartupOptimistic, enableStartupOptimistic,
ignoreUnviableAttestations,
enableFullSSZDataLogging, enableFullSSZDataLogging,
disableVerboseSigVerification, disableVerboseSigVerification,
prepareAllPayloads, prepareAllPayloads,
@@ -266,7 +272,6 @@ var BeaconChainFlags = combinedFlags([]cli.Flag{
enableExperimentalAttestationPool, enableExperimentalAttestationPool,
forceHeadFlag, forceHeadFlag,
blacklistRoots, blacklistRoots,
disableLastEpochTargets,
}, deprecatedBeaconFlags, deprecatedFlags, upcomingDeprecation) }, deprecatedBeaconFlags, deprecatedFlags, upcomingDeprecation)
func combinedFlags(flags ...[]cli.Flag) []cli.Flag { func combinedFlags(flags ...[]cli.Flag) []cli.Flag {