@@ -5,7 +5,7 @@ use rand::rngs::OsRng;
55use crate :: fiat_shamir:: NISigmaProtocol ;
66use crate :: tests:: test_utils:: {
77 bbs_blind_commitment_computation, discrete_logarithm, dleq, pedersen_commitment,
8- pedersen_commitment_dleq, translated_discrete_logarithm,
8+ pedersen_commitment_dleq, translated_discrete_logarithm, translated_dleq ,
99} ;
1010use crate :: { codec:: ShakeCodec , schnorr_protocol:: SchnorrProof } ;
1111
@@ -29,6 +29,12 @@ fn test_dleq() {
2929 dleq ( G :: random ( & mut rng) , Scalar :: random ( & mut rng) ) ;
3030}
3131
32+ #[ test]
33+ fn test_translated_dleq ( ) {
34+ let mut rng = OsRng ;
35+ dleq ( G :: random ( & mut rng) , Scalar :: random ( & mut rng) ) ;
36+ }
37+
3238#[ test]
3339fn test_pedersen_commitment ( ) {
3440 let mut rng = OsRng ;
@@ -111,7 +117,7 @@ fn noninteractive_translated_discrete_logarithm() {
111117 // The SigmaProtocol induced by relation
112118 let protocol = SchnorrProof :: from ( relation) ;
113119 // Fiat-Shamir wrapper
114- let domain_sep = b"test-fiat-shamir-schnorr" ;
120+ let domain_sep = b"test-fiat-shamir-translated- schnorr" ;
115121 let nizk = NISigmaProtocol :: < SchnorrProof < G > , ShakeCodec < G > > :: new ( domain_sep, protocol) ;
116122
117123 // Batchable and compact proofs
@@ -157,6 +163,33 @@ fn noninteractive_dleq() {
157163 ) ;
158164}
159165
166+ #[ test]
167+ fn noninteractive_translated_dleq ( ) {
168+ let mut rng = OsRng ;
169+ let ( relation, witness) = translated_dleq ( G :: random ( & mut rng) , Scalar :: random ( & mut rng) ) ;
170+
171+ // The SigmaProtocol induced by relation
172+ let protocol = SchnorrProof :: from ( relation) ;
173+ // Fiat-Shamir wrapper
174+ let domain_sep = b"test-fiat-shamir-translated-DLEQ" ;
175+ let nizk = NISigmaProtocol :: < SchnorrProof < G > , ShakeCodec < G > > :: new ( domain_sep, protocol) ;
176+
177+ // Batchable and compact proofs
178+ let proof_batchable_bytes = nizk. prove_batchable ( & witness, & mut rng) . unwrap ( ) ;
179+ let proof_compact_bytes = nizk. prove_compact ( & witness, & mut rng) . unwrap ( ) ;
180+ // Verify proofs
181+ let verified_batchable = nizk. verify_batchable ( & proof_batchable_bytes) . is_ok ( ) ;
182+ let verified_compact = nizk. verify_compact ( & proof_compact_bytes) . is_ok ( ) ;
183+ assert ! (
184+ verified_batchable,
185+ "Fiat-Shamir Schnorr proof verification failed"
186+ ) ;
187+ assert ! (
188+ verified_compact,
189+ "Fiat-Shamir Schnorr proof verification failed"
190+ ) ;
191+ }
192+
160193#[ test]
161194fn noninteractive_pedersen_commitment ( ) {
162195 let mut rng = OsRng ;
0 commit comments