wise-foundation / lending-audit

5 stars 4 forks source link

[OHR-03C] Loop Iterator Optimization #53

Open vm06007 opened 1 year ago

vm06007 commented 1 year ago

OHR-03C: Loop Iterator Optimization

Type Severity Location
Gas Optimization OracleHelper.sol:L116

Description:

The linked for loop increments / decrements the iterator "safely" due to Solidity's built-in safe arithmetics (post-0.8.X).

Example:

for (uint80 i = 1; i < iterationCount; ++i) {

Recommendation:

We advise the increment / decrement operation to be performed in an unchecked code block as the last statement within the for loop to optimize its execution cost.

vm06007 commented 1 year ago

Should be addressed as part of: https://github.com/wise-foundation/lending-audit/pull/51