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

[wip] feat: allow multiple compiler configs #170

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented Jul 16, 2024

This adds CompilerSettings::Restrictions associated type which allows configuring constraints for compilation settings. Those constraints can be checked against a settings object and merged.

Ideally given a set of constraints we'd be able to automatically resolve configurations given only basic (default) config, though I think we can do this in follow-up. Current implementation requires user to provide us with concrete profiles such that for each defined constraint at least one of the profiles matches it. This should be enough for most of the usecases for now.

Profile to use is resolved in Graph similarly to version resolution.

The way this could look in foundry.toml is:

[profile.default]
# by default no via-ir and evm version is paris for everything
evm_version = "paris"
via_ir = false

# add cancun profile and via_ir profiles
additional_compiler_profiles = [{ evm_version = "cancun" }, {via_ir = true} ]

# enforce compiling some contracts with cancun, and some with via-ir
# if those contracts are imported by some items in the project, constraints will apply as well
compilation_constraints = [{path = "./**/*.cancun.sol", min_evm_version = "cancun" }, {path = "SomeComplexFile.sol", via_ir = true }] 

This currently isn't really smart about which artifacts to write, so marking as WIP

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.

1 participant