Skip to content

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

Open

Description

@laygir

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.

Activity

  1. self-assigned this
    on Feb 28, 2022
  2. thebrianchen commented on Mar 15, 2022

    @thebrianchen
    Contributor

    @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.

  3. laygir commented on Mar 15, 2022

    @laygir
    Author

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwont fixThis will not be worked on

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions