Skip to content

execution/p2p, execution/engineapi: fail-fast NewPayload backward download when gap exceeds limit#21489

Merged
taratorio merged 1 commit into
mainfrom
yperbasis/bbd-newpayload-shortcircuit
May 28, 2026
Merged

execution/p2p, execution/engineapi: fail-fast NewPayload backward download when gap exceeds limit#21489
taratorio merged 1 commit into
mainfrom
yperbasis/bbd-newpayload-shortcircuit

Conversation

@yperbasis

Copy link
Copy Markdown
Member

Summary

Tightens the EngineBlockDownloader's behaviour when a NewPayload arrives
for a block whose parent is more than `MaxReorgDepth` blocks away from
the local head — the scenario behind #21311 / #20419.

  • `execution/p2p/bbd.go` — `downloadInitialHeader`'s early-exit check
    was one-sided (`currentHead > headerNum`), so when the EL was behind
    the new payload the check was skipped and the download wasted a
    `loadPeers` + 500-header batch fetch per slot before failing on the
    post-batch `chainLen > limit` check. Replaced with a symmetric
    `AbsoluteDifference` so the check fires in both directions.
  • `execution/engineapi/engine_block_downloader/block_downloader.go`
    added a short-circuit at the top of `downloadBlocks` for
    `NewPayloadTrigger`. When `abs(currentHead - parent) > MaxReorgDepth`
    we return `ErrChainLengthExceedsLimit` without spawning the bbd
    goroutine.
  • `download()` now logs the chain-length-exceeded case at INFO rather
    than WARN, since per @taratorio's triage on [EngineBlockDownloader] could not process backward download request #21311 it's expected
    behaviour, not an error — the EL relies on a later FCU (unbounded
    download) or staged sync to close the gap.

The underlying "Prysm doesn't always send a follow-up FCU" issue is
unchanged; that part remains tracked under #20419.

Test plan

  • New unit tests in `execution/p2p/bbd_test.go` cover the symmetric
    fail-fast check in both directions (EL behind / EL ahead).
  • New `TestNewPayloadGapExceedsLimit` table test in
    `execution/engineapi/engine_block_downloader/block_downloader_test.go`
    covers the boundary conditions of the predicate.
  • `make lint && make erigon integration` clean.
  • CI: `sync-with-externalcl` no longer log-spams the WARN line per slot.

Closes #21309 (duplicate of #21311). Partial fix toward #21311 / #20419
— full resolution of those issues still needs the FCU side handled.

🤖 Generated with Claude Code

…nload when gap exceeds limit

bbd.go's early-exit check was one-sided (`currentHead > headerNum`), so
when the EL was behind the new payload by more than chainLengthLimit
(the dominant failure in #21311 / #20419), the download still ran
loadPeers + a 500-header batch fetch before failing on the post-batch
chain-length check. Replace with a symmetric `AbsoluteDifference` so the
check fires in both directions.

Additionally, short-circuit `NewPayloadTrigger` in EngineBlockDownloader
when the gap to the local head exceeds MaxReorgDepth so we don't spawn
the bbd goroutine at all. Demote the resulting log line to INFO since
this is expected behaviour — the EL is waiting on a later FCU or staged
sync to close the gap.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@yperbasis yperbasis requested a review from mh0lt as a code owner May 28, 2026 12:36
@taratorio taratorio enabled auto-merge May 28, 2026 13:42
@taratorio

Copy link
Copy Markdown
Member

@yperbasis this is great, thanks! I had exact same thoughts and it was on my list. I would recommend we cherry-pick this to release/3.4 too

@taratorio taratorio added this pull request to the merge queue May 28, 2026
Merged via the queue into main with commit bc12fe0 May 28, 2026
91 checks passed
@taratorio taratorio deleted the yperbasis/bbd-newpayload-shortcircuit branch May 28, 2026 21:59
@taratorio

Copy link
Copy Markdown
Member

@yperbasis cherry picked in #21502

taratorio added a commit that referenced this pull request May 29, 2026
…ard download when gap exceeds limit (#21502)

Cherry-pick of #21489 to `release/3.4`.

## r3.4-specific adaptations

- `execution/engineapi/engine_block_downloader/block_downloader_test.go`
did not exist on `release/3.4` (file was introduced by #21362, not
backported). The cherry-pick keeps only the new
`TestNewPayloadGapExceedsLimit` test added by #21489; the unrelated
`TestBadHeader_*` tests from #21362 are not pulled in.

Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[EngineBlockDownloader] could not process backward download request

2 participants