Repository navigation
refactor: remove QUIC 0-RTT probe connection establishment (#1429) - #1465
Conversation
|
Warning Review limit reached
Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (48)
WalkthroughThe PR retires QUIC 0-RTT probe establishment, removes related configuration, APIs, metrics, and ticket-cache settings, simplifies probe handling, updates call sites and tests, and revises ADR, observability, changelog, and workspace documentation. ChangesQUIC 0-RTT retirement
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ProbeClient
participant QUICEndpoint
participant ProbeHandler
ProbeClient->>QUICEndpoint: connect with ALPN_PROBE
QUICEndpoint->>ProbeHandler: complete TLS handshake and accept request
ProbeHandler-->>ProbeClient: signed ProbeResponse
ProbeClient->>QUICEndpoint: close connection
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Coverage reportTotal: 81.10% (was 81.08%, ▲ +0.02%) — 52379/64583 lines
History
|
`cdn/probe/v1` now always completes a full TLS 1.3 handshake before the
request is sent — the behaviour the code already fell back to whenever a
ticket was missing or the server rejected early data. The optimization
bought exactly one round trip, and only on a warm reconnection to a peer
the client had already probed; cold probes (every first contact, and every
un-sampled peer in the ADR 037 background sweep) got nothing.
What it cost was a replay-safety surface no server-side gate could
enforce: iroh sets `max_early_data_size = u32::MAX` on every server TLS
config, so the whole guarantee rested on there being exactly one
early-data-emitting client path, hard-wired to the idempotent probe ALPN.
Any future side effect on the probe path (demand tracking, cache-priority
boosting) would have voided it silently, with no compile-time or
server-side backstop.
Removed: the `network.enable_0rtt` switch and its resolver, the client
attempt/fallback path and post-exchange ticket linger in both probe
requesters, the `ProbeMetrics` sink, `ProbeHandler::on_accepting`, the
now-redundant `ClientHandler::on_accepting`, `max_tls_tickets` sizing on
both endpoints, `decdn_protocol::SESSION_TICKET_CACHE_SIZE`, and the five
0-RTT / session-ticket metrics.
Kept: `cdn/probe/v1` itself (unchanged wire format, unchanged node-to-node
role), iroh's TLS session resumption for full handshakes, and QUIC stream
multiplexing on open connections.
BREAKING CHANGE: `network.enable_0rtt` is removed. `[network]` uses
`deny_unknown_fields`, so a config that still sets it now fails
`decdn config validate` and node startup rather than being ignored — the
post-removal behaviour equals the previously supported
`enable_0rtt = false`, so deleting the line is the whole migration. The
`decdn_quic_0rtt_{attempts,accepted,rejected}_total`,
`decdn_quic_session_ticket_cache_size`, and
`decdn_quic_session_ticket_peers_dropped_total` series are gone; all were
label-free, so no dashboard query loses a dimension.
ADR 015 is archived under `adr/_history/` per the convention used for
ADRs 032-035; 015 is added to the do-not-reuse list.
Closes #1429
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Trivy flagged a HIGH advisory in quinn-proto 0.11.14 (remote memory exhaustion in the QUIC state machine), fixed in 0.11.15. Lockfile-only bump to 0.11.16; no dependency requirement changes. The rest of the diff is resolution unification onto lock entries that already existed (getrandom 0.4.2, rand 0.10.2, windows-sys 0.59.0). Verified: cargo build --workspace, cargo nextest run --workspace (2548 passed), cargo deny check (advisories/bans/licenses/sources ok). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Review follow-ups on #1429. Two defects in the replacement artifacts, plus the prose sweep they exposed. The guard's primary needle could never match. `format!("into_0{rtt}")` with `rtt = "0rtt"` assembles to `into_00rtt`, so the one test standing between the repo and a silent 0-RTT reintroduction was vacuous for the exact call it names. Re-adding the deleted `Accepting::into_0rtt()` override would have passed CI. Fixed, and verified by mutation in both directions. Hardened while in there: a compile-time anchor pins the needles to real iroh types (an upstream rename now breaks the build instead of leaving a permanently-green grep), a self-test asserts each needle matches the call it names, the scan covers the workspace root rather than `crates/`, and the self-skip is a full repo-relative path. `max_tls_tickets` is no longer banned. It sizes the rustls client session cache backing ordinary 1-RTT resumption (iroh endpoint.rs:742 -> tls.rs:55), not early data, so forbidding it in a test named "no early data emitters" blocked tuning a mechanism this workspace still relies on. Dropping the call silently took the cache 1000 -> 256; that is now in the CHANGELOG with its operational consequence. Docs: a resumed rustls handshake still runs the full ECDHE exchange — it skips certificate transmission and signature verification. `psk_dhe` is hard-coded true with `psk` false (rustls client/hs.rs:309), so the "skips the handshake's asymmetric crypto" claim was wrong in canonical ADR 005, the CHANGELOG, and the archived banner. ADR 005 also now says the no-early-data invariant binds implementations rather than the wire. Also: the last orphaned ADR 015 citation (protocol/src/dht.rs); ADR 015 added to architecture.md's retired list, closing the unexplained 014 -> 016 gap; `PROBE_TIMEOUT` no longer claims a single round trip (probe_once dials fresh every call, so every probe is 2 RTT — flagged as the first term to revisit if distant-region selection looks sparse); probe_warm_reconnect states plainly that warmth is arranged, not asserted, since iroh exposes no resumption indicator, with TICKET_SETTLE's rationale corrected and the metric scrape moved after router shutdown to close a race against the server's post-write increment; the probe_client duplication note pointed at a nonexistent module and an obsolete blocker; and the "probe_once is not Send" premise inverted when the metrics sink was deleted, in four places. Recovers the surviving kernel of the deleted 0-RTT suite as `probe_survives_a_server_restart_under_the_same_identity`: same node id, fresh port, undecryptable cached ticket. Smaller items: quinn-proto GHSA-4w2j-m93h-cj5j Security entry; `decdn_probe_requests_total` catalogued in appendix-observability; key-rotation impact row rescoped now that no round trip is lost; dead `decdn-cli` workspace dependency dropped; `probe_collection_latency_seconds` labelled never-implemented; retiree roster in `_history` updated. Three pre-existing dangling ADR anchors fixed (008 x2, 011 -> a file that does not exist). Verified: cargo fmt --check, cargo clippy --workspace --all-targets -D warnings, cargo nextest run --no-fail-fast (2550 passed, +2), make -C adr check-refs check-book-list, cargo doc --no-deps --document-private-items, public-api snapshot unchanged, pre-commit over the changed files. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
dc605ea to
c2a494c
Compare
…rot again (#1473) `crates/node/tests/anvil_bringup_shutdown_e2e.rs` has not compiled since 2026-07-23. `ResolvedConfig` gained a `content` field in #1380 and `ResolvedCache` gained `max_rate_per_mb` in #1420; neither threaded the new field into this builder. Adding the two initializers is the whole fix — the test then passes on the first run, so nothing about the behaviour it asserts had actually regressed. The interesting part is why nobody noticed for three days. The `anvil e2e (settlement)` job ran `--test anvil_settlement_e2e`, a single-target filter, so this file was never built by any job in CI. It was even edited in its broken state by #1465 the day before this fix, because touching a file that no job compiles produces no signal. `cargo build --workspace --all-targets` does not catch it either: the target is behind the off-by-default `anvil-e2e` feature. So the job now names both anvil targets explicitly rather than filtering to one. A bare `-p decdn-node --features anvil-e2e` would have been shorter but drags the full unit suite in behind the feature flag and duplicates the `test` job; the explicit list keeps the job scoped while making a missing target a build failure instead of silence. The added target needs only `anvil` + `forge`, both already on PATH in that job, and drives `runtime::run` in-process, so it fits the "no daemon binary on disk" property the split relies on. Adds ~25s. Both targets pass together locally: 5 tests across 2 binaries. Incidental, found while auditing the metric registry for #1443: `decdn_probe_holds_disabled_total` was documented twice in `adr/appendix-observability.md` — once under § Slash-Safety Metrics and again under § Probe Metrics — and the two copies had already drifted in wording. The § Slash-Safety Metrics row is canonical (that section's preamble states the probe-hold capacity metrics are grouped there deliberately), so the § Probe Metrics copy is removed and replaced with a pointer naming all five probe-hold metrics and why they live elsewhere. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
What
Deletes the QUIC 0-RTT mechanism specified by ADR 015.
cdn/probe/v1now always completes a full TLS 1.3 handshake before sending the request — the exact path the code already fell back to when a ticket was missing or the server rejected early data.Removed:
network.enable_0rtt(schema field, resolver,DEFAULT_ENABLE_0RTT, CLI display line + config-template comment).into_0rtt()attempt/fallback branch, theenable_0rttgate, the post-exchange ticket linger (LINGER_MIN/MAX), and theProbeMetricssink — in both probe requesters (client-pull/src/probe.rsand the node-side copynode/src/probe_client.rs).max_tls_tickets(...)on the node endpoint and the CLI client endpoint;decdn_protocol::SESSION_TICKET_CACHE_SIZE(public-API snapshot re-blessed).ProbeHandler::on_acceptingand theenable_0rttfield/ctor arg.ClientHandler::on_acceptingwent too: it existed only to document the 0-RTT refusal and was byte-identical to iroh's default (accepting.await), so keeping it would have been an override that explains itself only in terms of a mechanism that no longer exists.decdn_quic_0rtt_{attempts,accepted,rejected}_total,decdn_quic_session_ticket_cache_size,decdn_quic_session_ticket_peers_dropped_total, plus the backingsession_ticket_peersset,note_session_ticket_peer,SESSION_TICKET_CACHE_CEILING, and the recorder macros.crates/node/tests/probe_0rtt.rs(664 lines).Kept:
cdn/probe/v1wire format and node-to-node probing (ADR 037), rustls session resumption for full handshakes, and stream multiplexing on open connections (ADR 005).Net: 50 files, +696/−1481. Added lines under
crates/outsidetests/directories: 107, and roughly a third of that is in-module unit tests (metrics.rs+14,config/mod.rs+17).Why the verdict is DROP, not "default it to false"
Per the issue's decision header. The win is one round trip that never compounds and only lands on a warm reconnect; the cost is a permanent footgun on the probe path. ADR 015 itself recorded that iroh sets
max_early_data_size = u32::MAXon every server TLS config, so 0-RTT acceptance was never server-gated — the guarantee was the hand-wired invariant "exactly one early-data-emitting client path". Removing the mechanism removes the invariant, the replay analysis, and the "probe handlers MUST be annotated 0-RTT-safe" obligation with it.What resumption actually keeps — and what it costs
Worth stating precisely, because an earlier revision of this PR got it wrong in three places.
A resumed rustls handshake still runs the full X25519 ECDHE key exchange. rustls never offers bare
psk_ke:rustls-0.23.37/src/client/hs.rs:309-311hard-codesPskKeyExchangeModes { psk: false, psk_dhe: true }, and the server refuses to resume withoutpsk_dhe. What resumption elides is the serverCertificate+CertificateVerifyand the client's verification of it — a signature, not "the asymmetric crypto". ADR 005, the CHANGELOG, and the retirement banner all say so now.Every probe is 2 RTT, not 1.
probe_oncedials a fresh connection on every call, so with 0-RTT gone even a resumable session pays a handshake round trip before the request goes out.PROBE_TIMEOUT(500 ms) previously justified itself with "warm connections complete in a single round trip"; that is no longer true, and against the 250–300 ms inter-continental figure in ADR 015's own context it puts the furthest candidates at or past the ceiling. Dropping them is the intended trade, butcrates/node/src/selection.rsnow records this as the first term to revisit if distant-region selection looks sparse.The client ticket cache shrank 1000 → 256. Dropping
max_tls_tickets(SESSION_TICKET_CACHE_SIZE)leaves iroh'sDEFAULT_MAX_TLS_TICKETS(iroh-1.0.0/src/tls.rs:33,8 * 32). That cache backs the retained 1-RTT resumption, not just early data — so a node probing more than 256 distinct peers between reconnections now re-handshakes in full where it previously resumed. This is in the CHANGELOG with the re-tuning pointer; it is a consequence worth a reviewer's opinion, not something this PR claims is free.Config migration
Config-breaking.
[network]carries#[serde(deny_unknown_fields)], so a node whose TOML still setsnetwork.enable_0rttnow fails at startup and underdecdn config validateinstead of silently ignoring it — the same policy commit19a3964used forprobe.rate_limit.trusted_ips/dht.rate_limit.trusted_ips, and for the same reason. Delete the line; the post-removal behaviour equalsenable_0rtt = false, which was already a supported state.Verified against the built binary, not just the unit test:
Tests
crates/node/tests/no_early_data_emitters.rs— the load-bearing guard. Scans every.rsfile under the workspace root (skippingtarget/and dot-dirs) and fails if any referencesinto_0rttorZeroRttStatus. Three properties make it worth its runtime:no_crate_requests_quic_early_datawas verified by mutation in both directions: plantingc.into_0rtt()incrates/cache/fails the guard naming the file; removing it passes. Same forZeroRttStatus.every_needle_matches_the_call_it_namesasserts each needle matches the call it names against a fixture, and stays quiet on prose. This exists because the first version of the guard was broken exactly this way —format!("into_0{rtt}")withrtt = "0rtt"assembles tointo_00rtt, so the primary needle could never match and re-addingAccepting::into_0rtt()would have passed CI.mod api_anchorpinsConnecting::into_0rtt,Accepting::into_0rtt, andZeroRttStatusto their real iroh types. Rename either entry point upstream and this test binary stops compiling, forcing the needle list to be updated — a plain-text grep against upstream API names would otherwise go permanently green.max_tls_ticketsis deliberately not in the forbidden list. It sizes the rustls client session cache backing ordinary 1-RTT resumption (iroh/src/endpoint.rs:742→src/tls.rs:55-64), not early data; banning it in a test named "no early data emitters" would forbid tuning a mechanism this PR keeps.crates/node/tests/probe_warm_reconnect.rs— two tests driving the productionProbeHandler(realRouter, real signer, real limiters):repeat_probes_on_a_reused_endpoint_answer_like_the_first— cold probe, then two more over one long-lived client endpoint, one through each probe requester. Asserts echoedhash/timestamp_us, unclamped rate, recoveringslash_sig, identical answers,decdn_probe_requests_total 3, and no0rtt/session_ticketseries in the real OpenMetrics output. The scrape happens afterrouter.shutdown(), because the handler increments the counter after writing the response frame and a returned client can otherwise be ahead of the server task.probe_survives_a_server_restart_under_the_same_identity— a client holding stale TLS session state probes a node that restarted under the same node id on a fresh port. The restarted server cannot decrypt its predecessor's ticket, so rustls falls back to a full handshake. Routine on the cache-miss path, and the surviving kernel of the deletedrejected_0rtt_falls_back_after_server_restart.Unit tests:
decdn-commonconfig::tests::network_rejects_removed_0rtt_keyanddecdn-nodemetrics::tests::quic_0rtt_and_session_ticket_series_are_not_exposed. Both fail before the change.Two honest limitations
No wire-level "no early data was sent" assertion. A test server converting every inbound connection with
Accepting::into_0rtt()and readingRecvStream::is_0rtt()detected deliberately sent early data in only 3/24 runs on loopback — the flag isis_handshaking()sampled whenaccept_biresolves, so it loses the race against handshake completion. A 20 ms delaying UDP forwarder did not fix it (1/8). This is why the guard is emitter-side. The property is nearly type-level anyway:Endpoint::connectyields aConnection, which iroh produces only by driving the handshake to completion or throughinto_0rtt— so the guard closes a small remaining gap rather than carrying the whole argument."Warm" in
probe_warm_reconnectis arranged, not asserted. Reusing one client endpoint gives later probes a cached ticket, but nothing verifies a given handshake resumed, because iroh exposes no way to ask —Connection::handshake_datacarries ALPN and server name only, andConnectionStatshas no resumption field. These tests would still pass if resumption silently stopped working. The module doc says so plainly rather than implying coverage that isn't there.Docs
ADR 015 is archived to
adr/_history/015-zero-rtt.mdwith a retirement banner and re-rooted cross-links, matching the 032–035 convention (numbers are never reused);015is added to CLAUDE.md's do-not-reuse list with a history entry, toarchitecture.md's retired-ADR parenthetical (which is what explains the 014 → 016 gap in the numeric index), and to the retiree roster in_history/alternatives-pre-launch.md. Removed fromadr/MakefileBOOK_SRCS.Swept every dangling reference — including the four the issue's list did not enumerate (
adr/005-protocol.md,adr/README.md,adr/appendix-operator-key-rotation.md,adr/appendix-operator-upgrade-path.md) plusadr/022-content-discovery.md,adr/architecture.md,adr/appendix-observability.md,adr/_build/part-2-discovery.md, the rootREADME.md, a staleCargo.tomlcomment, and the doc-comment mirror incrates/protocol/src/dht.rsthatadr/Makefile's.md-only checker could never have caught. Canonical docs read as if 0-RTT was never there: no tombstones, no supersedes voice.Two smaller doc corrections fall out of the same sweep.
adr/005-protocol.mdnow says the no-early-data property binds implementations rather than the wire — iroh accepts early data on any ALPN regardless of handler, so it is held on the emitter side, not enforced on receipt. Andappendix-operator-key-rotation.md's ticket-invalidation row no longer promises a "brief P95 bump": post-removal, clients pay a full handshake either way, so rotation costs certificate verification and no round trip.Also in this PR
quinn-proto→ 0.11.16 for GHSA-4w2j-m93h-cj5j (remote memory exhaustion in the QUIC state machine). Lockfile-only; now carries a### SecurityCHANGELOG entry in the established format.decdn_probe_requests_totaladded to the observability catalogue — it is exported by the node but was undocumented.decdn-cli[workspace.dependencies]entry dropped (nothing in the workspace depends on it).probe_once-is-not-Sendpremise inverted when theProbeMetricssink was deleted, so the four comments built on it (crates/cli/Cargo.toml,fetch.rs,file_manifest.rs,bundle_pull.rs) now say single-task is a choice.node/src/probe_client.rs's duplication note pointed atcli::commands::probe_client(does not exist) and cited a dependency blocker that no longer applies —nodealready depends ondecdn-client-pulland re-exports it asclient_requester. It now names the real counterpart and says the copy is redundant rather than forced.Rebase note
Rebased onto
mainat519fba2f. Three textual conflicts, all resolved:CLAUDE.mddo-not-reuse list — union of main's006(docs(adr): drop encrypted publishing appendix #1454) and this PR's015.appendix-observability.mdscope line — main still named 0-RTT panels as the "not exhaustive" example; this PR had swapped it for tokenomics panels, which docs(observability): drop tokenomics metrics #1449 then deleted from main. Both referents are gone, so the sentence now just ends.appendix-operator-upgrade-path.md— main replaced the whole Tier 3 rollout procedure with a short classification-boundary section, so this PR's edit inside the deleted text was dropped in favour of main's version.Separately, #1460 landed the same three dangling-anchor fixes this PR had also made (
008-reputation.md×2,011-content-takedown.md), with character-identical resolutions, plus a realcheck-anchor-targets.awkguard. The duplicate hunks dropped out of the rebase cleanly, and the new guard passes on this branch: 1662 anchor links resolve across 39 files.Verification (actual output, post-rebase)
That markdownlint failure is pre-existing and unrelated — it reproduces on a clean
origin/mainworktree, the file was last touched in #1002, and it is not in this branch's diff. Left alone rather than widening scope.No contracts touched, so no forge/gas-snapshot/slither run is implicated.
Closes #1429