Open code423n4 opened 3 years ago
0xRajeev
State variable maxTimelockDuration is read twice on consecutive lines 723 and 724 of function _calculateTimelockDuration(). Caching it in a local variable will save 100 gas.
https://github.com/code-423n4/2021-06-pooltogether/blob/85f8d044e7e46b7a3c64465dcd5dffa9d70e4a3e/contracts/PrizePool.sol#L723-L724
Manual Analysis
Cache maxTimelockDuration in a local variable in the beginning of the function.
Handle
0xRajeev
Vulnerability details
Impact
State variable maxTimelockDuration is read twice on consecutive lines 723 and 724 of function _calculateTimelockDuration(). Caching it in a local variable will save 100 gas.
Proof of Concept
https://github.com/code-423n4/2021-06-pooltogether/blob/85f8d044e7e46b7a3c64465dcd5dffa9d70e4a3e/contracts/PrizePool.sol#L723-L724
Tools Used
Manual Analysis
Recommended Mitigation Steps
Cache maxTimelockDuration in a local variable in the beginning of the function.