Inefficient Loop Condition in the constructor: Loop condition i < tokenAddresses.length
in the
should use cached array length instead of referencing length
member of the storage array (src/DSCEngine.sol#112).
Array length, the code directly references the length member of the storage array tokenAddresses
within the loop. This result in additional gas costs as the loop's length is checked for every iteration, which can be especially expensive if the array is large.
The impact of this vulnerability is mainly increased gas costs during contract execution. By not caching the array length before the loop, the contract will perform an SLOAD operation to fetch the array's length from storage at each iteration of the loop. This can result in unnecessary and avoidable gas expenses, making the contract less efficient and potentially costly for users.
Manually inspection
Cache the array length before entering the loop.
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.