-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
bug(config
): do not enable solc optimizer by default
#2486
Comments
Even defining no optimizations has lead to incorrect settings, leaving it undefined was not the same as explicitly disabling the optimizer |
I'm not sure I understood what is your point. Could you please clarify? |
That was the dapptools default I think. I'm open minded to either, but I personally like the optimizer for most use-cases that do not have to do with low level asm. Could be wrong. |
Maybe in earlier versions of dapptools, however the latest docs says otherwise (look for " As pointed out in the original comment, most of the widely used tools in the ecosystem DO NOT enable optimizations by default. |
config
): do not enable solc optimizer by default
Marking this as a |
this would also avoid confusion with coverage not being able to compile while test can without any optimization as in #8840 (comment) |
in previous versions of solidity, having your compiler settings not have explicitly mentioned "optimizer" was not the same as having it defined as "optimizer=off" meaning leaving it out of the configuration left it enabled. Some would think leaving it out of the configuration would mean that it was disabled, which was not the case. the 200 optimizer runs is the solc default which hardhat inherits |
Component
Forge
Describe the feature you would like
The
solc
optimizer has historically been a source of bugs in smart contracts.After a couple of years of stability, Solidity 0.8.x's optimizer had some outstanding bugs that could lead to catastrophic problems even when code is correct.
While one can appreciate the gains in gas costs that the optimizer brings, this should be an opt-in instead of the default option, since it can introduce bugs for seemingly correct code. Let's not underestimate the power of defaults.
Additional context
Other tools used in the industry also don't enable the optimizer by default:
So anyone coming from them who are not willing to use the optimizer can easily forget to disable it.
The text was updated successfully, but these errors were encountered: