arnaucube
arnaucube/testudoPublic Self-hosted repository
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
17#[derive(Clone, Debug, Eq, PartialEq)]
18pub enum R1CSError {
19  /// returned if the number of constraints is not a power of 2
20  NonPowerOfTwoCons,
21  /// returned if the number of variables is not a power of 2
22  NonPowerOfTwoVars,
23  /// returned if a wrong number of inputs in an assignment are supplied
24  InvalidNumberOfInputs,
25  /// returned if a wrong number of variables in an assignment are supplied
26  InvalidNumberOfVars,
27  /// returned if a [u8;32] does not parse into a valid Scalar in the field of ristretto255
28  InvalidScalar,
29  /// returned if the supplied row or col in (row,col,val) tuple is out of range
30  InvalidIndex,
31}