I ran into this Custom Error
during my Foundry test:
[FAIL. Reason: Custom Error cd786059:(0xF628...)]
and I had no idea about what it means... then I figured out where it went wrong after tracing back to this Solidity source code:
revert AddressInsufficientBalance(address(this));
Then I figured out how to confirm this error without using Foundry's expectRevert()
:
bytes4 errorSignature = 0xcd786059;//must prefix "0x"
bytes4 desiredSelector = bytes4(keccak256(bytes("AddressInsufficientBalance(address)")));
console.log(errorSignature == desiredSelector);
But that is not an efficient way to solve this, especially if I have a large Solidity codebase.
How can I quickly search and find out where Solidity Custom Error codes come from?