Since the default value of a uint in solidity is 0 and not null, there is no need to declare i=0 when using loops.
++i costs less gas compared to i++ or* i += 1* for an unsigned integer, as pre-increment is cheaper (about 5 gas per iteration). This statement is true even with the optimiser enabled.
it’s safe to put the ++i increment under the unchecked {…} wrap without losing on security.
Gas optimisation that could help optimize the contracts.
Cheaper for the users.
Main review.
Change the loops : "for (uint256 i = 0; i < arg1; i++)" to "for (uint256 i; i < arg1;)" and add "unchecked{++i}"
Please, do not suppose impacts, think about the real impact of the bug and check the CodeHawks documentation to confirm: https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity A PoC always helps to understand the real impact possible.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.