20,000 USDC
View results
Submission Details
Severity: gas
Valid

Using unchecked for ++i increments in for loops will save gas as these have no possibility of overflow

Summary

Using unchecked for ++i increments in for loops will save gas as these have no possibility of overflow

Vulnerability Details

The below pattern can be followed to save more gas when there is no possibility of overflow of the increments in the for loop.

for ( uint256 i; i < arrayLength ; ) {
. . .
unchecked {
++i
}
}

Impact

costs more gas.

Tools Used

Manual review

Recommendations

Using unchecked for ++i increments in for loops will save gas as these have no possibility of overflow

Support

FAQs

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