Skip to content

Commit 1366a31

Browse files
fix(solc): don't install solc via solc-select on ARM; add version sanity check (ethereum#1556)
Co-authored-by: danceratopz <[email protected]>
1 parent b3fb75b commit 1366a31

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

docs/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ A new fork `EOFv1` has additionally been created to fill and consume EOF related
2424

2525
- ✨ Engine API updates for Osaka, add `get_blobs` rpc method ([#1510](https://github.com/ethereum/execution-spec-tests/pull/1510)).
2626
- ✨ The EIP Version checker has been moved from `fill` and `execute` to it's own command-line tool `check_eip_versions` that gets ran daily as a Github Action ([#1537](https://github.com/ethereum/execution-spec-tests/pull/1537)).
27-
🔀 Add new `tests/unscheduled` folder, move EOF from Osaka to unscheduled, add `EOFv1` fork name for EOF tests ([#1507](https://github.com/ethereum/execution-spec-tests/pull/1507)).
27+
- 🔀 Add new `tests/unscheduled` folder, move EOF from Osaka to unscheduled, add `EOFv1` fork name for EOF tests ([#1507](https://github.com/ethereum/execution-spec-tests/pull/1507)).
2828
- ✨ CI features now contain an optional field to skip them from EEST full releases, `zkevm` and EOF features are now feature only ([#1596](https://github.com/ethereum/execution-spec-tests/pull/1596)).
29+
- 🐞 Don't attempt to install `solc` via `solc-select` on ARM (official Linux ARM builds of `solc` are not available at the time of writing, cf [ethereum/solidity#11351](https://github.com/ethereum/solidity/issues/11351)) and add a version sanity check ([#1556](https://github.com/ethereum/execution-spec-tests/pull/1556)).
2930

3031
### 🧪 Test Cases
3132

src/pytest_plugins/solc/solc.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Pytest plugin for configuring and installing the solc compiler."""
22

3+
import platform
4+
import subprocess
35
from argparse import ArgumentTypeError
46
from shutil import which
57

@@ -63,6 +65,18 @@ def pytest_configure(config: pytest.Config):
6365
except ArgumentTypeError:
6466
version = None
6567
if version != solc_version:
68+
# solc-select current does not support ARM linux
69+
if platform.system().lower() == "linux" and platform.machine().lower() == "aarch64":
70+
error_message = (
71+
f"Version {version} does not match solc_version {solc_version} "
72+
"and since solc-select currently does not support ARM linux you must "
73+
"manually do the following: "
74+
"Build solc from source, and manually move the binary to "
75+
".venv/.solc-select/artifacts/solc-x.y.z/solc-x.y.z, then run "
76+
"'uv run solc-select use <x.y.z>'"
77+
)
78+
pytest.exit(error_message, returncode=pytest.ExitCode.USAGE_ERROR)
79+
6680
if config.getoption("verbose") > 0:
6781
print(f"Setting solc version {solc_version} via solc-select...")
6882
try:
@@ -90,6 +104,27 @@ def pytest_configure(config: pytest.Config):
90104
)
91105
config.solc_version = solc_version_semver # type: ignore
92106

107+
# test whether solc_version matches actual one
108+
# using subprocess because that's how yul is compiled in
109+
# ./src/ethereum_test_specs/static_state/common/compile_yul.py
110+
expected_solc_version_string: str = str(solc_version_semver)
111+
actual_solc_version = subprocess.run(
112+
["solc", "--version"],
113+
stdout=subprocess.PIPE,
114+
stderr=subprocess.STDOUT,
115+
text=True,
116+
check=True,
117+
)
118+
actual_solc_version_string = actual_solc_version.stdout
119+
# use only look at first 10 chars to pass e.g.
120+
# actual: 0.8.25+commit.b61c2a91.Linux.g++ should pass with expected: "0.8.25+commit.b61c2a91
121+
if (
122+
expected_solc_version_string[:10] not in actual_solc_version_string
123+
) or expected_solc_version_string == "":
124+
error_message = f"Expected solc version {solc_version_semver} but detected a\
125+
different solc version:\n{actual_solc_version_string}\nCritical error, aborting.."
126+
pytest.exit(error_message, returncode=pytest.ExitCode.USAGE_ERROR)
127+
93128

94129
@pytest.fixture(autouse=True, scope="session")
95130
def solc_bin(request: pytest.FixtureRequest):

0 commit comments

Comments
 (0)