Repository navigation
Closed
Labels
package-auditFound by the 2026 package audit: compiling real npm packages from source instead of native bindingsFound by the 2026 package audit: compiling real npm packages from source instead of native bindings
Description
ethers@6.17.0's original compile blocker (#10757, HIR lowering hang on @noble/curves' weierstrass.js) is fixed — the package now compiles cleanly from real source (153 modules: ethers, @adraffy/ens-normalize, @noble/curves, @noble/hashes, aes-js). Linking fails with an undefined reference to a WebSocket wrapper symbol that codegen never emitted:
/usr/bin/ld: .../perry_closure_node_modules_ethers_src_ts_providers_provider_websocket_ts__1: in function ...:
undefined reference to `__perry_wrap_perry_fn_node_modules_ethers_src_ts_providers_ws_ts__WebSocket'
collect2: error: ld returned 1 exit status
Error: Linking failed
Reproduction
{
"dependencies": { "ethers": "6.17.0" },
"perry": {
"compilePackages": ["ethers"],
"allow": { "compilePackages": ["ethers"] }
}
}fixture.ts:
const { ethers } = require("ethers");
const pk = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
const wallet = new ethers.Wallet(pk);
console.log("address:", wallet.address);npm install
perry compile fixture.ts -o fixtureExpected
Links and runs; node fixture.ts (via --experimental-strip-types) prints:
address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
Actual (Perry, current main)
Link failure — collect2: error: ld returned 1 exit status, Error: Linking failed, naming __perry_wrap_perry_fn_node_modules_ethers_src_ts_providers_ws_ts__WebSocket as undefined.
Notes
ethers/src.ts/providers/provider-websocket.tsimports a local./ws.js/ws.tsshim that ethers ships internally (its own thinWebSocketwrapper around whatever runtime WebSocket is available), andprovider-websocket.tsbuilds a closure that references it. The mangled symbol name (__perry_wrap_perry_fn_..._ws_ts__WebSocket) suggests codegen registered a call site expecting a native-function wrapper for this locally-definedWebSocketsymbol but never emitted (or the linker never pulled in) the wrapper's definition — this fixture never actually opens a WebSocket connection (Walletconstruction alone triggers it), so the failure is purely at compile/link time, not runtime.- The reference-taking closure is specifically
provider-websocket.ts's module-level closure Support custom menu bar items #1, per the mangled name; that's the most direct lead for whoever picks this up. Not yet bisected further — this fixture doesn't need a real reproduction to trigger the link failure, so a minimal non-ethers repro is likely reachable by isolating whatever HIR/codegen patternprovider-websocket.tsuses to reference its localWebSocketimport.
Metadata
Metadata
Assignees
Labels
package-auditFound by the 2026 package audit: compiling real npm packages from source instead of native bindingsFound by the 2026 package audit: compiling real npm packages from source instead of native bindings
Activity
test(hir): prove #11044's node-core scoping fix against a real manife…
test(hir): prove #11044's node-core scoping fix against a real manife…
test(hir): prove #11044's node-core scoping fix against a real manife…