QuantAMM

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

`EchidnaQuantAMMMathGuard::numToUpdate` is not implemented in the for loop that updates `weights`, causing the last weight to be updated

Summary

In EchidnaQuantAMMMathGuard::weight_update_multiple_tokens___ if numWeight is even then the initial weight given to every element is equal and then they are updated but if numWeights are odd the all elements are equal except the last one. and updating the unequal weight element could cause a problem

Vulnerability Details

Impact

In odd number of weights the uneven last element of weight gets updated indifference with rest of other elements

Tools Used

manual review

Recommendations

Remove numWeight from limit of for loop and add numToUpdate

-for (uint i; i < numWeights; ++i) {
+for (uint i; i<numToUpdate; ++i ) {
int256 delta = int256(uint256(1e18 / weightDeltaDivisor));
// @audit-medium we should
if (i % 2 == 1) delta = -delta;
newWeights[i] = weights[i] + delta;
}
Updates

Lead Judging Commences

n0kto Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Out of scope

Support

FAQs

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