Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solidity Custom Errors are not returned by the RPC #2846

Closed
Crelde opened this issue Sep 5, 2023 · 0 comments · Fixed by #2855
Closed

Solidity Custom Errors are not returned by the RPC #2846

Crelde opened this issue Sep 5, 2023 · 0 comments · Fixed by #2855
Assignees
Labels
bug Something isn't working

Comments

@Crelde
Copy link

Crelde commented Sep 5, 2023

Describe the bug
Occurs when estimating gas (to see if the request will revert) or calling the function without gas estimation first.
The info about which error was thrown is not available from the RPC, when reverting using custom errors. (https://soliditylang.org/blog/2021/04/21/custom-errors/).

When reverting with just a string like this.
require(amount > 0, "Amount must be greater than 0");
It works as expected and the RPC displays the string.

But if you use custom errors, there is no revert reason.

To Reproduce
This is an article about custom errors, which includes a code sample. https://gist.github.com/fassko/b22c722f1d488528791f8c99e42c6a73

If you deploy this on ShimmerEVM and watch the rpc result, it doesn't have any data about which error was thrown, if you do the same on another chain it would include a hex value to be parsed.

Expected behavior
I expect to get a hex value which can be parsed by the contract abi to interpret the error with any parameters it might have.

Screenshots
Example of expected RPC output:
image
Notice that the "result" property has a hex value, which corrosponds to a custom error in the ABI.

Actual output from RPC:
image
It just includes a generic message saying that the request might require more gas than allowed.

Network and versioning
ShimmerEVM testnet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants