Skip to content

Commit 1280ffd

Browse files
authored
chore(proto): Update to rand 0.10 (#511)
## Description This updates noq and its dependencies to rand 0.10 and getrandom 0.4. ## Breaking Changes I don't think there are any of rand's APIs exposed in noq or noq-proto. So no breaking changes. ## Notes & open questions ~~Blocked on tomtomwombat/fastbloom#27 being released.~~ We can disable the rand feature for fastbloom instead. `proptest` still depends on rand 0.9: ``` $ cargo tree -i rand@0.9 rand v0.9.2 └── proptest v1.9.0 [dev-dependencies] └── noq-proto v0.16.0 (/home/philipp/program/work/noq/noq-proto) ├── noq v0.17.0 (/home/philipp/program/work/noq/noq) │ ├── bench v0.2.0 (/home/philipp/program/work/noq/bench) │ └── perf v0.2.0 (/home/philipp/program/work/noq/perf) └── perf v0.2.0 (/home/philipp/program/work/noq/perf) ``` But it's only a dev-dependency, so won't get pulled in for people depending on noq.
1 parent b3b50c0 commit 1280ffd

18 files changed

Lines changed: 307 additions & 81 deletions

File tree

Cargo.lock

Lines changed: 261 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ bytes = "1"
2323
clap = { version = "4.5", features = ["derive"] }
2424
crc = "3"
2525
directories-next = "2"
26-
fastbloom = "0.14"
26+
fastbloom = { version = "0.17", default-features = false }
2727
futures-io = "0.3.19"
28-
getrandom = { version = "0.3", default-features = false }
28+
getrandom = { version = "0.4", default-features = false }
2929
hdrhistogram = { version = "7.2", default-features = false }
3030
hex-literal = "0.4"
3131
identity-hash = "0.1.0"
@@ -34,7 +34,7 @@ log = "0.4"
3434
pin-project-lite = "0.2"
3535
proptest = { version = "1.9.0", default-features = false, features = ["std"] }
3636
qlog = { package = "n0-qlog", version = "0.1.0" }
37-
rand = "0.9"
37+
rand = "0.10"
3838
rcgen = "0.14"
3939
ring = "0.17"
4040
rustc-hash = "2"
@@ -66,7 +66,7 @@ async-global-executor = "2.4.1"
6666
async-fs = "2.1"
6767
async-executor = "1.13.0"
6868
aws-lc-fips-sys = "0.13.10"
69-
aws-lc-sys = "0.34.0"
69+
aws-lc-sys = "0.39.0"
7070
gcc = "0.3.55"
7171
http = "1.1.0"
7272
lazy_static = "1.5.0"

deny.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@ allow = [
1515
"NCSA",
1616
"OpenSSL",
1717
"Unicode-3.0",
18+
"Zlib", # foldhash, dependency of fastbloom
1819
]
1920
private = { ignore = true }
2021

2122
[bans]
2223
multiple-versions = "warn"
2324
skip = [
24-
# aws-lc-rs 1.x uses aws-lc-sys 0.32.x, our workaround deps use 0.34.x
25-
{ crate = "aws-lc-sys", reason = "aws-lc-rs uses 0.32.x, minimal-versions workaround uses 0.34.x" },
2625
# hdrhistogram uses base64 0.21, newer crates use 0.22
2726
{ crate = "base64", reason = "hdrhistogram uses 0.21, newer crates use 0.22" },
27+
{ crate = "cpufeatures", reason = "rand 0.10 pulls in newer chacha (which depends on this), but aes-gcm hasn't updated yet" },
2828
# ring uses getrandom 0.2, newer crates use 0.3
2929
{ crate = "getrandom", reason = "ring depends on 0.2, newer ecosystem uses 0.3" },
30+
{ crate = "r-efi", reason = "proptest dev-dependency pulls in old getrandom" },
3031
# jni and redox_users use thiserror 1.x
3132
{ crate = "thiserror", reason = "transitive deps use thiserror 1.x" },
3233
{ crate = "thiserror-impl", reason = "follows thiserror" },
@@ -43,4 +44,5 @@ skip = [
4344
{ crate = "windows_x86_64_gnu", reason = "follows windows-sys" },
4445
{ crate = "windows_x86_64_gnullvm", reason = "follows windows-sys" },
4546
{ crate = "windows_x86_64_msvc", reason = "follows windows-sys" },
47+
{ crate = "wit-bindgen", reason = "proptest dev-dependency pulls in old getrandom" },
4648
]

noq-proto/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,17 @@ web-time = { workspace = true }
8686
assert_matches = { workspace = true }
8787
hex-literal = { workspace = true }
8888
proptest = { workspace = true }
89-
rand_pcg = "0.9"
89+
rand_pcg = "0.10"
9090
rcgen = { workspace = true }
9191
test-strategy = { workspace = true }
9292
testresult = "0.4.1"
9393
tracing-subscriber = { workspace = true }
9494
wasm-bindgen-test = { workspace = true }
9595

96+
[target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dev-dependencies]
97+
# ensure we set the wasm_js feature even for the older version of getrandom used in proptest in Wasm
98+
getrandom_0_3 = { package = "getrandom", version = "0.3", features = ["wasm_js"] }
99+
96100
[[bench]]
97101
name = "send_buffer"
98102
harness = false

noq-proto/src/cid_generator.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::hash::Hasher;
22

3-
use rand::{Rng, RngCore};
3+
use rand::Rng;
4+
use rand::RngExt;
45

56
use crate::Duration;
67
use crate::MAX_CID_SIZE;

noq-proto/src/config/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl Default for EndpointConfig {
185185
fn default() -> Self {
186186
#[cfg(all(feature = "aws-lc-rs", not(feature = "ring")))]
187187
use aws_lc_rs::hmac;
188-
use rand::RngCore;
188+
use rand::Rng;
189189
#[cfg(feature = "ring")]
190190
use ring::hmac;
191191

noq-proto/src/congestion/bbr/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::any::Any;
22
use std::fmt::Debug;
33
use std::sync::Arc;
44

5-
use rand::{Rng, SeedableRng};
5+
use rand::RngExt;
66

77
use crate::congestion::ControllerMetrics;
88
use crate::congestion::bbr::bw_estimation::BandwidthEstimation;
@@ -56,7 +56,6 @@ pub struct Bbr {
5656
bw_at_last_round: u64,
5757
round_wo_bw_gain: u64,
5858
ack_aggregation: AckAggregationState,
59-
random_number_generator: rand::rngs::StdRng,
6059
}
6160

6261
impl Bbr {
@@ -97,7 +96,6 @@ impl Bbr {
9796
bw_at_last_round: 0,
9897
round_wo_bw_gain: 0,
9998
ack_aggregation: AckAggregationState::default(),
100-
random_number_generator: rand::rngs::StdRng::from_os_rng(),
10199
}
102100
}
103101

@@ -114,9 +112,7 @@ impl Bbr {
114112
// Pick a random offset for the gain cycle out of {0, 2..7} range. 1 is
115113
// excluded because in that case increased gain and decreased gain would not
116114
// follow each other.
117-
let mut rand_index = self
118-
.random_number_generator
119-
.random_range(0..K_PACING_GAIN.len() as u8 - 1);
115+
let mut rand_index = rand::rng().random_range(0..K_PACING_GAIN.len() as u8 - 1);
120116
if rand_index >= 1 {
121117
rand_index += 1;
122118
}

noq-proto/src/connection/assembler.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@ mod test {
676676
#[cfg(all(test, not(target_family = "wasm")))]
677677
mod proptests {
678678
use proptest::prelude::*;
679+
use rand::RngExt;
679680
use test_strategy::{Arbitrary, proptest};
680681

681682
use super::*;
@@ -743,7 +744,7 @@ mod proptests {
743744
}
744745

745746
fn make_data() -> Vec<u8> {
746-
use rand::{Rng, SeedableRng};
747+
use rand::SeedableRng;
747748
let mut rng = rand::rngs::StdRng::seed_from_u64(0xDEADBEEF);
748749
let mut data = vec![0u8; MAX_OFFSET as usize];
749750
rng.fill(data.as_mut_slice());

noq-proto/src/connection/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::{
1111
use bytes::{Bytes, BytesMut};
1212
use frame::StreamMetaVec;
1313

14-
use rand::{Rng, SeedableRng, rngs::StdRng};
14+
use rand::{RngExt, SeedableRng, rngs::StdRng};
1515
use rustc_hash::{FxHashMap, FxHashSet};
1616
use thiserror::Error;
1717
use tracing::{debug, error, trace, trace_span, warn};

noq-proto/src/connection/packet_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bytes::{BufMut, Bytes};
2-
use rand::Rng;
2+
use rand::RngExt;
33
use tracing::{debug, trace, trace_span};
44

55
use super::{Connection, PathId, SentFrames, TransmitBuf, spaces::SentPacket};

0 commit comments

Comments
 (0)