Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
19a02ec
forks: Implement fork operators, remove `is_fork` (#367)
marioevz Dec 21, 2023
5ce00e7
forks: Add fork-specific, non-inherited class variables (#366)
marioevz Dec 21, 2023
f71a615
tools(fix): Fix Storage iterator (#369)
marioevz Jan 5, 2024
7306261
tools: add txs root calculation (#353)
marioevz Jan 5, 2024
e07bfbe
feat: Add evm bytes to python converter (#357)
marioevz Jan 9, 2024
51d30bd
feat(tests): add reentrancy suicide revert test (#372)
winsvega Jan 9, 2024
cf2cf3e
all: Abstract fixtures, StateTest refactor (#354)
marioevz Dec 7, 2023
169066b
refactor: Abstract fixture type collection; Parametrize tests over fi…
marioevz Dec 13, 2023
1f51e3b
feat(fw,pytest): Implement state test fixture format
marioevz Dec 13, 2023
a2c8d86
tests: Fix all state_test usages to have a single transaction
marioevz Dec 13, 2023
5a08342
fix: remove `is_fork` usages
marioevz Dec 22, 2023
0aa8c33
tools: state_test_only, genesis blockchain modifications
marioevz Dec 22, 2023
05d260e
forks: Add `blob_gas_per_blob`
marioevz Jan 5, 2024
cffb642
tests/4844: Change most invalid block tests to state tests
marioevz Jan 5, 2024
1369123
evm-config: Update develop geth to master
marioevz Jan 5, 2024
340b011
github: Remove hive fixtures filling (#374)
marioevz Jan 8, 2024
67d8f43
tests: BlockchainTest to StateTest conversions (#370)
marioevz Jan 10, 2024
ef70823
fix(tools): Wording fixes
marioevz Jan 10, 2024
00965e6
Merge pull request #356 from ethereum/feat/statetest
marioevz Jan 10, 2024
390c9df
test(fw): add/refactor test_filling tests.
spencer-tb Jan 11, 2024
60548f1
fix(tests): Fix minimum balance required on 4844 blob tx gas tests, a…
marioevz Jan 15, 2024
8c7cb87
feat(tests): add test cases for the modexp precompile (#364)
jochem-brouwer Jan 17, 2024
afb3164
refactor(fw): make exception classes `kw_only` dataclasses to improve…
danceratopz Jan 18, 2024
4314b35
Merge branch 'main' into unit_test/small_refactor
danceratopz Jan 18, 2024
e230607
fix(fw): fix exception args ordering introduced in #386
danceratopz Jan 18, 2024
c3ba4c7
refactor(fw): refactor type exception tests; check equality directly …
danceratopz Jan 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/fixtures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,11 @@ jobs:
fill-params: ''
solc: '0.8.21'
python: '3.11'
- name: 'fixtures_hive'
evm-type: 'main'
fill-params: '--enable-hive --from=Merge'
solc: '0.8.21'
python: '3.11'
- name: 'fixtures_develop'
evm-type: 'develop'
fill-params: '--until=Cancun'
solc: '0.8.21'
python: '3.11'
- name: 'fixtures_develop_hive'
evm-type: 'develop'
fill-params: '--enable-hive --from=Merge --until=Cancun'
solc: '0.8.21'
python: '3.11'
steps:
- uses: actions/checkout@v3
with:
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ The following transition tools are supported by the framework:

### Upcoming EIP Development

Generally, specific `t8n` implementations and branches must be used when developing tests for upcoming EIPs (last updated 2023-10-19):
Generally, specific `t8n` implementations and branches must be used when developing tests for upcoming EIPs.

- Cancun related EIPs (4844, 4788, 1153, 6780) - [lightclient/go-ethereum@devnet-10](https://github.com/lightclient/go-ethereum/tree/devnet-10)
- EOF tests - [ethereum/evmone@master](https://github.com/ethereum/evmone)
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 [evm-config.yaml](evm-config.yaml).

## Getting Started

Expand Down
44 changes: 43 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,63 @@ Test fixtures for use by clients are available for each release on the [Github r

### 🧪 Test Cases

- ✨ Add tests for the MODEXP precompile ([#364](https://github.com/ethereum/execution-spec-tests/pull/364))
- 🔀 Add reentrancy suicide revert test ([#372](https://github.com/ethereum/execution-spec-tests/pull/372)).
- 🔀 BlockchainTests converted to StateTest (also automatically generate BlockchainTest) ([#368](https://github.com/ethereum/execution-spec-tests/pull/368), [#370](https://github.com/ethereum/execution-spec-tests/pull/370)):
- tests/cancun/eip4844_blobs/test_blob_txs.py::test_invalid_normal_gas
- tests/cancun/eip4844_blobs/test_blob_txs.py::test_insufficient_balance_blob_tx
- tests/cancun/eip4844_blobs/test_blob_txs.py::test_invalid_tx_blob_count
- tests/cancun/eip4844_blobs/test_blob_txs.py::test_invalid_blob_hash_versioning_single_tx
- tests/cancun/eip4844_blobs/test_blob_txs.py::test_blob_tx_attribute_opcodes
- tests/cancun/eip4844_blobs/test_blob_txs.py::test_blob_tx_attribute_value_opcode
- tests/cancun/eip4844_blobs/test_blob_txs.py::test_blob_tx_attribute_calldata_opcodes
- tests/cancun/eip4844_blobs/test_blob_txs.py::test_blob_tx_attribute_gasprice_opcode
- tests/cancun/eip4844_blobs/test_blob_txs.py::test_blob_type_tx_pre_fork
- tests/cancun/eip4844_blobs/test_point_evaluation_precompile_gas.py::test_point_evaluation_precompile_gas_usage
- tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py::test_valid_precompile_calls
- tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py::test_invalid_precompile_calls
- tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py::test_point_evaluation_precompile_external_vectors
- tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py::test_point_evaluation_precompile_calls
- tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py::test_point_evaluation_precompile_gas_tx_to
- tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py::test_point_evaluation_precompile_before_fork
- tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py::test_blobbasefee_before_fork
- tests/shanghai/eip3860_initcode/test_initcode.py::test_contract_creating_tx
- tests/shanghai/eip3860_initcode/test_initcode.py::TestContractCreationGasUsage
- 🐞 Fixed `tests/cancun/eip4844_blobs/test_blob_txs.py:test_invalid_tx_max_fee_per_blob_gas` to account for extra gas required in the case where the account is incorrectly deduced the balance as if it had the correct block blob gas fee ([#370](https://github.com/ethereum/execution-spec-tests/pull/370)).
- 🐞 Fixed `tests/cancun/eip4844_blobs/test_blob_txs.py:test_insufficient_balance_blob_tx` to correctly calculate the minimum balance required for the accounts ([#379](https://github.com/ethereum/execution-spec-tests/pull/379)).
- ✨ Add `tests/cancun/eip4844_blobs/test_blob_txs.py::test_sufficient_balance_blob_tx` and `tests/cancun/eip4844_blobs/test_blob_txs.py::test_sufficient_balance_blob_tx_pre_fund_tx` ([#379](https://github.com/ethereum/execution-spec-tests/pull/379)).
- 🐞 Fix and enable `tests/cancun/eip4844_blobs/test_blob_txs.py::test_invalid_blob_tx_contract_creation` ([#379](https://github.com/ethereum/execution-spec-tests/pull/379)).

### 🛠️ Framework

- ✨ Add a `--single-fixture-per-file` flag to generate one fixture JSON file per test case ([#331](https://github.com/ethereum/execution-spec-tests/pull/331)).
- 🔀 Rename test fixtures names to match the corresponding pytest node ID as generated using `fill` ([#342](https://github.com/ethereum/execution-spec-tests/pull/342)).
- 💥 Replace "=" with "_" in pytest node ids and test fixture names ([#342](https://github.com/ethereum/execution-spec-tests/pull/342)).
- ✨ Add `evm_bytes_to_python` command which converts EVM bytes to Python Opcodes ([#357](https://github.com/ethereum/execution-spec-tests/pull/357))
- 🔀 Locally calculate the transactions list's root instead of using the one returned by t8n when producing BlockchainTests ([#353](https://github.com/ethereum/execution-spec-tests/pull/353))
- ✨ Fork objects used to write tests can now be compared using the `>`, `>=`, `<`, `<=` operators, to check for a fork being newer than, newer than or equal, older than, older than or equal, respectively when compared against other fork ([#367](https://github.com/ethereum/execution-spec-tests/pull/367))
- 🐞 Storage type iterator is now fixed ([#369](https://github.com/ethereum/execution-spec-tests/pull/369))
- 💥 Removed `--enable-hive` parameter, now all test types are generated by default ([#358](https://github.com/ethereum/execution-spec-tests/pull/358))
- 💥 `StateTest`, spec format used to write tests, is now limited to a single transaction per test ([#361](https://github.com/ethereum/execution-spec-tests/pull/361))
- ✨ `StateTestOnly`, spec format is now available and its only difference with `StateTest` is that it does not produce a `BlockchainTest` ([#368](https://github.com/ethereum/execution-spec-tests/pull/368))
- ✨ Add a helper class `ethereum_test_tools.TestParameterGroup` to define test parameters as dataclasses and auto-generate test IDs ([#364](https://github.com/ethereum/execution-spec-tests/pull/364)).
- 🔀 Change custom exception classes to dataclasses to improve testability ([#386](https://github.com/ethereum/execution-spec-tests/pull/386)).

### 🔧 EVM Tools

### 📋 Misc

- 🔀 Docs: Update `t8n` tool branch to fill tests for development features in the [readme](https://github.com/ethereum/execution-spec-test) ([#338](https://github.com/ethereum/execution-spec-tests/pull/338)).
- 🔀 Filling tool: Updated filling tool to go-ethereum@master ([#368](https://github.com/ethereum/execution-spec-tests/pull/368))

## Breaking Changes

1. In this release the pytest node ID is now used for fixture names (previously only the test parameters were used), this should not be breaking. However, "=" in both node IDs and therefore fixture names, have been replaced with "_", which may break tooling that depends on the "=" character.
1. Fixture output, including release tarballs, now contain subdirectories for different test types:
- `blockchain_tests`: Contains BlockchainTest formatted tests
- `blockchain_tests_hive`: Contains BlockchainTest with Engine API call directives for use in hive
- `state_tests`: Contains StateTest formatted tests
2. `StateTest`, spec format used to write tests, is now limited to a single transaction per test.
3. In this release the pytest node ID is now used for fixture names (previously only the test parameters were used), this should not be breaking. However, "=" in both node IDs and therefore fixture names, have been replaced with "_", which may break tooling that depends on the "=" character.

Pytest node ID example:

Expand Down
102 changes: 52 additions & 50 deletions docs/getting_started/debugging_t8n_tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,39 @@ will produce the directory structure:

```text
📂 /tmp/evm-dump
└── 📂 berlin__eip2930_access_list__test_acl__test_access_list
└── 📂 fork_Berlin
├── 📂 0
│   ├── 📄 args.py
│   ├── 📂 input
│   │   ├── 📄 alloc.json
│   │   ├── 📄 env.json
│   │   └── 📄 txs.json
│   ├── 📂 output
│   │   ├── 📄 alloc.json
│   │   ├── 📄 result.json
│   │   └── 📄 txs.rlp
│   ├── 📄 returncode.txt
│   ├── 📄 stderr.txt
│   ├── 📄 stdin.txt
│   ├── 📄 stdout.txt
│   └── 📄 t8n.sh
└── 📂 1
├── 📄 args.py
├── 📂 input
│   ├── 📄 alloc.json
│   ├── 📄 env.json
│   └── 📄 txs.json
├── 📂 output
│   ├── 📄 alloc.json
│   ├── 📄 result.json
│   └── 📄 txs.rlp
├── 📄 returncode.txt
├── 📄 stderr.txt
├── 📄 stdin.txt
├── 📄 stdout.txt
└── 📄 t8n.sh
└── 📂 blockchain_tests
└── 📂 berlin__eip2930_access_list__test_acl__test_access_list
└── 📂 fork_Berlin
├── 📂 0
│   ├── 📄 args.py
│   ├── 📂 input
│   │   ├── 📄 alloc.json
│   │   ├── 📄 env.json
│   │   └── 📄 txs.json
│   ├── 📂 output
│   │   ├── 📄 alloc.json
│   │   ├── 📄 result.json
│   │   └── 📄 txs.rlp
│   ├── 📄 returncode.txt
│   ├── 📄 stderr.txt
│   ├── 📄 stdin.txt
│   ├── 📄 stdout.txt
│   └── 📄 t8n.sh
└── 📂 1
├── 📄 args.py
├── 📂 input
│   ├── 📄 alloc.json
│   ├── 📄 env.json
│   └── 📄 txs.json
├── 📂 output
│   ├── 📄 alloc.json
│   ├── 📄 result.json
│   └── 📄 txs.rlp
├── 📄 returncode.txt
├── 📄 stderr.txt
├── 📄 stdin.txt
├── 📄 stdout.txt
└── 📄 t8n.sh
```

where the directories `0` and `1` correspond to the different calls made to the `t8n` tool executed during the test:
Expand Down Expand Up @@ -120,24 +121,25 @@ will additionally run the `evm blocktest` command on every JSON fixture file and

```text
📂 /tmp/evm-dump
└── 📂 berlin__eip2930_access_list__test_acl__test_access_list
├── 📄 fixtures.json
├── 📂 fork_Berlin
│   ├── 📂 0
│   │   ├── 📄 args.py
│   │   ├── 📂 input
│   │   │   ├── 📄 alloc.json
│   │   │   ├── 📄 env.json
│   │   │   └── 📄 txs.json
│   │   ├── 📂 output
│   │   │   ├── 📄 alloc.json
│ ... ... ...
├── 📄 verify_fixtures_args.py
├── 📄 verify_fixtures_returncode.txt
├── 📄 verify_fixtures.sh
├── 📄 verify_fixtures_stderr.txt
└── 📄 verify_fixtures_stdout.txt
└── 📂 blockchain_tests
└── 📂 berlin__eip2930_access_list__test_acl__test_access_list
├── 📄 fixtures.json
├── 📂 fork_Berlin
│   ├── 📂 0
│   │   ├── 📄 args.py
│   │   ├── 📂 input
│   │   │   ├── 📄 alloc.json
│   │   │   ├── 📄 env.json
│   │   │   └── 📄 txs.json
│   │   ├── 📂 output
│   │   │   ├── 📄 alloc.json
│ ... ... ...
├── 📄 verify_fixtures_args.py
├── 📄 verify_fixtures_returncode.txt
├── 📄 verify_fixtures.sh
├── 📄 verify_fixtures_stderr.txt
└── 📄 verify_fixtures_stdout.txt
```

where the `verify_fixtures.sh` script can be used to reproduce the `evm blocktest` command.
Expand Down
1 change: 0 additions & 1 deletion docs/getting_started/executing_tests_command_line.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ Arguments defining filler location and output:
Don't group fixtures in JSON files by test function;
write each fixture to its own file. This can be used to
increase the granularity of --verify-fixtures.
--enable-hive Output test fixtures with the hive-specific properties.
Arguments defining debug behavior:
--evm-dump-dir EVM_DUMP_DIR, --t8n-dump-dir EVM_DUMP_DIR
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ The following requires a Python 3.10, 3.11 or 3.12 installation.
2. The corresponding fixture file has been generated:

```console
head fixtures/berlin/eip2930_access_list/acl/access_list.json
head fixtures/blockchain_tests/berlin/eip2930_access_list/acl/access_list.json
```

## Next Steps
Expand Down
5 changes: 3 additions & 2 deletions docs/getting_started/repository_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ The most relevant folders and files in the repo are:
│ ├── 📁 vm/
│ └── 📁 ...
├─╴📁 fixtures/ # default fixture output dir
│ ├── 📁 eips/
│ ├── 📁 vm/
│ ├── 📁 blockchain_tests/
│ ├── 📁 blockchain_tests_hive/
│ ├── 📁 state_tests/
│ └── 📁 ...
├─╴📁 src/ # library & framework packages
│ ├── 📁 ethereum_test_fork/
Expand Down
4 changes: 1 addition & 3 deletions docs/getting_started/using_fixtures.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ The @ethereum/execution-spec-tests repository provides [releases](https://github
| ------------------------------ | -------- | ------------------ |
| `fixtures.tar.gz` | Clients | All tests until the last stable fork | "Must pass" |
| `fixtures_develop.tar.gz` | Clients | All tests until the last development fork |
| `fixtures_hive.tar.gaz` | Hive | All tests until the last stable fork in hive format |
| `fixtures_develop_hive.tar.gz` | Hive | All tests until the last development fork in hive format |

The Hive format uses Engine API directives instead of the usual BlockchainTest format.
The Hive format tests are included in subdirectory `blockchain_tests_hive` and these use Engine API directives instead of the usual BlockchainTest format.

## Obtaining the Most Recent Release Artifacts

Expand Down
16 changes: 8 additions & 8 deletions docs/tutorials/state_transition.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# State Transition Tests

This tutorial teaches you to create a state transition execution specification test. These tests verify that a blockchain, starting from a defined pre-state, will reach a specified post-state after executing a set of specific transactions.
This tutorial teaches you to create a state transition execution specification test. These tests verify that a starting pre-state will reach a specified post-state after executing a single transaction.

## Pre-requisites

Expand All @@ -13,7 +13,7 @@ Before proceeding with this tutorial, it is assumed that you have prior knowledg

## Example Tests

The most effective method of learning how to write tests is to study a couple of straightforward examples. In this tutorial we will go over the [Yul](https://github.com/ethereum/execution-spec-tests/blob/main/tests/example/test_yul_example.py#L17) state test.
The most effective method of learning how to write tests is to study a couple of straightforward examples. In this tutorial we will go over the [Yul](https://github.com/ethereum/execution-spec-tests/blob/main/tests/homestead/yul/test_yul_example.py#L19) state test.

### Yul Test

Expand Down Expand Up @@ -83,7 +83,7 @@ The function definition ends when there is a line that is no longer indented. As
env = Environment()
```

This line specifies that `env` is an [`Environment`](https://github.com/ethereum/execution-spec-tests/blob/main/src/ethereum_test_tools/common/types.py#L445) object, and that we just use the default parameters.
This line specifies that `env` is an [`Environment`](https://github.com/ethereum/execution-spec-tests/blob/main/src/ethereum_test_tools/common/types.py#L878) object, and that we just use the default parameters.
If necessary we can modify the environment to have different block gas limits, block numbers, etc.
In most tests the defaults are good enough.

Expand All @@ -102,7 +102,7 @@ It is a [dictionary](https://docs.python.org/3/tutorial/datastructures.html#dict
"0x1000000000000000000000000000000000000000": Account(
```

The keys of the dictionary are addresses (as strings), and the values are [`Account`](https://github.com/ethereum/execution-spec-tests/blob/main/src/ethereum_test_tools/common/types.py#L264) objects.
The keys of the dictionary are addresses (as strings), and the values are [`Account`](https://github.com/ethereum/execution-spec-tests/blob/main/src/ethereum_test_tools/common/types.py#L517) objects.
You can read more about address fields [in the static test documentation](https://ethereum-tests.readthedocs.io/en/latest/test_filler/state_filler.html#address-fields).

```python
Expand Down Expand Up @@ -145,7 +145,7 @@ Generally for execution spec tests the `sstore` instruction acts as a high-level
}
```

[`TestAddress`](https://github.com/ethereum/execution-spec-tests/blob/main/src/ethereum_test_tools/common/constants.py#L8) is an address for which the test filler has the private key.
[`TestAddress`](https://github.com/ethereum/execution-spec-tests/blob/main/src/ethereum_test_tools/common/constants.py#L7) is an address for which the test filler has the private key.
This means that the test runner can issue a transaction as that contract.
Of course, this address also needs a balance to be able to issue transactions.

Expand All @@ -163,7 +163,7 @@ Of course, this address also needs a balance to be able to issue transactions.
)
```

With the pre-state specified, we can add a description for the [`Transaction`](https://github.com/ethereum/execution-spec-tests/blob/main/src/ethereum_test_tools/common/types.py#L516).
With the pre-state specified, we can add a description for the [`Transaction`](https://github.com/ethereum/execution-spec-tests/blob/main/src/ethereum_test_tools/common/types.py#L1155).
For more information, [see the static test documentation](https://ethereum-tests.readthedocs.io/en/latest/test_filler/state_filler.html#transaction)

#### Post State
Expand All @@ -185,10 +185,10 @@ In this case, we look at the storage of the contract we called and add to it wha
#### State Test

```python
state_test(env=env, pre=pre, post=post, txs=[tx])
state_test(env=env, pre=pre, post=post, tx=tx)
```

This line calls the wrapper to the `StateTest` object that provides all the objects required (for example, the fork parameter) in order to fill the test, generate the test fixtures and write them to file (by default, `./fixtures/example/yul_example/test_yul.json`).
This line calls the wrapper to the `StateTest` object that provides all the objects required (for example, the fork parameter) in order to fill the test, generate the test fixtures and write them to file (by default, `./fixtures/<blockchain,state>_tests/example/yul_example/test_yul.json`).

## Conclusion

Expand Down
Loading