The _clampWeights function in QuantAMMMathGuard.sol contains a critical flaw in its weight normalization logic that allows weights to exceed their maximum bounds. The issue occurs during the rescaling phase:
The issue is that the function fails to maintain the maximum bound during weight normalization. After clamping weights to absoluteMax, these same weights are incorrectly included in the rescaling step because the function only excludes weights at absoluteMin. This causes weights that were clamped to absoluteMax to be multiplied by proportionalRemainder, potentially pushing them above their intended maximum bounds.
The weight clamping bypass fundamentally undermines QuantAMM's risk management infrastructure. When a pool performs weight adjustments, particularly during high volatility periods, weights can exceed their maximum bounds due to subsequent rescaling. This creates a direct violation of the protocol's guard rail system.
The implications ripple through the entire pool's operation. Since weights can exceed their intended maximum bounds, the pool's risk profile becomes distorted. BTFs using trend-following or mean-reversion strategies may develop over-concentrated positions that violate their design parameters. These enlarged weight ranges affect the pool's pricing function and trading behavior in ways that weren't accounted for in the protocol's economic model.
The likelihood of this happening is high as it occurs in normal operation whenever weights need clamping to absoluteMax while requiring upward rescaling of remaining weights to maintain the sum-to-one constraint.
The fix properly tracks and excludes both minimum and maximum-bound weights from rescaling, ensuring guard rails are maintained throughout the normalization process. This should be implemented with high priority as it affects a core safety mechanism of the protocol.
Likelihood: Medium/High, when a weight is above absoluteMax. Impact: Low/Medium, weights deviate much faster, and sum of weights also.
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.