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

web3.js: Implement a nonce-based transaction confirmation strategy #25303

Closed
steveluscher opened this issue May 17, 2022 · 1 comment · Fixed by #25839
Closed

web3.js: Implement a nonce-based transaction confirmation strategy #25303

steveluscher opened this issue May 17, 2022 · 1 comment · Fixed by #25839
Assignees
Labels
javascript Pull requests that update Javascript code

Comments

@steveluscher
Copy link
Contributor

Problem

We have no strategy for confirming nonce-based transactions other than ‘wait 60 seconds.’ In fact, nonce-based transactions expire either:

  1. If the blockhash that the transaction was signed with is not the same as the blockhash in the nonce account from the get-go, or
  2. If the nonce is ‘advanced’ before the transaction is confirmed.

Proposed Solution

  1. Follow the pattern established by BlockheightBasedTransactionConfimationStrategy; create a NonceBasedTransactionConfimationStrategy
  2. Create a TransactionExpiredNonceAdvancedError
  3. Augment new Transaction to take nonce-based constructor args.
  4. Augment confirmTransaction() to accept NonceBasedTransactionConfimationStrategy
  5. Write expiry logic that polls the nonce account, watching for a mismatch between the blockhash that the transaction was signed with, and the blockhash in the nonce account. Throw a TransactionExpiredNonceAdvancedError when this happens.
@steveluscher steveluscher added the javascript Pull requests that update Javascript code label May 17, 2022
@steveluscher steveluscher self-assigned this May 17, 2022
@marcnjaramillo
Copy link
Contributor

I'm trying to wrap up some other things, but I'm happy to continue working on this later this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants