[r3.4] exec: fix partial block receipt reconstruction (#20452)#20849
Merged
Conversation
- When execution resumes from a snapshot boundary mid-block (`initialBlockTxOffset > 0`), the receipts passed to `engine.Finalize()` only contained receipts from the re-executed portion. This causes Pectra requests hash validation to fail because deposit request extraction needs ALL receipt logs. - Fixes the `isPartial` detection in the parallel executor — `tasks[0]` is the system tx (`TxIndex=-1`), so the first user tx must be found by scanning for `TxIndex >= 0`. - Adds `replayPriorTxsForReceipts` functions that use a `HistoryReaderV3` to re-execute prior transactions and reconstruct their receipts, prepending them before calling `Finalize`. - Applied to both parallel (`exec3_parallel.go`) and serial (`exec3_serial.go`) executors. Closes #20452 - [x] `make erigon` and `make integration` build successfully - [x] `make lint` passes (run twice for non-determinism) - [x] `go test -short ./execution/stagedsync/...` passes - [x] Run node through a Pectra-era snapshot boundary where `initialBlockTxOffset > 0` and verify requests hash validation passes - [x] Verify deposit request extraction from logs includes all block transactions 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Mark Holt <erigon@dev-bm-e3-ethmainnet-n4.erigon.io> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
LGTM.
Compared with #20847, this is broader and more complete rather than identical:
- it fixes both
exec3_serialandexec3_parallel - it factors the receipt replay logic into a shared
execution/receiptshelper instead of inlining a one-off path - it reconstructs prior receipts by replaying transactions against the correct historical state, which is a more general solution than relying only on receipt-cache availability
So the intent is the same (ensure Finalize sees the full receipt set for partial/frozen blocks), but #20849 is not just a duplicate cherry-pick of #20847 — it is the more complete implementation.
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.
Cherry-pick of #20467 to release/3.4.
When execution resumes from a snapshot boundary mid-block (
initialBlockTxOffset > 0), the receipts passed toengine.Finalize()only contained receipts from the re-executed portion. This causes Pectra requests hash validation to fail because deposit request extraction needs ALL receipt logs.Reproduces as:
invalid requests root hash in headerat block 24966723 on mainnet re-sync.