execution: remove legacy headerdownload, bodydownload and dataflow packages#21505
Merged
Conversation
…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.
Contributor
There was a problem hiding this comment.
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.
The inline comments on the StageExecuteBlocksCfg call were off-by-one (stale from an older signature); relabel them to match the current parameters.
yperbasis
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
headerdownload,bodydownloadanddataflowimplement the legacy devp2p header/bodydownload 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 alreadydisabled —
sentryMcDisableBlockDownload = truemadeMultiClient.Hd/Bdempty stubs, theeth/66 download handlers early-returned, and
StageLoop's only caller was the deadpre-merge-PoW branch in
Ethereum.Start().What
decoupled from
headerdownload.StageLoop+StageLoopIteration+ProcessFrozenBlocksand the legacynon-PoS / non-Bor branch in
Ethereum.Start().Hd/Bdfromsentry_multi_client: the four download message handlers (now asingle no-op dispatch case),
SendHeaderRequest/SendBodyRequest/Penalize, and thedead
broadcast.go(BroadcastNewBlock/PropagateNewBlockHashes).Sync.posTransition, the execute stage'sunused
hdinterface + the deadPOSSync()→ReportBadHeaderPoSbranches,disableBlockDownload,blockBufferSize/DefaultBlockBufferSize,maxBlockBroadcastPeers.MockSentrytest fixture to drop the vestigial downloader — tests alreadyinsert blocks via the PoS engine-API path (
InsertChain→UpdateForkChoice).Behavior note: a bare pre-merge PoW chain (not PoS, not Bor) no longer starts a sync
loop — consistent with
StageLoopbeing unused in production. PoS and Polygon are unaffected.Verification
go build ./...,make erigon integration, andmake lintare clean; targeted tests pass(
stagedsync,sentry_multi_client,execmoduletester,execution/tests,polygon/bor).Full
make test-all(on ramdisk) is running.