11use curve25519_dalek:: ristretto:: RistrettoPoint ;
22use group:: Group ;
3- use rand:: rngs:: OsRng ;
3+ use rand:: { rngs:: OsRng , thread_rng } ;
44
55use super :: test_relations:: * ;
66use crate :: composition:: { ComposedRelation , ComposedWitness } ;
@@ -20,7 +20,7 @@ fn test_composition_example() {
2020 let domain_sep = b"hello world" ;
2121
2222 // definitions of the underlying protocols
23- let mut rng = OsRng ;
23+ let mut rng = thread_rng ( ) ;
2424 let ( relation1, witness1) = dleq ( & mut rng) ;
2525 let ( relation2, witness2) = pedersen_commitment ( & mut rng) ;
2626 let ( relation3, witness3) = discrete_logarithm ( & mut rng) ;
@@ -44,8 +44,8 @@ fn test_composition_example() {
4444 let nizk = instance. into_nizk ( domain_sep) ;
4545
4646 // Batchable and compact proofs
47- let proof_batchable_bytes = nizk. prove_batchable ( & witness, & mut OsRng ) . unwrap ( ) ;
48- let proof_compact_bytes = nizk. prove_compact ( & witness, & mut OsRng ) . unwrap ( ) ;
47+ let proof_batchable_bytes = nizk. prove_batchable ( & witness, & mut rng ) . unwrap ( ) ;
48+ let proof_compact_bytes = nizk. prove_compact ( & witness, & mut rng ) . unwrap ( ) ;
4949 // Verify proofs
5050 assert ! ( nizk. verify_batchable( & proof_batchable_bytes) . is_ok( ) ) ;
5151 assert ! ( nizk. verify_compact( & proof_compact_bytes) . is_ok( ) ) ;
@@ -57,7 +57,7 @@ fn test_or_one_true() {
5757 // Test composition of a basic OR protocol, with one of the two witnesses being valid.
5858
5959 // definitions of the underlying protocols
60- let mut rng = OsRng ;
60+ let mut rng = rand :: thread_rng ( ) ;
6161 let ( relation1, witness1) = dleq :: < G , _ > ( & mut rng) ;
6262 let ( relation2, witness2) = dleq :: < G , _ > ( & mut rng) ;
6363
@@ -78,8 +78,8 @@ fn test_or_one_true() {
7878
7979 for witness in [ witness_or_1, witness_or_2] {
8080 // Batchable and compact proofs
81- let proof_batchable_bytes = nizk. prove_batchable ( & witness, & mut OsRng ) . unwrap ( ) ;
82- let proof_compact_bytes = nizk. prove_compact ( & witness, & mut OsRng ) . unwrap ( ) ;
81+ let proof_batchable_bytes = nizk. prove_batchable ( & witness, & mut rng ) . unwrap ( ) ;
82+ let proof_compact_bytes = nizk. prove_compact ( & witness, & mut rng ) . unwrap ( ) ;
8383 // Verify proofs
8484 assert ! ( nizk. verify_batchable( & proof_batchable_bytes) . is_ok( ) ) ;
8585 assert ! ( nizk. verify_compact( & proof_compact_bytes) . is_ok( ) ) ;
@@ -92,18 +92,18 @@ fn test_or_both_true() {
9292 // Test composition of a basic OR protocol, with both of the two witnesses being valid.
9393
9494 // definitions of the underlying protocols
95- let mut rng = OsRng ;
95+ let mut rng = rand :: thread_rng ( ) ;
9696 let ( relation1, witness1) = dleq :: < G , _ > ( & mut rng) ;
9797 let ( relation2, witness2) = dleq :: < G , _ > ( & mut rng) ;
9898
9999 let or_protocol = ComposedRelation :: or ( [ relation1, relation2] ) ;
100100
101101 let witness = ComposedWitness :: or ( [ witness1, witness2] ) ;
102- let nizk = or_protocol. into_nizk ( b"test_or_one_true " ) ;
102+ let nizk = or_protocol. into_nizk ( b"test_or_both_true " ) ;
103103
104104 // Batchable and compact proofs
105- let proof_batchable_bytes = nizk. prove_batchable ( & witness, & mut OsRng ) . unwrap ( ) ;
106- let proof_compact_bytes = nizk. prove_compact ( & witness, & mut OsRng ) . unwrap ( ) ;
105+ let proof_batchable_bytes = nizk. prove_batchable ( & witness, & mut rng ) . unwrap ( ) ;
106+ let proof_compact_bytes = nizk. prove_compact ( & witness, & mut rng ) . unwrap ( ) ;
107107 // Verify proofs
108108 assert ! ( nizk. verify_batchable( & proof_batchable_bytes) . is_ok( ) ) ;
109109 assert ! ( nizk. verify_compact( & proof_compact_bytes) . is_ok( ) ) ;
0 commit comments