The AntiMomentumUpdateRule contract fails to maintain the fundamental invariant that pool weights must sum exactly to 1e18 (100%). This can lead to invalid pool states where the total weight exceeds 100%, potentially causing incorrect price calculations and pool imbalances. While the deviation is small (2 out of 1e18) and doesn't appear to compound, it could still lead to minor calculation inaccuracies in the pool.
Location: pkg/pool-quantamm/contracts/rules/AntiMomentumUpdateRule.sol
The issue occurs in the weight calculation logic where there's no validation that the sum of weights equals 1e18:
Proof of Concept:
Test Results:
Total pool weight exceeds 100%
Incorrect price calculations due to invalid weight normalization
Potential economic exploits through weight manipulation
Violation of core AMM invariants
Even small deviations from 1e18 can compound over multiple updates
Price calculations assume exact 100% total weight
Same vulnerability pattern as MomentumUpdateRule
Add total weight validation:
Consider architectural improvements:
Add weight normalization step to ensure sum equals 1e18
Implement weight validation as a shared function
Add explicit invariant checks in base classes
Ensure consistent validation between scalar and vector paths
Add tests:
Test total weight invariant across all update rules
Add fuzz testing for weight calculations
Test edge cases with extreme price movements
According the sponsor and my understanding, sum of weights does not have to be exactly 1 to work fine. So no real impact here. Please provide a PoC showing a realistic impact if you disagree. This PoC cannot contains negative weights because they will be guarded per clampWeights.
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.