A discrepancy was identified in the results of two functions, solmateMulWadUp and mulWadUp, both designed for decimal number multiplication and rounding up the result.
The test failed for certain large values, suggesting an issue in handling rounding or overflow.
The mulWadUp function appears to have a problem in its rounding logic for large values. It uses inline assembly with a series of checks and adjustments to compute the multiplication and rounding.
The failed test indicates that the function does not handle rounding consistently compared to solmateMulWadUp.
I have compared the function of the contract under analysis with the same function used in the Solmate repository contract:
The primary impact is inconsistency in computation results, particularly for large values. This could lead to unexpected outcomes in the application and potentially affect operations reliant on this function.
Halmos
It is recommended to review and adjust the rounding logic in mulWadUp. A potential solution is to modify the function to appropriately check for the division remainder and apply upward rounding accurately.
This would ensure that the function behaves as expected in all cases, especially for large numerical values.
In this corrected version, the multiplication is performed first and then checked if there is a remainder in the division by WAD. If there is a remainder, 1 is added to the result to ensure rounding up.
This logic should correctly handle test cases like the one you provided, ensuring that the function behaves as expected in all cases.
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.