Repository navigation
fix(sei-global-wallet): follow Dynamic's viem peer to 2.57.19 #362
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| --- | ||
| '@sei-js/sei-global-wallet': patch | ||
| --- | ||
|
|
||
| Verify consumers against `viem@2.57.19`, and drop Viem's two `ws` advisories from the Bun waiver. | ||
|
|
||
| Dynamic published `@dynamic-labs/global-wallet-client@4.104.0` inside this package's `^4.96.3` range on November 3, raising the `viem` peer of the client and of `@dynamic-labs/ethereum-aa` from `^2.45.3` to `^2.54.2`. The consumer verifier still installed `viem@2.45.3`, so every nightly consumer run since then failed with `ERESOLVE` rather than on any change in this repository. Its full consumers now install `viem@2.57.19`, and the [Optional peer versions](https://github.com/sei-protocol/sei-js/blob/main/packages/sei-global-wallet/README.md#optional-peer-versions) table lists it as the verified version. | ||
|
|
||
| Every Viem inside `^2.54.2` depends on an Ox whose Tempo `VirtualMaster` miner loads `node:worker_threads` for its Node worker pool, which Vite resolves and reports as externalized for browser compatibility. No wallet path reaches the miner and it is tree-shaken out of the bundle, so the verifier now tolerates that one warning from `ox/_esm/tempo/internal/virtualMasterPool.js`. It still fails if Vite externalizes `node:worker_threads` for any other module, or if a browser or edge bundle contains a `worker_threads` path. | ||
|
|
||
| Viem 2.54.2 and later pin `ws@8.21.0`, outside both `GHSA-58qx-3vcg-4xpx` and `GHSA-96hv-2xvq-fx4p`, so the Bun AA consumer no longer reports them and they leave the Bun waiver. The scoped npm `ws` override stays in the [Required consumer overrides](https://github.com/sei-protocol/sei-js/blob/main/packages/sei-global-wallet/README.md#required-consumer-overrides) blocks for applications that still hold an older Viem; on current Viem it changes nothing. | ||
|
|
||
| No published dependency or peer range changes. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,14 +46,7 @@ const fastCheck = process.env.SEI_GLOBAL_WALLET_FAST_CHECK === '1'; | |
| // requires it, and every version outside its advisories is ESM-only under a | ||
| // moved `src/` layout, so an override turns them into a MODULE_NOT_FOUND. | ||
| const acceptedNpmAdvisories: readonly string[] = ['GHSA-528h-pc64-c93x', 'GHSA-hqr4-qq8f-hg3x', 'GHSA-mjw6-4jj6-33hc']; | ||
| const acceptedBunAdvisories: readonly string[] = [ | ||
| 'GHSA-378v-28hj-76wf', | ||
| 'GHSA-528h-pc64-c93x', | ||
| 'GHSA-58qx-3vcg-4xpx', | ||
| 'GHSA-96hv-2xvq-fx4p', | ||
| 'GHSA-hqr4-qq8f-hg3x', | ||
| 'GHSA-mjw6-4jj6-33hc' | ||
| ]; | ||
| const acceptedBunAdvisories: readonly string[] = ['GHSA-378v-28hj-76wf', 'GHSA-528h-pc64-c93x', 'GHSA-hqr4-qq8f-hg3x', 'GHSA-mjw6-4jj6-33hc']; | ||
|
|
||
| const manifest = JSON.parse(await readFile(join(packageDir, 'package.json'), 'utf8')) as { | ||
| dependencies: Record<string, string>; | ||
|
|
@@ -151,12 +144,20 @@ const makeTestedPeerVersions = (ethereumAa: string) => | |
| '@wallet-standard/features': '^1.0.3', | ||
| '@wallet-standard/wallet': '^1.1.0', | ||
| '@zerodev/sdk': '5.5.7', | ||
| viem: '2.45.3', | ||
| viem: '2.57.19', | ||
| 'zksync-sso': '0.2.0' | ||
| }) as const; | ||
|
|
||
| type TestedPeerVersions = ReturnType<typeof makeTestedPeerVersions>; | ||
|
|
||
| // Current Viem releases depend on an Ox that ships a Tempo `VirtualMaster` | ||
| // miner, whose Node worker pool imports `node:worker_threads` through a | ||
| // constant. Vite resolves it, and warns, while loading the module graph. No | ||
| // wallet path reaches the miner and it is tree-shaken out, which the bundle | ||
| // scan in runBrowserBundle enforces, so it is the only importer the Vite check | ||
| // tolerates. | ||
| const toleratedWorkerThreadsImporter = /(?:^|\/)node_modules\/ox\/_esm\/tempo\/internal\/virtualMasterPool\.js$/; | ||
|
|
||
| const assertTestedPeersFitPublishedRanges = (testedPeerVersions: TestedPeerVersions) => { | ||
| // Guards the two from drifting: every version the harness installs has to be | ||
| // allowed by the range the package publishes. This is what catches Dynamic | ||
|
|
@@ -897,7 +898,7 @@ try { | |
| assert.equal(npmLock.packages['node_modules/number-to-bn/node_modules/bn.js']?.version, '4.12.5'); | ||
| assertMajor(npmLock.packages['node_modules/bn.js']?.version, '5', 'hoisted bn.js'); | ||
| assert.equal(npmLock.packages['node_modules/ws']?.version, '8.21.0'); | ||
| assert.equal(npmLock.packages['node_modules/viem']?.dependencies?.ws, '8.18.3'); | ||
| assert.equal(npmLock.packages['node_modules/viem']?.dependencies?.ws, '8.21.0'); | ||
| assert.equal(npmLock.packages['node_modules/jayson']?.dependencies?.ws, '^7.5.10'); | ||
| assertMajor(npmLock.packages['node_modules/jayson/node_modules/ws']?.version, '7', 'jayson nested ws'); | ||
| await run(['node', 'check-ssr.mjs'], npmConsumerDir); | ||
|
|
@@ -940,11 +941,18 @@ try { | |
| // Vite routes externalization warnings through its own logger, which writes | ||
| // to stdout in most versions, so scan both streams. | ||
| const viteOutput = `${viteBuild.stdout}\n${viteBuild.stderr}`; | ||
| assert.doesNotMatch( | ||
| viteOutput, | ||
| /(?:node:)?worker_threads.*externaliz|externaliz.*(?:node:)?worker_threads/i, | ||
| `Vite externalized worker_threads:\n${viteOutput}` | ||
| const workerThreadsExternalizations = viteOutput | ||
| .split('\n') | ||
| .filter((line) => /(?:node:)?worker_threads.*externaliz|externaliz.*(?:node:)?worker_threads/i.test(line)); | ||
| const unexpectedExternalizations = workerThreadsExternalizations.filter( | ||
| (line) => !toleratedWorkerThreadsImporter.test(line.match(/imported by "([^"]+)"/)?.[1]?.replaceAll('\\', '/') ?? '') | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit] This fails closed when a matching line has no |
||
| ); | ||
| assert.deepEqual(unexpectedExternalizations, [], `Vite externalized worker_threads:\n${viteOutput}`); | ||
| if (workerThreadsExternalizations.length === 0) { | ||
| reportWaiverProgress( | ||
| "Vite no longer externalizes node:worker_threads for Ox's Tempo miner. Remove toleratedWorkerThreadsImporter from this script and the Vite note from packages/sei-global-wallet/README.md." | ||
| ); | ||
| } | ||
| const viteFiles = (await readdir(join(npmConsumerDir, 'vite-dist'))).filter((path) => path.endsWith('.js')); | ||
| assert.equal(viteFiles.length, 1, `Expected one Vite bundle, found: ${viteFiles.join(', ')}`); | ||
| await runBrowserBundle(join(npmConsumerDir, 'vite-dist', viteFiles[0]), true); | ||
|
|
@@ -971,7 +979,7 @@ try { | |
| console.log( | ||
| fastCheck | ||
| ? 'Sei Global Wallet fast npm consumer checks passed.' | ||
| : 'Sei Global Wallet consumer checks passed: the wallet-only npm consumer audited clean, npm scoped patched bn.js/ws8 while preserving Solana bn5/Jayson ws7, and both full consumers stayed within the accepted advisory waiver.' | ||
| : 'Sei Global Wallet consumer checks passed: the wallet-only npm consumer audited clean, npm scoped patched bn.js while preserving Solana bn5/Jayson ws7, and both full consumers stayed within the accepted advisory waiver.' | ||
| ); | ||
| } finally { | ||
| await rm(temporaryRoot, { force: true, recursive: true }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit]
(?:^|\/)node_modules\/ox\/...also matches a nested copy such asnode_modules/viem/node_modules/ox/..., which seems intended. Note that the safety argument depends on the bundle scans inrunBrowserBundle/edge (!bundle.includes('node:worker_threads')) staying in place. If those scans are ever relaxed, this tolerance should be revisited too.