From 74be2bf05089bac214d06a6b16f394f98f094361 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Sat, 24 Oct 2026 10:06:42 -0700 Subject: [PATCH 1/4] quest: plan pure-Rust crypto, the C name clash, and the crate split rerun Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0115AT2ue6x9cT5e5J9SZtCn --- quest/m1/c/README.md | 1 + quest/m1/c/name-clash.md | 17 ++++++++++ quest/m2/README.md | 2 ++ quest/m2/ffi-crate-split.md | 24 ++++++++++++++ quest/m2/pure-crypto/README.md | 28 +++++++++++++++++ quest/m2/pure-crypto/acme-upstream.md | 26 ++++++++++++++++ quest/m2/pure-crypto/jwt-graviola.md | 27 ++++++++++++++++ quest/m2/pure-crypto/relay-graviola.md | 43 ++++++++++++++++++++++++++ 8 files changed, 168 insertions(+) create mode 100644 quest/m1/c/name-clash.md create mode 100644 quest/m2/ffi-crate-split.md create mode 100644 quest/m2/pure-crypto/README.md create mode 100644 quest/m2/pure-crypto/acme-upstream.md create mode 100644 quest/m2/pure-crypto/jwt-graviola.md create mode 100644 quest/m2/pure-crypto/relay-graviola.md diff --git a/quest/m1/c/README.md b/quest/m1/c/README.md index 0f13a5b2123..2366825773c 100644 --- a/quest/m1/c/README.md +++ b/quest/m1/c/README.md @@ -65,6 +65,7 @@ requests internally and keeps its ABI, so that quest does not wait here. ## Required +- [One C name per moq-ffi item](/quest/m1/c/name-clash.md) - `MoqAudioEncoder::finish` and `MoqAudioEncoderFinish` stop sharing `moq_audio_encoder_finish` - [moq-c package](/quest/m1/c/package.md) - the generated header ships as `moq-c` 0.8.0 with `moq::c`, pkg-config, and a release workflow - [C consumers](/quest/m1/c/consumers.md) - the C interop client and `doc/lib/c` samples move onto the generated API - [Async failure contract](/quest/m1/c/async-failure-contract.md) - a generated async call that fails early fires no callback, and one that started always delivers its terminal callback diff --git a/quest/m1/c/name-clash.md b/quest/m1/c/name-clash.md new file mode 100644 index 00000000000..514ca5866a5 --- /dev/null +++ b/quest/m1/c/name-clash.md @@ -0,0 +1,17 @@ +# [S] One C name per moq-ffi item + +## Goal + +The generated C header gives every moq-ffi item its own name. Today the method +`MoqAudioEncoder::finish` and the record `MoqAudioEncoderFinish` both map to +`moq_audio_encoder_finish`. + +## Plan + +Either rename one of the two in moq-ffi, or fix the C backend in +[kixelated/rust2](https://github.com/kixelated/rust2)'s UniFFI fork so a method +and a type can never map to the same C name. Ask the maintainer which before +starting. + +Public API: the C name of one of the two items, or of every colliding pair the +generator renames. Wire: none. diff --git a/quest/m2/README.md b/quest/m2/README.md index 5059da4d5b7..0681340dd31 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -25,6 +25,8 @@ lite-07; bitrate enforcement is not part of this release. - [P2P](/quest/m2/p2p/README.md) - application-selected peer sessions use shared priorities, routing, and same-epoch handover - [rust2 publishes its UniFFI fork](/quest/m2/rust2-uniffi.md) - waiting on kixelated/rust2 to import UniFFI and moq's generators and publish them - [Switch to rust2's UniFFI](/quest/m2/uniffi-fork.md) - moq-ffi and every wrapper build from kixelated/rust2's fork under one pin, and moq's generator code is deleted +- [Re-run the per-layer crate split](/quest/m2/ffi-crate-split.md) - with same-named types across crates fixed in rust2's fork, the maintainer re-decides moq-ffi's split +- [Pure-Rust crypto for moq-relay](/quest/m2/pure-crypto/README.md) - moq-relay's release builds use graviola and RustCrypto and compile no C - [Benchmark sources](/quest/m2/bench-sources.md) - every measuring nightly benchmark feeds the regression table, and none is a smoke run - [Link the benchmark trends](/quest/m2/bench-site-doc.md) - the docs point language choosers at the regression table - [Poll-native async](/quest/m2/ffi-poll-migrate.md) - moq-ffi's pure-kio async exports poll their state directly instead of going through `ffi::Task` diff --git a/quest/m2/ffi-crate-split.md b/quest/m2/ffi-crate-split.md new file mode 100644 index 00000000000..69bbaa32019 --- /dev/null +++ b/quest/m2/ffi-crate-split.md @@ -0,0 +1,24 @@ +# [S] Re-run the per-layer crate split decision + +## Goal + +The maintainer re-decides whether moq-ffi splits into one UniFFI crate per layer, +so a layer reuses the net noun it wraps (`media.GroupConsumer(group: +GroupConsumer)`), from a fresh report against rust2's UniFFI fork. + +## Plan + +[moq-dev/moq#5460](https://github.com/moq-dev/moq/pull/5460) rejected the split +on 2026-10-13 because UniFFI keyed types by bare name, so no generator could +take the same noun from two crates. +[kixelated/rust2#21](https://github.com/kixelated/rust2/pull/21) fixes that in +every generator of rust2's fork, reusing #5460's two-crate harness. What #5460 +measured still stands until re-measured: each extra crate adds about 48 KB of +scaffolding to the cdylib. + +Public API: none here; a split would rename every binding's namespaces. +Wire: none. + +## Related + +- [Switch to rust2's UniFFI](/quest/m2/uniffi-fork.md) - the fork the split would build on diff --git a/quest/m2/pure-crypto/README.md b/quest/m2/pure-crypto/README.md new file mode 100644 index 00000000000..7434189d670 --- /dev/null +++ b/quest/m2/pure-crypto/README.md @@ -0,0 +1,28 @@ +# Pure-Rust crypto for moq-relay + +## Goal + +moq-relay's release builds compile no C: its crypto moves off aws-lc-rs onto +graviola and RustCrypto, with no hand-rolled primitive, and aws-lc-rs stays +where graviola does not run. + +## Plan + +Decided with the maintainer on 2026-10-24: adopt all seven recommendations of +the spike in [kixelated/rust2#13](https://github.com/kixelated/rust2/pull/13), +which has the numbers, prototyped on moq's +[`spike/pure-crypto`](https://github.com/moq-dev/moq/tree/spike/pure-crypto) +branch. In short: a clean `cargo check` of moq-relay retires 24% fewer +instructions and a build 14% fewer, since aws-lc-sys's build script leaves the +critical path; handshakes are about a third faster; AES-GCM packets and relay +throughput are even; ChaCha20-Poly1305 packets are 1.7-3x slower. + +Split into three quests, so the relay can move while the upstream change waits. +rust2's [no-C check](https://github.com/kixelated/rust2/blob/main/quest/m3/bench-no-c.md) +keeps C from creeping back into the build it benchmarks. + +## Required + +- [JWT on graviola](/quest/m2/pure-crypto/jwt-graviola.md) - moq-auth signs and verifies tokens through a graviola-based jsonwebtoken provider, with no `rsa` crate +- [moq-relay on graviola](/quest/m2/pure-crypto/relay-graviola.md) - moq-relay's x86_64 and aarch64 release builds use graviola as their rustls provider and compile no C +- [Provider-neutral rustls-acme](/quest/m2/pure-crypto/acme-upstream.md) - rustls-acme takes any rustls crypto provider upstream, and moq drops its patched copy diff --git a/quest/m2/pure-crypto/acme-upstream.md b/quest/m2/pure-crypto/acme-upstream.md new file mode 100644 index 00000000000..3b73b499492 --- /dev/null +++ b/quest/m2/pure-crypto/acme-upstream.md @@ -0,0 +1,26 @@ +# [S] Provider-neutral rustls-acme upstream + +## Goal + +rustls-acme takes its crypto from any rustls `CryptoProvider` instead of +hard-requiring ring or aws-lc-rs, in a release moq can depend on, and moq drops +its patched copy. Check: rustls-acme's latest release builds with neither its +`ring` nor its `aws-lc-rs` feature. + +## Plan + +Decided with the maintainer on 2026-10-24, from +[kixelated/rust2#13](https://github.com/kixelated/rust2/pull/13)'s decision 1: +upstream a provider-neutral crypto hook, as rustls-acme's own TODO asks, and +carry the spike's patched copy (crypto on graviola and P-256) only until it +lands. instant-acme hard-requires ring or aws-lc-rs too. + +Posting upstream is outside the kixelated and moq-dev organizations, so it needs +the maintainer's approval when this starts. + +Public API: none. Wire: none. + +## Related + +- [moq-relay on graviola](/quest/m2/pure-crypto/relay-graviola.md) - carries the patched copy until this lands +- [ACME renewal budget](/quest/m1/acme-renewal-budget.md) - also works around rustls-acme's order loop diff --git a/quest/m2/pure-crypto/jwt-graviola.md b/quest/m2/pure-crypto/jwt-graviola.md new file mode 100644 index 00000000000..280d10cdc36 --- /dev/null +++ b/quest/m2/pure-crypto/jwt-graviola.md @@ -0,0 +1,27 @@ +# [M] JWT on graviola + +## Goal + +moq-auth signs and verifies JWTs through a jsonwebtoken `CryptoProvider` built +on graviola, so moq-relay's graph holds neither the `rsa` crate nor the second +RustCrypto generation that jsonwebtoken's `rust_crypto` backend pins, and every +algorithm moq-auth accepts today still verifies. + +## Plan + +Decided with the maintainer on 2026-10-24, from +[kixelated/rust2#13](https://github.com/kixelated/rust2/pull/13)'s decision 3: +the spike's `rust_crypto` backend signs RS* and PS* with the `rsa` crate, which +is exposed to the Marvin timing attack (RUSTSEC-2023-0071; `deny.toml`'s ignore +of it relies on aws-lc-rs), and adds p256/p384 0.13, ecdsa 0.16, crypto-bigint +0.5, and ed25519-dalek 2 to the graph. graviola has constant-time RSA, ECDSA, +Ed25519, and HMAC. + +Never hand-roll a primitive; the provider only adapts graviola to jsonwebtoken's +traits. + +Public API: none expected; say so if moq-auth's key types change. Wire: none. + +## Related + +- [moq-relay on graviola](/quest/m2/pure-crypto/relay-graviola.md) - the rest of the relay's crypto diff --git a/quest/m2/pure-crypto/relay-graviola.md b/quest/m2/pure-crypto/relay-graviola.md new file mode 100644 index 00000000000..0deda5e1453 --- /dev/null +++ b/quest/m2/pure-crypto/relay-graviola.md @@ -0,0 +1,43 @@ +# [L] moq-relay on graviola + +## Goal + +moq-relay's release targets on x86_64 and aarch64 use graviola as their rustls +provider, and their graph compiles no C: no aws-lc-sys, ring, `cc`, or `cmake`, +checked with `cargo tree -i`. Every other target, and every other crate that uses +aws-lc-rs today, keeps it. + +## Plan + +Decided with the maintainer on 2026-10-24: adopt +[kixelated/rust2#13](https://github.com/kixelated/rust2/pull/13)'s +recommendations, starting from moq's +[`spike/pure-crypto`](https://github.com/moq-dev/moq/tree/spike/pure-crypto) +branch: + +- graviola only supports x86_64 and aarch64, so it is the provider for + moq-relay's release targets there; aws-lc-rs stays the default elsewhere. +- moq-tokio refuses `aws-lc-rs` and `graviola` enabled at once. With both on, + aws-lc-rs won silently, which hid a graviola-only bug in the spike and would + make a workspace build benchmark aws-lc. CI builds and tests moq-relay alone, + so feature unification cannot pick the provider. +- Keep moq-quic's QUIC adapter for graviola (graviola seals packets, RustCrypto + computes header-protection masks) until rustls-graviola ships QUIC keys + ([ctz/graviola#156](https://github.com/ctz/graviola/pull/156)), then delete it. +- rustls-acme refuses to build without ring or aws-lc-rs, so moq carries the + spike's patched copy until [the upstream hook](/quest/m2/pure-crypto/acme-upstream.md) + lands. +- Accept ChaCha20-Poly1305 on graviola being 1.7-3x slower than aws-lc per + packet, and record it. It only matters for peers that prefer ChaCha20, which + lack AES hardware. + +Public API: moq-tokio's and moq-quic's crypto features; moq-relay's TLS provider +on its release targets. Wire: none. + +## Required + +- [JWT on graviola](/quest/m2/pure-crypto/jwt-graviola.md) - moq-relay never ships the `rust_crypto` backend's `rsa` in between + +## Related + +- [moq-quic's crypto is rustls](/quest/m1/quic-api/crypto.md) - reshapes the crypto surface the QUIC adapter plugs into From 43db663eacba41f87ae4a0ba6dabf403010a4347 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Sat, 24 Oct 2026 11:20:48 -0700 Subject: [PATCH 2/4] quest: scope the name-clash rename, Swift's modules, and the per-target check Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0115AT2ue6x9cT5e5J9SZtCn --- quest/m1/c/name-clash.md | 5 +++-- quest/m2/ffi-crate-split.md | 4 +++- quest/m2/pure-crypto/relay-graviola.md | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/quest/m1/c/name-clash.md b/quest/m1/c/name-clash.md index 514ca5866a5..728344639da 100644 --- a/quest/m1/c/name-clash.md +++ b/quest/m1/c/name-clash.md @@ -13,5 +13,6 @@ Either rename one of the two in moq-ffi, or fix the C backend in and a type can never map to the same C name. Ask the maintainer which before starting. -Public API: the C name of one of the two items, or of every colliding pair the -generator renames. Wire: none. +Public API: a rename in moq-ffi changes that item's name in every binding (Python, +Swift, Kotlin, Dart, Go, C++, and C); a generator fix changes only the C names of +the pairs it renames. Wire: none. diff --git a/quest/m2/ffi-crate-split.md b/quest/m2/ffi-crate-split.md index 69bbaa32019..08f9f62de13 100644 --- a/quest/m2/ffi-crate-split.md +++ b/quest/m2/ffi-crate-split.md @@ -12,7 +12,9 @@ GroupConsumer)`), from a fresh report against rust2's UniFFI fork. on 2026-10-13 because UniFFI keyed types by bare name, so no generator could take the same noun from two crates. [kixelated/rust2#21](https://github.com/kixelated/rust2/pull/21) fixes that in -every generator of rust2's fork, reusing #5460's two-crate harness. What #5460 +every generator of rust2's fork, reusing #5460's two-crate harness. Swift takes +same-named types only with one module per crate, while moq's Swift package builds +one module today, so the report covers that packaging change. What #5460 measured still stands until re-measured: each extra crate adds about 48 KB of scaffolding to the cdylib. diff --git a/quest/m2/pure-crypto/relay-graviola.md b/quest/m2/pure-crypto/relay-graviola.md index 0deda5e1453..846cb541002 100644 --- a/quest/m2/pure-crypto/relay-graviola.md +++ b/quest/m2/pure-crypto/relay-graviola.md @@ -4,7 +4,7 @@ moq-relay's release targets on x86_64 and aarch64 use graviola as their rustls provider, and their graph compiles no C: no aws-lc-sys, ring, `cc`, or `cmake`, -checked with `cargo tree -i`. Every other target, and every other crate that uses +checked with `cargo tree -i` for each release target triple. Every other target, and every other crate that uses aws-lc-rs today, keeps it. ## Plan From 61f90e033819fb1646411265ac1b0dbb94f30a73 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Sat, 24 Oct 2026 11:24:49 -0700 Subject: [PATCH 3/4] quest: fix the C name clash in the generator Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0115AT2ue6x9cT5e5J9SZtCn --- quest/m1/c/README.md | 2 +- quest/m1/c/name-clash.md | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/quest/m1/c/README.md b/quest/m1/c/README.md index 3da584c4faf..75082e8001e 100644 --- a/quest/m1/c/README.md +++ b/quest/m1/c/README.md @@ -65,7 +65,7 @@ requests internally and keeps its ABI, so that quest does not wait here. ## Required -- [One C name per moq-ffi item](/quest/m1/c/name-clash.md) - `MoqAudioEncoder::finish` and `MoqAudioEncoderFinish` stop sharing `moq_audio_encoder_finish` +- [One C name per moq-ffi item](/quest/m1/c/name-clash.md) - rust2's C generator derives collision-free names, so `MoqAudioEncoder::finish` and `MoqAudioEncoderFinish` stop sharing `moq_audio_encoder_finish` - [moq-c package](/quest/m1/c/package.md) - the generated header ships as `moq-c` 0.8.0 with `moq::c`, pkg-config, and a release workflow - [C consumers](/quest/m1/c/consumers.md) - the C interop client and `doc/lib/c` samples move onto the generated API - [Async failure contract](/quest/m1/c/async-failure-contract.md) - a generated async call that fails early fires no callback, and one that started always delivers its terminal callback diff --git a/quest/m1/c/name-clash.md b/quest/m1/c/name-clash.md index 728344639da..98ca21d8257 100644 --- a/quest/m1/c/name-clash.md +++ b/quest/m1/c/name-clash.md @@ -8,11 +8,12 @@ The generated C header gives every moq-ffi item its own name. Today the method ## Plan -Either rename one of the two in moq-ffi, or fix the C backend in -[kixelated/rust2](https://github.com/kixelated/rust2)'s UniFFI fork so a method -and a type can never map to the same C name. Ask the maintainer which before -starting. +Decided with the maintainer on 2026-10-24: fix the C generator, not moq-ffi. The +generator derives collision-free names, for example by qualifying a method with +its type, so no moq-ffi item is renamed. -Public API: a rename in moq-ffi changes that item's name in every binding (Python, -Swift, Kotlin, Dart, Go, C++, and C); a generator fix changes only the C names of -the pairs it renames. Wire: none. +The generator lives in [kixelated/rust2](https://github.com/kixelated/rust2)'s +UniFFI fork (`uniffi/`), so the work lands there. This quest stands in for it +until moq builds from a fork that ships the fix. + +Public API: the C names of the pairs the generator renames. Wire: none. From 4af4cb0ae4ddd2f95829890d54b0a28ec2e1b7ef Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Sat, 24 Oct 2026 15:28:06 -0700 Subject: [PATCH 4/4] quest: drop the link to the finished ACME renewal quest Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0115AT2ue6x9cT5e5J9SZtCn --- quest/m2/pure-crypto/acme-upstream.md | 1 - 1 file changed, 1 deletion(-) diff --git a/quest/m2/pure-crypto/acme-upstream.md b/quest/m2/pure-crypto/acme-upstream.md index 3b73b499492..94aed1960f6 100644 --- a/quest/m2/pure-crypto/acme-upstream.md +++ b/quest/m2/pure-crypto/acme-upstream.md @@ -23,4 +23,3 @@ Public API: none. Wire: none. ## Related - [moq-relay on graviola](/quest/m2/pure-crypto/relay-graviola.md) - carries the patched copy until this lands -- [ACME renewal budget](/quest/m1/acme-renewal-budget.md) - also works around rustls-acme's order loop