Open quiet-node opened 8 months ago
Update: Hashscan does decode the error message using the contract interface when the contract is verified.
error Unauthorized(address account, string message, uint256 ID, bool status);
function withdraw() public {
if (msg.sender != owner)
revert Unauthorized(msg.sender, "Unauthorized!!", 369, false);
payable(msg.sender).transfer(address(this).balance);
}
link to example transaction: https://hashscan.io/testnet/transaction/1708635063.837440003
This will leave the solution left with If the contract is not verified and the error is caused by a custom error, display the data hash
Below is an example of a redirectForToken
function call that reverts with the following error that isn't plainly human readable.
0x494e56414c49445f4f5045524154494f4e
https://hashscan.io/mainnet/transaction/1723125786.080226003
Problem
Description: Currently, when a smart contract call is reverted, the error message displayed on Hashscan is well-readable if the error message is either
Error(string)
orPanic(uint256)
. However, for custom errors, the display lacks human readability, as it doesn't decode the custom data into a readable format.Example:
In this example, the error generates an
Error(string)
data, which Hashscan displays nicely.link to example transaction: https://hashscan.io/testnet/transaction/1708618373.183662003
Proposal: Enhance the error message display for custom errors such as:
Currently, Hashscan decodes custom error data into a non-human-readable format.
link to example transaction: https://hashscan.io/testnet/transaction/1708620069.753947441
This issue proposes improving this to make custom error messages more easily understandable to developers.
Expected Outcome: With this enhancement, developers will benefit from better readability of error messages, especially for custom errors, leading to improved debugging and development experiences when interacting with smart contracts on Hashscan.
Solution
- If the contract is verified, decode the error using its ABIAlternatives
No response