1414//! - `G`: the group used for commitments and operations ([`Group`] trait).
1515
1616use crate :: codec:: Codec ;
17- use crate :: errors:: ProofError ;
17+ use crate :: errors:: Error ;
1818use crate :: traits:: { CompactProtocol , SigmaProtocol } ;
1919
2020use group:: { Group , GroupEncoding } ;
5050 pub sigmap : P ,
5151}
5252
53+ // TODO: Write a serialization of the morphism to the transcript.
5354impl < P , C , G > NISigmaProtocol < P , C , G >
5455where
5556 G : Group + GroupEncoding ,
9394 & self ,
9495 witness : & P :: Witness ,
9596 rng : & mut ( impl RngCore + CryptoRng ) ,
96- ) -> Result < Transcript < P > , ProofError > {
97+ ) -> Result < Transcript < P > , Error > {
9798 let mut codec = self . hash_state . clone ( ) ;
9899
99100 let ( commitment, prover_state) = self . sigmap . prover_commit ( witness, rng) ?;
@@ -131,7 +132,7 @@ where
131132 commitment : & P :: Commitment ,
132133 challenge : & P :: Challenge ,
133134 response : & P :: Response ,
134- ) -> Result < ( ) , ProofError > {
135+ ) -> Result < ( ) , Error > {
135136 let mut codec = self . hash_state . clone ( ) ;
136137
137138 // Commitment data for expected challenge generation
@@ -144,7 +145,7 @@ where
144145 // Verification of the proof
145146 match * challenge == expected_challenge {
146147 true => self . sigmap . verifier ( commitment, challenge, response) ,
147- false => Err ( ProofError :: VerificationFailure ) ,
148+ false => Err ( Error :: VerificationFailure ) ,
148149 }
149150 }
150151 /// Generates a batchable, serialized non-interactive proof.
@@ -162,7 +163,7 @@ where
162163 & self ,
163164 witness : & P :: Witness ,
164165 rng : & mut ( impl RngCore + CryptoRng ) ,
165- ) -> Result < Vec < u8 > , ProofError > {
166+ ) -> Result < Vec < u8 > , Error > {
166167 let ( commitment, challenge, response) = self . prove ( witness, rng) ?;
167168 Ok ( self
168169 . sigmap
@@ -183,7 +184,7 @@ where
183184 /// - Returns `ProofError::VerificationFailure` if:
184185 /// - The challenge doesn't match the recomputed one from the commitment.
185186 /// - The response fails verification under the Sigma protocol.
186- pub fn verify_batchable ( & self , proof : & [ u8 ] ) -> Result < ( ) , ProofError > {
187+ pub fn verify_batchable ( & self , proof : & [ u8 ] ) -> Result < ( ) , Error > {
187188 let ( commitment, response) = self . sigmap . deserialize_batchable ( proof) . unwrap ( ) ;
188189
189190 let mut codec = self . hash_state . clone ( ) ;
@@ -223,7 +224,7 @@ where
223224 & self ,
224225 witness : & P :: Witness ,
225226 rng : & mut ( impl RngCore + CryptoRng ) ,
226- ) -> Result < Vec < u8 > , ProofError > {
227+ ) -> Result < Vec < u8 > , Error > {
227228 let ( commitment, challenge, response) = self . prove ( witness, rng) ?;
228229 Ok ( self
229230 . sigmap
@@ -246,7 +247,7 @@ where
246247 /// - Returns `ProofError::VerificationFailure` if:
247248 /// - Deserialization fails.
248249 /// - The recomputed commitment or response is invalid under the Sigma protocol.
249- pub fn verify_compact ( & self , proof : & [ u8 ] ) -> Result < ( ) , ProofError > {
250+ pub fn verify_compact ( & self , proof : & [ u8 ] ) -> Result < ( ) , Error > {
250251 let ( challenge, response) = self . sigmap . deserialize_compact ( proof) . unwrap ( ) ;
251252 // Compute the commitments
252253 let commitment = self . sigmap . get_commitment ( & challenge, & response) ?;
0 commit comments