In the process of normalizing weights in QuantammMathGuard contract, precision loss will occur in the computation of the delta change in weight.
In the function _normalizeWeightUpdates in QuantammMathGuard.sol, whenever the absolute change in the weights exceeds _epsilonMax, rescaling of the weight is done. The process here comprises of division followed by multiplication which will result in the loss of precision. In the end, it is ensured that the weights are normalized and their sum is ‘1’. In some cases, due to rounding issues, this sum may be off by 1e18 which is accordingly added/subtracted to the weight of the first asset in the pool.
Manual review
Consider replacing the aforementioned piece of code with
According the sponsor and my understanding, sum of weights does not have to be exactly 1 to work fine. So no real impact here. Please provide a PoC showing a realistic impact if you disagree. This PoC cannot contains negative weights because they will be guarded per clampWeights.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.