Ethereum foundation tests
These are the official execution spec tests. There are two kinds: state tests and blockchain tests, you can execute them with:
State tests
The state tests are individual transactions not related one to each other that test particular behavior of the EVM. Tests are usually run for multiple forks and the result of execution may vary between forks. See docs.
To run the test first:
cd tooling/ef_tests/state
then download the test vectors:
make download-evm-ef-tests
then run the tests:
make run-evm-ef-tests
Blockchain tests
The blockchain tests test block validation and the consensus rules of the Ethereum blockchain. Tests are usually run for multiple forks. See docs.
To run the tests first:
cd tooling/ef_tests/blockchain
then run the tests:
make test-levm
Standalone runners
blocktest and enginetest run fixtures from any directory and print one result per fixture, which is how EELS consume direct calls them. From tooling/:
cargo run --profile release-fast -p ef_tests-runners --bin blocktest -- <path>... [--workers N] [--run REGEX] [--json] [--bal-sequential] [--bal-withhold] [--no-precompile-cache] [--bal-report]
cargo run --profile release-fast -p ef_tests-runners --bin enginetest -- <path>... [same flags]
- Each
<path>is a fixture file or a directory searched recursively for.jsonfiles; all of them run in one process and print one set of results.-p/--path <path>still works and may repeat. Both runners exit 0 when every fixture ran and passed, 1 when every fixture ran and at least one failed, and 2 when they could not run all of their input: a path that does not exist, or a file or directory that cannot be read, whether named or found under a directory (reported on stderr before any fixture runs), or a fixture file that does not parse (reported on stderr and left out of the results; the other files still run and are reported). blocktestimports eachblockchain_testblock through the blockchain ef_tests harness, handing it the fixture’sblockAccessList(orrlp_decoded.blockAccessListfor a block expected to be invalid) when the keccak of its RLP, in the order given, equalsblockAccessListHash. A list that does not match or does not parse is dropped, as full sync drops a peer’s, and the block runs without it.enginetestsends eachblockchain_test_enginepayload and forkchoice update to ethrex’s ownengine_newPayloadV<n>andengine_forkchoiceUpdatedV<n>handlers, in process. After the last payload, the chain’s head must be the fixture’slastblockhash.- Each
blocktestandenginetestresult lists the blocks or payloads ethrex rejected inrejections,[]when none:{"index":0,"hash":"0x…","error":"…"}, whereindexis the position inblocksorengineNewPayloadsanderroris ethrex’s error as given. A block that does not decode has the decoder’s error and no hash; a payload rejected with a JSON-RPC error has<code>: <message>(plus: <data>when the error has data) and no hash. The runners never compare these errors with the fixture’s expected exception: a fixture passes when what it expects to be rejected is rejected, whatever the reason, and a harness reading the results can check the reasons with EEST’s mapping.enginetestdoes compare a JSON-RPC error’s code with the payload’serrorCode.ETHREX_ENGINE_STRICT_EXCEPTIONSapplies to the cargo engine harness only. - ethrex’s
statetestisef_tests-statev2 statetest(seetooling/ef_tests/state_v2). --versionprints one line naming the client and the tool,ethrex-blocktest <version>,ethrex-enginetest <version>, orethrex-statetest <version>foref_tests-statev2 statetest --version, where the version is the tooling workspace’s; harnesses identify a runner by it.--bal-sequentialruns every block on the sequential executor, like the node’s--no-bal-parallel-exec.--no-precompile-cache(orETHREX_NO_PRECOMPILE_CACHE) runs every block without the per-block precompile result cache, like the node flag of the same name.blocktest --bal-withholdnever delivers the fixture’s access list, so every block runs without one and ethrex checks the list it builds against the header, as for a block received without its list.- With
--bal-report,blocktestandenginetestprint the executor chosen for each block as one JSON line on stderr, for example{"event":"balExecution","block":1,"hash":"0x…","path":"sequential","reason":"disabled"}.reasonisbad-access-listwhen the runner dropped the block’s delivered list andwithheldwhen--bal-withholdkept back the list the block has, whatever ran the block; a block without a list keeps its own reason under--bal-withhold. Otherwise it is empty forparallel, and forsequentialthe first condition that ruled parallel out:no-access-list,pre-amsterdam,disabledorno-rayon. A list over the EIP-7928 item cap shows asno-access-list, because the node drops it before the executor. Without the flag these lines are off. stdout carries only the results.