Skip to content

Commit

Permalink
cleanup: pass rng
Browse files Browse the repository at this point in the history
  • Loading branch information
sveitser committed Dec 9, 2024
1 parent a55cfd6 commit e19186a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contracts/rust/adapter/src/stake_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,8 @@ mod test {
use super::*;

impl NodeInfoJf {
fn random() -> Self {
fn random(rng: &mut impl RngCore) -> Self {
let mut seed = [0u8; 32];
let mut rng = rand::thread_rng();
rng.fill_bytes(&mut seed);

let (stake_table_key, _) = BLSPubKey::generated_from_seed_indexed(seed, 0);
Expand All @@ -215,8 +214,9 @@ mod test {

#[test]
fn test_node_info_round_trip() {
let mut rng = rand::thread_rng();
for _ in 0..20 {
let jf = NodeInfoJf::random();
let jf = NodeInfoJf::random(&mut rng);
let sol: NodeInfo = jf.clone().into();
let jf2: NodeInfoJf = sol.into();
assert_eq!(jf2, jf);
Expand Down

0 comments on commit e19186a

Please sign in to comment.