PoolTogether TWAB Delegator Gas Optimization Report
Unless otherwise noted, manual auditing and testing were done using Visual Studio Code and Remix. The sponsor-provided test suite was used to verify the findings.
The audit was done from February 22-24, 2022 by ye0lde through code4rena.
G-1 - Comparison with literal boolean value (TWABDelegator.sol)
Impact
While doing comparisons with literal boolean values is considered a "best practice" it also does save a small amount of gas during deployment and execution.
Below are some examples from the sponsor's test suite before and after the change:
PoolTogether TWAB Delegator Gas Optimization Report
Unless otherwise noted, manual auditing and testing were done using Visual Studio Code and Remix. The sponsor-provided test suite was used to verify the findings.
The audit was done from February 22-24, 2022 by ye0lde through code4rena.
Findings
G-1 - Comparison with literal boolean value (TWABDelegator.sol)
Impact
While doing comparisons with literal boolean values is considered a "best practice" it also does save a small amount of gas during deployment and execution.
Below are some examples from the sponsor's test suite before and after the change:
Proof of Concept
https://github.com/pooltogether/v4-twab-delegator/blob/21bb53b2ea54a248bbd1d3170dbadd3a0c83d874/contracts/TWABDelegator.sol#L583
Recommended Mitigation Steps
I suggest the following change: