15,000 USDC
View results
Submission Details
Severity: gas

Assigning uint256 i its default value

Summary

Uint256 i = 0 in for loops is redundant because uint256's default value is 0

Vulnerability Details

As i is an uint256, it is already initialized to 0. uint256 i = 0 reassigns the 0 to i which wastes gas.Also ++i costs less gas than i++ for for loops.

Impact

Gas efficiency

Tools Used

Manual Review

Recommendations

If the for loops look like this they will save a little bit of gas - for (uint256 i; i < tokenAddresses.length; ++i)

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.