The DifferenceMomentumUpdateRule contract allows negative weights to be created in pools when using the scalar path. More critically, these negative weights can compound to extreme values (-9625%+) over multiple updates while maintaining total weight at 100%, severely breaking fundamental AMM invariants.
Location: pkg/pool-quantamm/contracts/rules/DifferenceMomentumUpdateRule.sol
The issue occurs in the scalar path weight calculation where there's no validation against negative weights:
Proof of Concept:
Test Results:
Severity: HIGH
Technical Impact:
Negative weights compound rapidly to extreme values (-9625%+ after just 5 updates)
Weights grow unbounded while maintaining total weight at 100%
Breaks fundamental AMM invariants about weight bounds
Economic Impact:
Potential manipulation of pool pricing
Invalid pool states could lead to economic exploits
Risk of fund loss through arbitrage against negative weights
Extreme weight values could cause catastrophic price impacts
Compounding effect makes exploitation easier over time
Add negative weight validation in scalar path:
Consider architectural improvements:
Extract weight validation to a shared function
Use unsigned integers for weights
Implement consistent validation across all weight calculation paths
Add maximum weight bounds to prevent extreme values
Add compounding protection mechanisms
Add invariant checks:
Validate weights are non-negative before returning
Consider adding minimum weight thresholds
Add explicit weight range validation
Add maximum weight thresholds to prevent extreme values
Add checks for rate of weight change between updates
_clampWeights will check that these weights are positive and in the boundaries before writing them in storage.
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.