Skip to content

feat: quic transport support#7775

Open
richard-ramos wants to merge 3 commits intounstablefrom
quic
Open

feat: quic transport support#7775
richard-ramos wants to merge 3 commits intounstablefrom
quic

Conversation

@richard-ramos
Copy link
Copy Markdown
Member

@richard-ramos richard-ramos commented Dec 3, 2025

Adds QUIC transport support to Nimbus beacon node while keeping TCP as the default transport.

  • add hidden CLI/config flags for enabling QUIC and selecting QUIC ports on beacon nodes and light clients
  • extend ENR creation and parsing to carry QUIC endpoints alongside existing TCP/UDP fields
  • update peer address handling so discovered/bootstrap peers can be dialed over TCP or QUIC
  • modifies the libp2p switch setup to bind and advertise multiple transport addresses
  • update local testnet tooling, scripts, docker examples, and tests to allocate and pass QUIC ports
  • bump the vendored nim-libp2p dependency and relax stack-usage flags for relevant lsquic objects

Notes

  • QUIC is still hidden behind --debug-quic; existing TCP behavior remains unchanged by default
  • this PR is mainly transport/address plumbing plus dev/test tooling updates, not a change to the default networking mode

@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 3, 2025

Unit Test Results

       12 files  ±0    2 488 suites  ±0   51m 25s ⏱️ + 2m 7s
12 978 tests ±0  12 431 ✔️ ±0  547 💤 ±0  0 ±0 
65 612 runs  ±0  64 902 ✔️ ±0  710 💤 ±0  0 ±0 

Results for commit 9dcfd4d. ± Comparison against base commit 0075b88.

♻️ This comment has been updated with latest results.

@arnetheduck
Copy link
Copy Markdown
Member

we will need to put this behind a flag (--debug-quic=false) initially

@tersec
Copy link
Copy Markdown
Contributor

tersec commented Jan 21, 2026

Can remove ngtcp2 and nim-quic as well.

@richard-ramos richard-ramos force-pushed the quic branch 2 times, most recently from 9a8cb28 to 57965b0 Compare January 29, 2026 20:47
@richard-ramos richard-ramos force-pushed the quic branch 2 times, most recently from 8187eea to d8636d0 Compare February 12, 2026 21:46
@richard-ramos richard-ramos force-pushed the quic branch 2 times, most recently from 8c2b001 to e908eee Compare March 17, 2026 14:51
@richard-ramos richard-ramos force-pushed the quic branch 8 times, most recently from 2ef0d18 to 62cb4ee Compare March 18, 2026 19:47
@richard-ramos richard-ramos changed the title wip: quic feat: quic Mar 18, 2026
@richard-ramos richard-ramos marked this pull request as ready for review March 18, 2026 21:39
Copilot AI review requested due to automatic review settings March 18, 2026 21:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds initial QUIC transport support (behind hidden/debug flags) across Nimbus networking, ENR generation, and local/test tooling, alongside vendor bumps required for QUIC integration.

Changes:

  • Update networking stack to support TCP and/or QUIC transports and advertise QUIC in ENR records.
  • Add hidden CLI/config flags and ports for QUIC, and adjust bootstrap/ENR port handling.
  • Update test/simulation scripts, docker compose examples, and Makefile port allocations for QUIC.

Reviewed changes

Copilot reviewed 14 out of 18 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
vendor/nim-libp2p Bumps libp2p dependency to version that presumably includes QUIC support.
vendor/nim-eth Bumps nim-eth dependency to support QUIC ENR fields / discovery changes.
tests/test_keymanager_api.nim Enables TCP + QUIC flags in test node startup with a dedicated QUIC port offset.
tests/simulation/restapi.sh Extends port cleanup to UDP and adds TCP/QUIC flags for simulation flows.
scripts/run-beacon-node.sh Adds QUIC-related flags and introduces derived port variables.
scripts/launch_local_testnet.sh Adds UDP port cleanup and plumbs TCP/QUIC + separate ENR/bootstrap port flags.
ncli/ncli_testnet.nim Adds hidden flags for TCP/QUIC enablement and splits ENR/bootstrap ports (tcp/udp/quic).
docker/dist/binaries/docker-compose-example1.yml Exposes an additional UDP port for QUIC and adds corresponding flags.
docker/dist/README.md.tpl Updates example command to include QUIC flags/port.
config.nims Tweaks compile flags for lsquic objects when stack-usage limiting is enabled.
beacon_chain/spec/network.nim Introduces default QUIC port and ENR “quic” field constant.
beacon_chain/rpc/rest_node_api.nim Updates discovery address derivation to use new toPeerAddr proto-selection API.
beacon_chain/nimbus_beacon_node.nim Updates ENR record creation to conditionally include TCP/QUIC ports.
beacon_chain/networking/eth2_network.nim Implements proto-aware address extraction (TCP/UDP/QUIC), transport selection, and switch builder changes.
beacon_chain/networking/eth2_discovery.nim Threads QUIC ENR port into discovery protocol initialization.
beacon_chain/conf_light_client.nim Adds hidden TCP/QUIC enable flags and QUIC port configuration for light client.
beacon_chain/conf.nim Adds hidden TCP/QUIC enable flags, QUIC ports (incl. external), and exports default QUIC port.
Makefile Adjusts REST test port stride, forces verbose builds for tools, and adds QUIC flags/port to params.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

std/[os, random, strutils, terminal, times],
chronos, chronicles,
metrics, metrics/chronos_httpserver,
lsquic/lsquic_ffi,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover from when I had this code to debug lsquic:

proc logging(ctx: pointer, buf: cstring, len: csize_t): cint {.cdecl.} =
  echo $buf
  return 0

let logger = struct_lsquic_logger_if(log_buf: logging)
discard lsquic_set_log_level("debug")
discard lsquic_logger_lopt("engine=debug,conn=debug,stream=debug")
lsquic_logger_init(addr logger, nil, LLTS_HHMMSSUS)

I'll remove it. 🤔 It is weird that the compiler did not complaint, because i see: switch("warningAsError", "UnusedImport:on") in config.nims

@richard-ramos richard-ramos force-pushed the quic branch 6 times, most recently from 73e6960 to 182892c Compare March 19, 2026 12:56
@jakubgs
Copy link
Copy Markdown
Member

jakubgs commented Mar 27, 2026

Richard requested testing of this on infra-nimbu:

But since it's not merged into unstable we can't easily test it unless we modify existing nodes.
We already changed libp2p nodes to run syncv3, what next? Switch testing to use quic? Silly.

@jakubgs
Copy link
Copy Markdown
Member

jakubgs commented Mar 27, 2026

Could we get this merged into unstable first so we can test it there without having to modify existing nodes to use an unconventional branch?

@richard-ramos
Copy link
Copy Markdown
Member Author

@tersec, do you think this PR could be merged into unstable after being reviewed?
quic transport is hidden behind a flag anyway, and having everything in unstable would make deployment easier

@richard-ramos richard-ramos changed the title feat: quic feat: quic transport support Mar 27, 2026
defaultValueDesc: "*"
name: "listen-address" .}: Option[IpAddress]

tcpEnabled* {.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is presumably the existing mplex support?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants