Skip to content

[SharovBot] fix: read historical receipts for frozen-block Finalize to compute correct EIP-7685 requests hash#20847

Closed
erigon-copilot[bot] wants to merge 1 commit into
release/3.4from
agent-fix/requests-hash-frozen-block-r34
Closed

[SharovBot] fix: read historical receipts for frozen-block Finalize to compute correct EIP-7685 requests hash#20847
erigon-copilot[bot] wants to merge 1 commit into
release/3.4from
agent-fix/requests-hash-frozen-block-r34

Conversation

@erigon-copilot

Copy link
Copy Markdown
Contributor

[SharovBot]

Problem

The minimal-node-sync-from-scratch-test and sync-with-externalcl (lighthouse) CI jobs on release/3.4 fail with:

invalid block, txnIdx=754, error: invalid requests root hash in header,
  expected: 0xf572b27b91d729a55933cfcc56f8ec84716ddb181d5b0de5223522fff6bdf23d,
  got:      0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
ProcessFrozenBlocks: too far unwind. requested=24966722, minAllowed=24966723

Block 24966723 on mainnet has 754 transactions, one of which is a deposit to the EIP-6110 beacon deposit contract (0x00000000219ab540356cbb839cbe05303d7705fa). This deposit contributes to the block's requestsHash.

Root Cause

When the sync resumes from a snapshot boundary and all 754 transactions are already in the frozen domain files (startTxIndex = 754), the serial executor's blockReceipts slice is empty — no transactions were executed in this run. However, engine.Finalize receives blockReceipts to parse deposit logs via ParseDepositLogs. With an empty slice, no deposit logs are found, all three request types (deposits, withdrawals, consolidations) contribute nothing to the SHA-256 chain, and the computed hash is SHA256("") = 0xe3b0c44298... instead of the correct value.

Fix

In executeBlock, when startTxIndex > 0 and the block header has a non-nil RequestsHash (Prague+), read historical receipts from the receipt-cache domain via rawdb.ReadReceiptsCacheV2 and use the full historical receipt set for the Finalize call. This ensures ParseDepositLogs sees the complete log set.

Testing

  • go build ./... passes clean
  • This directly fixes the CI regression at mainnet block 24966723 on release/3.4

…o compute correct EIP-7685 requests hash

When block execution resumes from a snapshot boundary (startTxIndex > 0),
all user transactions are already frozen in domain snapshot files.
The blockReceipts slice for this run is empty (0 transactions executed).

However, EIP-7685 request validation in Finalize requires logs from ALL
transactions in the block — specifically EIP-6110 deposit events — to
compute the correct requestsHash.

Fix: when startTxIndex > 0 and the block header has a non-nil RequestsHash
(Prague+), read historical receipts from the receipt-cache domain via
ReadReceiptsCacheV2 and use those as the full receipts set for Finalize.

This fixes the sync-from-scratch regression at mainnet block 24966723:
  expected: 0xf572b27b91d729a55933cfcc56f8ec84716ddb181d5b0de5223522fff6bdf23d
  got:      0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 (SHA-256 of empty)

The empty hash was produced because blockReceipts was empty when the block
was fully frozen in snapshots, causing ParseDepositLogs to find no logs and
all request types to contribute nothing to the hash.

Fixes: https://github.com/erigontech/erigon/actions (release/3.4 minimal-node-sync-from-scratch-test and sync-with-externalcl lighthouse failures)

Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com>
@AskAlexSharov

Copy link
Copy Markdown
Collaborator

closing in favor of #20849

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.

1 participant