Skip to content

execution: remove legacy headerdownload, bodydownload and dataflow packages#21505

Merged
yperbasis merged 7 commits into
mainfrom
remove_headers_bodies
May 30, 2026
Merged

execution: remove legacy headerdownload, bodydownload and dataflow packages#21505
yperbasis merged 7 commits into
mainfrom
remove_headers_bodies

Conversation

@taratorio
Copy link
Copy Markdown
Member

Why

headerdownload, bodydownload and dataflow implement the legacy devp2p header/body
download used by the staged-sync Headers/Bodies stages. Post-merge they are dead in
production: blocks arrive from the consensus layer via the engine API / execution module
(PipelineStages), which omits the Headers/Bodies stages entirely. The path was already
disabled — sentryMcDisableBlockDownload = true made MultiClient.Hd/Bd empty stubs, the
eth/66 download handlers early-returned, and StageLoop's only caller was the dead
pre-merge-PoW branch in Ethereum.Start().

What

  • Delete the three packages (~4.7k lines).
  • Headers/Bodies stage forward funcs become no-ops; their unwinds are kept but
    decoupled from headerdownload.
  • Remove StageLoop + StageLoopIteration + ProcessFrozenBlocks and the legacy
    non-PoS / non-Bor branch in Ethereum.Start().
  • Strip Hd/Bd from sentry_multi_client: the four download message handlers (now a
    single no-op dispatch case), SendHeaderRequest/SendBodyRequest/Penalize, and the
    dead broadcast.go (BroadcastNewBlock/PropagateNewBlockHashes).
  • Remove the dead params/plumbing this exposed: Sync.posTransition, the execute stage's
    unused hd interface + the dead POSSync()ReportBadHeaderPoS branches,
    disableBlockDownload, blockBufferSize/DefaultBlockBufferSize, maxBlockBroadcastPeers.
  • Rework the MockSentry test fixture to drop the vestigial downloader — tests already
    insert blocks via the PoS engine-API path (InsertChainUpdateForkChoice).

Behavior note: a bare pre-merge PoW chain (not PoS, not Bor) no longer starts a sync
loop — consistent with StageLoop being unused in production. PoS and Polygon are unaffected.

Verification

go build ./..., make erigon integration, and make lint are clean; targeted tests pass
(stagedsync, sentry_multi_client, execmoduletester, execution/tests, polygon/bor).
Full make test-all (on ramdisk) is running.

taratorio added 2 commits May 29, 2026 15:36
…iplePeers

Both fields became write-only after the header/body download handlers were
removed (their only readers were newBlock66 and the header-request path).
Pre-existing dead code: the method had no callers.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes Erigon’s legacy devp2p-based header/body download pipeline (headerdownload, bodydownload, dataflow) and the associated staged-sync loop plumbing that was already effectively dead in production post-merge. The remaining staged-sync “Headers/Bodies” stages are turned into forward no-ops (unwinds retained), and the sentry multi-client is simplified to drop the internal downloaders and related message handling/broadcasting.

Changes:

  • Delete legacy header/body downloader and dataflow packages; remove StageLoop-based syncing and related backend plumbing.
  • Simplify sentry_multi_client (drop Hd/Bd, disable download handlers, remove broadcast helpers, reduce constructor deps).
  • Adjust staged-sync stage configs/APIs (headers/bodies forward no-ops; remove downloader hooks from senders/execute) and update affected tests/integration tooling.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
polygon/bor/bor_test.go Removes now-deleted WithBlockBufferSize option usage in Bor tests.
p2p/sentry/sentry_multi_client/sentry_multi_client.go Drops embedded Hd/Bd downloaders and turns eth/66 download inbound messages into no-ops.
p2p/sentry/sentry_multi_client/sentry_api.go Removes legacy request/penalty APIs tied to header/body downloading.
p2p/sentry/sentry_multi_client/broadcast.go Deletes legacy devp2p new-block/new-hash broadcast helpers.
node/eth/backend.go Removes legacy StageLoop startup/shutdown and sentry multi-client downloader plumbing; PoW-only branch no longer starts sync loop.
node/components/sentry/provider.go Simplifies MultiClientDeps and BuildMultiClient call (removes sync cfg/buffer/broadcast/download flags).
execution/tests/blockchain_test.go Removes now-deleted WithBlockBufferSize option usage in execution tests.
execution/stagedsync/sync.go Removes posTransition gating from break-after-stage logic.
execution/stagedsync/stageloop/stageloop.go Removes StageLoop/ProcessFrozenBlocks/StageLoopIteration and updates stage construction to no longer depend on Hd/Bd.
execution/stagedsync/stage_witness.go Updates Execute stage cfg construction for witness rewind (but currently has a signature/order mismatch—see comment).
execution/stagedsync/stage_senders.go Removes hd-based PoS bad-header reporting hooks from Senders stage.
execution/stagedsync/stage_senders_test.go Updates senders stage cfg call signature.
execution/stagedsync/stage_headers.go Replaces headers stage cfg with a minimal cfg; keeps unwind logic but removes downloader interactions.
execution/stagedsync/stage_execute.go Removes header-downloader interface hook from execute stage configuration.
execution/stagedsync/stage_bodies.go Removes bodies forward download logic; keeps unwind via block writer canonical markers.
execution/stagedsync/exec3.go Removes bad-header reporting hook from wrong-trie-root path; adjusts helper signature accordingly.
execution/stagedsync/exec3_serial.go Removes PoS bad-header reporting hook on serial execution invalid block.
execution/stagedsync/exec3_parallel.go Removes PoS bad-header reporting hook on parallel execution invalid block; updates helper signature usage.
execution/stagedsync/default_stages.go Makes Headers/Bodies forward functions no-ops while retaining unwind hooks.
execution/stagedsync/dataflow/states.go Deletes legacy download state tracking utility.
execution/stagedsync/headerdownload/header_data_struct.go Deletes legacy header download implementation.
execution/stagedsync/headerdownload/header_algos.go Deletes legacy header download implementation.
execution/stagedsync/headerdownload/header_algo_test.go Deletes legacy header download tests.
execution/stagedsync/bodydownload/prefetched_blocks.go Deletes legacy body prefetch cache used by downloader.
execution/stagedsync/bodydownload/body_test.go Deletes legacy body downloader tests.
execution/stagedsync/bodydownload/body_data_struct.go Deletes legacy body download implementation.
execution/stagedsync/bodydownload/body_algos.go Deletes legacy body download implementation.
execution/stagedsync/bodydownload/block_propagator.go Deletes legacy block propagator type used by downloader.
execution/execmodule/execmoduletester/from0_genesis_internal_test.go Removes passing Hd into execute cfg builder.
execution/execmodule/execmoduletester/exec_module_tester.go Removes WithBlockBufferSize, drops internal downloader wiring from mock sentry setup and stage construction.
db/snapshotsync/freezeblocks/dump_test.go Removes now-deleted WithBlockBufferSize option usage.
cmd/integration/commands/state_stages.go Updates execute stage cfg calls for signature change (removes hd arg).
cmd/integration/commands/stages.go Updates bodies/senders/exec integration commands for new stage cfg signatures and NewDefaultStages signature change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread execution/stagedsync/stage_witness.go Outdated
The inline comments on the StageExecuteBlocksCfg call were off-by-one (stale
from an older signature); relabel them to match the current parameters.
@taratorio taratorio added this pull request to the merge queue May 29, 2026
@taratorio taratorio removed this pull request from the merge queue due to a manual request May 29, 2026
@taratorio taratorio enabled auto-merge May 29, 2026 14:30
@taratorio taratorio added this pull request to the merge queue May 29, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 29, 2026
@yperbasis yperbasis enabled auto-merge May 30, 2026 08:14
@yperbasis yperbasis added this pull request to the merge queue May 30, 2026
Merged via the queue into main with commit d0caf67 May 30, 2026
89 checks passed
@yperbasis yperbasis deleted the remove_headers_bodies branch May 30, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants