ethereum/execution-spec-tests is both a collection of test cases and a framework implemented in Python to generate tests for Ethereum execution clients.
The framework collects and executes the test cases in order to generate test fixtures (JSON) which can be consumed by any execution client to verify their implementation of ethereum/execution-specs. The fixtures, which define state transition and block tests, are generated by the framework using one of the t8n
command-line tools that are provided by most execution clients, see below for an overview of the supported t8n
tools.
---
title: Test Fixture Generation with execution-spec-tests
---
flowchart LR
style C stroke:#333,stroke-width:2px
style D stroke:#333,stroke-width:2px
style G stroke:#F9A825,stroke-width:2px
style H stroke:#F9A825,stroke-width:2px
subgraph "ethereum/go-ethereum, ..."
C[<code>evm t8n</code>\nexternal executable]
end
subgraph ethereum/solidity
D[<code>solc</code>\nexternal executable]
end
subgraph ethereum/EIPs
E(<code>EIPS/EIP-*.md</code>\nSHA digest via Github API)
end
subgraph "ethereum/execution-spec-tests"
A(<code>./tests/**/*.py</code>\nPython Test Cases)
B([<code>$ fill ./tests/</code>\nPython Framework])
end
subgraph Test Fixture Consumers
subgraph ethereum/hive
G([<code>$ hive ...</code>\nGo Test Framework])
end
H([Client executables])
end
C <-.-> B
D <-.-> B
A --> B
E <-.-> |retrieve latest spec version\ncheck tested spec version| B
B -->|output| F(<code>./fixtures/**/*.json</code>\nJSON Test Fixtures)
F -->|input| G
F -->|input| H
The generated test fixtures can be used:
- Directly by client teams' test frameworks, and,
- In the integration tests executed in the ethereum/hive framework.
The following transition tools are supported by the framework:
Client | "t8n" Tool | Tracing Support |
---|---|---|
ethereum/evmone | evmone-t8n |
Yes |
ethereum/execution-specs | ethereum-spec-evm |
Yes |
ethereum/go-ethereum | evm t8n |
Yes |
hyperledger/besu | evm t8n-server |
Yes |
status-im/nimbus-eth1 | t8n |
Yes |
Generally, specific t8n
implementations and branches must be used when developing tests for upcoming EIPs.
We use named reference tags to point to the specific version of the t8n
implementation that needs to be used fill the tests.
All current tags, their t8n implementation and branch they point to, are listed in .github/configs/evm.yaml.
The following requires a Python 3.10, 3.11 or 3.12 installation.
This guide installs stable versions of the external (go-ethereum) evm
executable and will only enable generation of test fixtures for features deployed to mainnet. In order to generate fixtures for features under active development, you can follow the steps below and then follow the additional steps in the online doc.
-
Ensure go-ethereum's
evm
tool is in your path. Either build the required version, or alternatively:sudo add-apt-repository -y ppa:ethereum/ethereum sudo apt-get update sudo apt-get install ethereum
More help:
Help for other platforms is available in the online doc.
-
Clone the execution-spec-tests repo and install its dependencies (
uv
will create and manage a virtual environment for its installation):git clone https://github.com/ethereum/execution-spec-tests cd execution-spec-tests pip install uv # or curl -LsSf https://astral.sh/uv/install.sh | sh uv sync --all-extras source .venv/bin/activate # or run `uv run fill ...`
-
Verify the installation:
-
Explore test cases:
fill --collect-only
-
Execute the test cases (verbosely) in the
./tests/berlin/eip2930_access_list/test_acl.py
module:fill -v tests/berlin/eip2930_access_list/test_acl.py
Expected console output: Check:
-
The versions of the
evm
tool is as expected (your versions may differ from those in the highlighted box). -
The corresponding fixture file has been generated:
head fixtures/blockchain_tests/berlin/eip2930_access_list/acl/access_list.json
-
-
More information on how to obtain and consume the released test fixtures can be found in the documentation.
For further help with working with this codebase, see the online documentation:
- Learn useful command-line flags.
- Execute tests for features under development via the
--from=FORK1
and--until=FORK2
flags. - Optional: Configure VS Code to auto-format Python code and execute tests within VS Code.
- Implement a new test case, see Writing Tests.
The available test cases can be browsed in the Test Case Reference doc.
If you encounter issues during the installation process, please refer to the Installation Troubleshooting page.
Contributions and feedback are welcome. Please see the online documentation for this repository's coding standards and help on implementing new tests.
This project is licensed under the MIT License - see the LICENSE file for details.