✅02 - SimpleRevert
Goal: Trigger a revert without any message from Yul.
To revert execution (e.g., indicate an error), Yul provides the revert(p, s)
opcode, which stops execution and returns an error code to the caller. A simple revert with no message can be done by specifying a memory pointer and length of zero (revert(0, 0)
). This is equivalent to a Solidity revert()
with no reason string.
Explanation:
We do not need to store any data in memory for an empty revert. By convention, the pointer can be 0
and length 0 to signify no return data. This will roll back all state changes and signal an error.
Run test:
Last updated