-
Notifications
You must be signed in to change notification settings - Fork 5k
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
transaction confirmation workflow issue with Ganache #4618
Comments
/cc @MicaiahReid |
@davidmurdoch Thanks for sharing this info. |
Quick update on our end! We switched Ganache v7.0.0's default "instamine" mode to match that of Ganache v6, so while the issue is technically there, web3 should work as usual in Ganache's default mode. You can reproduce the race condition by setting Ganache's instamine mode to "strict": |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
Bad robot |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
Bad robot |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
Bad robot. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
Can we reopen this until we figure out if it is still a problem? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
I'm having same issues |
6/12 - keep |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
Is there an existing issue for this?
Current Behavior
Bringing issue #2940 back to life here.
The [email protected] WebsocketProvider subscribes to
newHeads
after sending the transaction, which means web3 may miss the emittednewHeads
notification. While it is unlikely for this race condition to be a problem on mainnet, or even test nets, it is pretty much guaranteed to be a problem when testing against Ganache v7.0.0 (currently available as a beta).It can be a tricky race condition to reproduce as Ganache v7 is very fast for simple transactions; the immediate call to
eth_getTransactionReceipt
will likely return the receipt, so Web3 won't need to subscribe tonewHeads
. However, if the transaction sent to Ganache is sufficiently complexeth_getTransactionReceipt
may returnnull
, in which case Web3 will fall back to subscribing tonewHeads
. The problem is that it is possible for thenewHeads
subscription to arrive too late, as by the time the request is received by Ganache the block header has already been saved (and thenewHeads
message event won't ever be sent again).(There is a similar race condition issue for the HttpProvider, but I don't think there is a good way of solving it on Web3's side, so we'll work on a way of dealing with this on the Ganache side)
Expected Behavior
.
Steps to Reproduce
.
Web3.js Version
1.6.1
Environment
No response
Anything Else?
No response
The text was updated successfully, but these errors were encountered: