11use ff:: Field ;
22use group:: prime:: PrimeGroup ;
3- use rand:: rngs:: OsRng ;
43use rand:: RngCore ;
54
65use crate :: codec:: Shake128DuplexSponge ;
@@ -474,7 +473,7 @@ fn test_cmz_wallet_with_fee() {
474473 use group:: Group ;
475474 type G = bls12_381:: G1Projective ;
476475
477- let mut rng = OsRng ;
476+ let mut rng = rand :: thread_rng ( ) ;
478477
479478 // This version should fail with InvalidInstanceWitnessPair
480479 // because it uses a scalar constant directly in the equation
@@ -508,7 +507,7 @@ fn test_cmz_wallet_with_fee() {
508507
509508 // Try to convert to CanonicalLinearRelation - this should fail
510509 let nizk = relation. into_nizk ( b"session_identifier" ) . unwrap ( ) ;
511- let result = nizk. prove_batchable ( & vec ! [ n_balance, i_price, z_w_balance] , & mut OsRng ) ;
510+ let result = nizk. prove_batchable ( & vec ! [ n_balance, i_price, z_w_balance] , & mut rng ) ;
512511 assert ! ( result. is_ok( ) ) ;
513512 let proof = result. unwrap ( ) ;
514513 let verify_result = nizk. verify_batchable ( & proof) ;
@@ -518,12 +517,9 @@ fn test_cmz_wallet_with_fee() {
518517/// Generic helper function to test both relation correctness and NIZK functionality
519518#[ test]
520519fn test_relations ( ) {
521- use group:: Group ;
522520 type G = bls12_381:: G1Projective ;
523- type RelationGenerator < G > =
524- & ' static dyn Fn ( & mut OsRng ) -> ( CanonicalLinearRelation < G > , Vec < <G as Group >:: Scalar > ) ;
525521
526- let instance_generators: Vec < ( & str , RelationGenerator < G > ) > = vec ! [
522+ let instance_generators: Vec < ( _ , & ' static dyn Fn ( & mut _ ) -> _ ) > = vec ! [
527523 ( "dlog" , & discrete_logarithm) ,
528524 ( "shifted_dlog" , & shifted_dlog) ,
529525 ( "dleq" , & dleq) ,
@@ -541,7 +537,7 @@ fn test_relations() {
541537 ] ;
542538
543539 for ( relation_name, relation_sampler) in instance_generators. iter ( ) {
544- let mut rng = OsRng ;
540+ let mut rng = rand :: thread_rng ( ) ;
545541 let ( canonical_relation, witness) = relation_sampler ( & mut rng) ;
546542
547543 // Test the NIZK protocol
@@ -555,10 +551,10 @@ fn test_relations() {
555551
556552 // Test both proof types
557553 let proof_batchable = nizk
558- . prove_batchable ( & witness, & mut OsRng )
554+ . prove_batchable ( & witness, & mut rng )
559555 . unwrap_or_else ( |_| panic ! ( "Failed to create batchable proof for {relation_name}" ) ) ;
560556 let proof_compact = nizk
561- . prove_compact ( & witness, & mut OsRng )
557+ . prove_compact ( & witness, & mut rng )
562558 . unwrap_or_else ( |_| panic ! ( "Failed to create compact proof for {relation_name}" ) ) ;
563559
564560 // Verify both proof types
0 commit comments