Skip to content

Commit

Permalink
fix(fw): review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed Apr 9, 2024
1 parent ef59a43 commit f39cd54
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/ethereum_test_tools/code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from .code import Code
from .generators import CalldataCase, Case, CodeGasMeasure, Conditional, Initcode, Switch
from .yul import Yul, YulCompiler
from .yul import Solc, Yul, YulCompiler

__all__ = (
"Case",
Expand All @@ -12,6 +12,7 @@
"CodeGasMeasure",
"Conditional",
"Initcode",
"Solc",
"Switch",
"Yul",
"YulCompiler",
Expand Down
5 changes: 2 additions & 3 deletions src/ethereum_test_tools/code/yul.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from semver import Version

from ethereum_test_forks import Fork, get_closest_fork_with_solc_support
from ethereum_test_forks import Fork

from ..common.conversions import to_bytes
from .code import Code
Expand Down Expand Up @@ -80,8 +80,7 @@ def __init__(
):
super().__init__(binary)
self.source = source
if fork and (fork := get_closest_fork_with_solc_support(fork, self.version)):
self.evm_version = fork.solc_name()
self.evm_version = fork.solc_name() if fork else None

@cached_property
def compiled(self) -> bytes:
Expand Down
15 changes: 12 additions & 3 deletions src/ethereum_test_tools/tests/test_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@
import pytest
from semver import Version

from ethereum_test_forks import Cancun, Fork, Homestead, Shanghai, get_deployed_forks
from ethereum_test_forks import (
Cancun,
Fork,
Homestead,
Shanghai,
get_closest_fork_with_solc_support,
get_deployed_forks,
)
from evm_transition_tool import FixtureFormats, GethTransitionTool

from ..code import CalldataCase, Case, Code, Conditional, Initcode, Switch, Yul
from ..code import CalldataCase, Case, Code, Conditional, Initcode, Solc, Switch, Yul
from ..common import Account, Environment, Hash, TestAddress, Transaction
from ..spec import StateTest
from ..vm.opcode import Opcodes as Op
Expand Down Expand Up @@ -66,7 +73,9 @@ def yul_code(request: pytest.FixtureRequest, fork: Fork, padding_before: str, pa
else:
compiled_yul_code = Code("")
for yul_code in yul_code_snippets:
compiled_yul_code += Yul(yul_code, fork=fork)
compiled_yul_code += Yul(
yul_code, fork=get_closest_fork_with_solc_support(fork, Solc().version)
)
if padding_after is not None:
compiled_yul_code += Code(padding_after)
return compiled_yul_code
Expand Down

0 comments on commit f39cd54

Please sign in to comment.