Using increased fuzz testing it was found that the MathMasters::mulWadUp
function can return incorrect information.
One such case had the inputs as uint256x = 3323484123583475243233908 and uint256y = 1661742061791737621616955. When used as inputs for MathMasters::mulWadUp
the result was 5522773359855710271721681416461. However the correct result is. 5522773359855710271721683078203. Line 56 is noted below. It seems to adjust x under certain conditions, but the logic is not clear. The use of z here is particularly confusing since z is not initialized before this operation.
Users of this library can return incorrect information breaking the intented function of the library. Theoretically if a DeFi protocol were to implement this library it could result in funds being lost.
Foundry Fuzz Testing
It is recomended to remove line 56 from the function as described below.
This new function was ran through an extensive fuzz test of over 100,000,000 inputs and passed each case. It also passed previous input parameters that returned bad information before the function was modified.
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.