This report highlights a critical vulnerability in the setWeights
function of the QuantAMM contract. The function lacks a check to ensure that the normalized sum of updated weights equals FixedPoint.ONE. This invariant is enforced during initialization in _setInitialWeights
but is missing in setWeights
, which can lead to operational instability and economic exploits. Additionally, since weights are defined as int256 instead of uint256, this introduces potential edge cases where negative values could bypass logical safeguards.
In the _setInitialWeights
function, a check ensures that the normalized sum of weights equals FixedPoint.ONE
:
This ensures that the sum of weights maintains the invariant required for proper pool functionality.
In the setWeights
function, there is no similar validation to enforce that the sum of weights equals FixedPoint.ONE
.
Additionally, weights are defined as int256
, which allows negative values. This introduces the risk of:
Invalid weight distributions.
Exploits where negative weights could manipulate calculations.
setWeights
Function
The setWeights
function is called by the updateWeightRunner
with weights
that do not sum to FixedPoint.ONE
.
The lack of validation allows the weights to:
Sum to a value greater than FixedPoint.ONE
, disrupting proportional calculations.
Sum to a value less than FixedPoint.ONE
, leading to pool imbalances.
The absence of a normalized sum check and the use of int256 for weights can lead to:
Incorrect weight distributions disrupt the pool's operation.
Manual Review
Include a check to validate that the sum of weights equalsFixedPoint.ONE
.
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.