Platform: Code4rena
Start Date: 15/06/2022
Pot Size: $30,000 USDC
Total HM: 5
Participants: 55
Period: 3 days
Judge: Jack the Pug
Id: 138
League: ETH
Rank: 39/55
Findings: 1
Award: $53.62
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0v3rf10w, 0x1f8b, 0xDjango, 0xFar5eer, 0xNazgul, 0xNineDec, 242, Chom, Czar102, Funen, GimelSec, Meera, Picodes, Sm4rty, Tadashi, TerrierLover, Waze, _Adam, a12jmx, asutorufos, codexploder, cryptphi, defsec, gzeon, hyh, joestakey, minhquanym, oyc_109, reassor, robee, saian, sorrynotsorry, unforgiven, zzzitron
53.6173 USDC - $53.62
__
I recommend to set
line 117 uint256 length = tokens.length; to uint256 tokensLength = tokens.length; this will ofcourse also set line 118 to for(uint i = 0; i < tokensLength; i++) this will provide better general clarity in line with other consistency factors of, for example line 175 of the AuraLocker.sol contract where as it is uint256 rewardTokensLength = rewardTokens.length; instead of uint256 length = rewardTokens.length;
__
For consistency in line with code of for loop
line 153 for (uint256 i; i < numRewards; ++i) I recommend to also set other for loops to also implement code structure line 118 change the uint i = 0; to uint256 i; line 300 line 317 change the uint256 i = 0; to uint256 i;
Result
for(uint256 i; i < length; i++) for (uint256 i; i < _claims.length; i++) for (uint256 i; i < _claims.length; i++)
#0 - liveactionllama
2022-06-22T16:07:13Z
On June 18 at 18:19, warden reached out via C4 help request to let us know that they accidentally submitted this to the wrong contest. Since we received their message prior to the contest closing, adding their submission here. Will notify sponsor and judge as well.
#1 - GalloDaSballo
2022-06-22T16:23:04Z
These are valid gas optimizations, savings is 3 gas per length cached and 3 gas for not initializing the iterator