The AntiMomentumUpdateRule contract handles negative prices asymmetrically compared to positive prices, leading to inconsistent weight calculations. While ChainlinkOracle enforces positive prices (require(data > 0)), negative prices can still occur through the project's MultiHopOracle which performs mathematical operations that may result in negative values. This asymmetry could cause unexpected pool behavior and potential economic vulnerabilities in pools using MultiHopOracle or similar oracles that support negative prices.
Location: pkg/pool-quantamm/contracts/rules/AntimomentumUpdateRule.sol
The issue occurs in the weight calculation where negative prices produce asymmetric results compared to equivalent positive prices:
When handling negative prices (which can occur through MultiHopOracle's mathematical operations), the sign propagates through multiple calculations affecting both the normalization factor and final weights.
Test Results:
Asymmetric weight calculations for positive vs negative prices
Inconsistent pool behavior depending on price sign
Could lead to unexpected weight distributions
May create arbitrage opportunities due to predictable asymmetry
Breaks mathematical symmetry expected in price calculations
Could compound with other weight calculation issues
Modify price handling to maintain symmetry:
Consider architectural improvements:
Add explicit sign handling throughout calculations
Implement symmetry validation in tests
Add invariant checks for price sign handling
Consider using absolute values for intermediate calculations
Add documentation about price sign handling expectations
Add comprehensive tests:
Test symmetry with various price magnitudes
Test edge cases with extreme price values
Add property-based tests for price sign handling
Test interactions with other weight calculation components
Test compounding effects over multiple updates
Multihop will call ChainlinkOracle and the check is in it: `require(data > 0, "INVLDDATA");` MultiHop is just here to combine Chainlinks feed when there is no direct USD price feed for a token.
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.