Skip to content

improve ci test stability #587

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

Merged
merged 12 commits into from
Apr 10, 2025
Merged

improve ci test stability #587

merged 12 commits into from
Apr 10, 2025

Conversation

andrewkmin
Copy link
Collaborator

@andrewkmin andrewkmin commented Apr 10, 2025

Summary & Motivation

$title

Viem tests were very unstable in CI, particularly due to the ERC721 case. Specifically, there were instances where there would be EVM collisions due to the ERC721 contract being deployed, deterministically, to the same address each time. (address and nonce are factors in determining the contract address. You cannot pass a salt during contract deployment using viem at this time)

This PR aims to improve test stability by:

  • Removing redundant test (that may have been causing evm collisions during contract deployments within viem tests)
  • Kill anvil after tests (this is mainly to ensure that processes properly get cleaned up post-test)
  • Introducing a separate wallet account address for testing

Interestingly, these race conditions do not happen locally.

If I were to test something else out, there are the following options:

  • Have each config use a unique ETH address (currently we reuse some)
  • Have unique contracts to deploy per address
  • Introduce an effective "jitter"/source of randomness for the number of transactions that an address has performed, thereby controlling its nonce in order to prevent EVM collisions.

How I Tested These Changes

local, CI

Did you add a changeset?

If updating one of our packages, you'll likely need to add a changeset to your PR. To do so, run pnpm changeset. pnpm changeset will generate a file where you should write a human friendly message about the changes. Note how this (example) includes the package name (should be auto added by the command) along with the type of semver change (major.minor.patch) (which you should set).

These changes will be used at release time to determine what packages to publish and how to bump their version. For more context see this comment.

Copy link

vercel bot commented Apr 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sdk-email-auth ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 4:05pm
sdk-otp-auth ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 4:05pm

Copy link

codesandbox-ci bot commented Apr 10, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a3341bd:

Sandbox Source
@turnkey/example-react-components Configuration

Comment on lines 1 to 5
---
"@turnkey/eip-1193-provider": patch
---

Tweak unit tests given expectation that the wallet ID used for tests will have 2 associated addresses
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: if it's a test-only change and doesn't impact the code that our customers consume whatsoever there's no need for a changelog entry 💅

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sahweet! removed :)

Copy link
Contributor

@zkharit zkharit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI 😵

@andrewkmin andrewkmin merged commit dcef06e into main Apr 10, 2025
8 checks passed
@andrewkmin andrewkmin deleted the andrew/viem-test-noop branch April 10, 2025 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants