QuantAMM

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

incorrect index assignment in QuantAMMWegitedPool::_splitWeightAndMultipliers()

Summary

Tthe split function _splitWeightAndMultipliers() does not store the splitted value correctly

Vulnerability Details

QuantAMMWegitedPool::_splitWeightAndMultipliers() is a helper function to split passed parameter "weights" into two arrays. However in the code:

function _splitWeightAndMultipliers(
int256[] memory weights
) internal pure returns (int256[][] memory splitWeights) {
uint256 tokenLength = weights.length / 2;
splitWeights = new int256[][]();
splitWeights[0] = new int256[]();
for (uint i; i < 4; ) {
splitWeights[0][i] = weights[i];
splitWeights[0][i + 4] = weights[i + tokenLength]; //<=== @audit
unchecked {
i++;
}
}
...
}

The first array does not correctly store muliplier in right location. Instead it should be:

splitWeights[0][i + tokenLength] = weights[i + tokenLength];

Impact

This will broken function logic causing the potocol handle weights and multiplier incorrectly.

Tools Used

manual

Recommendations

Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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