Repository navigation
fix: send a new receipt request for each block in waitForTransactionReceipt - #5662
Open
frontier159 wants to merge 1 commit into
Open
frontier159 wants to merge 1 commit into
frontier159 wants to merge 1 commit into
Conversation
…eceipt getTransactionReceipt dedupes: if the same client has sent an identical request and is still waiting for its response, a new call returns that response instead of sending its own request. When waitForTransactionReceipt checks a new block, that earlier request may have been sent before the block arrived, so its response can say there is no receipt for a transaction in the block. If the node then mines no later block, as anvil without interval mining does, the wait times out on a mined transaction. getTransactionReceipt takes `dedupe` (default `true`). The receipt lookups inside waitForTransactionReceipt's block check pass `dedupe: false`, so each sends its own request after the block arrived. The wait's first receipt lookup, before polling starts, still dedupes.
|
@frontier159 is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 36d3705 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5661.
getTransactionReceiptdedupes: if the same client has sent an identical request and is still waiting for its response, a new call returns that response instead of sending its own request. WhenwaitForTransactionReceiptchecks a new block, that earlier request may have been sent before the block arrived, so its response can say there is no receipt for a transaction in the block. If the node then mines no later block, as anvil without interval mining does, the wait times out on a mined transaction.getTransactionReceiptnow takesdedupe(defaulttrue, so its behavior does not change). The receipt lookups insidewaitForTransactionReceipt's block check passdedupe: false, so each sends its own request after its block arrived. The wait's first lookup, before polling starts, still dedupes. Nothing else changes: the scheduling of block checks, the replacement search and confirmations are as before.Cost: while a transaction is pending, the wait sends one receipt request per new block, where main sent one per poll. When one poll finds several new blocks, the wait sends a request for each: about 2× the receipt requests on Arbitrum at the default polling interval, and almost no change on Ethereum, Base or BSC. Waits on one client also stop sharing receipt requests with each other.
Alternatives considered:
eth_getTransactionReceiptdirectly inside the wait, without a new option. Ruled out: it would skip a client's override ofgetTransactionReceipt, which the wait honors throughgetAction.Tests:
waitForTransactionReceipt: the transport receives anvil's answer to a block check's receipt request (no receipt), mines the transaction's block, and returns that answer only after the client has polled the new block number. The new block's check starts while that request is still waiting. It times out on main and passes with this change.getTransactionReceipt: a call made while an identical request is still waiting, after the transaction was mined, gets "not found" by default and the receipt withdedupe: false. It fails withdedupealways on.