Skip to content

chore: stack upgrade#29

Open
hieu-w wants to merge 14 commits intomainfrom
chore/stack-upgrade
Open

chore: stack upgrade#29
hieu-w wants to merge 14 commits intomainfrom
chore/stack-upgrade

Conversation

@hieu-w
Copy link
Member

@hieu-w hieu-w commented Mar 9, 2026

Motivation and Context

Modernize the web3auth-backend Node SDK by upgrading dependencies, migrating the test framework, replacing ethers with viem, removing Node.js Buffer polyfills, and adding CI and code ownership configuration.

Jira Link:
https://consensyssoftware.atlassian.net/browse/EMBED-29

Description

Test framework migration: Mocha + Chai → Vitest

  • Removed .mocharc.json, babel.config.js, and test/setup.mjs
  • Added vitest.config.mts with verbose reporter and istanbul coverage
  • Rewrote test assertions from Chai (expect(...).to.equal(...)) to Vitest (expect(...).toBe(...))

ethers → viem

  • Replaced ethers (Wallet, JsonRpcProvider) with viem (createWalletClient, privateKeyToAccount, http)
  • Updated WalletResult EIP155 signer type from Wallet to WalletClient

Buffer polyfill removal

  • Buffer.from(..., "base64")Uint8Array.from(atob(...), (c) => c.charCodeAt(0))
  • Buffer.from(..., "utf8")new TextEncoder().encode(...)

Utility update

  • safeatobbase64toJSON from @web3auth/auth

Dependency version bumps

  • Bumped all @toruslabs/*, @web3auth/*, @solana/*, @segment/* to latest majors
  • Removed Babel-related packages, mocha, chai, tsx, tsconfig-paths
  • Added vitest, @toruslabs/torus-scripts
  • Node engine: >=20.x>=22.x; npm: >=9.x>=10.x
  • Build script: rimraf dist/ && tsctorus-scripts build
  • Lint script: eslint --fix 'src/**/*.ts'torus-scripts lint src test

CI & CODEOWNERS

  • Added .github/workflows/ci.yml (Build, Test & Lint on push, Node 24.x)
  • Added .github/CODEOWNERS with @torusresearch/Admins fallback and @torusresearch/Web3Auth-Product for source/test

ESLint config

  • Removed mocha/no-setup-in-describe rule
  • Added import/no-extraneous-dependencies: off for test and config files

How has this been tested?

  • Migrated existing integration tests to Vitest and verified they pass against live Torus nodes
  • Tests cover: EIP155 wallet creation with signer, aggregate login with signer, and Solana login with TransactionSigner
  • Build and lint verified locally via npm run build and npm run lint

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project. (run lint)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My code requires a db migration.

Note

Medium Risk
Build/test automation now runs on Node 24 and tests require a JWT_PRIVATE_KEY secret, which may break CI/dev setups until the environment is updated. Other changes are mostly configuration cleanup (removing Mocha/Babel config and adjusting lint rules).

Overview
Adds GitHub governance and CI plumbing: new .github/CODEOWNERS ownership rules and a GitHub Actions workflow that runs build, lint, and test on every push, passing JWT_PRIVATE_KEY from repo secrets.

Updates local/runtime expectations by bumping .nvmrc to >=24.x and adding .env.example for test env setup, while removing legacy Mocha/Babel config (.mocharc.json, babel.config.js) and tweaking eslint.config.mjs to relax dependency rules for tests/config files.

Written by Cursor Bugbot for commit 60ee8ec. This will update automatically on new commits. Configure here.

@hieu-w hieu-w force-pushed the chore/stack-upgrade branch from cf9bd85 to d960dd3 Compare March 9, 2026 17:22
@hieu-w
Copy link
Member Author

hieu-w commented Mar 9, 2026

* @torusresearch/Admins

# Product code
**/src/ @torusresearch/Web3Auth-Product
Copy link
Member

Choose a reason for hiding this comment

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

should be web3auth

Copy link
Member Author

Choose a reason for hiding this comment

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

I've fix this, however team @Web3auth/Web3Auth-Admins not existed in Web3auth org, so we need create it.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.


# Product code
src/ @Web3auth/Web3Auth-Product
test/ @Web3auth/Web3Auth-Product
Copy link

Choose a reason for hiding this comment

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

CODEOWNERS patterns won't match any source files

Medium Severity

The src/ and test/ patterns only match root-level directories, but this is a Lerna monorepo where all source and test files live under packages/node-sdk/src/ and packages/node-sdk/test/. There are no root-level src/ or test/ directories, so @Web3auth/Web3Auth-Product will never be assigned as code owner for any product code — everything falls through to the * wildcard and gets assigned to @Web3auth/Web3Auth-Admins instead. The patterns likely need a **/ prefix or full paths like packages/*/src/.

Fix in Cursor Fix in Web

* @Web3auth/Web3Auth-Admins

# Product code
src/ @Web3auth/Web3Auth-Product
Copy link
Member

Choose a reason for hiding this comment

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

you need to use the lerna based folder structure

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.

2 participants