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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
use dusk_bytes::Error as DuskBytesError;
#[derive(core::fmt::Debug)]
pub enum Error {
InvalidEvalDomainSize {
log_size_of_group: u32,
adacity: u32,
},
ProofVerificationError,
CircuitInputsNotFound,
UninitializedPIGenerator,
InvalidPublicInputBytes,
CircuitAlreadyPreprocessed,
MismatchedPolyLen,
DegreeIsZero,
TruncatedDegreeTooLarge,
TruncatedDegreeIsZero,
PolynomialDegreeTooLarge,
PolynomialDegreeIsZero,
PairingCheckFailure,
BytesError(DuskBytesError),
NotEnoughBytes,
PointMalformed,
BlsScalarMalformed,
}
#[cfg(feature = "std")]
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::InvalidEvalDomainSize {
log_size_of_group,
adacity,
} => write!(
f,
"Log-size of the EvaluationDomain group > TWO_ADACITY\
Size: {:?} > TWO_ADACITY = {:?}",
log_size_of_group, adacity
),
Self::ProofVerificationError => {
write!(f, "proof verification failed")
}
Self::CircuitInputsNotFound => {
write!(f, "circuit inputs not found")
}
Self::UninitializedPIGenerator => {
write!(f, "PI generator uninitialized")
}
Self::InvalidPublicInputBytes => {
write!(f, "invalid public input bytes")
}
Self::MismatchedPolyLen => {
write!(f, "the length of the wires is not the same")
}
Self::CircuitAlreadyPreprocessed => {
write!(f, "circuit has already been preprocessed")
}
Self::DegreeIsZero => {
write!(f, "cannot create PublicParameters with max degree 0")
}
Self::TruncatedDegreeTooLarge => {
write!(f, "cannot trim more than the maximum degree")
}
Self::TruncatedDegreeIsZero => write!(
f,
"cannot trim PublicParameters to a maximum size of zero"
),
Self::PolynomialDegreeTooLarge => write!(
f,
"proving key is not large enough to commit to said polynomial"
),
Self::PolynomialDegreeIsZero => {
write!(f, "cannot commit to polynomial of zero degree")
}
Self::PairingCheckFailure => write!(f, "pairing check failed"),
Self::NotEnoughBytes => write!(f, "not enough bytes left to read"),
Self::PointMalformed => write!(f, "BLS point bytes malformed"),
Self::BlsScalarMalformed => write!(f, "BLS scalar bytes malformed"),
Self::BytesError(err) => write!(f, "{:?}", err),
}
}
}
impl From<DuskBytesError> for Error {
fn from(bytes_err: DuskBytesError) -> Self {
Self::BytesError(bytes_err)
}
}
#[cfg(feature = "std")]
impl std::error::Error for Error {}