-
-
Notifications
You must be signed in to change notification settings - Fork 156
Added via_ir
Detection for Foundry Projects in Ape
#2572
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
base: main
Are you sure you want to change the base?
Added via_ir
Detection for Foundry Projects in Ape
#2572
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also edit this test and the foundry_toml fixture to include the new value
src/ape_pm/project.py
Outdated
@@ -266,6 +266,9 @@ def _parse_solidity_config( | |||
if evm_version := data.get("evm_version"): | |||
sol_cfg["evm_version"] = evm_version | |||
|
|||
if via_ir := data.get("via_ir"): | |||
sol_cfg["viaIR"] = via_ir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is snake case: https://github.com/ApeWorX/ape-solidity/blob/main/ape_solidity/compiler.py#L142
sol_cfg["viaIR"] = via_ir | |
sol_cfg["via_ir"] = via_ir |
note: we are not editing solidity directly but the ape-solidity plugin which handles it
Hey @antazoey I did the change for |
Right now, the foundry toml fixture looks like this: (from tests/functional/test_project.py)
it is basically just the string version of a foundry TOML file, for configuring foundry. Foundry-based projects will have these (similar to how Ape has an ape-config.yaml). The project API layer in Ape converts 1 config to another for the sake of successfully using dependencies that happen to be foundry projects, as well as being able to use Anyway, you need to update this fixture to have The After this is done, head over to the assert actual_sol["via_ir"] is True |
Description
This PR fixes issue #2564 , where Ape’s
FoundryProject
class does not detect thevia_ir
setting from Foundry’sfoundry.toml
configuration file.The change updates the
_parse_solidity_config
method insrc/ape_pm/project.py
to read thevia_ir
key and include it in the Solidity compiler configuration asviaIR
. This ensures Ape respects Foundry’svia_ir
setting during compilation, aligning with Foundry’s behavior.Changes Made
FoundryProject._parse_solidity_config
insrc/ape_pm/project.py
to check forvia_ir
in the parsedfoundry.toml
data.via_ir
to thesol_cfg
dictionary as"viaIR": via_ir
when present, preserving existing logic for other settings (version
,evm_version
,remappings
).via_ir
keys usingdata.get("via_ir")
.Testing
Created a test Foundry project with:
in
foundry.toml
.Ran
ape compile
to verify that the compiler applies theviaIR
pipeline (confirmed via compiler output).Tested with
via_ir
absent to ensure no unintended side effects.[Optional] Added a unit test in
tests/test_foundry_project.py
to validatevia_ir
detection.Thank you for considering this contribution! 🚀