Skip to content

cl/persistence: fix caplin historical state reconstruction loop at bellatrix transition#22345

Merged
domiwei merged 4 commits into
erigontech:mainfrom
Sahil-4555:fix/caplin-bellatrix-reconstruction-loop
Jul 10, 2026
Merged

cl/persistence: fix caplin historical state reconstruction loop at bellatrix transition#22345
domiwei merged 4 commits into
erigontech:mainfrom
Sahil-4555:fix/caplin-bellatrix-reconstruction-loop

Conversation

@Sahil-4555

Copy link
Copy Markdown
Contributor

What was the issue?

The first Bellatrix-era slot is 4,636,672. Since the Merge did not happen yet at this point, this block has an empty execution payload header with BlockHash = 0x000...000 and BlockNumber = 0.

Previously, if the block version was post-Altair, we were unconditionally trying to fetch EL transactions. This means we queried executionReader.Transactions(0, 0x00...).

Because of a recent change (commit 04d330df0b which routes block 0 queries to the database instead of snapshots), this lookup went to the DB. Since the database requires a matching hash and the zero hash doesn't match our real genesis block hash, it returned nil, throwing the error: transactions not found for block 0. This caused the antiquary loop to crash and rollback to the previous checkpoint, looping forever.

What is the fix?

We added a simple check to check if the execution payload blockHash is the zero hash. If it is, this is a pre-Merge block where execution is not yet active under consensus rules, so we skip the EL transaction/withdrawal lookup completely.

Checking the block hash instead of the block number also keeps custom networks safe where execution block 0 can have a valid non-zero block hash.

closes #22337

@Sahil-4555 Sahil-4555 changed the title cl/persistence: fix Caplin historical state reconstruction loop at Bellatrix transition cl/persistence: fix caplin historical state reconstruction loop at bellatrix transition Jul 9, 2026
@domiwei domiwei enabled auto-merge July 9, 2026 09:48
@Sahil-4555 Sahil-4555 requested a review from domiwei July 10, 2026 04:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes Caplin historical state reconstruction getting stuck at the Bellatrix fork boundary by skipping Execution Layer (EL) transaction/withdrawal lookups when the execution payload header indicates execution is not enabled (zero BlockHash).

Changes:

  • Add an early-return in ReadBlockFromSnapshot for post-Altair blocks with a zero execution BlockHash, avoiding EL lookups for pre-Merge Bellatrix blocks.
  • Add a regression test ensuring EL lookups are skipped for a pre-Merge Bellatrix block (prevents the infinite retry loop reported in #22337).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
cl/persistence/format/snapshot_format/blocks.go Skips EL transaction/withdrawal fetch when the blinded block’s execution BlockHash is zero (pre-Merge Bellatrix payload header).
cl/persistence/format/snapshot_format/blocks_test.go Adds regression test that fails if ReadBlockFromSnapshot attempts an EL lookup for a zero-hash Bellatrix execution payload.

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

@domiwei domiwei added this pull request to the merge queue Jul 10, 2026
Merged via the queue into erigontech:main with commit 18b4145 Jul 10, 2026
91 checks passed
yperbasis pushed a commit that referenced this pull request Jul 10, 2026
…p at bellatrix transition (#22370)

## Summary

Cherry-pick of #22345 to `release/3.5`.

- Pre-Merge Bellatrix blocks carry a default (all-zero) execution
payload header — `ReadBlockFromSnapshot` now detects the zero
`BlockHash` and skips the EL transaction lookup, preventing an infinite
retry loop during historical state reconstruction at the Bellatrix
transition.

## Test plan

- [x] `TestPreMergeBellatrixBlockSkipsExecutionLookup` passes
- [x] `make lint` clean

Co-authored-by: Sahil Sojitra <sahilsojitra4555@gmail.com>
@Sahil-4555 Sahil-4555 deleted the fix/caplin-bellatrix-reconstruction-loop branch July 10, 2026 10:23
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.

caplin: not advancing past merge bellatrix slot 4636671

3 participants