Skip to content

Conversation

@gzliudan
Copy link
Collaborator

@gzliudan gzliudan commented Feb 6, 2026

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 apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Regular KTLO or any of the maintaince work. e.g code style
  • CICD Improvement

Impacted Components

Which part of the codebase this PR will touch base on,

Put an in the boxes that apply

  • Consensus
  • Account
  • Network
  • Geth
  • Smart Contract
  • External components
  • Not sure (Please specify below)

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

  • This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
  • Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
  • Tested the backwards compatibility.
  • Tested with XDC nodes running this version co-exist with those running the previous version.
  • Relevant documentation has been updated as part of this PR
  • N/A

Copilot AI review requested due to automatic review settings February 6, 2026 14:58
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a 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.

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.

3 participants