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

transaction confirmation workflow issue with Ganache #4618

Closed
1 task done
davidmurdoch opened this issue Dec 10, 2021 · 15 comments
Closed
1 task done

transaction confirmation workflow issue with Ganache #4618

davidmurdoch opened this issue Dec 10, 2021 · 15 comments
Labels
1.x 1.0 related issues Bug Addressing a bug

Comments

@davidmurdoch
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

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 emitted newHeads 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 to newHeads. However, if the transaction sent to Ganache is sufficiently complex eth_getTransactionReceipt may return null, in which case Web3 will fall back to subscribing to newHeads. The problem is that it is possible for the newHeads subscription to arrive too late, as by the time the request is received by Ganache the block header has already been saved (and the newHeads 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

@davidmurdoch davidmurdoch added the Bug Addressing a bug label Dec 10, 2021
@davidmurdoch
Copy link
Author

/cc @MicaiahReid

@jdevcs
Copy link
Contributor

jdevcs commented Jan 24, 2022

@davidmurdoch Thanks for sharing this info.

@jdevcs jdevcs added the 1.x 1.0 related issues label Jan 24, 2022
@davidmurdoch
Copy link
Author

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": ganache --miner.instamine strict. This will cause Ganache to return a transaction's hash before including the transaction in a block.

@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale Has not received enough activity label Mar 26, 2022
@davidmurdoch
Copy link
Author

Bad robot

@github-actions github-actions bot removed the Stale Has not received enough activity label Mar 27, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale Has not received enough activity label May 26, 2022
@davidmurdoch
Copy link
Author

Bad robot

@github-actions github-actions bot removed the Stale Has not received enough activity label May 27, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale Has not received enough activity label Jul 26, 2022
@davidmurdoch
Copy link
Author

Bad robot.

@github-actions github-actions bot removed the Stale Has not received enough activity label Jul 27, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale Has not received enough activity label Sep 26, 2022
@davidmurdoch
Copy link
Author

Can we reopen this until we figure out if it is still a problem?

@jdevcs jdevcs reopened this Jan 12, 2023
@github-actions github-actions bot removed the Stale Has not received enough activity label Jan 13, 2023
@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale Has not received enough activity label Mar 15, 2023
@jdevcs jdevcs removed the Stale Has not received enough activity label Mar 15, 2023
@Ajemark
Copy link

Ajemark commented May 6, 2023

I'm having same issues

@mconnelly8
Copy link

6/12 - keep

@github-actions
Copy link

github-actions bot commented Oct 5, 2023

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.

@github-actions github-actions bot added the Stale Has not received enough activity label Oct 5, 2023
@mconnelly8 mconnelly8 removed the Stale Has not received enough activity label Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Bug Addressing a bug
Projects
None yet
Development

No branches or pull requests

4 participants