No need to initialize uint256 i variable to 0 in for loops #103
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
G (Gas Optimization)
Handle
Reigada
Vulnerability details
Impact
As i is an uint, it is already initialized to 0. uint i = 0 reassings the 0 to i which wastes gas.
Proof of Concept
AirdropDistributionMock.sol:97: for (uint i = 0; i < airdropArray.length; i++) {
PublicSaleBatchWithdraw.sol:29: for (uint i = 0; i < arrayDays.length; i++) {
PublicSaleBatchWithdraw.sol:36: for (uint i = 0; i < length; i++) {
AirdropDistribution.sol:507: for (uint i = 0; i < airdropArray.length; i++) {
Tools Used
Manual testing
Recommended Mitigation Steps
Do not initialize i variable to 0 -> for (uint i; i < airdropArray.length; i++) {
The text was updated successfully, but these errors were encountered: