Skip to content

EVM: block hash to block store wire up - #5437

Open
mpapierski wants to merge 6 commits into
casper-network:feat-evmfrom
mpapierski:evm-block-hash-to-block-store-wire-up
Open

EVM: block hash to block store wire up#5437
mpapierski wants to merge 6 commits into
casper-network:feat-evmfrom
mpapierski:evm-block-hash-to-block-store-wire-up

Conversation

@mpapierski

Copy link
Copy Markdown
Collaborator

Overview

This PR removes the BlockHashProvider abstraction from the EVM executor and lets CasperDb read block hashes directly from the indexed LMDB block store through the DataAccessLayer.

The DAL now owns a shallow-cloned LmdbBlockStore handle, allowing the executor to open short-lived read transactions without reopening the LMDB environment. The old block-hash preloading logic and the speculative execution requests used to populate it have been removed.

As part of the DAL wiring, LMDB transaction access is exposed through semantic block-store methods. The generic DataReader and DataWriter traits and their internal key types are now crate-private. Temporary block stores also own their temporary directory, making shallow-cloned test stores self-contained.

EIP-2935

This also adds the EIP-2935 block hash history contract at its standard address, with the standard runtime bytecode and code hash. The predeploy is installed idempotently during genesis and protocol upgrades.

Direct CALL and STATICCALL operations are handled natively by CasperEvmPrecompiles. Valid requests read indexed Casper block headers from LMDB instead of executing the contract bytecode or maintaining Ethereum’s 8,191-slot state ring. DELEGATECALL and CALLCODE continue to use the deployed bytecode path.

The existing BLOCKHASH opcode remains unchanged semantically: revm continues to enforce its 256-block window, while the hash itself is loaded from the indexed block store.

Execution guard

Before executing a finalized block containing EVM transactions, contract runtime checks that the full 8,191-block EIP-2935 history window is locally available. Missing history emits the existing non-executable block announcement and moves the node toward CatchUp. Non-EVM blocks skip this check.

Replace external DataReader and DataWriter usage with semantic methods on
LMDB transactions. Keep the generic traits and internal key types
crate-private, exposing only methods required by node and EVM callers.

Let temporary block stores own their directory across shallow clones and
update storage, executor, and test-support callers accordingly.
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