Summary
eth_simulateV1 (added in #10227, #11253) has several spec conformance issues when tested against the official ethereum/execution-apis test suite. Before fixes: 46/91 passed. After fixes: 86/91 passed (94.5% conformance).
Issues Found and Fixed
1. Wrong error codes (fixed 14 tests)
The spec defines custom error codes for eth_simulateV1 that anvil was not using:
-38012 BaseFee too low → was returning -32003
-38013 Intrinsic gas too low → was returning -32000
-38014 Insufficient funds → was returning -32003
-38020 Block numbers not in order → not validated
-38021 Block timestamps not in order → not validated
-38022 movePrecompileToAddress self-reference → not validated
-38026 Too many blocks → was returning -32603
2. Transaction build failure on missing to field (fixed 9 tests)
When a call has no to field (empty {} or create-style tx), EVM execution succeeds but post-execution build_unsigned() fails because it requires to. Fixed by setting TxKind::Create when to is missing.
3. Missing block number/timestamp ordering validation (fixed 8 tests)
The spec requires:
- Block numbers must be strictly increasing (error
-38020)
- Block timestamps must be strictly increasing (error
-38021)
- Intermediate empty blocks generated when block number gaps exist
4. validation: true mode broken (fixed in prior commit)
build_call_env() unconditionally sets disable_nonce_check = true, disable_base_fee = true, disable_block_gas_limit = true. When validation: true, these should be re-enabled per the spec.
5. Missing movePrecompileToAddress validation (fixed 3 tests)
- Source must be a precompile (0x01-0x09), else error
-32000
- Source ≠ destination, else error
-38022
6. Future block returns wrong error code (fixed 2 tests)
When block parameter references a block beyond head, should return -32000 "header not found", was returning -32602.
7. parent_hash always zero in multi-block simulation (fixed)
Multi-block simulation had parent_hash: Default::default() for all blocks instead of chaining from previous block.
8. Revert error missing output data (fixed)
SimulateError was missing the data field with revert bytes.
Remaining 5 Failures
| Test |
Root Cause |
blocknumber-increment |
Timestamp env-dependent: spec expects genesis-based timestamps (~462) but anvil uses wallclock |
use-as-many-features-as-possible |
Same timestamp issue |
eth-send-should-produce-more-logs-on-forward |
CALL+value forwarding behavior difference |
overflow-nonce-validation |
revm returns NonceTooLow instead of NonceMaxValue on overflow |
run-out-of-gas-in-block-38015 |
Per-block gas accounting not enforced in simulation mode |
Spec Test Runner
Included a Python runner script that downloads and runs all 91 official spec tests against a running anvil instance. Can be used as CI regression gate.
How to reproduce
# Start anvil and mine 45 blocks to match spec test expectations
anvil --port 18547 &
cast rpc anvil_mine 0x2d --rpc-url http://localhost:18547
# Run spec tests
python3 crates/anvil/tests/it/spec_eth_simulateV1/run_spec_tests.py http://localhost:18547
Summary
eth_simulateV1(added in #10227, #11253) has several spec conformance issues when tested against the official ethereum/execution-apis test suite. Before fixes: 46/91 passed. After fixes: 86/91 passed (94.5% conformance).Issues Found and Fixed
1. Wrong error codes (fixed 14 tests)
The spec defines custom error codes for
eth_simulateV1that anvil was not using:-38012BaseFee too low → was returning-32003-38013Intrinsic gas too low → was returning-32000-38014Insufficient funds → was returning-32003-38020Block numbers not in order → not validated-38021Block timestamps not in order → not validated-38022movePrecompileToAddress self-reference → not validated-38026Too many blocks → was returning-326032. Transaction build failure on missing
tofield (fixed 9 tests)When a call has no
tofield (empty{}or create-style tx), EVM execution succeeds but post-executionbuild_unsigned()fails because it requiresto. Fixed by settingTxKind::Createwhentois missing.3. Missing block number/timestamp ordering validation (fixed 8 tests)
The spec requires:
-38020)-38021)4.
validation: truemode broken (fixed in prior commit)build_call_env()unconditionally setsdisable_nonce_check = true,disable_base_fee = true,disable_block_gas_limit = true. Whenvalidation: true, these should be re-enabled per the spec.5. Missing movePrecompileToAddress validation (fixed 3 tests)
-32000-380226. Future block returns wrong error code (fixed 2 tests)
When block parameter references a block beyond head, should return
-32000"header not found", was returning-32602.7. parent_hash always zero in multi-block simulation (fixed)
Multi-block simulation had
parent_hash: Default::default()for all blocks instead of chaining from previous block.8. Revert error missing output data (fixed)
SimulateErrorwas missing thedatafield with revert bytes.Remaining 5 Failures
blocknumber-incrementuse-as-many-features-as-possibleeth-send-should-produce-more-logs-on-forwardoverflow-nonce-validationrun-out-of-gas-in-block-38015Spec Test Runner
Included a Python runner script that downloads and runs all 91 official spec tests against a running anvil instance. Can be used as CI regression gate.
How to reproduce