Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: specify the target evm version to solc for yul compilation #147

Merged

Conversation

danceratopz
Copy link
Member

@danceratopz danceratopz commented Jun 14, 2023

This PR:

  • Adds an optional keyword argument to the Yul constructor that allows the user to specify the fork for which the code should be compiled for. This fixes evm version not passed to solc when compiling yul #135.
  • Adds a --solc-bin command-line flag analogous to --evm-bin.
  • Checks whether any forks (configured the command-line) don't supported by the configured solc binary. This may be done in the forks plugin, but perhaps undesirable as it would potentially force users to use a development version of solc to run fill with dev forks.

Note, after changing the behavior so that Yul gets compiled with the test's current fork parameter value: tests/security/test_selfdestruct_balance_bug.py fails if compiled with Constantinople or Shanghai. Shanghai can be explained: This is just because solc refuses to compile contracts with SELFDESTRUCT. I didn't understand why the code doesn't compile for Constantinople yet. We don't need to fix this in the scope of this PR, imo, but we should make a ticket to not forget. This is currently avoided by applying @pytest.mark.compile_yul_with("Merge").

@danceratopz danceratopz force-pushed the fix/enable-solc-version-in-yul-code branch from a596b66 to 977aaf4 Compare June 14, 2023 20:32
Copy link
Member

@marioevz marioevz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! :)

Only two minor comments that would not affect the tests.

src/ethereum_test_tools/code/yul.py Show resolved Hide resolved
src/ethereum_test_tools/tests/test_code.py Show resolved Hide resolved
@danceratopz danceratopz marked this pull request as ready for review June 14, 2023 21:53
@marioevz marioevz merged commit a8b6c7d into ethereum:main Jun 14, 2023
2 checks passed
@danceratopz danceratopz deleted the fix/enable-solc-version-in-yul-code branch June 23, 2023 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

evm version not passed to solc when compiling yul
2 participants