testudo/src/errors.rs
src/errors.rsRaw
1use core::fmt;
2
3pub struct ProofVerifyError;
4
5impl fmt::Display for ProofVerifyError {
6 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
7 write!(f, "Proof verification failed")
8 }
9}
10
11impl fmt::Debug for ProofVerifyError {
12 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
13 write!(f, "{{ file: {}, line: {} }}", file!(), line!())
14 }
15}
16
17pub enum R1CSError {
18 /// returned if the number of constraints is not a power of 2
19 NonPowerOfTwoCons,
20 /// returned if the number of variables is not a power of 2
21 NonPowerOfTwoVars,
22 /// returned if a wrong number of inputs in an assignment are supplied
23 InvalidNumberOfInputs,
24 /// returned if a wrong number of variables in an assignment are supplied
25 InvalidNumberOfVars,
26 /// returned if a [u8;32] does not parse into a valid Scalar in the field of ristretto255
27 InvalidScalar,
28}
29
30impl fmt::Display for R1CSError {
31 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
32 write!(f, "R1CSError")
33 }
34}
35
36impl fmt::Debug for R1CSError {
37 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
38 write!(f, "{{ file: {}, line: {} }}", file!(), line!())
39 }
40}