Skip to content

Commit

Permalink
ex: revertstring completed
Browse files Browse the repository at this point in the history
  • Loading branch information
Quertyy committed May 7, 2023
1 parent a729aed commit aa6f8eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/RevertString.huff
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
* The task is to write within the `MAIN` macro below, huff code that reverts (all the time) with the string error message `Only Huff`
*/

#define error TEST = 0x4f6e6c7920487566660000000000000000000000000000000000000000000000


#define macro MAIN() = takes(0) returns(0) {
__ERROR([TEST]) 0x00 mstore
0x20 0x00 revert
0x4f6e6c792048756666 // ["Only Huff"]
0x00 mstore
0x09 0x17 revert
}
4 changes: 2 additions & 2 deletions test/RevertString.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ contract RevertStringTest is Test {
require(!success, "call expected to fail");
assertEq(
keccak256(bytes("Only Huff")),
keccak256(abi.decode(revertData, (bytes))),
keccak256(revertData),
"Expected the call to revert with custom error 'Only Huff' but it didn't "
);
}
}
}

0 comments on commit aa6f8eb

Please sign in to comment.