Skip to content

fix(l1): resolve RPC block hashes to that header - #7421

Open
colinlyguo wants to merge 1 commit into
lambdaclass:mainfrom
colinlyguo:fix-l1-rpc-block-hash-slot
Open

colinlyguo wants to merge 1 commit into
lambdaclass:mainfrom
colinlyguo:fix-l1-rpc-block-hash-slot

Conversation

@colinlyguo

Copy link
Copy Markdown

Motivation

eth_call, eth_estimateGas, eth_createAccessList, and debug_traceCall accept a block hash, turn it into a height, and load the canonical block at that height. EIP-1898 says a blockHash with requireCanonical left false names that block, including one that is no longer canonical. Two blocks at one height share a block number, so NUMBER still matches. TIMESTAMP, PREVRANDAO, COINBASE, base fee, account state, and SLOTNUM come from the canonical sibling. SLOTNUM is the new opcode that shows this. Calls by number, by tag, or by the canonical hash already returned that block.

Description

BlockIdentifierOrHash::resolve_block_header now loads a hash with get_block_header_by_hash. eth_call and eth_estimateGas already used this helper. eth_createAccessList and debug_traceCall each had their own height fold and now load the requested block. A number or a tag still resolves to the canonical block at that height.

The new test stores two headers at height 7, with slots 4 and 9, and marks slot 4 canonical. The side hash returns slot 9. The canonical hash and height 7 return slot 4.

Reads that still go through resolve_block_number are unchanged. eth_getBalance, eth_getCode, eth_getStorageAt, nonce, and proofs still answer a non-canonical hash with the canonical block at that height. requireCanonical is still accepted and not enforced. The store schema is unchanged.

Checklist

  • Updated STORE_SCHEMA_VERSION (crates/storage/lib.rs) if the PR includes breaking changes to the Store requiring a re-sync.

eth_call and eth_estimateGas turned a block hash into a height and then
loaded the canonical header, so SLOTNUM on a non-canonical hash returned
the sibling's slot. Load the header by hash. createAccessList and
debug_traceCall used the same height fold.
@colinlyguo
colinlyguo requested a review from a team as a code owner October 15, 2026 16:27
@github-actions github-actions Bot added the external-contributor PR opened by a contributor outside the team label Oct 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor PR opened by a contributor outside the team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant