The assembly for "Equivalent to require(y == 0 || x <= type(uint256).max / y)
." is wrong.
if mul(y, gt(x, or(div(not(0), y), x))) {
is used to test require(y == 0 || x <= type(uint256).max / y)
. The or
statement breaks the check because gt(x, div(not(0), y)
is equivalent to x > (UINT256_MAX / y) ? 1 : 0
the or
will scramble the result of UINT256_MAX / y
.
The function can continue instead of revert and lead to an overflow and a wrong result.
Add theses lines at the end of MathMastersTest
.
What the check if mul(y, gt(x, or(div(not(0), y), x))) {
does:
Foundry
You can use the same verification as the MathMasters:mulWad()
function: if mul(y, gt(x, div(not(0), y)))
.
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.