Summary
Build a test runner that parses and executes the official Ethereum execution test fixtures (EEST / ethereum-tests). This is the critical validation step that verifies eevm against thousands of official test vectors covering every opcode, gas rule, and edge case.
Specification
StateTest JSON format:
{
"testName": {
"env": { "currentCoinbase": "...", "currentNumber": "...", ... },
"pre": { "address": { "balance": "...", "nonce": "...", "code": "...", "storage": {...} } },
"transaction": { "sender": "...", "to": "...", "data": ["..."], "gasLimit": ["..."], ... },
"post": {
"Shanghai": [{ "hash": "0x...", "indexes": { "data": 0, "gas": 0, "value": 0 } }]
}
}
}
The runner must:
- Parse the JSON fixture
- Load
pre state into Database.InMemory
- Set up
Context.Block from env
- Execute the transaction (apply validation, intrinsic gas, then EVM execution)
- Compute the post-state root using MPT
- Compare against the expected
hash in post
Implementation Guide
- Create
test/support/state_test_runner.ex — parsing + execution harness
- Wire MPT state root computation:
- Build account trie from all accounts in DB
- Each account leaf:
RLP.encode([nonce, balance, storage_root, code_hash])
- Storage root: MPT of
{keccak(slot) => RLP.encode(value)} for each account
- Create
test/state_test_test.exs — parameterized test that loads fixtures and runs them
- Download fixtures: EEST release v5.4.0 from
https://github.com/ethereum/execution-spec-tests/releases
- Start with simple fixtures: arithmetic, comparison, bitwise opcodes first, then gas, then system calls
Acceptance Criteria
Reference
Summary
Build a test runner that parses and executes the official Ethereum execution test fixtures (EEST / ethereum-tests). This is the critical validation step that verifies eevm against thousands of official test vectors covering every opcode, gas rule, and edge case.
Specification
StateTest JSON format:
{ "testName": { "env": { "currentCoinbase": "...", "currentNumber": "...", ... }, "pre": { "address": { "balance": "...", "nonce": "...", "code": "...", "storage": {...} } }, "transaction": { "sender": "...", "to": "...", "data": ["..."], "gasLimit": ["..."], ... }, "post": { "Shanghai": [{ "hash": "0x...", "indexes": { "data": 0, "gas": 0, "value": 0 } }] } } }The runner must:
prestate intoDatabase.InMemoryContext.BlockfromenvhashinpostImplementation Guide
test/support/state_test_runner.ex— parsing + execution harnessRLP.encode([nonce, balance, storage_root, code_hash]){keccak(slot) => RLP.encode(value)}for each accounttest/state_test_test.exs— parameterized test that loads fixtures and runs themhttps://github.com/ethereum/execution-spec-tests/releasesAcceptance Criteria
mix test test/state_test_test.exsReference