nova_snark/errors.rs
1//! This module defines errors returned by the library.
2use crate::frontend::SynthesisError;
3use core::fmt::Debug;
4use thiserror::Error;
5
6/// Errors returned by Nova
7#[derive(Clone, Debug, Eq, PartialEq, Error)]
8#[non_exhaustive]
9pub enum NovaError {
10 /// returned if the supplied row or col in (row,col,val) tuple is out of range
11 #[error("InvalidIndex")]
12 InvalidIndex,
13 /// returned if the step circuit calls inputize or alloc_io in its synthesize method
14 /// instead of passing output with the return value
15 #[error("InvalidStepCircuitIO")]
16 InvalidStepCircuitIO,
17 /// returned if the supplied input is not of the right length
18 #[error("InvalidInputLength")]
19 InvalidInputLength,
20 /// returned if the supplied witness is not of the right length
21 #[error("InvalidWitnessLength")]
22 InvalidWitnessLength,
23 /// returned if the supplied witness is not a satisfying witness to a given shape and instance
24 #[error("UnSat: {reason}")]
25 UnSat {
26 /// The reason for circuit UnSat failure
27 reason: String,
28 },
29 /// returned if proof verification fails
30 #[error("ProofVerifyError")]
31 ProofVerifyError {
32 /// The reason for the proof verification error
33 reason: String,
34 },
35 /// returned if the provided commitment key is not of sufficient length
36 #[error("InvalidCommitmentKeyLength")]
37 InvalidCommitmentKeyLength,
38 /// returned if the provided number of steps is zero
39 #[error("InvalidNumSteps")]
40 InvalidNumSteps,
41 /// returned when an invalid PCS evaluation argument is provided
42 #[error("InvalidPCS")]
43 InvalidPCS,
44 /// returned when an invalid sum-check proof is provided
45 #[error("InvalidSumcheckProof")]
46 InvalidSumcheckProof,
47 /// returned when the initial input to an incremental computation differs from a previously declared arity
48 #[error("InvalidInitialInputLength")]
49 InvalidInitialInputLength,
50 /// returned when the step execution produces an output whose length differs from a previously declared arity
51 #[error("InvalidStepOutputLength")]
52 InvalidStepOutputLength,
53 /// returned when the transcript engine encounters an overflow of the round number
54 #[error("InternalTranscriptError")]
55 InternalTranscriptError,
56 /// returned when the multiset check fails
57 #[error("InvalidMultisetProof")]
58 InvalidMultisetProof,
59 /// returned when the product proof check fails
60 #[error("InvalidProductProof")]
61 InvalidProductProof,
62 /// returned when the consistency with public IO and assignment used fails
63 #[error("IncorrectWitness")]
64 IncorrectWitness,
65 /// returned when error during synthesis
66 #[error("SynthesisError: {reason}")]
67 SynthesisError {
68 /// The reason for circuit synthesis failure
69 reason: String,
70 },
71 /// returned when there is an error creating a digest
72 #[error("DigestError")]
73 DigestError,
74 /// returned when the prover cannot prove the provided statement due to completeness error
75 #[error("InternalError")]
76 InternalError,
77}
78
79impl From<SynthesisError> for NovaError {
80 fn from(err: SynthesisError) -> Self {
81 Self::SynthesisError {
82 reason: err.to_string(),
83 }
84 }
85}