feat: add QUIC support - #8051
Conversation
twoeths
left a comment
There was a problem hiding this comment.
I dropped few minor comments
also need to handle quic6 for direct peers too? see
…ic to off Replace negative boolean flags (disableQuic, disableTcp) with positive flags (quic, tcp). QUIC is now disabled by default and opted into with --quic. Add QUIC transport documentation to networking docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously only TCP multiaddrs were extracted, so ENRs with only QUIC advertised were rejected as having no transport. Now both QUIC and TCP multiaddrs are included, with QUIC listed first for dial preference. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add type guard to filter for Multiaddr type narrowing in parseDirectPeers - Update discv5 utils test import to use @lodestar/config/test-utils Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… discovery Distinguish between peers with no multiaddrs at all (no_multiaddrs) and peers whose transports don't overlap with ours (transport_incompatible). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 92be808c06
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds native QUIC transport support to Lodestar’s libp2p stack (alongside TCP) with new CLI flags, ENR advertisement updates, discovery/dial preference changes, docs, dashboards, and unit tests.
Changes:
- Introduce QUIC transport configuration (
--quic,--quicPort{,6}, hidden--tcp) and prefer QUIC multiaddrs for dialing. - Extend ENR/discovery/direct-peers handling to accept and prioritize QUIC-only or QUIC+TCP peers.
- Add/adjust unit tests, networking docs, dashboards, and sim-test port allocation to account for QUIC.
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Excludes QUIC packages from pnpm minimum release age policy. |
| pnpm-lock.yaml | Locks @chainsafe/libp2p-quic and platform-specific optional deps. |
| packages/cli/test/utils/crucible/utils/ports.ts | Strides ports by 2 to leave room for QUIC port. |
| packages/cli/test/unit/options/beaconNodeOptions.test.ts | Updates expected network options and adds tcp/quic flag tests. |
| packages/cli/test/unit/cmds/initPeerIdAndEnr.test.ts | Adds tests for ENR field gating and QUIC port behavior. |
| packages/cli/src/options/beaconNodeOptions/network.ts | Adds QUIC ports + tcp/quic flags, validation, and multiaddr ordering. |
| packages/cli/src/cmds/beacon/options.ts | Adds --enr.quic / --enr.quic6 CLI overrides. |
| packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts | Writes/clears QUIC ENR fields based on flags and locality checks. |
| packages/beacon-node/test/unit/network/libp2p/getDiscv5Multiaddrs.test.ts | New tests for QUIC preference/fallback in boot ENR extraction. |
| packages/beacon-node/test/unit/network/gossip/directPeers.test.ts | Extends direct peer ENR parsing tests for QUIC/TCP combinations. |
| packages/beacon-node/test/unit/network/discv5/utils.test.ts | New tests for ENR relevance with TCP/QUIC transport combinations. |
| packages/beacon-node/src/network/peers/discover.ts | Supports QUIC multiaddrs, transport compatibility filtering, and safer addr selection. |
| packages/beacon-node/src/network/options.ts | Adds quic/tcp options and defaults. |
| packages/beacon-node/src/network/metadata.ts | Adds ENRKey.quic. |
| packages/beacon-node/src/network/libp2p/index.ts | Enables QUIC transport, configures transports list, and QUIC-aware boot multiaddr selection. |
| packages/beacon-node/src/network/gossip/gossipsub.ts | Allows QUIC/TCP transport multiaddrs from ENR direct peers and logs all addrs. |
| packages/beacon-node/src/network/discv5/utils.ts | Updates ENR relevance to accept TCP or QUIC. |
| packages/beacon-node/package.json | Adds @chainsafe/libp2p-quic dependency. |
| docs/pages/run/beacon-management/networking.md | Documents QUIC usage, ports, ENR advertisement, and firewall changes. |
| dashboards/lodestar_libp2p.json | Updates panels/queries to include QUIC transport metrics and reorganizes panels. |
| .wordlist.txt | Adds QUIC/TLS to spelling allowlist. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Generally looks good!!! LFG 🚀
Just need to address this comment:
#8051 (comment)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #8051 +/- ##
=========================================
Coverage 52.32% 52.32%
=========================================
Files 848 848
Lines 62505 62470 -35
Branches 4603 4597 -6
=========================================
- Hits 32703 32689 -14
+ Misses 29736 29716 -20
+ Partials 66 65 -1 🚀 New features to boost your workflow:
|
|
🎉 This PR is included in v1.41.0 🎉 |
Motivation
Add native QUIC transport support to Lodestar via
@chainsafe/libp2p-quic. QUIC provides lower-latency connections with built-in encryption (TLS 1.3) and multiplexing, eliminating the need for separate stream muxers and reducing handshake overhead compared to TCP+Noise+mplex.Supersedes #7659
Description
Transport configuration
@chainsafe/libp2p-quic--quicport + 1(9001 when port is 9000), configurable via--quicPort/--quicPort6--quicand--tcpCLI flags to selectively enable/disable transports (--tcpis hidden, defaults to true)discoveryPortandquicPortcollide (both UDP)localMultiaddrsso libp2p prefers QUIC for outbound dialsENR (Ethereum Node Record)
quic/quic6fields in ENR when QUIC is enabled--tcp/--quicflags: only advertise enabled transportstcp,quic) whentestMultiaddrForLocaldetects a non-local IPPeer discovery
enrRelevanceaccepts peers with TCP or QUIC (previously required TCP)getDiscv5Multiaddrsprefers QUIC multiaddrs from boot ENRs when QUIC is enabled, falls back to TCPhandleDiscoveredPeerselects multiaddrs by protocol (/tcp/,/quic-v1) instead of assuming array index orderinghandleDiscoveredPeermatches peers that share any enabled transport, not just TCPSymbol.toStringTagvalues for matching (@libp2p/tcp→tcp,quic→quic)CachedENR.multiaddrTCPis now optional to support QUIC-only peersDocumentation
Testing
enrRelevancewith tcp-only, quic-only, both, and neithergetDiscv5MultiaddrsQUIC preference and fallback behavior--tcp,--quic) and quic port fallback preservation--tcp/--quicAI Disclosure
AI-assisted (Claude Code)