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

Revert reason is not returned while it shows on Alchemy dashboard #102

Open
laygir opened this issue Feb 25, 2022 · 2 comments
Open

Revert reason is not returned while it shows on Alchemy dashboard #102

laygir opened this issue Feb 25, 2022 · 2 comments
Assignees
Labels
bug Something isn't working wont fix This will not be worked on

Comments

@laygir
Copy link

laygir commented Feb 25, 2022

Hello,

I'm trying to get the revert reason of a transaction on my frontend.
When using Alchemy I get the error on the screenshot and notice there is no revert reason.
But on the Alchemy dashboard, I can see the revert reason speed invalid as expected.

image

image

Here's the repo for a reproduction case, just add your api key and give it a shot.
https://github.com/laygir/web3-revert-test/tree/using-alchemy

Following contract is being used for this reproduction case.

contract CallRevert {
    uint256 speed;

    function Start(uint256 _speedPercent) public {
        require(_speedPercent <= 100, 'speed invalid');
        speed = _speedPercent;
    }
}

When deployed and a transaction sent locally againts Hardhat, here's the result.

image

*I've tried getting help on Discord but no luck, so creating an issue here.

@thebrianchen thebrianchen self-assigned this Feb 28, 2022
@thebrianchen
Copy link
Member

@laygir I dug into this some more, and the error reason is being dropped in the web3.js library.

In utils._fireError, the error string is being created without error.reason which contains the speed invalid error we hit in the contract (link).

Unfortunately, there's not much we can do here since we wrap web3. Happy to update the web3 dependency if web3.js comes out with a fix for the error. I'll leave this issue open in the meantime.

@laygir
Copy link
Author

laygir commented Mar 15, 2022

Hey @thebrianchen
Thank you for taking the time for it, really appreciate it! 🙏

Do you know how Alchemy dashboard handles this and able to display user friendly message on the dashboard?

Meanwhile just to create awareness, I also have an issue open on ChainSafe side, perhaps your finding could help anybody out there who could make a PR on this.

web3/web3.js#4787

@thebrianchen thebrianchen added bug Something isn't working wont fix This will not be worked on labels May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wont fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants