use crate::base::database::ColumnType;
use snafu::Snafu;
#[derive(Snafu, Debug)]
pub enum ProofError {
#[snafu(display("Verification error: {error}"))]
VerificationError { error: &'static str },
#[snafu(display("Unsupported query plan: {error}"))]
UnsupportedQueryPlan { error: &'static str },
#[snafu(display("Result does not match query: type mismatch"))]
InvalidTypeCoercion,
#[snafu(display("Result does not match query: field names mismatch"))]
FieldNamesMismatch,
#[snafu(display("Result does not match query: field count mismatch"))]
FieldCountMismatch,
#[snafu(transparent)]
ProofSizeMismatch { source: ProofSizeMismatch },
#[snafu(transparent)]
PlaceholderError { source: PlaceholderError },
}
#[derive(Snafu, Debug)]
pub enum ProofSizeMismatch {
#[snafu(display("Sumcheck proof is too small"))]
SumcheckProofTooSmall,
#[snafu(display("Proof has too few MLE evaluations"))]
TooFewMLEEvaluations,
#[snafu(display("Post result challenge count mismatch"))]
PostResultCountMismatch,
#[snafu(display("Constraint count mismatch"))]
ConstraintCountMismatch,
#[snafu(display("Proof has too few bit distributions"))]
TooFewBitDistributions,
#[snafu(display("Proof has too few one lengths"))]
TooFewChiLengths,
#[snafu(display("Proof has too few rho lengths"))]
TooFewRhoLengths,
#[snafu(display("Proof has too few sumcheck variables"))]
TooFewSumcheckVariables,
#[snafu(display("Proof doesn't have requested one length"))]
ChiLengthNotFound,
#[snafu(display("Proof doesn't have requested rho length"))]
RhoLengthNotFound,
}
#[derive(Snafu, Debug, PartialEq, Eq)]
pub enum PlaceholderError {
#[snafu(display("Invalid placeholder index: {index}, number of params: {num_params}"))]
InvalidPlaceholderIndex {
index: usize,
num_params: usize,
},
#[snafu(display("Invalid placeholder type: {index}, expected: {expected}, actual: {actual}"))]
InvalidPlaceholderType {
index: usize,
expected: ColumnType,
actual: ColumnType,
},
#[snafu(display("Placeholder id must be greater than 0"))]
ZeroPlaceholderId,
}
pub type PlaceholderResult<T> = Result<T, PlaceholderError>;