Conversation
Install the parent-beacon-block-root system contract at the canonical address 0x000F3df6...Beac02 (Cancun+) and drive its block-start deposit through the normal executor, matching mainnet semantics. - Add `eip_4788` hardfork flag, active from Cancun. - Add `parent_beacon_block_root` to `Context.Block` — used by higher layers that will drive the system call at block boundaries once block processing lands (tracked in #86). - New `EEVM.SystemContracts.BeaconRoots` with: - `install/1` / `install_if_enabled/2` — deploy the EIP's exact runtime bytecode into a `Database`. - `commit/3` — run the block-start system call (caller = SYSTEM_ADDRESS, calldata = 32-byte root) through `Executor.run_loop`, storing the root in the 8191-slot ring buffer. - `lookup/2` — convenience reader that goes directly to storage; a dedicated test also exercises the read path end-to-end via a user CALL so we verify the bytecode itself, not just the storage layout. Closes #82 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Closes #82.
Summary
Install the parent-beacon-block-root system contract at the canonical
address
0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02(Cancun+) and driveits block-start deposit through the normal executor.
eip_4788added toHardforkConfig, active from Cancun.parent_beacon_block_rootadded toContext.Block.EEVM.SystemContracts.BeaconRoots:install/1/install_if_enabled/2— deploy the EIP's exact runtime bytecode.commit/3— run the block-start system call (caller =SYSTEM_ADDRESS, calldata = 32-byte root) throughExecutor.run_loop; stores into the 8191-slot ring buffer.lookup/2— direct storage read.Design notes
No custom precompile — we deploy the exact runtime bytecode specified by the EIP and call it through the real executor. Any future CALL-semantic changes come along for free, and the tests exercise the real bytecode, not a reimplementation.
commit/3andlookup/2take/return aDatabase, keeping the integration surface small for higher layers (block processing in #86 will hook this in at block boundaries).Test plan
install/1places bytecode, is idempotent.install_if_enabled/2gates on Cancun.commit/3populates both ring-buffer slots (ts % 8191and+ 8191).lookup/2round-trips a stored root.lookup/2returns:not_foundfor unknown timestamps.CALLwith a known timestamp returns the 32-byte root via RETURN.CALLwith an unknown timestamp reverts.🤖 Generated with Claude Code