The current implementation of the calculation:
uses locals.sign to determine the sign of the result by multiplying with ONE (1e18) for positive values and -ONE (-1e18) for negative values. However, this approach unintentionally scales the result by 1e18 (or -1e18), leading to a value with 36 decimals, which is unintended.
PowerChannelUpdate.sol
Results in unintended scaling of the output to 36 decimals, which may cause precision errors in subsequent computations. Could lead to overflow/underflow in locals.newWeights[locals.i] = locals.sign.mul(_pow(locals.intermediateRes.abs(), locals.q));
Intermediate Overflow or Underflow in _pow
Underflow: The _pow function calls exp2() on potentially large negative values of log2(x) * y, resulting in a return value of 0.
Manual review
To ensure that the calculation respects the intended precision without introducing scaling issues:
Directly apply the sign by negating _pow(locals.intermediateRes.abs(), locals.q) if the sign is negative, rather than multiplying by ONE.
The revised calculation should be:
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.