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

bug: Failing to find pending transactions #1540

Closed
1 task done
banky opened this issue Nov 28, 2023 · 6 comments
Closed
1 task done

bug: Failing to find pending transactions #1540

banky opened this issue Nov 28, 2023 · 6 comments

Comments

@banky
Copy link

banky commented Nov 28, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

1.19.9

Current Behavior

When looking at pending transactions in the mempool, a Transaction with hash <hash> could not be found. error gets thrown often. I am currently polling using an http transport and I am using a local Erigon archive node. This is a similar issue to #161, but in my case, the transactions that can't be found are recent

I also verify that the transactions are new by checking etherscan

Expected Behavior

I expect that every transaction hash that comes in should be ready to be queried on the node

Steps To Reproduce

publicClient.watchPendingTransactions({
  pollingInterval: 100,
  onTransactions: async (hashes) => {
    await Promise.all(
      hashes.map(async (hash) => {
        try {
          const tx = await publicClient.getTransaction({ hash });
          console.log(tx.hash);
        } catch (e) {
          if (
            e instanceof Error &&
            /Transaction with hash "0x[0-9a-fA-F]{64}" could not be found./.test(
              e.message
            )
          ) {
            console.log("Transaction not found:", hash);
            return;
          }
            console.log(e);
        }
      })
    );
  },
});

This outputs the following

[2023-11-27T23:49:36.898Z] 0x86959218f61a1d79e699d2c1fdf2cc83e0c6bedde34acbed6148d5be6aab6148
[2023-11-27T23:49:36.898Z] Transaction not found: 0x29ff06972fb4fb696227cc2a61b3a00c6ab79a85444e8a91aa49adcf2b461381
[2023-11-27T23:49:37.405Z] Transaction not found: 0x9bd77973507e737050343c72060b428daff1ae7c10d524b78c40aef8fefc1399
[2023-11-27T23:49:37.506Z] 0xa44124744d4a9a673e18f415a9ffd6c6f5161b25e4221551611f1b731fef5dec
[2023-11-27T23:49:37.507Z] 0x43a060c0260718bc94dd2db65801c9463ff8b0d4fa50ac42d7ab59cca581d3df
[2023-11-27T23:49:37.913Z] Transaction not found: 0x2e3b682c4e1220ee41666f5be38bd22d488098df17ae146227c751c1d4f84e8c
[2023-11-27T23:49:38.219Z] 0x8841822f1c0c21c1678deeb5cb96e8de09ce2e88a3f30852848b145c5f28f393
[2023-11-27T23:49:38.320Z] 0x7469db4d17dee4e9fd25f236362acf4da58860c2710e9bbf708cbd701f8b57d7
[2023-11-27T23:49:38.320Z] 0xf34d475857f63d6b425d8dbba62d99c7a511443f29e67eaf66c01ed61533ea75
[2023-11-27T23:49:38.524Z] 0x417aab4d6b61535b7c96f81d4c011948237afa43c4bec4d6dd5a341f864c4d52
[2023-11-27T23:49:38.626Z] 0x50ed8d4e9f19d97c03b5f74b47637f565e17c57684660893bf10ab927dba9728
[2023-11-27T23:49:38.727Z] Transaction not found: 0x1f0c69df8565daf405d5ff79766e556082d6bde4193695591b9874bb6870d294
[2023-11-27T23:49:38.727Z] 0x9216c72c3ada4a447b60390fbc41d0c1d0257f5f0b19206bb757a0c23df6e650
[2023-11-27T23:49:38.829Z] 0x00966e5e845a65de18559ea28ead8d0f7801a5372cc06a75478b5378c94ca67b
[2023-11-27T23:49:38.829Z] 0x6ebc7c919bc6ca7ead535f221dbcefa9ae226b9518240a1d2a77f96dfc7d0967
[2023-11-27T23:49:38.829Z] 0xd15f3cd435ebde08175878cae1d7652ef0232ec17cd1ec18ae57afd65dbd1eb8
[2023-11-27T23:49:38.829Z] 0x43acdc970ba080430e18bc52931ee3308585b6c5722412c4027d5f328ea4e24b
[2023-11-27T23:49:38.931Z] 0x4207fd0b58e4ac66696cb18b635675cf6013b4308c3b2b690bedfd1e30938050
[2023-11-27T23:49:39.136Z] 0x57616b47a4c77b4e7c258c050a0cf624cdad2aea6b1a479aaf9de1167526ff52
[2023-11-27T23:49:39.238Z] 0x72b6d14181d9d6e3129d703a5f6a0b4b7031c0bf65ed4d1a215171f70432965b
[2023-11-27T23:49:40.051Z] 0x64e4e93e8726c2f47b77aa04db71796ce2d5c6c1efc62ccfa47c075bf2dde062
[2023-11-27T23:49:40.357Z] 0xb96bf8ea9f07da8eaed8f51b6361eb42b1fb064efd94dc6029600a3f3d520dc8
[2023-11-27T23:49:40.461Z] Transaction not found: 0xbcd3e0b0c0dd389c7dfa3dad3f3d17dd8cdf16dc4d5367ea30646327b9fe142d
[2023-11-27T23:49:40.661Z] 0xc5b396bf2f56fb19a214503b90e8a0cfc3c0d084edddd115bf5bb7aaecb3e7d9
[2023-11-27T23:49:40.662Z] 0xbfb16b1ecefd94c1162706e7bfced291b798190f3f8515d5d7dd18bdc9b08722
[2023-11-27T23:49:40.865Z] 0x32f23234367d10d28d4ec967b10662e8279d897196146cabd515d06f399b1fad
[2023-11-27T23:49:41.068Z] 0x1a983a2377040c9b2688e52258f824634740d3c00ad836b8dcbf44edd8faabf1
[2023-11-27T23:49:41.272Z] 0xbaf029a543804287544fc4d8c89f011a2d8f91159cbd77c043acbbf6bbefec74
[2023-11-27T23:49:41.272Z] 0x22c86c609461c82679450298ebb7d102913389f227459bc483290ef4375e7a6f
[2023-11-27T23:49:41.578Z] Transaction not found: 0xcc6daa55876acc54c832208ae054eacc601892fa7e2eef384a57a864d3809065
[2023-11-27T23:49:41.679Z] 0xcfc379220db0580b2981fe2bbdf69b9987f3e1a8d5e205ffeaa447a39f82bd00
[2023-11-27T23:49:41.781Z] 0x77239648cab5c98d6f5ed26bfb7d6e480d580645b3b7a9d8e915640932187e75
[2023-11-27T23:49:41.781Z] 0xd3274648f4de9186d9988f2dd1735d14d672133c5380dcdaac575dd3907f0b93
[2023-11-27T23:49:42.597Z] Transaction not found: 0x312396b9eaa3ef0911f42b885a3b61f8773af4fa22797b9e7ed6667fcfa60051
[2023-11-27T23:49:42.798Z] 0x1395ca297b624bebd1b565589472941a06fb785d9849c4778cbab201538fdb8e
[2023-11-27T23:49:42.899Z] 0xea4a721bc088c8fb040430296d5c534935c1f11293a2661f7dfcd69d1fbfeed8
[2023-11-27T23:49:43.000Z] 0x48544d4b682bf75b68915eafc546f981dfbdb175190c3c0a1cf40aca79f2a1d9
[2023-11-27T23:49:43.001Z] 0x7ea721c244fc07336b4670028946a4411725e3d32c1f8ce7ac92d8d3c645a9d7
[2023-11-27T23:49:43.103Z] 0x4a3550d133ed6535483e68457d4b0729f83177aea0cf2a5c9d95363733049dc7
[2023-11-27T23:49:43.106Z] Transaction not found: 0x4b79283f9fc5c876185f600d51113cb6c8c0442dbcae2d6ef97125212d484b9a

Checking against my node, transactions which are reported to not be found can in fact be found

cast receipt 0x29ff06972fb4fb696227cc2a61b3a00c6ab79a85444e8a91aa49adcf2b461381

blockHash               0x7d85773948df1e5470f1d2fee88be13e10c809ad1fbbe0bf72eb8a1c3193ffbf
blockNumber             18666359
contractAddress
cumulativeGasUsed       9905815
effectiveGasPrice       30395534762
gasUsed                 21000
logs                    []
logsBloom               0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
root
status                  1
transactionHash         0x29ff06972fb4fb696227cc2a61b3a00c6ab79a85444e8a91aa49adcf2b461381
transactionIndex        70
type                    1

Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.)

No response

Anything else?

No response

@Yuripetusko
Copy link
Sponsor Contributor

Just had a forge-anvil test failing on this too. Was using alchemy rpc url btw. And I've seen it on wagmi react hook few times also. But it's inconsistent and a bit hard to reproduce. Perhaps issue is somewhere around that exponential backoff in waitForTransactionReceipt.ts? Will try to debug a bit tonight

@hstarorg
Copy link
Contributor

hstarorg commented Feb 27, 2024

Maybe we can increase the waiting time

@roninjin10
Copy link
Sponsor Contributor

Interesting I wonder if this issue is from the RPC instead of viem?

@banky
Copy link
Author

banky commented Mar 12, 2024

I was initially working with erigon, I've also tried nethermind but I do still see the same issue. It does seem to be an issue with timing though, ie. for those transactions that are not found if I immediately try to get the transaction with an rpc call via curl (curl -H 'Content-Type: application/json' --data '{ "id": 1, "method": "eth_getTransactionByHash", "params": [<tx_hash>] }' <node_url>), it's also not found for a while

@jxom
Copy link
Member

jxom commented Mar 12, 2024

So it's an RPC issue then. Might be worth performing some polling to get the example in OP to work.

@jxom jxom closed this as not planned Won't fix, can't repro, duplicate, stale Mar 12, 2024
Copy link
Contributor

This issue has been locked since it has been closed for more than 14 days.

If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@Yuripetusko @hstarorg @jxom @banky @roninjin10 and others