Skip to content

Commit bddd329

Browse files
committed
removed solc dependency (#1759)
1 parent 2a7a6d7 commit bddd329

32 files changed

+443
-1076
lines changed

CLAUDE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ All commands use `uv run` prefix.
3232

3333
```bash
3434
uv sync --all-extras
35-
uv run solc-select use 0.8.24 --always-install
3635
uvx pre-commit install
3736
```
3837

CONTRIBUTING.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ We welcome contributions via pull requests! This section will guide you through
8585
uv python install 3.12
8686
uv python pin 3.12
8787
uv sync --all-extras
88-
uv run solc-select use 0.8.24 --always-install
8988
```
9089

9190
See [installation troubleshooting](https://eest.ethereum.org/main/getting_started/installation_troubleshooting) if you encounter issues.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ cd execution-spec-tests
109109
uv python install 3.11
110110
uv python pin 3.11
111111
uv sync --all-extras
112-
uv run solc-select use 0.8.24 --always-install
113112
```
114113

115114
See [Installation Troubleshooting](https://eest.ethereum.org/main/getting_started/installation_troubleshooting/) in the online docs if you encounter issues.

docs/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ Test fixtures for use by clients are available for each release on the [Github r
1010

1111
- Python 3.10 support was removed in this release ([#1808](https://github.com/ethereum/execution-spec-tests/pull/1808)).
1212

13+
#### 💥 Important Change for test contributors
14+
15+
- EEST no longer allows usage of Yul code in Python tests. From now on, please make use of our opcode wrapper. Yul code is now only allowed in the "static tests" located in `./tests/static/` (these are test cases defined by JSON and YAML files instead of Python test functions that were originally maintained in [ethereum/tests](https://github.com/ethereum/tests)).
16+
- In order to fill the static tests (which is not the case by default), please ensure that `solc` is located in your `PATH`.
17+
1318
#### 💥 Important Change for `fill` Users
1419

1520
The output behavior of `fill` has changed ([#1608](https://github.com/ethereum/execution-spec-tests/pull/1608)):
@@ -27,6 +32,12 @@ Users can select any of the artifacts depending on their testing needs for their
2732

2833
### 🛠️ Framework
2934

35+
#### 🔀 Refactoring
36+
37+
- 🔀 Move `TransactionType` enum from test file to proper module location in `ethereum_test_types.transaction_types` for better code organization and reusability.
38+
- ✨ Opcode classes now validate keyword arguments and raise `ValueError` with clear error messages.
39+
- 🔀 This PR removes the `solc` requirement to fill Python test cases. Regular test contributors no longer need to concern themselves with `solc` and, as such, the `solc-select` dependency has been removed. The remaining tests that used Yul have been ported to the EEST opcode wrapper mini-lang and the use of Yul in Python tests is no longer supported. Maintainers only: To fill the "static" JSON and YAML tests (`./tests/static/`) locally, `solc` (ideally v0.8.24) must be available in your PATH.
40+
3041
#### `fill`
3142

3243
- ✨ Add the `ported_from` test marker to track Python test cases that were converted from static fillers in [ethereum/tests](https://github.com/ethereum/tests) repository ([#1590](https://github.com/ethereum/execution-spec-tests/pull/1590)).

docs/dev/porting_legacy_tests.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,14 @@ Follow the hyperlinks for lost base coverage (`LBC`) to address coverage gaps. H
8585

8686
It's important to note that coverage helps identify missing test paths. If you believe the coverage loss is due to differences in "setup" code between frameworks and doesn't impact the feature you're testing, explain this in your PR. A team member can help with the review.
8787

88-
Also note that yul tests and possibly other tests used `CALLDATALOAD` that might no longer needed when designing a test with python. But we must always investigate if an opcode is not covered anymore to see if its okay.
89-
90-
For example, review the [discussion in this PR.](https://github.com/ethereum/execution-spec-tests/pull/975#issuecomment-2528792289)
88+
For example, review the [discussion in this PR] to see an example of why and how coverage loss can occur.(https://github.com/ethereum/execution-spec-tests/pull/975#issuecomment-2528792289)
9189

9290
## Resolving Coverage Gaps from Yul Compilation
9391

9492
When porting tests from ethereum/tests, you may encounter coverage gaps that are false positives. This commonly occurs because:
9593

9694
- **Original tests** often used Yul to define smart contracts, and solc compilation introduces additional opcodes that aren't specifically under test
97-
- **EEST ports** typically use the explicit EEST Opcode mini-language, which is more precise in opcode definition
95+
- **EEST ports** use the explicit EEST Opcode mini-language, which is more precise in opcode definition
9896

9997
If coverage analysis shows missing opcodes that were only present due to Yul compilation artifacts (not the actual feature being tested), this can be resolved during PR review by adding the `coverage_missed_reason` parameter:
10098

docs/getting_started/installation.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,17 @@ If installed via `curl`, `uv` will download Python for your target platform if o
2626

2727
Clone [execution-spec-tests](https://github.com/ethereum/execution-spec-tests) and install its dependencies. We recommend using Python 3.12, the following uses `uv` to download and configures 3.12 to be the Python version used in execution-spec-tests:
2828

29-
=== "All x86-64 platforms and ARM64 macOS"
29+
=== "All platforms"
3030

3131
```console
3232
git clone https://github.com/ethereum/execution-spec-tests
3333
cd execution-spec-tests
3434
uv python install 3.12
3535
uv python pin 3.12
3636
uv sync --all-extras
37-
uv run solc-select use 0.8.24 --always-install
3837
```
3938

40-
=== "ARM64 Linux"
41-
42-
```console
43-
git clone https://github.com/ethereum/execution-spec-tests
44-
uv python install 3.12
45-
uv python pin 3.12
46-
cd execution-spec-tests
47-
uv sync --all-extras
48-
```
49-
Then follow [this guide](./installation_troubleshooting.md#problem-exception-failed-to-compile-yul-source) to build the `solc` binary from source and copy it to the expected location.
39+
Static tests/maintainers only: To learn how to build the `solc` binary from source (optional) follow [this guide](./installation_troubleshooting.md#problem-exception-failed-to-compile-yul-source).
5040

5141
## Installation Troubleshooting
5242

docs/getting_started/installation_troubleshooting.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ This page provides guidance on how to troubleshoot common issues that may arise
3838

3939
### Problem: `CERTIFICATE_VERIFY_FAILED`
4040

41-
!!! danger "Problem: `Failed to install solc ... CERTIFICATE_VERIFY_FAILED`"
42-
When running either `uv run solc-select use 0.8.24 --always-install` or `fill` you encounter the following error:
41+
!!! danger "Problem: `Failed to ... CERTIFICATE_VERIFY_FAILED`"
42+
When running `fill` you might encounter the following error:
4343

4444
```bash
45-
Exit: Failed to install solc version 0.8.24: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)>
45+
Exit: Failed to ...: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)>
4646
```
4747

4848
=== "Ubuntu"
@@ -66,15 +66,8 @@ This page provides guidance on how to troubleshoot common issues that may arise
6666

6767
### Problem: `Exception: failed to compile yul source`
6868

69-
!!! danger "Problem: `Running fill fails with tests that contain yul source code` on ARM platforms"
70-
If you're using `x86_64`, try to manually run `solc-select` to install the required version of the `solc` binary:
71-
72-
```shell
73-
uv run solc-select use 0.8.24 --always-install
74-
```
75-
76-
Otherwise, this can happen when you're using an ARM64 OS but followed the x86-64 installation guide.
77-
To resolve the issue you must build solidity from source (avoid 0.8.24 as it might require building z3 from source as well).
69+
!!! danger "Problem: `Running fill on static_tests fails with tests that contain yul source code` on ARM platforms"
70+
To resolve the issue you must acquire the `solc` binary e.g. by building solidity from source. The guide below installs v0.8.28 but you might prefer to choose a different version.
7871

7972
!!! success "Solution: Build solc from source"
8073
The following steps have been tested on Ubuntu 24.04.2 LTS ARM64:
@@ -88,7 +81,7 @@ This page provides guidance on how to troubleshoot common issues that may arise
8881
cp ./solc/solc $HOME/Documents/execution-spec-tests/.venv/bin/
8982
chmod +x $HOME/Documents/execution-spec-tests/.venv/bin/solc
9083
```
91-
Running `uv run solc --version` should now return the expected version. Verify that `fill` works by running `uv run fill -m yul_test` in the execution-spec-tests root folder.
84+
Running `uv run solc --version` should now return the expected version.
9285

9386
## Problem: `ValueError: unsupported hash type ripemd160`
9487

docs/writing_tests/fork_methods.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ Methods for fork identification and comparison:
151151
```python
152152
fork.name() # Returns the name of the fork
153153
fork.transition_tool_name(block_number=0, timestamp=0) # Returns name for transition tools
154-
fork.solc_name() # Returns name for the solc compiler
155-
fork.solc_min_version() # Returns minimum solc version supporting this fork
156154
fork.is_deployed() # Returns whether the fork is deployed to mainnet
157155
```
158156

docs/writing_tests/tutorials/blockchain.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Before proceeding with this tutorial, it is assumed that you have prior knowledg
99
- Repository set-up, see [installation](../../getting_started/installation.md).and run an execution specification test as outlined in the .
1010
- Able to run `fill`, see [Getting Started: Filling Tests](../../filling_tests/getting_started.md).
1111
- Understand how to read a [blockchain test](https://ethereum-tests.readthedocs.io/en/latest/test_filler/blockchain_filler.html).
12-
- Know the basics of [Yul](https://docs.soliditylang.org/en/latest/yul.html), which is an EVM assembly language.
1312
- Familiarity with [Python](https://docs.python.org/3/tutorial/).
1413
- Understand how to write an execution spec [state transition test](./state_transition.md).
1514

@@ -26,15 +25,7 @@ A smart contract is defined that is called by each transaction in the test. It s
2625
```python
2726
contract_addr: Account(
2827
balance=1000000000000000000000,
29-
code=Yul(
30-
"""
31-
{
32-
let next_slot := sload(0)
33-
sstore(next_slot, number())
34-
sstore(0, add(next_slot, 1))
35-
}
36-
"""
37-
),
28+
code=code,
3829
storage={
3930
0x00: 0x01,
4031
},

docs/writing_tests/tutorials/state_transition.md

Lines changed: 20 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,12 @@ Before proceeding with this tutorial, it is assumed that you have prior knowledg
99
- Repository set-up, see [installation](../../getting_started/installation.md).and run an execution specification test as outlined in the .
1010
- Able to run `fill`, see [Getting Started: Filling Tests](../../filling_tests/getting_started.md).
1111
- Understand how to read a [static state transition test](https://ethereum-tests.readthedocs.io/en/latest/state-transition-tutorial.html#the-source-code).
12-
- Know the basics of [Yul](https://docs.soliditylang.org/en/latest/yul.html), which is an EVM assembly language.
12+
- Know the basics of the [EVM](https://www.evm.codes/).
1313
- Familiarity with [Python](https://docs.python.org/3/tutorial/).
1414

15-
## Example Tests
15+
## Example Test
1616

17-
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.
18-
19-
### Yul Test
20-
21-
You can find the source code for the Yul test in [tests/homestead/yul/test_yul_example.py](../../tests/homestead/yul/test_yul_example/index.md).
22-
It is the spec test equivalent of this [static test](https://github.com/ethereum/tests/blob/develop/src/GeneralStateTestsFiller/stExample/yulExampleFiller.yml).
23-
24-
Lets examine each section.
25-
26-
```python
27-
"""
28-
Test Yul Source Code Examples
29-
"""
30-
```
31-
32-
In Python, multi-line strings are denoted using `"""`. As a convention, a file's purpose is often described in the opening string of the file.
17+
The most effective method of learning how to write tests is to study a straightforward example. In this tutorial we will go over a simple state test that adds two numbers and stores them in the storage.
3318

3419
```python
3520
from ethereum_test_forks import Fork, Frontier, Homestead
@@ -39,7 +24,6 @@ from ethereum_test_tools import (
3924
Environment,
4025
StateTestFiller,
4126
Transaction,
42-
YulCompiler,
4327
)
4428
```
4529

@@ -57,19 +41,19 @@ In this case, the decorator is a custom [pytest fixture](https://docs.pytest.org
5741
To fill this test for all the specified forks, we can specify pytest's `-k` flag that [filters test cases by keyword expression](https://docs.pytest.org/en/latest/how-to/usage.html#specifying-tests-selecting-tests):
5842

5943
```console
60-
fill -k test_yul
44+
fill -k test_example
6145
```
6246

6347
and to fill it for a specific fork range, we can provide the `--from` and `--until` command-line arguments:
6448

6549
```console
66-
fill -k test_yul --from London --until Paris
50+
fill -k test_example --from London --until Paris
6751
```
6852

6953
```python
70-
def test_yul(state_test: StateTestFiller, pre: Alloc, yul: YulCompiler, fork: Fork):
54+
def test_example(state_test: StateTestFiller, pre: Alloc, fork: Fork):
7155
"""
72-
Test YUL compiled bytecode.
56+
Test that adds two numbers and stores the result in storage at key 0.
7357
"""
7458
```
7559

@@ -93,7 +77,7 @@ In most tests the defaults are good enough.
9377

9478
For more information, [see the static test documentation](../../running_tests/test_formats/state_test.md).
9579

96-
#### Pre State
80+
### Pre State
9781

9882
For every test we need to define the pre-state requirements, so we are certain of what is on the "blockchain" before the transaction is executed.
9983
It can be used as a [dictionary](https://docs.python.org/3/tutorial/datastructures.html#dictionaries), which is the Python term for an associative array, but the appropriate way to populate it is by using the methods `fund_eoa`, `deploy_contract` or `fund_address` from the `Alloc` object.
@@ -102,23 +86,18 @@ In this example we are using the `deploy_contract` method to deploy a contract t
10286

10387
```python
10488
contract_address = pre.deploy_contract(
105-
code=yul(
106-
"""
107-
{
108-
function f(a, b) -> c {
109-
c := add(a, b)
110-
}
111-
112-
sstore(0, f(1, 2))
113-
return(0, 32)
114-
}
115-
"""
116-
),
89+
code = Op.PUSH1(0)
90+
+ Op.PUSH1(2)
91+
+ Op.PUSH1(1)
92+
+ Op.ADD
93+
+ Op.SSTORE
94+
+ Op.STOP
95+
,
11796
balance=0x0BA1A9CE0BA1A9CE,
11897
)
11998
```
12099

121-
Specifically we deploy a contract with yul code that adds two numbers and stores the result in storage.
100+
Specifically we deploy a contract with EVM bytecode that adds two numbers and stores the result in storage.
122101

123102
```python
124103
balance=0x0BA1A9CE0BA1A9CE,
@@ -134,38 +113,13 @@ As return value of the `deploy_contract` method we get the address where the con
134113

135114
```python
136115
storage={
137-
0x00: 0x00,
116+
0x00: 0x03,
138117
},
139118
```
140119

141120
We could also specify a starting storage for the contract, which is done by adding a `storage` parameter to the `deploy_contract` method.
142121

143-
```python
144-
code=yul(
145-
```
146-
147-
Here we define the [Yul](https://docs.soliditylang.org/en/v0.8.17/yul.html) code for the contract. It is defined as a multi-line string and starts and ends with curly braces (`{ <yul> }`).
148-
149-
When running the test filler `fill`, the solidity compiler `solc` will automatically translate the Yul to EVM opcode at runtime.
150-
151-
!!! note
152-
Currently Yul and direct EVM opcode are supported in execution spec tests.
153-
154-
```python
155-
"""
156-
{
157-
function f(a, b) -> c {
158-
c := add(a, b)
159-
}
160-
sstore(0, f(1, 2))
161-
return(0, 32)
162-
}
163-
"""
164-
```
165-
166-
Within this example test Yul code we have a function definition, and inside it we are using the Yul `add` instruction. When compiled with `solc` it translates the instruction directly to the `ADD` opcode. For further Yul instructions [see here](https://docs.soliditylang.org/en/latest/yul.html#evm-dialect). Notice that function is utilized with the Yul `sstore` instruction, which stores the result of `add(1, 2)` to the storage address `0x00`.
167-
168-
Generally for execution spec tests the `sstore` instruction acts as a high-level assertion method to check pre to post-state changes. The test filler achieves this by verifying that the correct value is held within post-state storage, hence we can validate that the Yul code has run successfully.
122+
Generally for execution spec tests the `sstore` instruction acts as a high-level assertion method to check pre to post-state changes. The test filler achieves this by verifying that the correct value is held within post-state storage, hence we can validate that the code has run successfully.
169123

170124
```python
171125
sender = pre.fund_eoa(amount=0x0BA1A9CE0BA1A9CE)
@@ -223,15 +177,15 @@ For more information, [see the static test documentation](../../running_tests/te
223177

224178
This is the post-state which is equivalent to [`expect`](https://ethereum-tests.readthedocs.io/en/latest/test_filler/state_filler.html#expect) in static tests, but without the indexes. It is similar to the pre-state, except that we do not need to specify everything, only those accounts and fields we wish to test.
225179

226-
In this case, we look at the storage of the contract we called and add to it what we expect to see. In this example storage cell `0x00` should be `0x03` as in the pre-state we essentially stored the result of the Yul instruction `add(1, 2)`.
180+
In this case, we look at the storage of the contract we called and add to it what we expect to see. In this example storage cell `0x00` should be `0x03` as in the pre-state we essentially stored the result of the instruction `add(1, 2)`.
227181

228182
#### State Test
229183

230184
```python
231185
state_test(env=env, pre=pre, post=post, tx=tx)
232186
```
233187

234-
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`).
188+
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/test_example.json`).
235189

236190
## Conclusion
237191

0 commit comments

Comments
 (0)