In the MathMasters::mulWad
and MathMasters::mulWadUp
functions the error selector is wrong and the revert
read from empty slot.
In the MathMasters::mulWad
and MathMasters::mulWadUp
is used the error selector 0xbac65e5b
for the cases when the functions revert.
But 0xbac65e5b
is a selector for MulWadFailed
error from Solady
library not for a MathMasters__MulWadFailed
error from MathMasters
contract.
The right selector for the error MathMasters__MulWadFailed
from MathMasters
contract is 0xa56044f7
. This can be retrieved by using chisel
and the command: cast sig "MathMasters__MulWadFailed()"
.
Additionally, the revert error is written to 0x40
and afterthat is read in the revert
from 0x1c
. That is incorrect and leads to empty reason for revert.
The functions MathMasters::mulWad
and MathMasters::mulWadUp
use wrong error selector and by reverting the reason is not MathMasters__MulWadFailed
.
Also, the mstore(0x40, 0xbac65e5b)
statement stores the error message identifier at memory location 0x40
, but the revert(0x1c, 0x04)
statement is trying to read from memory location 0x1c
. These are different memory locations. The revert(0x1c, 0x04)
statement will read the data stored at memory location 0x1c
, which in this case is undefined (it is empty) since it hasn't been set anywhere else in the function. But if we change the memory location, the error message will be custom error 0xbac65e5b
, because the selector of this error is not defined in this contract. It is from the Solady
library.
VS Code, Foundry
Change mstore(0x40, 0xbac65e5b)
to mstore(0x00, 0xa56044f7)
in MathMasters::mulWad
and MathMasters::mulWadUp
functions to have Reason: MathMasters__MulWadFailed()
by reverting:
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.