Custom error is introduced since Solidity 0.8.4, allowing developer to showcase different error events. Consider the following error event:
And the code section below revert the transaction with Unauthorized
error.
It is equivalent to the Yul code as follow:
The freeMemPtr
first load the free memory pointer into the variable, and loading the signature of custom error Unauthorized
, finally revert the transaction with the signature.
However, the value in mstore opcode is mismatched with the error signature.
In MathMasters::mulWadUp()
and MathMasters::mulWad()
functions, there are custom error specified, which is MathMasters__MulWadFailed()
. However, the value in revert
opcode is inconsistent to the error signature.
add the following test in test/MathMasters.t.sol
,
The test will fail, indicating the revert data is incorrect.
The parameter passed in revert opcode is inconsistent to the comment, and it will confuse the developer about the error message.
Foundry
correct the error signature, updating 0xbac65e5b to 0xe243bb9b0, which is the signature of MathMasters__MulWadFailed error.
mulWad(uint256 x, uint256 y)
mulWadUp(uint256 x, uint256 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.