11use rand:: { rngs:: OsRng , CryptoRng , Rng } ;
2- use sigma_rs:: toolbox:: sigma:: { proof_composition:: OrEnum , SigmaProtocolSimulator , AndProtocol , OrProtocol , SigmaProtocol } ;
2+ use sigma_rs:: { toolbox:: sigma:: { proof_composition:: OrEnum , AndProtocol , OrProtocol , SigmaProtocol , SigmaProtocolSimulator } , ProofError } ;
33use curve25519_dalek:: { ristretto:: RistrettoPoint , scalar:: Scalar } ;
44
55pub struct SchnorrZkp {
@@ -39,10 +39,10 @@ impl SigmaProtocol for SchnorrZkp {
3939 commitment : & Self :: Commitment ,
4040 challenge : & Self :: Challenge ,
4141 response : & Self :: Response ,
42- ) -> Result < ( ) , ( ) > {
42+ ) -> Result < ( ) , ProofError > {
4343 match response * self . generator == challenge * self . target + commitment {
4444 true => Ok ( ( ) ) ,
45- false => Err ( ( ) ) ,
45+ false => Err ( ProofError :: VerificationFailure ) ,
4646 }
4747 }
4848}
@@ -104,7 +104,7 @@ fn andproof_schnorr_correct() {
104104 // Verifier checks
105105 let result = and_proof. verifier ( & commitments, & challenge, & responses) ;
106106
107- assert ! ( result == Ok ( ( ) ) ) ;
107+ assert ! ( result. is_ok ( ) ) ;
108108}
109109
110110
@@ -144,7 +144,7 @@ fn andproof_schnorr_incorrect() {
144144 // Verifier checks
145145 let result = and_proof. verifier ( & commitments, & challenge, & responses) ;
146146
147- assert ! ( result == Err ( ( ) ) ) ;
147+ assert ! ( ! result. is_ok ( ) ) ;
148148}
149149
150150
@@ -182,7 +182,7 @@ fn orproof_schnorr_correct() {
182182 // Verifier checks
183183 let result = or_proof. verifier ( & commitments, & challenge, & responses) ;
184184
185- assert ! ( result == Ok ( ( ) ) ) ;
185+ assert ! ( result. is_ok ( ) ) ;
186186}
187187
188188
@@ -220,5 +220,5 @@ fn orproof_schnorr_incorrect() {
220220 // Verifier checks
221221 let result = or_proof. verifier ( & commitments, & challenge, & responses) ;
222222
223- assert ! ( result == Err ( ( ) ) ) ;
223+ assert ! ( ! result. is_ok ( ) ) ;
224224}
0 commit comments