Skip to content

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

Merged
matthewwalsh0 merged 4 commits into
mainfrom
test/fix-transaction-controller-integration-tests
Aug 12, 2024
Merged

test: fix transaction controller integration tests with nonce tracker 6#4591
matthewwalsh0 merged 4 commits into
mainfrom
test/fix-transaction-controller-integration-tests

Conversation

@matthewwalsh0

@matthewwalsh0matthewwalsh0 commented Aug 2, 2024

Copy link
Copy Markdown
Member

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

@socket-security

socket-securityBot commented Aug 2, 2024

Copy link
Copy Markdown

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

PackageNew capabilitiesTransitivesSizePublisher
npm/@metamask/nonce-tracker@6.0.0None029.1 kBlgbot

View full report↗︎

@matthewwalsh0
matthewwalsh0 marked this pull request as ready for review August 2, 2024 17:44
@matthewwalsh0
matthewwalsh0 requested a review from a team as a code ownerAugust 2, 2024 17:44
@matthewwalsh0
matthewwalsh0 requested a review from a teamAugust 2, 2024 17:44
@legobeat
legobeat requested a review from dbransAugust 8, 2024 21:52
@matthewwalsh0
matthewwalsh0 merged commit 5318618 into mainAug 12, 2024
@matthewwalsh0
matthewwalsh0 deleted the test/fix-transaction-controller-integration-tests branch August 12, 2024 13:27
Sign up for freeto 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

@matthewwalsh0@pedronfigueiredo@cryptodev-2s@legobeat