QuantAMM

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

Having lambda in parameterDescriptions is misleading and can cause integration errors

Summary

Most update rules incorrectly include lambda in their parameterDescriptions array, set in constructors. Lambda is not one of the parameters that's passed as _parameters array to validParameters() for validation or to _getWeights(). Instead it is part of QuantAMMPoolParameters struct that's provided separately. Having lambda in parameterDescriptions is misleading and can cause integration errors.

Vulnerability Details

In rules like MomentumUpdateRule, AntimomentumUpdateRule, PowerChannelUpdateRule, lambda is listed in parameterDescriptions:

// MomentumUpdateRule.sol
constructor(address updateWeightRunner) UpdateRule(updateWeightRunner) {
name = 'Momentum';
parameterDescriptions = new string[](3);
parameterDescriptions[0] = 'Kappa: Kappa dictates the aggressiveness...';
parameterDescriptions[1] = 'Use raw price: 0 = use moving average...';
parameterDescriptions[2] = 'Lambda: Lambda dictates the estimator weighting...'; // @audit incorrect
}

This gives impression that lambda value(s) should be part of _parameters array which is passed to validParameters() and _getWeights() functions. However lambda is actually passed separately.

  1. In validParameters function:

// @audit input `_parameters` does not include lambda
function validParameters(int256[][] calldata _parameters) external pure override returns (bool) {
...
}
  1. In _getWeights function:

function _getWeights(
int256[] calldata _prevWeights,
int256[] memory _data,
int256[][] calldata _parameters, // @audit Does not include lambda
QuantAMMPoolParameters memory _poolParameters // @audit Lambda is here
) internal virtual returns (int256[] memory);

On the other hand, rule ChannelFollowingUpdateRule correctly omits lambda from its parameterDescriptions, showing the proper implementation.

Impact

Low severity because:

  1. Could lead to integration errors with other contracts, since integrators can expect that lambda should be provided in parameters

  2. Makes code harder to maintain and audit

  3. However, doesn't affect actual functionality since lambda is handled correctly in code

Tools Used

Manual review

Recommendations

Remove lambda from parameterDescriptions in affected rules

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.