-
Notifications
You must be signed in to change notification settings - Fork 69
feat(core): implement EIP-2935 #29465 #30924 #2033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev-upgrade
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements EIP-2935, which provides access to historical block hashes from state via a system contract. The implementation follows the EIP specification closely, storing block hashes in a ring buffer contract deployed at a specific address (0x0000F90827F1C53a10cb7A02335B175320002935) when the Prague hard fork activates.
Changes:
- Added EIP-2935 history storage system contract that maintains a ring buffer of the most recent 8,191 block hashes
- Implemented one-time backfilling of recent block hashes when Prague activates on existing networks
- Integrated the system contract calls into all block processing paths (mining, state access, tracing, and test utilities)
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| params/protocol_params.go | Defines the history storage contract address, bytecode, and window size (8,191 blocks); adds SystemAddress for system calls |
| core/state_processor.go | Implements ProcessParentBlockHash function that deploys the contract, performs backfilling, and stores parent hashes via system calls |
| core/state_processor_test.go | Adds comprehensive tests for ProcessParentBlockHash including Prague guard checks, backfilling with missing history, and code mismatch detection |
| miner/worker.go | Integrates parent block hash processing during block mining when Prague is active |
| eth/tracers/api.go | Adds parent block hash processing in three tracer endpoints (traceChain, IntermediateRoots, traceBlock) for accurate state reconstruction |
| eth/state_accessor.go | Processes parent block hash when reconstructing historical state for transaction replay |
| core/chain_makers.go | Updates test chain generation to include EIP-2935 processing and adds Engine() method to fakeChainReader for ChainContext interface compliance |
| core/genesis.go | Pre-deploys history storage contract in developer genesis; cleans up incomplete comment |
| common/big.go | Adds U2560 constant (uint256 zero) used in EVM calls |
| docs/upgrade.md | Documents Prague/EIP-2935 upgrade notes including deployment strategy and backfilling behavior |
| docs/README.md | Adds link to upgrade notes documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Proposed changes
implement EIP-2935
Ref:
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which part of the codebase this PR will touch base on,
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that