The DifferenceMomentumUpdateRule contract exhibits both precision loss and dangerous weight imbalance issues. The precision loss compounds over multiple updates, while the weight imbalance grows exponentially until the system fails with invalid (negative) weights. This breaks two critical invariants: weights must sum to exactly 100%, and weights must remain positive.
Location: pkg/pool-quantamm/contracts/rules/DifferenceMomentumUpdateRule.sol
The issues manifest in two ways:
Precision loss in normalization calculations
Exponential weight divergence leading to system failure
Test Results:
Attacker identifies assets with trending price movements
Creates pool with specific kappa values that accelerate weight divergence
Takes advantage of predictable weight shifts through arbitrage
Forces pool into extreme weight imbalances
Can potentially cause system failure through weight invalidation
Severity: HIGH
Technical Impact:
Weight imbalance grows exponentially
Precision loss compounds with each update
System fails when weights approach zero
Critical invariant violations:
Weights don't sum to exactly 100%
Weights can become invalid (negative)
Affects all pools using DifferenceMomentumUpdateRule
Economic Impact:
Extreme asset allocation skews
Predictable weight movements enable arbitrage
System instability from growing imbalances
Potential complete pool failure
LP value misalignment
Accumulated losses over time
Foundry testing framework
Custom test suite for precision and weight analysis
Mathematical modeling of weight evolution
Manual code review
Implement Weight Bounds:
Add Kappa Constraints:
Implement Weight Rebalancing:
Add Circuit Breakers:
Monitor weight divergence rate
Track cumulative precision loss
Implement emergency stops for extreme imbalances
Add weight validation checks
Consider rebalancing triggers
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.