Skip to content

Commit c888556

Browse files
committed
removed solc dependency from ci
1 parent 86b9178 commit c888556

File tree

3 files changed

+5
-160
lines changed

3 files changed

+5
-160
lines changed

src/ethereum_test_tools/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from ..code import Solc
99

10-
SOLC_PADDING_VERSION = Version.parse("0.8.21")
10+
SOLC_PADDING_VERSION = Version.parse("0.8.24")
1111

1212

1313
@pytest.fixture(scope="session")

src/ethereum_test_tools/tests/test_code.py

Lines changed: 3 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
"""Test suite for `ethereum_test.code` module."""
22

33
from string import Template
4-
from typing import Mapping, SupportsBytes
4+
from typing import Mapping
55

66
import pytest
77
from semver import Version
88

99
from ethereum_clis import TransitionTool
10-
from ethereum_test_base_types import Account, Address, Bytes, Hash, TestAddress, TestPrivateKey
10+
from ethereum_test_base_types import Account, Address, Hash, TestAddress, TestPrivateKey
1111
from ethereum_test_fixtures import BlockchainFixture
1212
from ethereum_test_forks import (
1313
Cancun,
1414
Fork,
1515
Homestead,
1616
Shanghai,
17-
get_closest_fork_with_solc_support,
1817
get_deployed_forks,
1918
)
2019
from ethereum_test_specs import StateTest
2120
from ethereum_test_types import Alloc, Environment, Transaction
2221
from ethereum_test_vm import Opcodes as Op
2322
from ethereum_test_vm import UndefinedOpcodes
2423

25-
from ..code import CalldataCase, Case, Conditional, Initcode, Solc, Switch, Yul
24+
from ..code import CalldataCase, Case, Conditional, Initcode, Switch
2625
from .conftest import SOLC_PADDING_VERSION
2726

2827

@@ -32,27 +31,6 @@ def fork(request: pytest.FixtureRequest):
3231
return request.param
3332

3433

35-
@pytest.fixture()
36-
def yul_code(
37-
request: pytest.FixtureRequest,
38-
fork: Fork,
39-
padding_before: str | None,
40-
padding_after: str | None,
41-
) -> bytes:
42-
"""Return the Yul code for the test."""
43-
yul_code_snippets = request.param
44-
compiled_yul_code = b""
45-
if padding_before is not None:
46-
compiled_yul_code += Bytes(padding_before)
47-
for yul_code in yul_code_snippets:
48-
compiled_yul_code += bytes(
49-
Yul(yul_code, fork=get_closest_fork_with_solc_support(fork, Solc().version))
50-
)
51-
if padding_after is not None:
52-
compiled_yul_code += Bytes(padding_after)
53-
return compiled_yul_code
54-
55-
5634
@pytest.fixture()
5735
def expected_bytes(request: pytest.FixtureRequest, solc_version: Version, fork: Fork):
5836
"""Return the expected bytes for the test."""
@@ -74,83 +52,6 @@ def expected_bytes(request: pytest.FixtureRequest, solc_version: Version, fork:
7452
raise Exception("Unsupported expected_bytes type: {}".format(type(expected_bytes)))
7553

7654

77-
@pytest.mark.parametrize(
78-
["yul_code", "padding_before", "padding_after", "expected_bytes"],
79-
[
80-
pytest.param(
81-
(
82-
"""
83-
{
84-
sstore(1, 2)
85-
}
86-
""",
87-
),
88-
None,
89-
None,
90-
Template("6002600155${solc_padding}"),
91-
id="simple",
92-
),
93-
pytest.param(
94-
(
95-
"""
96-
{
97-
sstore(1, 2)
98-
}
99-
""",
100-
),
101-
None,
102-
"0x00",
103-
Template("6002600155${solc_padding}00"),
104-
id="simple-with-padding",
105-
),
106-
pytest.param(
107-
(
108-
"""
109-
{
110-
sstore(1, 2)
111-
}
112-
""",
113-
),
114-
"0x00",
115-
None,
116-
Template("006002600155${solc_padding}"),
117-
id="simple-with-padding-2",
118-
),
119-
pytest.param(
120-
(
121-
"""
122-
{
123-
sstore(1, 2)
124-
}
125-
""",
126-
"""
127-
{
128-
sstore(3, 4)
129-
}
130-
""",
131-
),
132-
None,
133-
None,
134-
Template("6002600155${solc_padding}6004600355${solc_padding}"),
135-
id="multiple",
136-
),
137-
pytest.param(
138-
("{\n" + "\n".join(["sstore({0}, {0})".format(i) for i in range(5000)]) + "\n}",),
139-
None,
140-
None,
141-
b"".join([b"\x60" + i.to_bytes(1, "big") + b"\x80\x55" for i in range(256)])
142-
+ b"".join([b"\x61" + i.to_bytes(2, "big") + b"\x80\x55" for i in range(256, 5000)]),
143-
id="large",
144-
),
145-
],
146-
indirect=["yul_code", "expected_bytes"],
147-
)
148-
def test_yul( # noqa: D103
149-
yul_code: SupportsBytes, expected_bytes: bytes, padding_before: str, padding_after: str
150-
):
151-
assert bytes(yul_code) == expected_bytes
152-
153-
15455
@pytest.mark.parametrize(
15556
"initcode,bytecode",
15657
[

tox.ini

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -66,65 +66,9 @@ setenv =
6666
# Use custom EELS_RESOLUTIONS_FILE if it is set via the environment (eg, in CI)
6767
EELS_RESOLUTIONS_FILE = {env:EELS_RESOLUTIONS_FILE:}
6868
CI = {env:CI:}
69-
# Add the solc binary directory to PATH
70-
PATH = {envdir}/bin{:}{env:PATH}
7169
extras =
7270
test
73-
lint # Required `gentest` for formatting tests
74-
allowlist_externals =
75-
sh
76-
bash
77-
mkdir
78-
curl
79-
chmod
80-
test
81-
solc
82-
grep
83-
commands_pre =
84-
# Create bin directory
85-
mkdir -p {envdir}/bin
86-
# if solc 0.8.24 exists already we are done, otherwise download it and verify version equals 0.8.24 (will fail on linux-arm64)
87-
sh -c 'echo "Checking for system solc..."; \
88-
if command -v solc >/dev/null 2>&1; then \
89-
SYSTEM_SOLC=$(command -v solc); \
90-
echo "Found solc at $SYSTEM_SOLC"; \
91-
VERSION_OUTPUT=$("$SYSTEM_SOLC" --version 2>&1); \
92-
echo "Found solc version:"; \
93-
echo "$VERSION_OUTPUT"; \
94-
if echo "$VERSION_OUTPUT" | grep -q "Version: 0\.8\.24"; then \
95-
echo "System solc is correct version, copying to tox env..."; \
96-
mkdir -p {envdir}/bin; \
97-
cp "$SYSTEM_SOLC" {envdir}/bin/solc; \
98-
exit 0; \
99-
else \
100-
echo "This is not the correct version, expected 0.8.24."; \
101-
fi; \
102-
fi; \
103-
for dir in "{envdir}/bin" "{envdir}/local/bin"; do \
104-
if [ -x "$dir/solc" ]; then \
105-
echo "Found solc at $dir/solc"; \
106-
VERSION_OUTPUT=$("$dir/solc" --version 2>&1); \
107-
echo "Found solc version:"; \
108-
echo "$VERSION_OUTPUT"; \
109-
if echo "$VERSION_OUTPUT" | grep -q "Version: 0\.8\.24"; then \
110-
exit 0; \
111-
else \
112-
echo "This is not the correct version, expected 0.8.24."; \
113-
fi; \
114-
fi; \
115-
done; \
116-
echo "Downloading solc 0.8.24..."; \
117-
mkdir -p {envdir}/bin; \
118-
if [ "$(uname)" = "Darwin" ]; then \
119-
curl -L -o {envdir}/bin/solc https://github.com/ethereum/solidity/releases/download/v0.8.24/solc-macos; \
120-
else \
121-
curl -L -o {envdir}/bin/solc https://github.com/ethereum/solidity/releases/download/v0.8.24/solc-static-linux; \
122-
fi; \
123-
chmod +x {envdir}/bin/solc; \
124-
echo "Downloaded solc to {envdir}/bin/solc"; \
125-
echo "Verifying installation..."; \
126-
{envdir}/bin/solc --version'
127-
71+
lint # Required `gentest` for formatting tests
12872
commands =
12973
pytest -c ./pytest-framework.ini -n auto -m "not run_in_serial"
13074
pytest -c ./pytest-framework.ini -m run_in_serial

0 commit comments

Comments
 (0)