foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.11k stars 1.67k forks source link

Building contracts with different compiler settings #5715

Open drortirosh opened 1 year ago

drortirosh commented 1 year ago

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 commented 10 months ago

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 commented 10 months ago

Would like this feature as well

CodeSandwich commented 8 months ago

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.

KholdStare commented 3 months ago

@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 commented 2 months ago

Related: https://github.com/foundry-rs/foundry/issues/6099