Evm block hash history contract#5426
Open
mpapierski wants to merge 2 commits into
Open
Conversation
mpapierski
requested review from
EdHastingsCasperAssociation,
darthsiroftardis and
zajko
July 9, 2026 13:09
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.
Summary
This PR adds EIP-2935 block hash history support for Prague-mode Casper EVM.
It installs the standard EIP-2935 block-hash-history predeploy and updates it once per block with the parent Casper block hash. This gives EVM contracts the expected Prague system-contract interface while keeping the existing
BLOCKHASHopcode behavior unchanged.The important Casper-specific semantic is:
So the interface matches EIP-2935, but the stored values are Casper block hashes, not Ethereum L1 execution block hashes.
What Changed
Added EIP-2935 constants under
casper_types::evm:Generalized Prague EVM predeploy setup so genesis and protocol upgrade install both:
Preserved the existing idempotent predeploy behavior:
Added a pre-block EIP-2935 system call:
0Updated EVM documentation to mark EIP-2935 as implemented and clarify that
BLOCKHASHremains separate.Semantics
For each non-genesis Prague EVM block, Casper calls the EIP-2935 contract with the parent Casper block hash as calldata. The contract stores that hash in the standard 8191-slot history ring buffer.
Contracts can then call the EIP-2935 predeploy at:
to retrieve recent stored Casper block hashes through the standard EIP-2935 lookup interface.
This does not change the
BLOCKHASHopcode.BLOCKHASHstill uses Casper’s existing node-supplied block hash provider.