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

Building contracts with different compiler settings #5715

Closed
drortirosh opened this issue Aug 24, 2023 · 5 comments · Fixed by #8668
Closed

Building contracts with different compiler settings #5715

drortirosh opened this issue Aug 24, 2023 · 5 comments · Fixed by #8668
Labels
A-compatibility Area: compatibility A-compiler Area: compiler T-feature Type: feature
Milestone

Comments

@drortirosh
Copy link

Component

Forge

Describe the feature you would like

Currenlty forge build uses a single configuration settings for all compiled contracts.
In our project, we need to compile the production code (2 contracts) using via-ir, but all the supporting contracts without.

We currently use hardhat configuration with specific "configuration override" for just those 2 contracts.

It would be nice if forge supported such configuration too.

Additional context

No response

@drortirosh drortirosh added the T-feature Type: feature label Aug 24, 2023
@gakonst gakonst added this to Foundry Aug 24, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry Aug 24, 2023
@drortirosh
Copy link
Author

Is there any plan to implement this feature?
Having few production contracts an a lot of surrounding test contracts is a common practice.
Current (single-compiler settings) require either very slow project compilation, since all tests (and unused library contracts) are required to be optimized, or testing the production code in un-optimized build - which makes the tests incomplete, and gas tests unusable.

@arr00
Copy link

arr00 commented Nov 16, 2023

Would like this feature as well

@CodeSandwich
Copy link
Contributor

CodeSandwich commented Dec 20, 2023

Another reason to tune the compiler for specific contracts is that some of them need to be compiled into a small bytecode, but they shouldn't force all the contracts in the project to get poor runtime optimization.

  • Some contracts are just large, and must have a lower optimizer_runs to fit in the 24576B size limit.
  • Some contracts are designed to be deployed multiple times by the end users, they too should be optimized for small deployment size, because the gas savings coming from high optimizer_runs may never recoup the higher deployment costs.

@KholdStare
Copy link
Contributor

@mattsse Any thoughts on this? We're running into this where we have a few contracts, and one is quite large and just over the limit on the our optimizer setting. It would be nice to override the profile settings per contract.

@zerosnacks
Copy link
Member

Related: #6099

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compatibility Area: compatibility A-compiler Area: compiler T-feature Type: feature
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants