proof_of_sql/base/proof/
error.rs1use crate::base::database::ColumnType;
2use snafu::Snafu;
3
4#[derive(Snafu, Debug)]
5pub enum ProofError {
7 #[snafu(display("Verification error: {error}"))]
8 VerificationError { error: &'static str },
10 #[snafu(display("Unsupported query plan: {error}"))]
12 UnsupportedQueryPlan { error: &'static str },
13 #[snafu(display("Result does not match query: type mismatch"))]
15 InvalidTypeCoercion,
16 #[snafu(display("Result does not match query: field names mismatch"))]
18 FieldNamesMismatch,
19 #[snafu(display("Result does not match query: field count mismatch"))]
21 FieldCountMismatch,
22 #[snafu(transparent)]
23 ProofSizeMismatch { source: ProofSizeMismatch },
24 #[snafu(transparent)]
25 PlaceholderError { source: PlaceholderError },
26}
27
28#[derive(Snafu, Debug)]
29pub enum ProofSizeMismatch {
31 #[snafu(display("Sumcheck proof is too small"))]
33 SumcheckProofTooSmall,
34 #[snafu(display("Proof has too few MLE evaluations"))]
36 TooFewMLEEvaluations,
37 #[snafu(display("Post result challenge count mismatch"))]
39 PostResultCountMismatch,
40 #[snafu(display("Constraint count mismatch"))]
42 ConstraintCountMismatch,
43 #[snafu(display("Proof has too few bit distributions"))]
45 TooFewBitDistributions,
46 #[snafu(display("Proof has too few one lengths"))]
48 TooFewChiLengths,
49 #[snafu(display("Proof has too few rho lengths"))]
51 TooFewRhoLengths,
52 #[snafu(display("Proof has too few sumcheck variables"))]
54 TooFewSumcheckVariables,
55 #[snafu(display("Proof doesn't have requested one length"))]
57 ChiLengthNotFound,
58 #[snafu(display("Proof doesn't have requested rho length"))]
60 RhoLengthNotFound,
61}
62
63#[derive(Snafu, Debug, PartialEq, Eq)]
65pub enum PlaceholderError {
66 #[snafu(display("Invalid placeholder index: {index}, number of params: {num_params}"))]
67 InvalidPlaceholderIndex {
69 index: usize,
71 num_params: usize,
73 },
74
75 #[snafu(display("Invalid placeholder type: {index}, expected: {expected}, actual: {actual}"))]
76 InvalidPlaceholderType {
78 index: usize,
80 expected: ColumnType,
82 actual: ColumnType,
84 },
85
86 #[snafu(display("Placeholder id must be greater than 0"))]
87 ZeroPlaceholderId,
89}
90
91pub type PlaceholderResult<T> = Result<T, PlaceholderError>;