Skip to content

fix(internal): process prague system calls in eth_simulate #31176#2069

Merged
AnilChinchawale merged 1 commit intoXinFinOrg:dev-upgradefrom
gzliudan:fix-sim-proc-block
Feb 23, 2026
Merged

fix(internal): process prague system calls in eth_simulate #31176#2069
AnilChinchawale merged 1 commit intoXinFinOrg:dev-upgradefrom
gzliudan:fix-sim-proc-block

Conversation

@gzliudan
Copy link
Collaborator

Proposed changes

Ref: ethereum#31176

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 15, 2026 07:38
@coderabbitai
Copy link

coderabbitai bot commented Feb 15, 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 refactors the EVM initialization pattern to fix an issue where Prague system calls (specifically ProcessParentBlockHash for EIP-2935) were not being executed in eth_simulate. The core change separates EVM initialization from transaction context setting, allowing an EVM instance to be created once per block and reused across multiple transactions by calling SetTxContext for each transaction.

Changes:

  • Refactored vm.NewEVM() to no longer take TxContext as a parameter; transaction context is now set separately via evm.SetTxContext()
  • Added ProcessParentBlockHash system call execution in eth_simulate for Prague-enabled chains
  • Updated all EVM creation sites across the codebase (tests, tracers, miners, state processors, API handlers) to use the new initialization pattern

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.

Show a summary per file
File Description
core/vm/evm.go Modified NewEVM signature to remove TxContext parameter; added SetTxContext method to replace Reset; added SetTracer method
core/state_processor.go Updated ProcessParentBlockHash signature to remove statedb parameter; refactored ApplyTransaction and ApplyTransactionWithEVM to accept pre-created EVM
internal/ethapi/simulate.go Added Prague system call processing before transaction execution (main fix)
internal/ethapi/api.go Updated applyMessage and AccessList to set balance before GetEVM and call SetTxContext after EVM creation
internal/ethapi/backend.go Simplified GetEVM signature by removing msg parameter and balance setting (moved to callers)
miner/worker.go Modified Work struct to include EVM field; EVM now created once per block and reused via commitTransaction
eth/tracers/api.go Updated all tracing functions to create EVM without TxContext and set it separately; added Prague system call to traceBlock paths
eth/state_accessor.go Updated stateAtTransaction to create EVM once and reuse with SetTxContext for replay
tests/*.go Updated all test files to use new EVM initialization pattern
eth/tracers/*_test.go Updated all tracer tests; added TestTraceBlockParallelPragueParentHashSystemCall to verify Prague system calls
core/state_processor_test.go Added TestApplyTransactionWithEVMStateChangeHooks; updated Prague-related tests
Various helper files Updated consensus tests, chain makers, gas estimator, runtime env, and simulated backend to new pattern

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AnilChinchawale AnilChinchawale merged commit fc6c692 into XinFinOrg:dev-upgrade Feb 23, 2026
13 checks passed
@gzliudan gzliudan deleted the fix-sim-proc-block branch February 23, 2026 01:52
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.

6 participants