QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Invalid

`setWeights` - Missing `minWeight` check against `absoluteWeightGuardRail`

Title

setWeights - Missing minWeight check against absoluteWeightGuardRail

Summary

setWeights function lacks a check to keep weights above the absoluteWeightGuardRail, risking pool instability and enforcing potential exploitations.

Vulnerability Details

Here's minWeight check in _setInitialWeights function:

function _setInitialWeights(int256[] memory _weights) internal {
require(_normalizedFirstFourWeights == 0, "init");
require(_normalizedSecondFourWeights == 0, "init");
InputHelpers.ensureInputLengthMatch(_totalTokens, _weights.length);
int256 normalizedSum;
int256[] memory _weightsAndBlockMultiplier = new int256[]();
for (uint i; i < _weights.length; ) {
>> if (_weights[i] < int256(uint256(absoluteWeightGuardRail))) {
revert MinWeight();
}
_weightsAndBlockMultiplier[i] = _weights[i];
normalizedSum += _weights[i];
//Initially register pool with no movement, first update will come and set block multiplier.
_weightsAndBlockMultiplier[i + _weights.length] = int256(0);
unchecked {
++i;
}
}
...
}

Above check ensures that all initial weights meet the minimum threshold.
In contrast, in the setWeights function, there is no similar validation. Consequently, during updates, weights can be set below the absoluteWeightGuardRail, bypassing the safeguard enforced during initialization.

Impact

Invalid weights compromise the pool's balance and functionality, potentially leading to instability and economic vulnerabilities.

Tools Used

Manual Review

Recommendations

Add a validation check in the setWeights function to ensure that all updated weights remain above the absoluteWeightGuardRail, similar to the validation implemented in the _setInitialWeights function.

Updates

Lead Judging Commences

n0kto Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas / Admin is trusted / Pool creation is trusted / User mistake / Suppositions

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.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.