From 15f38df7e5cb2ecd9999e44a6a39f65cd63056be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Tue, 17 Mar 2026 09:51:25 +0100 Subject: [PATCH 01/10] chore(proto): Update to rand 0.10 --- Cargo.lock | 267 +++++++++++++++++++-- Cargo.toml | 7 +- noq-proto/Cargo.toml | 2 +- noq-proto/src/cid_generator.rs | 3 +- noq-proto/src/config/mod.rs | 2 +- noq-proto/src/congestion/bbr/mod.rs | 8 +- noq-proto/src/connection/assembler.rs | 3 +- noq-proto/src/connection/mod.rs | 2 +- noq-proto/src/connection/packet_builder.rs | 2 +- noq-proto/src/connection/packet_crypto.rs | 2 +- noq-proto/src/connection/spaces.rs | 4 +- noq-proto/src/endpoint.rs | 4 +- noq-proto/src/tests/mod.rs | 2 +- noq-proto/src/token.rs | 5 +- noq-proto/src/transport_parameters.rs | 23 +- noq/src/tests.rs | 2 +- noq/tests/many_connections.rs | 2 +- 17 files changed, 287 insertions(+), 53 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 23b1c48fa..4b66784ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,7 +35,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", - "cpufeatures", + "cpufeatures 0.2.17", ] [[package]] @@ -545,6 +545,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chacha20" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.0", +] + [[package]] name = "ciborium" version = "0.2.2" @@ -742,6 +753,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "crc" version = "3.3.0" @@ -1022,13 +1042,13 @@ dependencies = [ [[package]] name = "fastbloom" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18c1ddb9231d8554c2d6bdf4cfaabf0c59251658c68b6c95cd52dd0c513a912a" +version = "0.17.0" +source = "git+https://github.com/matheus23/fastbloom?branch=matheus23%2Frand-0.10#2710d2688ea7f726f08e734d904311e08598d7c7" dependencies = [ - "getrandom 0.3.3", + "foldhash 0.2.0", "libm", - "rand", + "portable-atomic", + "rand 0.10.0", "siphasher", ] @@ -1060,6 +1080,18 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "form_urlencoded" version = "1.2.2" @@ -1180,11 +1212,25 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "r-efi", + "r-efi 5.3.0", "wasi 0.14.7+wasi-0.2.4", "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.0", + "wasip2", + "wasip3", +] + [[package]] name = "ghash" version = "0.5.1" @@ -1236,6 +1282,15 @@ dependencies = [ "crunchy", ] +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + [[package]] name = "hashbrown" version = "0.16.0" @@ -1467,6 +1522,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "ident_case" version = "1.0.1" @@ -1507,7 +1568,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.16.0", + "serde", + "serde_core", ] [[package]] @@ -1599,6 +1662,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libc" version = "0.2.176" @@ -1785,7 +1854,7 @@ dependencies = [ "noq-proto", "noq-udp", "pin-project-lite", - "rand", + "rand 0.10.0", "rcgen", "rustc-hash", "rustls", @@ -1822,7 +1891,7 @@ dependencies = [ "lru-slab", "n0-qlog", "proptest", - "rand", + "rand 0.10.0", "rand_pcg", "rcgen", "ring", @@ -2059,11 +2128,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "opaque-debug", "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" + [[package]] name = "potential_utf" version = "0.1.3" @@ -2115,7 +2190,7 @@ checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" dependencies = [ "bitflags", "num-traits", - "rand", + "rand 0.9.2", "rand_chacha", "rand_xorshift", "regex-syntax", @@ -2169,6 +2244,12 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "rand" version = "0.9.2" @@ -2176,7 +2257,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha", - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc266eb313df6c5c09c1c7b1fbe2510961e5bcd3add930c1e31f7ed9da0feff8" +dependencies = [ + "chacha20", + "getrandom 0.4.2", + "rand_core 0.10.0", ] [[package]] @@ -2186,7 +2278,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.9.3", ] [[package]] @@ -2198,13 +2290,19 @@ dependencies = [ "getrandom 0.3.3", ] +[[package]] +name = "rand_core" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" + [[package]] name = "rand_pcg" -version = "0.9.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b48ac3f7ffaab7fac4d2376632268aa5f89abdb55f7ebf8f4d11fffccb2320f7" +checksum = "2a36dd10a879f5c16e363eed24471b321b114ce3112c2d5d8df06545fcf48152" dependencies = [ - "rand_core", + "rand_core 0.10.0", ] [[package]] @@ -2213,7 +2311,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" dependencies = [ - "rand_core", + "rand_core 0.9.3", ] [[package]] @@ -3161,7 +3259,16 @@ version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.46.0", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", ] [[package]] @@ -3254,6 +3361,40 @@ dependencies = [ "syn", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + [[package]] name = "web-sys" version = "0.3.83" @@ -3557,6 +3698,94 @@ version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + [[package]] name = "writeable" version = "0.6.1" diff --git a/Cargo.toml b/Cargo.toml index 41746ad23..1fe2d1f74 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ bytes = "1" clap = { version = "4.5", features = ["derive"] } crc = "3" directories-next = "2" -fastbloom = "0.14" +fastbloom = "0.17" futures-io = "0.3.19" getrandom = { version = "0.3", default-features = false } hdrhistogram = { version = "7.2", default-features = false } @@ -34,7 +34,7 @@ log = "0.4" pin-project-lite = "0.2" proptest = { version = "1.9.0", default-features = false, features = ["std"] } qlog = { package = "n0-qlog", version = "0.1.0" } -rand = "0.9" +rand = "0.10" rcgen = "0.14" ring = "0.17" rustc-hash = "2" @@ -89,3 +89,6 @@ unreachable_pub = "warn" manual_let_else = "warn" or_fun_call = "warn" use_self = "warn" + +[patch.crates-io] +fastbloom = { git = "https://github.com/matheus23/fastbloom", branch = "matheus23/rand-0.10" } diff --git a/noq-proto/Cargo.toml b/noq-proto/Cargo.toml index a1e442997..5f8a075d0 100644 --- a/noq-proto/Cargo.toml +++ b/noq-proto/Cargo.toml @@ -86,7 +86,7 @@ web-time = { workspace = true } assert_matches = { workspace = true } hex-literal = { workspace = true } proptest = { workspace = true } -rand_pcg = "0.9" +rand_pcg = "0.10" rcgen = { workspace = true } test-strategy = { workspace = true } testresult = "0.4.1" diff --git a/noq-proto/src/cid_generator.rs b/noq-proto/src/cid_generator.rs index e57acb9e3..84575419e 100644 --- a/noq-proto/src/cid_generator.rs +++ b/noq-proto/src/cid_generator.rs @@ -1,6 +1,7 @@ use std::hash::Hasher; -use rand::{Rng, RngCore}; +use rand::Rng; +use rand::RngExt; use crate::Duration; use crate::MAX_CID_SIZE; diff --git a/noq-proto/src/config/mod.rs b/noq-proto/src/config/mod.rs index e380831fd..8be51a764 100644 --- a/noq-proto/src/config/mod.rs +++ b/noq-proto/src/config/mod.rs @@ -185,7 +185,7 @@ impl Default for EndpointConfig { fn default() -> Self { #[cfg(all(feature = "aws-lc-rs", not(feature = "ring")))] use aws_lc_rs::hmac; - use rand::RngCore; + use rand::Rng; #[cfg(feature = "ring")] use ring::hmac; diff --git a/noq-proto/src/congestion/bbr/mod.rs b/noq-proto/src/congestion/bbr/mod.rs index a8607b713..7450c707a 100644 --- a/noq-proto/src/congestion/bbr/mod.rs +++ b/noq-proto/src/congestion/bbr/mod.rs @@ -2,7 +2,7 @@ use std::any::Any; use std::fmt::Debug; use std::sync::Arc; -use rand::{Rng, SeedableRng}; +use rand::RngExt; use crate::congestion::ControllerMetrics; use crate::congestion::bbr::bw_estimation::BandwidthEstimation; @@ -56,7 +56,6 @@ pub struct Bbr { bw_at_last_round: u64, round_wo_bw_gain: u64, ack_aggregation: AckAggregationState, - random_number_generator: rand::rngs::StdRng, } impl Bbr { @@ -97,7 +96,6 @@ impl Bbr { bw_at_last_round: 0, round_wo_bw_gain: 0, ack_aggregation: AckAggregationState::default(), - random_number_generator: rand::rngs::StdRng::from_os_rng(), } } @@ -114,9 +112,7 @@ impl Bbr { // Pick a random offset for the gain cycle out of {0, 2..7} range. 1 is // excluded because in that case increased gain and decreased gain would not // follow each other. - let mut rand_index = self - .random_number_generator - .random_range(0..K_PACING_GAIN.len() as u8 - 1); + let mut rand_index = rand::rng().random_range(0..K_PACING_GAIN.len() as u8 - 1); if rand_index >= 1 { rand_index += 1; } diff --git a/noq-proto/src/connection/assembler.rs b/noq-proto/src/connection/assembler.rs index 7c4d68ec1..16a40638d 100644 --- a/noq-proto/src/connection/assembler.rs +++ b/noq-proto/src/connection/assembler.rs @@ -676,6 +676,7 @@ mod test { #[cfg(all(test, not(target_family = "wasm")))] mod proptests { use proptest::prelude::*; + use rand::RngExt; use test_strategy::{Arbitrary, proptest}; use super::*; @@ -743,7 +744,7 @@ mod proptests { } fn make_data() -> Vec { - use rand::{Rng, SeedableRng}; + use rand::SeedableRng; let mut rng = rand::rngs::StdRng::seed_from_u64(0xDEADBEEF); let mut data = vec![0u8; MAX_OFFSET as usize]; rng.fill(data.as_mut_slice()); diff --git a/noq-proto/src/connection/mod.rs b/noq-proto/src/connection/mod.rs index 3428cb1a9..1060d9efb 100644 --- a/noq-proto/src/connection/mod.rs +++ b/noq-proto/src/connection/mod.rs @@ -11,7 +11,7 @@ use std::{ use bytes::{Bytes, BytesMut}; use frame::StreamMetaVec; -use rand::{Rng, SeedableRng, rngs::StdRng}; +use rand::{RngExt, SeedableRng, rngs::StdRng}; use rustc_hash::{FxHashMap, FxHashSet}; use thiserror::Error; use tracing::{debug, error, trace, trace_span, warn}; diff --git a/noq-proto/src/connection/packet_builder.rs b/noq-proto/src/connection/packet_builder.rs index 9ea341530..a2c2146c8 100644 --- a/noq-proto/src/connection/packet_builder.rs +++ b/noq-proto/src/connection/packet_builder.rs @@ -1,5 +1,5 @@ use bytes::{BufMut, Bytes}; -use rand::Rng; +use rand::RngExt; use tracing::{debug, trace, trace_span}; use super::{Connection, PathId, SentFrames, TransmitBuf, spaces::SentPacket}; diff --git a/noq-proto/src/connection/packet_crypto.rs b/noq-proto/src/connection/packet_crypto.rs index 67df6c557..2b8eb48f3 100644 --- a/noq-proto/src/connection/packet_crypto.rs +++ b/noq-proto/src/connection/packet_crypto.rs @@ -8,7 +8,7 @@ use crate::connection::assembler::Assembler; use crate::crypto::{self, HeaderKey, KeyPair, Keys, PacketKey}; use crate::packet::{Packet, PartialDecode}; use crate::token::ResetToken; -use rand::{CryptoRng, Rng}; +use rand::{CryptoRng, RngExt}; use crate::{ConnectionId, Instant, Side}; use crate::{RESET_TOKEN_SIZE, TransportError}; diff --git a/noq-proto/src/connection/spaces.rs b/noq-proto/src/connection/spaces.rs index ab3bdd35c..985da50f4 100644 --- a/noq-proto/src/connection/spaces.rs +++ b/noq-proto/src/connection/spaces.rs @@ -6,7 +6,7 @@ use std::{ ops::{Bound, Index, IndexMut}, }; -use rand::{CryptoRng, Rng}; +use rand::{CryptoRng, RngExt}; use rustc_hash::{FxHashMap, FxHashSet}; use sorted_index_buffer::SortedIndexBuffer; use tracing::trace; @@ -1279,7 +1279,7 @@ const MAX_ACK_BLOCKS: usize = 64; #[cfg(test)] mod test { - use rand::RngCore; + use rand::Rng; use rand::seq::SliceRandom; use crate::token::ResetToken; diff --git a/noq-proto/src/endpoint.rs b/noq-proto/src/endpoint.rs index d34bc9498..2f819f74d 100644 --- a/noq-proto/src/endpoint.rs +++ b/noq-proto/src/endpoint.rs @@ -8,7 +8,7 @@ use std::{ }; use bytes::{Buf, BufMut, Bytes, BytesMut}; -use rand::{Rng, RngCore, SeedableRng, rngs::StdRng}; +use rand::{Rng, RngExt, SeedableRng, rngs::StdRng}; use rustc_hash::FxHashMap; use slab::Slab; use thiserror::Error; @@ -69,7 +69,7 @@ impl Endpoint { Self { rng: config .rng_seed - .map_or_else(StdRng::from_os_rng, StdRng::from_seed), + .map_or_else(|| StdRng::from_rng(&mut rand::rng()), StdRng::from_seed), index: ConnectionIndex::default(), connections: Slab::new(), local_cid_generator: (config.connection_id_generator_factory.as_ref())(), diff --git a/noq-proto/src/tests/mod.rs b/noq-proto/src/tests/mod.rs index ebbe609e0..e06d29618 100644 --- a/noq-proto/src/tests/mod.rs +++ b/noq-proto/src/tests/mod.rs @@ -10,7 +10,7 @@ use assert_matches::assert_matches; use aws_lc_rs::hmac; use bytes::{Bytes, BytesMut}; use hex_literal::hex; -use rand::RngCore; +use rand::Rng; #[cfg(feature = "ring")] use ring::hmac; use rustls::{ diff --git a/noq-proto/src/token.rs b/noq-proto/src/token.rs index 9595b3721..8de2b5d6f 100644 --- a/noq-proto/src/token.rs +++ b/noq-proto/src/token.rs @@ -4,7 +4,7 @@ use std::{ }; use bytes::{Buf, BufMut, Bytes}; -use rand::{CryptoRng, Rng}; +use rand::{CryptoRng, RngExt}; use crate::{ Duration, RESET_TOKEN_SIZE, ServerConfig, SystemTime, UNIX_EPOCH, @@ -403,10 +403,11 @@ impl fmt::Display for ResetToken { #[cfg(all(test, any(feature = "aws-lc-rs", feature = "ring")))] mod test { + use rand::Rng; + use crate::crypto::ring_like::RetryTokenKey; use super::*; - use rand::prelude::*; fn token_round_trip(payload: TokenPayload) -> TokenPayload { let rng = &mut rand::rng(); diff --git a/noq-proto/src/transport_parameters.rs b/noq-proto/src/transport_parameters.rs index f1d9c5319..65f0dce4f 100644 --- a/noq-proto/src/transport_parameters.rs +++ b/noq-proto/src/transport_parameters.rs @@ -13,7 +13,7 @@ use std::{ }; use bytes::{Buf, BufMut}; -use rand::{Rng as _, RngCore, seq::SliceRandom as _}; +use rand::{Rng, RngExt, seq::SliceRandom as _}; use thiserror::Error; use crate::{ @@ -163,7 +163,7 @@ impl TransportParameters { cid_gen: &dyn ConnectionIdGenerator, initial_src_cid: ConnectionId, server_config: Option<&ServerConfig>, - rng: &mut impl RngCore, + rng: &mut impl Rng, ) -> Self { Self { initial_src_cid: Some(initial_src_cid), @@ -639,7 +639,7 @@ impl ReservedTransportParameter { /// The implementation is inspired by quic-go and quiche: /// 1. /// 2. - fn random(rng: &mut impl RngCore) -> Self { + fn random(rng: &mut impl Rng) -> Self { let id = Self::generate_reserved_id(rng); let payload_len = rng.random_range(0..Self::MAX_PAYLOAD_LEN); @@ -667,7 +667,7 @@ impl ReservedTransportParameter { /// Reserved transport parameter identifiers are used to test compliance with the requirement /// that unknown transport parameters must be ignored by peers. /// See: and - fn generate_reserved_id(rng: &mut impl RngCore) -> VarInt { + fn generate_reserved_id(rng: &mut impl Rng) -> VarInt { let id = { let rand = rng.random_range(0u64..(1 << 62) - 27); let n = rand / 31; @@ -886,21 +886,23 @@ mod test { struct StepRng(u64); - impl RngCore for StepRng { + impl rand::TryRng for StepRng { + type Error = std::convert::Infallible; + #[inline] - fn next_u32(&mut self) -> u32 { - self.next_u64() as u32 + fn try_next_u32(&mut self) -> Result { + Ok(self.next_u64() as u32) } #[inline] - fn next_u64(&mut self) -> u64 { + fn try_next_u64(&mut self) -> Result { let res = self.0; self.0 = self.0.wrapping_add(1); - res + Ok(res) } #[inline] - fn fill_bytes(&mut self, dst: &mut [u8]) { + fn try_fill_bytes(&mut self, dst: &mut [u8]) -> Result<(), Self::Error> { let mut left = dst; while left.len() >= 8 { let (l, r) = left.split_at_mut(8); @@ -911,6 +913,7 @@ mod test { if n > 0 { left.copy_from_slice(&self.next_u32().to_le_bytes()[..n]); } + Ok(()) } } diff --git a/noq/src/tests.rs b/noq/src/tests.rs index 5f3994195..b6ad21b3b 100755 --- a/noq/src/tests.rs +++ b/noq/src/tests.rs @@ -19,7 +19,7 @@ use crate::runtime::TokioRuntime; use crate::{Duration, Instant}; use bytes::Bytes; use proto::{ConnectionError, RandomConnectionIdGenerator, crypto::rustls::QuicClientConfig}; -use rand::{RngCore, SeedableRng, rngs::StdRng}; +use rand::{Rng, SeedableRng, rngs::StdRng}; use rustls::{ RootCertStore, pki_types::{CertificateDer, PrivateKeyDer, PrivatePkcs8KeyDer}, diff --git a/noq/tests/many_connections.rs b/noq/tests/many_connections.rs index dbc8f54a4..5d3fcc8b9 100644 --- a/noq/tests/many_connections.rs +++ b/noq/tests/many_connections.rs @@ -8,7 +8,7 @@ use std::{ use crc::Crc; use noq::{self, ConnectionError, ReadError, StoppedError, TransportConfig, WriteError}; -use rand::{self, RngCore}; +use rand::{self, Rng}; use rustls::pki_types::{CertificateDer, PrivatePkcs8KeyDer}; use tokio::runtime::Builder; From 6cf2f1a300858bb2214dbaed6548447ba407fd49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Tue, 17 Mar 2026 17:37:20 +0100 Subject: [PATCH 02/10] Also update getrandom to v0.4 --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4b66784ee..bec4e7989 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1210,11 +1210,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", - "js-sys", "libc", "r-efi 5.3.0", "wasi 0.14.7+wasi-0.2.4", - "wasm-bindgen", ] [[package]] @@ -1224,11 +1222,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi 6.0.0", "rand_core 0.10.0", "wasip2", "wasip3", + "wasm-bindgen", ] [[package]] @@ -1885,7 +1885,7 @@ dependencies = [ "derive_more", "enum-assoc", "fastbloom", - "getrandom 0.3.3", + "getrandom 0.4.2", "hex-literal", "identity-hash", "lru-slab", diff --git a/Cargo.toml b/Cargo.toml index 1fe2d1f74..4e58e8ae1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ crc = "3" directories-next = "2" fastbloom = "0.17" futures-io = "0.3.19" -getrandom = { version = "0.3", default-features = false } +getrandom = { version = "0.4", default-features = false } hdrhistogram = { version = "7.2", default-features = false } hex-literal = "0.4" identity-hash = "0.1.0" From 33a185fb65db5024932af6e9815a3d9e80b4d477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Fri, 20 Mar 2026 10:45:32 +0100 Subject: [PATCH 03/10] Avoid depending on proptest in Wasm --- noq-proto/Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/noq-proto/Cargo.toml b/noq-proto/Cargo.toml index 5f8a075d0..1ec5acd37 100644 --- a/noq-proto/Cargo.toml +++ b/noq-proto/Cargo.toml @@ -85,7 +85,6 @@ web-time = { workspace = true } [dev-dependencies] assert_matches = { workspace = true } hex-literal = { workspace = true } -proptest = { workspace = true } rand_pcg = "0.10" rcgen = { workspace = true } test-strategy = { workspace = true } @@ -93,6 +92,9 @@ testresult = "0.4.1" tracing-subscriber = { workspace = true } wasm-bindgen-test = { workspace = true } +[target.'cfg(not(all(target_family = "wasm", target_os = "unknown")))'.dev-dependencies] +proptest = { workspace = true } + [[bench]] name = "send_buffer" harness = false From e8338fa54896edd9b97f09c625b56844d785a335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Fri, 20 Mar 2026 11:00:02 +0100 Subject: [PATCH 04/10] Revert "Avoid depending on proptest in Wasm" This reverts commit add1fe3150f5f37b35477f1784ad260cd0b20b21. --- noq-proto/Cargo.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/noq-proto/Cargo.toml b/noq-proto/Cargo.toml index 1ec5acd37..5f8a075d0 100644 --- a/noq-proto/Cargo.toml +++ b/noq-proto/Cargo.toml @@ -85,6 +85,7 @@ web-time = { workspace = true } [dev-dependencies] assert_matches = { workspace = true } hex-literal = { workspace = true } +proptest = { workspace = true } rand_pcg = "0.10" rcgen = { workspace = true } test-strategy = { workspace = true } @@ -92,9 +93,6 @@ testresult = "0.4.1" tracing-subscriber = { workspace = true } wasm-bindgen-test = { workspace = true } -[target.'cfg(not(all(target_family = "wasm", target_os = "unknown")))'.dev-dependencies] -proptest = { workspace = true } - [[bench]] name = "send_buffer" harness = false From c8e6e7bf0002f67511940d60f466af6dcb7312da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Fri, 20 Mar 2026 11:02:06 +0100 Subject: [PATCH 05/10] Set `wasm_js` ff for the old getrandom dep in Wasm tests for proptest --- Cargo.lock | 3 +++ noq-proto/Cargo.toml | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index bec4e7989..7a113dc98 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1210,9 +1210,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi 5.3.0", "wasi 0.14.7+wasi-0.2.4", + "wasm-bindgen", ] [[package]] @@ -1885,6 +1887,7 @@ dependencies = [ "derive_more", "enum-assoc", "fastbloom", + "getrandom 0.3.3", "getrandom 0.4.2", "hex-literal", "identity-hash", diff --git a/noq-proto/Cargo.toml b/noq-proto/Cargo.toml index 5f8a075d0..82ad4f463 100644 --- a/noq-proto/Cargo.toml +++ b/noq-proto/Cargo.toml @@ -93,6 +93,10 @@ testresult = "0.4.1" tracing-subscriber = { workspace = true } wasm-bindgen-test = { workspace = true } +[target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dev-dependencies] +# ensure we set the wasm_js feature even for the older version of getrandom used in proptest in Wasm +getrandom_0_3 = { package = "getrandom", version = "0.3", features = ["wasm_js"] } + [[bench]] name = "send_buffer" harness = false From c8d765ab1ef6bd17178855b5c4397f15c2e8dd96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Mon, 23 Mar 2026 09:47:27 +0100 Subject: [PATCH 06/10] Disable fastbloom default features --- Cargo.lock | 4 ++-- Cargo.toml | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a113dc98..87bf7fd46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1043,12 +1043,12 @@ dependencies = [ [[package]] name = "fastbloom" version = "0.17.0" -source = "git+https://github.com/matheus23/fastbloom?branch=matheus23%2Frand-0.10#2710d2688ea7f726f08e734d904311e08598d7c7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef975e30683b2d965054bb0a836f8973857c4ebf6acf274fe46617cd285060d8" dependencies = [ "foldhash 0.2.0", "libm", "portable-atomic", - "rand 0.10.0", "siphasher", ] diff --git a/Cargo.toml b/Cargo.toml index 4e58e8ae1..4e2f65492 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ bytes = "1" clap = { version = "4.5", features = ["derive"] } crc = "3" directories-next = "2" -fastbloom = "0.17" +fastbloom = { version = "0.17", default-features = false } futures-io = "0.3.19" getrandom = { version = "0.4", default-features = false } hdrhistogram = { version = "7.2", default-features = false } @@ -89,6 +89,3 @@ unreachable_pub = "warn" manual_let_else = "warn" or_fun_call = "warn" use_self = "warn" - -[patch.crates-io] -fastbloom = { git = "https://github.com/matheus23/fastbloom", branch = "matheus23/rand-0.10" } From dcbcfdc6c6ba22367d2863c65014390389ef19ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Mon, 23 Mar 2026 09:54:01 +0100 Subject: [PATCH 07/10] Update away from libraries with vulns --- Cargo.lock | 10 +++++----- Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 87bf7fd46..68c1973c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -336,9 +336,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.34.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "179c3777a8b5e70e90ea426114ffc565b2c1a9f82f6c4a0c5a34aa6ef5e781b6" +checksum = "4321e568ed89bb5a7d291a7f37997c2c0df89809d7b6d12062c81ddb54aa782e" dependencies = [ "cc", "cmake", @@ -1842,7 +1842,7 @@ dependencies = [ "async-global-executor", "async-io", "aws-lc-fips-sys", - "aws-lc-sys 0.34.0", + "aws-lc-sys 0.38.0", "bytes", "cfg_aliases", "clap", @@ -2494,9 +2494,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" [[package]] name = "rustls-webpki" -version = "0.103.7" +version = "0.103.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10b3f4191e8a80e6b43eebabfac91e5dcecebb27a71f04e820c47ec41d314bf" +checksum = "df33b2b81ac578cabaf06b89b0631153a3f416b0a886e8a7a1707fb51abbd1ef" dependencies = [ "aws-lc-rs", "ring", diff --git a/Cargo.toml b/Cargo.toml index 4e2f65492..e6e0ad404 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,7 @@ async-global-executor = "2.4.1" async-fs = "2.1" async-executor = "1.13.0" aws-lc-fips-sys = "0.13.10" -aws-lc-sys = "0.34.0" +aws-lc-sys = "0.38.0" gcc = "0.3.55" http = "1.1.0" lazy_static = "1.5.0" From 6cc2001a30ae4b6b61c399437119bda3a5842cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Mon, 23 Mar 2026 10:22:19 +0100 Subject: [PATCH 08/10] Update to aws-lc-sys 0.39 for minimal deps --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 68c1973c5..de8310536 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -336,9 +336,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4321e568ed89bb5a7d291a7f37997c2c0df89809d7b6d12062c81ddb54aa782e" +checksum = "1fa7e52a4c5c547c741610a2c6f123f3881e409b714cd27e6798ef020c514f0a" dependencies = [ "cc", "cmake", @@ -1842,7 +1842,7 @@ dependencies = [ "async-global-executor", "async-io", "aws-lc-fips-sys", - "aws-lc-sys 0.38.0", + "aws-lc-sys 0.39.0", "bytes", "cfg_aliases", "clap", diff --git a/Cargo.toml b/Cargo.toml index e6e0ad404..694a8e09f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,7 @@ async-global-executor = "2.4.1" async-fs = "2.1" async-executor = "1.13.0" aws-lc-fips-sys = "0.13.10" -aws-lc-sys = "0.38.0" +aws-lc-sys = "0.39.0" gcc = "0.3.55" http = "1.1.0" lazy_static = "1.5.0" From 4746c17998e20d7cb291e64570f8553569d2ee92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Mon, 23 Mar 2026 11:14:10 +0100 Subject: [PATCH 09/10] Update aws-lc-sys to 0.39 --- Cargo.lock | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index de8310536..c80601442 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -311,29 +311,15 @@ dependencies = [ [[package]] name = "aws-lc-rs" -version = "1.14.1" +version = "1.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879b6c89592deb404ba4dc0ae6b58ffd1795c78991cbb5b8bc441c48a070440d" +checksum = "a054912289d18629dc78375ba2c3726a3afe3ff71b4edba9dedfca0e3446d1fc" dependencies = [ "aws-lc-fips-sys", - "aws-lc-sys 0.32.2", + "aws-lc-sys", "zeroize", ] -[[package]] -name = "aws-lc-sys" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2b715a6010afb9e457ca2b7c9d2b9c344baa8baed7b38dc476034c171b32575" -dependencies = [ - "bindgen", - "cc", - "cmake", - "dunce", - "fs_extra", - "libloading", -] - [[package]] name = "aws-lc-sys" version = "0.39.0" @@ -1842,7 +1828,7 @@ dependencies = [ "async-global-executor", "async-io", "aws-lc-fips-sys", - "aws-lc-sys 0.39.0", + "aws-lc-sys", "bytes", "cfg_aliases", "clap", From 2b322b917750425233fd57b615ba1caae4ca1b2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Mon, 23 Mar 2026 11:22:23 +0100 Subject: [PATCH 10/10] Update deny.toml --- Cargo.lock | 6 +++--- deny.toml | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c80601442..f3cc96c00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -297,9 +297,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "aws-lc-fips-sys" -version = "0.13.10" +version = "0.13.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57900537c00a0565a35b63c4c281b372edfc9744b072fd4a3b414350a8f5ed48" +checksum = "f8bce4948d2520386c6d92a6ea2d472300257702242e5a1d01d6add52bd2e7c1" dependencies = [ "bindgen", "cc", @@ -1679,7 +1679,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.53.4", + "windows-targets 0.52.6", ] [[package]] diff --git a/deny.toml b/deny.toml index 667ae9e6b..494d96553 100644 --- a/deny.toml +++ b/deny.toml @@ -15,18 +15,19 @@ allow = [ "NCSA", "OpenSSL", "Unicode-3.0", + "Zlib", # foldhash, dependency of fastbloom ] private = { ignore = true } [bans] multiple-versions = "warn" skip = [ - # aws-lc-rs 1.x uses aws-lc-sys 0.32.x, our workaround deps use 0.34.x - { crate = "aws-lc-sys", reason = "aws-lc-rs uses 0.32.x, minimal-versions workaround uses 0.34.x" }, # hdrhistogram uses base64 0.21, newer crates use 0.22 { crate = "base64", reason = "hdrhistogram uses 0.21, newer crates use 0.22" }, + { crate = "cpufeatures", reason = "rand 0.10 pulls in newer chacha (which depends on this), but aes-gcm hasn't updated yet" }, # ring uses getrandom 0.2, newer crates use 0.3 { crate = "getrandom", reason = "ring depends on 0.2, newer ecosystem uses 0.3" }, + { crate = "r-efi", reason = "proptest dev-dependency pulls in old getrandom" }, # jni and redox_users use thiserror 1.x { crate = "thiserror", reason = "transitive deps use thiserror 1.x" }, { crate = "thiserror-impl", reason = "follows thiserror" }, @@ -43,4 +44,5 @@ skip = [ { crate = "windows_x86_64_gnu", reason = "follows windows-sys" }, { crate = "windows_x86_64_gnullvm", reason = "follows windows-sys" }, { crate = "windows_x86_64_msvc", reason = "follows windows-sys" }, + { crate = "wit-bindgen", reason = "proptest dev-dependency pulls in old getrandom" }, ]