The MultiHopOracle contract exhibits severe precision loss when processing multiple small values in sequence or handling chained operations with inversions. Testing shows losses of up to 100% in some scenarios, rendering the oracle completely unreliable for certain token pairs.
Location: pkg/pool-quantamm/contracts/MultiHopOracle.sol
The vulnerability manifests in two critical scenarios:
Multiple Small Values:
Complete loss of precision (100%) when handling very small values in sequence.
Chained Operations with Inversion:
Massive overestimation due to precision loss in inverted calculations, especially when combining multiple operations.
Proof of Concept:
Test Results:
Severity: HIGH
Technical Impact:
Complete loss of precision (100%) in small value calculations
Massive overestimation in chained operations with inversion
Affects all multi-hop oracle paths with small values or inversions
Economic Impact:
Incorrect pricing for micro-tokens
Unreliable price feeds for inverted pairs
Potential arbitrage opportunities
Strategy miscalculations leading to losses
Foundry testing framework
Custom precision loss test suite
Manual code review
Mathematical analysis of fixed-point arithmetic operations
Implement Precision-Safe Calculations:
Add Value Range Validation:
Architectural Changes:
Use a precision-focused math library
Implement circuit breakers for extreme values
Add monitoring for precision loss events
Consider alternative scaling approaches for small values
Likelihood: Informational/Very Low, admin should use a price feed with 18 decimals and this feed should compare a assets with a very small value and an asset with a biggest amount to have the smallest price possible. Admin wouldn't do that intentionally, but one token could collapse, and with multiple hop, it increases a bit the probability. Impact: High, complete loss of precision. Probability near 0 but not 0: deserve a Low
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.