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

test: fix transaction controller integration tests with nonce tracker 6 #4591

Merged
merged 4 commits into from
Aug 12, 2024

Conversation

matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Aug 2, 2024

Explanation

Fix the TransactionController integration tests with version 6.0.0 of @metamask/nonce-tracker.

This version of the nonce tracker constructs a new Web3Provider instance every time a eth_getTransactionCount call is required, this is needed in order to support the proxy provider which can dynamically point to different networks.

This Web3Provider extends the JsonRpcProvider whose constructor has the side effect of creating a timeout to determine the chain ID, if not provided in the constructor. When calling getTransactionCount on this provider, it first awaits the network being identified as a result of the timeout.

https://github.com/ethers-io/ethers.js/blob/v5.7.2/packages/providers/src.ts/json-rpc-provider.ts#L416

https://github.com/ethers-io/ethers.js/blob/v5.7.2/packages/providers/src.ts/base-provider.ts#L1461

Since the integration tests use fake timers, some of them were hanging when generating a nonce since an additional tick was required to process this constructor network timeout.

References

Related to #2668

Changelog

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

Copy link

socket-security bot commented Aug 2, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/nonce-tracker@6.0.0 None 0 29.1 kB lgbot

View full report↗︎

@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review August 2, 2024 17:44
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners August 2, 2024 17:44
@legobeat legobeat requested a review from dbrans August 8, 2024 21:52
@matthewwalsh0 matthewwalsh0 merged commit 5318618 into main Aug 12, 2024
116 checks passed
@matthewwalsh0 matthewwalsh0 deleted the test/fix-transaction-controller-integration-tests branch August 12, 2024 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants