QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Invalid

Inconsistent Gas Usage by Not Caching Loop Bound in Constructor

Summary

the code references _oracles.length in each iteration. Although reading an array’s .length in memory is not as expensive as reading from storage, repeatedly accessing it still incurs unnecessary overhead compared to caching the value in a local variable.

Vulnerability Details

https://github.com/Cyfrin/2024-12-quantamm/blob/a775db4273eb36e7b4536c5b60207c9f17541b92/pkg/pool-quantamm/contracts/MultiHopOracle.sol#L20

Impact

  • Gas Overhead: Minor additional gas cost per iteration.

  • Severity: Low, because this does not affect security or correctness—only efficiency.

Tools Used

Manual audit

Recommendations

  • Store _oracles.length in a local variable, for example:

constructor(HopConfig[] memory _oracles) {
uint256 oracleLen = _oracles.length;
for (uint i = 0; i < oracleLen; i++) {
oracles.push(_oracles[i]);
}
}
Updates

Lead Judging Commences

n0kto Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas / Admin is trusted / Pool creation is trusted / User mistake / Suppositions

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

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

Give us feedback!