1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
pub type Result<T> = core::result::Result<T, ZkpError>;
/// zkp errors.
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum ZkpError {
/// Common: Could not serialize object.
SerializationError,
/// Common: Could not deserialize object.
DeserializationError,
/// Common: Unexpected parameter for method or function.
ParameterError,
/// Params: The program is loading verifier parameters that are not hardcoded.
MissingVerifierParamsError,
/// Params: The Noah library is compiled without SRS, which prevents proof generation.
MissingSRSError,
/// Params: Could not preprocess verifier.
VerifierParamsError,
/// PolyComScheme: Cannot compute the proof as sumcheck fails.
PCSProveEvalError,
/// PolyComScheme: The degree of the polynomial is higher than the maximum supported.
DegreeError,
/// Plonk: Querying a selector that does not exist.
SelectorIndexOutOfBound,
/// Plonk: challenge is invalid.
ChallengeError,
/// Plonk: Setup error.
SetupError,
/// Plonk: Group not found of size {0}.
GroupNotFound(usize),
/// Plonk: Division by zero.
DivisionByZero,
/// Plonk: Commitment error.
CommitmentError,
/// Plonk: FFT error.
FFTError,
/// Plonk: Function params error.
FuncParamsError,
/// Plonk: Proof error.
ProofError,
/// Plonk: Verification error.
VerificationError,
/// Plonk: {0}
Message(String),
}
impl core::fmt::Display for ZkpError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{:?}", self)
}
}
impl ark_std::error::Error for ZkpError {
#[cfg(feature = "std")]
fn description(&self) -> &str {
Box::leak(format!("{}", self).into_boxed_str())
}
}