Repository navigation
fix(l1): resolve RPC block hashes to that header - #7421
Open
colinlyguo wants to merge 1 commit into
Open
colinlyguo wants to merge 1 commit into
colinlyguo wants to merge 1 commit into
Conversation
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.
This branch has not been deployed
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.
Motivation
eth_call,eth_estimateGas,eth_createAccessList, anddebug_traceCallaccept a block hash, turn it into a height, and load the canonical block at that height. EIP-1898 says ablockHashwithrequireCanonicalleft false names that block, including one that is no longer canonical. Two blocks at one height share a block number, soNUMBERstill matches.TIMESTAMP,PREVRANDAO,COINBASE, base fee, account state, andSLOTNUMcome from the canonical sibling.SLOTNUMis the new opcode that shows this. Calls by number, by tag, or by the canonical hash already returned that block.Description
BlockIdentifierOrHash::resolve_block_headernow loads a hash withget_block_header_by_hash.eth_callandeth_estimateGasalready used this helper.eth_createAccessListanddebug_traceCalleach 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_numberare unchanged.eth_getBalance,eth_getCode,eth_getStorageAt, nonce, and proofs still answer a non-canonical hash with the canonical block at that height.requireCanonicalis still accepted and not enforced. The store schema is unchanged.Checklist
STORE_SCHEMA_VERSION(crates/storage/lib.rs) if the PR includes breaking changes to theStorerequiring a re-sync.