code-423n4 / 2022-06-badger-findings

0 stars 0 forks source link

QA Report #157

Open liveactionllama opened 2 years ago

liveactionllama commented 2 years ago
  1. __

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;

  1. __

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++)
liveactionllama commented 2 years ago

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.

GalloDaSballo commented 2 years ago

These are valid gas optimizations, savings is 3 gas per length cached and 3 gas for not initializing the iterator