Commit 4f6a067
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
File tree
- packages
- brow-2-brow
- src
- kernel-errors
- kernel-node-runtime
- test
- e2e
- helpers
- kernel-shims
- kernel-test
- kernel-utils
- ocap-kernel
- src
- remotes
- platform
- utils
- patches
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
0 commit comments