QuantAMM

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

Insufficient parameter validation in AntiMomentumUpdateRule.sol

Summary

The validParameters function in AntiMomentumUpdateRule.sol contains a critical validation flaw where it fails to properly validate the denominator type parameter (_parameters[1][0]). The function only validates that values are positive but doesn't enforce the specific requirements for the denominator type parameter, potentially leading to incorrect weight calculations in the pool.

Vulnerability Details

The validParameters() function has insufficient validation logic for its parameters structure:

function validParameters(int256[][] calldata _parameters) external pure override returns (bool) {
if (_parameters.length == 1 || (_parameters.length == 2 && _parameters[1].length == 1)) {
int256[] memory kappa = _parameters[0];
uint16 valid = uint16(kappa.length) > 0 ? 1 : 0;
for (uint i; i < kappa.length; ) {
if (!(kappa[i] > 0)) {
valid = 0;
break;
}
unchecked {
++i;
}
}
return valid == 1;
}
return false;
}

The function:

  1. Checks if _parameters.length is 1 or 2

  2. If length is 2, checks if _parameters[1].length == 1

  3. Only validates that values in _parameters[0] are positive

  4. Does not validate the specific value requirement for _parameters[1][0]

Based on the test file QuantAMMAntiMomentum.t.sol, the parameters should follow this structure:

parameters[0] = new int256[](); // Kappa values, all positive
parameters[1] = new int256[](); // Denominator type

parameters[1][0] is supposed to be 0 or 1, but in current implementation it can be set to any number.

Tools Used

Manual review

Recommendations

Add validation for parameters[1][0].

Updates

Lead Judging Commences

n0kto Lead Judge 10 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.