The MomentumUpdateRule contract allows negative weights to be created in pools when using the scalar path. More critically, these negative weights can compound to extreme values (-3000%+) over multiple updates while maintaining total weight at 100%, severely breaking fundamental AMM invariants.
Location: pkg/pool-quantamm/contracts/rules/MomentumUpdateRule.sol
The issue occurs in the scalar path weight calculation where there's no validation against negative weights:
Proof of Concept:
Test Results:
Negative weights can compound to extreme values (-3000%+)
Weights can grow unbounded while maintaining total weight at 100%
Breaks fundamental AMM invariants about weight bounds
Could lead to invalid pool states and economic exploits
Inconsistent with vector path that prevents negative weights
Could cause catastrophic issues with price calculations and swaps
Same vulnerability pattern as AntiMomentumUpdateRule with similar compounding effects
Add negative weight validation in scalar path:
Consider architectural improvements:
Add weight validation in base class
Implement weight bounds checking as a shared function
Add explicit invariant checks for all weight updates
Ensure consistent validation between scalar and vector paths
Add maximum weight bounds to prevent extreme values
Add tests:
Test weight bounds across all update rules
Add fuzz testing for weight calculations
Test edge cases with extreme price movements
Test for compounding effects over multiple 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.