arnaucube
arnaucube/testudoPublic Self-hosted repository
testudo/src/errors.rs
src/errors.rsRaw
 1use core::fmt::Debug;
 2use thiserror::Error;
 3
 4#[derive(Error, Debug)]
 5pub enum ProofVerifyError {
 6    #[error("Proof verification failed")]
 7    InternalError,
 8    #[error("Compressed group element failed to decompress: {0:?}")]
 9    DecompressionError(Vec<u8>),
10}
11
12impl Default for ProofVerifyError {
13    fn default() -> Self {
14        ProofVerifyError::InternalError
15    }
16}
17
18#[derive(Clone, Debug, Eq, PartialEq)]
19pub enum R1CSError {
20    /// returned if the number of constraints is not a power of 2
21    NonPowerOfTwoCons,
22    /// returned if the number of variables is not a power of 2
23    NonPowerOfTwoVars,
24    /// returned if a wrong number of inputs in an assignment are supplied
25    InvalidNumberOfInputs,
26    /// returned if a wrong number of variables in an assignment are supplied
27    InvalidNumberOfVars,
28    /// returned if a [u8;32] does not parse into a valid Scalar in the field of ristretto255
29    InvalidScalar,
30    /// returned if the supplied row or col in (row,col,val) tuple is out of range
31    InvalidIndex,
32}