Evm parent beacon block root#5425
Open
mpapierski wants to merge 5 commits into
Open
Conversation
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 Prague-compatible EIP-4788 beacon-roots support to Casper’s EVM implementation, using Casper-native semantics for the root value:
The goal is to provide the standard EIP-4788 contract interface and update behavior expected by EVM smart contracts, while mapping the underlying value to a consensus object that exists natively on Casper. This keeps the EVM-facing shape compatible with Ethereum, but the meaning of the stored root is explicitly Casper-specific.
What Changed
This adds the EIP-4788 beacon roots system contract at the standard address:
The implementation includes:
casper_types::evm.revm::SystemCallEvm.The system call is not modeled as a signed transaction. It does not create a user transaction, receipt, fee transfer, or transaction artifact.
Semantics
Ethereum’s EIP-4788 exposes the parent beacon block root to the EVM through a system contract. On Ethereum mainnet, this root is an SSZ beacon-chain consensus root and can be used by contracts to verify beacon-state data.
Casper does not have Ethereum beacon-chain blocks. Instead, this PR uses the parent Casper block hash as the root value. Casper block hashes are consensus-significant and commit to the Casper block header, including parent hash, state root, body hash, timestamp, era data, protocol version, proposer, gas price, and related fields.
So this implementation is interface-compatible with EIP-4788, but not semantically identical to Ethereum mainnet.
For dApp developers, this means contracts can use the standard EIP-4788 lookup flow and sidecar JSON-RPC can project
parentBeaconBlockRootto the same parent Casper block hash, so on-chain reads andeth_getBlockByNumberagree. Applications that only need a recent consensus-root oracle should work against the standard interface; applications that specifically verify Ethereum beacon-chain data must treat this as Casper-specific semantics.Why This Approach
This gives EVM contracts a deterministic, protocol-maintained consensus-root oracle without adding a new Casper block-header field.
Compared with other EVM L1s, this sits between strict adoption and omission. Chains with Ethereum-like consensus, such as Gnosis, can implement EIP-4788 unchanged. Beacon-style EVM L1s such as Berachain/BeaconKit map native consensus data into the Ethereum execution interface. Chains without a beacon-chain analogue often skip or neutralize the feature, for example Polygon PoS, BSC, or Avalanche’s zero-valued ParentBeaconRoot compatibility field in ACP-131. Casper keeps the standard contract interface instead of omitting it, but makes the root meaningful for Casper consensus rather than pretending to expose Ethereum beacon state.
Pros
Tradeoffs Compared to Ethereum