Platform: Code4rena
Start Date: 09/12/2021
Pot Size: $25,000 USDC
Total HM: 12
Participants: 25
Period: 4 days
Judge: LSDan
Total Solo HM: 4
Id: 64
League: ETH
Rank: 24/25
Findings: 1
Award: $50.92
🌟 Selected for report: 1
🚀 Solo Findings: 0
44.9501 USDC - $44.95
ye0lde
Transfer amount can be checked for > 0 before making the external call to safeTransfer
or transfer
.
This can save gas by avoiding the external call.
The transfers are here: https://github.com/pooltogether/v4-periphery/blob/b520faea26bcf60371012f6cb246aa149abd3c7d/contracts/TwabRewards.sol#L133 https://github.com/pooltogether/v4-periphery/blob/b520faea26bcf60371012f6cb246aa149abd3c7d/contracts/TwabRewards.sol#L186
Visual Studio Code, Remix
Check that transfer amount != 0
#0 - PierrickGT
2021-12-13T22:09:51Z
Most transfers will be made with an amount superior to 0
, so it will actually be less gas efficient for these transfers. For this reason, I've acknowledged the issue but we won't make any change.
🌟 Selected for report: robee
Also found by: GiveMeTestEther, Jujic, Meta0xNull, WatchPug, defsec, sirhashalot, ye0lde
ye0lde
Shortening revert strings to fit in 32 bytes will decrease deployment time gas and will decrease runtime gas when the revert condition has been met. Revert strings that are longer than 32 bytes require at least one additional mstore, along with additional overhead for computing memory offset, etc.
https://github.com/pooltogether/v4-periphery/blob/b520faea26bcf60371012f6cb246aa149abd3c7d/contracts/TwabRewards.sol#L80 https://github.com/pooltogether/v4-periphery/blob/b520faea26bcf60371012f6cb246aa149abd3c7d/contracts/TwabRewards.sol#L128 https://github.com/pooltogether/v4-periphery/blob/b520faea26bcf60371012f6cb246aa149abd3c7d/contracts/TwabRewards.sol#L177 https://github.com/pooltogether/v4-periphery/blob/b520faea26bcf60371012f6cb246aa149abd3c7d/contracts/TwabRewards.sol#L231
Visual Studio Code
Consider shortening the revert strings to fit in 32 bytes or using custom errors (v0.8.4) in the future.
#0 - PierrickGT
2021-12-13T22:02:06Z