Skip to content

fallback / useWaitForTransactionReceipt BUG when TX out of gas #4972

@nfts2me

Description

@nfts2me

Check existing issues

Describe the bug

When using a fallback provider, and one of the RPCs is not properly responding, if the TX is confirmed, it works.
However, if the TX is out of gas (and thus reverted) or just reverted, it keeps on confirming and never confirms.
It should, instead, return and error.

Transport Working Example:

  transports: {
    [baseSepolia.id]: fallback([
      http('https://sepolia.base.org'),
      http('https://base-sepolia-rpc.publicnode.com'),
    ]),
  },

Transport BUG Example (fails on 'out of gas' or reverted TXs, but works on succeeded TXs):

  transports: {
    [baseSepolia.id]: fallback([
      http('https://sepolia.base.org'),
      http('https://rpc.notadegen.com/base/sepolia),
    ]),
  },

This example RPC was a previously working RPC that is not working anymore.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/usewaitfortransactionreceipt-wagmi-bug

Steps To Reproduce

  • Connect using any wallet.
  • Set baseSepolia as chain.
  • Choose a non EOA address.
  • Choose any valid / invalid data (depends if you want to test succeeded or failed TXs).
  • Send the TX.
  • Optionally lower the max gas per TX on the wallet to force "out of gas".

It will work on succeeded TXs, and will never change from "pending" on reverted TXs.

However, changing the RPCs to all working RPCs will make it work.

What Wagmi package(s) are you using?

wagmi

Wagmi Package(s) Version(s)

2.19.5

Viem Version

2.44.4

TypeScript Version

No response

Anything else?

Also, I noticed that the returned information from useWaitForTransactionReceipt is different when a TX is out of gas and a transaction reverts but not because out of gas. This is confusing, as the way to check for that is not homogeneous.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions