diff --git a/Cargo.lock b/Cargo.lock index 6e1107d22..87c5b635c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2755,6 +2755,7 @@ dependencies = [ "hex", "hex-literal", "rand 0.8.4", + "rand_chacha 0.3.1", "serde", "signature", "thiserror", diff --git a/crates/tor-netdir/Cargo.toml b/crates/tor-netdir/Cargo.toml index 41651e43f..6a3810540 100644 --- a/crates/tor-netdir/Cargo.toml +++ b/crates/tor-netdir/Cargo.toml @@ -47,3 +47,4 @@ tracing = "0.1.26" hex = "0.4.3" hex-literal = "0.3.1" tor-netdoc = { path="../tor-netdoc", version = "0.0.2", features=["build_docs"] } +rand_chacha = "0.3.1" \ No newline at end of file diff --git a/crates/tor-netdir/src/testing.rs b/crates/tor-netdir/src/testing.rs index c95607851..9ffd5b691 100644 --- a/crates/tor-netdir/src/testing.rs +++ b/crates/tor-netdir/src/testing.rs @@ -16,12 +16,9 @@ mod imp { pub(crate) fn get_rng() -> impl rand::Rng { // When stochastic tests aren't enabled, we use a RNG seeded // with a fixed value and a small number of iterators for each test. - // - // XXXX: Note that the StdRng is not guaranteed to be - // reproducible across rust stdlib versions; an upgrade might break - // these tests. use rand::SeedableRng; - rand::rngs::StdRng::from_seed( + // Use this RNG to make the tests reproducible. + rand_chacha::ChaCha12Rng::from_seed( // Fun facts: // The Julius Tote was a mechanical computer and point-of-sale // system from the 1920s that used horses as an RNG.