Omniscia 0xPhase Audit
MasterOracle Code Style Findings
MasterOracle Code Style Findings
MOE-01C: Loop Iterator Optimization
Type | Severity | Location |
---|---|---|
Gas Optimization | MasterOracle.sol:L64 |
Description:
The linked for
loop increments / decrements the iterator "safely" due to Solidity's built-in safe arithmetics (post-0.8.X
).
Example:
oracle/MasterOracle.sol
64for (uint256 i = 0; i < length; 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.
Alleviation (3dd3d7bf0c2693b2f9c23bacedfa420393f7ea84):
All referenced loop iterators have been optimized as advised, removing their for
declaration increment statement and instead performing it in an unchecked
code block wherever needed (i.e. before a continue
statement or at the end of the for
loop's body).