Replies: 2 comments 1 reply
-
Related issue on MetaMask: MetaMask/metamask-extension#13302 |
Beta Was this translation helpful? Give feedback.
0 replies
-
#945 related? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Waiting for transaction receipt (
TransactionResponse.wait()
) takes longer than expected with MetaMask, especially when interacting with EVM blockchain with dynamic and fast block creation time. Setting a lowprovider.pollingInterval
value doesn't make any difference.So I decided to debug the issue and found a few interesting things:
eth_getBlockNumber
, waiting for a block number change (by default every 4 seconds)This has the effect that whatever polling interval is set in ethers.js, the returned block number will continue to be same because it comes from the MetaMask cache. On average, with default settings, a confirmation will be detected after 12 seconds, and in 24 seconds in the worst case, ruining the UX of any blockchain with sub-second block finality.
Looking at the MetaMask cache I noticed that it doesn't cache the responses from the
eth_getTransactionByHash
andeth_getTransactionReceipt
calls. More interesting, when one of such calls returns and contains a more recent block number, MetaMask detects it and recognizes that the cache is not valid anymore and that the pending transactions have been confirmed, speeding up also the metamask confirmation pop-up.Beta Was this translation helpful? Give feedback.
All reactions