Skip to content

Commit 4f6a067

Browse files
sirtimidclaude
andauthored
feat: upgrade libp2p v2 to v3 (#900)
## Summary Upgrade all libp2p ecosystem packages from v2 to v3, pinned to the exact versions from the [`libp2p-v3.1.7`](https://github.com/libp2p/js-libp2p/tree/libp2p-v3.1.7) monorepo tag to ensure cross-package compatibility. Also removes the superseded `@ocap/brow-2-brow` PoC package. ### Changes - **Core upgrade**: `libp2p` 2.10.0 → 3.1.7, `@libp2p/interface` 2.11.0 → 3.1.1, plus 12 other `@libp2p/*` packages - **Companion upgrades**: `@chainsafe/libp2p-noise` 16→17, `yamux` 7→8, `libp2p-quic` 1→2, `@multiformats/multiaddr` 12→13, `multiaddr-matcher` 2→3 - **Breaking change fixes**: - Protocol handler signature: `({ stream, connection })` → `(stream, connection)` - `it-byte-stream` → `@libp2p/utils` for `byteStream()` (new generic `ByteStream<Stream>`) - Multiaddr v13 API: `getPeerId()`/`toOptions()`/`protoNames()` → `getComponents()` + `CODE_*` constants - WebSocket filter option removed (now default in v10) - **Cleanup**: - Remove stale `@chainsafe/libp2p-yamux` SES patch (`returnlessSource` removed in v8) - Update `node-datachannel` references (renamed from `@ipshipyard/node-datachannel`) - Remove `@ocap/brow-2-brow` PoC (superseded by production `ocap-kernel/src/remotes/`) - **New test**: `relay-connectivity.test.ts` — relay startup, kernel connection, multi-kernel discovery ### Testing All unit tests pass across the full monorepo (46 turbo tasks). All 62 e2e tests pass including the full remote-comms suite (bidirectional messaging, reconnection, queueing, incarnation detection, DGC) and the new relay connectivity smoke tests. Full build succeeds across all 23 remaining packages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Upgrades core networking dependencies (`libp2p`/`@libp2p/*`/`@multiformats/*`) across the monorepo and adapts connection/multiaddr handling to new APIs; regressions would impact relay connectivity and remote comms. Changes are well-covered by updated and expanded E2E tests, but the dependency jump is large and includes native WebRTC (`node-datachannel`) behavior. > > **Overview** > Upgrades the libp2p ecosystem to v3 (including `libp2p`, `@libp2p/interface`, `@libp2p/webrtc`, QUIC/TCP/WebSockets/WebTransport, and `@multiformats/multiaddr` v13) and updates workspace `resolutions` accordingly. > > Adapts remote-comms to breaking API changes: switches `byteStream` usage to `@libp2p/utils`, updates inbound protocol handler signatures, removes the WebSocket filter option, and replaces deprecated multiaddr helpers (`getPeerId`/`toOptions`/`protoNames`) with new shared utilities (`getLastPeerId`, `getHost`, `isPlainWs`) plus extracted `isPrivateAddress` logic. > > E2E tests are adjusted and expanded: adds a relay connectivity smoke test, deduplicates helper logic (`stopWithTimeout`, `getRemoteCommsPeerId`), and introduces a Vitest setup to suppress known benign `node-datachannel` uncaught exceptions. Cleans up legacy artifacts by removing the `@ocap/brow-2-brow` PoC package, dropping the `@chainsafe/libp2p-yamux` patch/`patch-package` wiring, and updating native rebuild scripts for the `node-datachannel` rename. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 277d212. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2f7ecbc commit 4f6a067

43 files changed

Lines changed: 1311 additions & 2051 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@
124124
"vitest>@vitest/browser>webdriverio>@wdio/utils>edgedriver": false,
125125
"vitest>@vitest/browser>webdriverio>@wdio/utils>geckodriver": false,
126126
"vitest>@vitest/mocker>msw": false,
127-
"@metamask/kernel-cli>@metamask/kernel-node-runtime>@libp2p/webrtc>@ipshipyard/node-datachannel": false,
127+
"@metamask/kernel-cli>@metamask/kernel-node-runtime>@libp2p/webrtc>node-datachannel": false,
128128
"@metamask/kernel-cli>@metamask/kernel-node-runtime>@metamask/kernel-store>better-sqlite3": false,
129129
"@metamask/kernel-cli>@metamask/kernel-node-runtime>@metamask/streams": false,
130-
"@metamask/kernel-cli>@metamask/kernel-shims>@libp2p/webrtc>@ipshipyard/node-datachannel": false,
130+
"@metamask/kernel-cli>@metamask/kernel-shims>@libp2p/webrtc>node-datachannel": false,
131131
"@metamask/kernel-cli>@metamask/kernel-utils": false,
132132
"vitest>jsdom>ws>bufferutil": false,
133133
"vitest>jsdom>ws>utf-8-validate": false
@@ -136,10 +136,10 @@
136136
"resolutions": {
137137
"@radix-ui/react-slot@npm:^1.1.0": "1.2.4",
138138
"cookie": "^0.7.0",
139-
"@chainsafe/libp2p-noise": "16.1.5",
140-
"@libp2p/interface": "2.11.0",
141-
"@multiformats/multiaddr": "12.5.1",
142-
"@multiformats/multiaddr-to-uri": "11.0.2",
139+
"@chainsafe/libp2p-noise": "17.0.0",
140+
"@libp2p/interface": "3.1.1",
141+
"@multiformats/multiaddr": "13.0.1",
142+
"@multiformats/multiaddr-to-uri": "12.0.0",
143143
"@multiformats/dns": "1.0.9"
144144
}
145145
}

packages/brow-2-brow/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/brow-2-brow/esbuild.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/brow-2-brow/package.json

Lines changed: 0 additions & 90 deletions
This file was deleted.

packages/brow-2-brow/src/constants.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/brow-2-brow/src/index.html

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)