code-423n4 / 2021-07-pooltogether-findings

0 stars 0 forks source link

Increase Solc Optimiser Runs #18

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

hickuphh3

Vulnerability details

Impact

The number of solc runs used for contract compilation is 200. This number can be bumped significantly to produce more gas efficient code (max value of 2**32-1).

More information can be found in the solidity docs.

Recommended Mitigation Steps

In hardhat.config.ts, increase solc runs significantly. Contract sizes and thus deployment costs will increase, but functions will cost less gas to execute.

PierrickGT commented 3 years ago

200 is the default value, not sure what would be the real gain of bumping it and since no value is proposed by the warden, this recommended mitigation isn't concrete and applicable.

0xean commented 3 years ago

Disagree, warden has provided exact instructions on how to increase the value.

asselstine commented 3 years ago

This issue is really hand-wavy. Based on the warden's logic, this "issue" applies to any contract that isn't compiled with runs set to 2**32-1, which is absurd.

The number of runs is a balance between contract size and runtime efficiency. The warden has done zero analysis in this respect, and simply hand-waved "do more".

This isn't specific enough to be useful. Saying "do 2**32-1 runs" isn't helpful for us, and likely inaccurate.