Skip to content

Conversation

@morelucks
Copy link

Description

This PR adds support for the eth_simulateV1 RPC method, which provides comprehensive simulation results in a single call. Unlike eth_call or eth_estimateGas, eth_simulateV1 returns return data, gas used, and logs together, making it ideal for debugging and transaction simulation.

Changes

  • Added SimulateV1 function that follows the same pattern as Call and AccessList
  • Implemented SimulateV1Response struct with proper JSON unmarshaling
  • Added test coverage with golden file
  • Supports optional overrides parameter for state overrides
  • Supports optional blockNumber parameter (defaults to latest if nil)

Implementation Details

The implementation follows the existing codebase patterns:

  • Uses module.NewFactory with msgArgsWrapper for consistent message handling
  • Custom UnmarshalJSON method handles hex-encoded JSON fields (hexutil.Bytes, hexutil.Uint64)
  • Response struct includes ReturnData, GasUsed, and Logs fields

Fixes #240
@lmittmann

Implements SimulateV1 function and SimulateV1Response type to support
the eth_simulateV1 RPC method. This provides comprehensive simulation
results including return data, gas used, and logs in a single call.
@lmittmann
Copy link
Owner

Have you tested this? A PR to fix #240 is verry welcome, but this does not look quite right yet.

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.

module/eth: add support for eth_simulateV1

2 participants