1- use std:: ops:: Not ;
2-
31use rand:: { rngs:: OsRng , CryptoRng , Rng } ;
42use sigma_rs:: toolbox:: sigma:: { proof_composition:: OrEnum , AndProtocol , OrProtocol , SigmaProtocol } ;
53use curve25519_dalek:: { ristretto:: RistrettoPoint , scalar:: Scalar } ;
@@ -41,8 +39,11 @@ impl SigmaProtocol for SchnorrZkp {
4139 commitment : & Self :: Commitment ,
4240 challenge : & Self :: Challenge ,
4341 response : & Self :: Response ,
44- ) -> bool {
45- response * self . generator == challenge * self . target + commitment
42+ ) -> Result < ( ) , ( ) > {
43+ match response * self . generator == challenge * self . target + commitment {
44+ true => Ok ( ( ) ) ,
45+ false => Err ( ( ) ) ,
46+ }
4647 }
4748
4849 fn simulate_proof (
@@ -97,7 +98,7 @@ fn andproof_schnorr_correct() {
9798 // Verifier checks
9899 let result = and_proof. verifier ( & commitments, & challenge, & responses) ;
99100
100- assert ! ( result) ;
101+ assert ! ( result == Ok ( ( ) ) ) ;
101102}
102103
103104#[ allow( non_snake_case) ]
@@ -134,7 +135,7 @@ fn andproof_schnorr_incorrect() {
134135 // Verifier checks
135136 let result = and_proof. verifier ( & commitments, & challenge, & responses) ;
136137
137- assert ! ( result. not ( ) ) ;
138+ assert ! ( result == Err ( ( ) ) ) ;
138139}
139140
140141#[ allow( non_snake_case) ]
@@ -169,7 +170,7 @@ fn orproof_schnorr_correct() {
169170 // Verifier checks
170171 let result = or_proof. verifier ( & commitments, & challenge, & responses) ;
171172
172- assert ! ( result) ;
173+ assert ! ( result == Ok ( ( ) ) ) ;
173174}
174175
175176#[ allow( non_snake_case) ]
@@ -204,5 +205,5 @@ fn orproof_schnorr_incorrect() {
204205 // Verifier checks
205206 let result = or_proof. verifier ( & commitments, & challenge, & responses) ;
206207
207- assert ! ( result. not ( ) ) ;
208+ assert ! ( result == Err ( ( ) ) ) ;
208209}
0 commit comments