binius_core/protocols/evalcheck/
error.rs1use binius_field::TowerField;
4
5use crate::{
6 oracle::{CompositePolyOracle, Error as OracleError, OracleId},
7 polynomial::Error as PolynomialError,
8};
9
10#[derive(Debug, thiserror::Error)]
11pub enum Error {
12 #[error("witness is unable to evaluate multilinear with ID: {0}")]
13 InvalidWitness(OracleId),
14 #[error("missing query")]
15 MissingQuery,
16 #[error("oracle error: {0}")]
17 Oracle(#[from] OracleError),
18 #[error("polynomial error: {0}")]
19 Polynomial(#[from] PolynomialError),
20 #[error("verification failure: {0}")]
21 Verification(#[from] VerificationError),
22 #[error("witness error: {0}")]
23 Witness(#[from] crate::witness::Error),
24 #[error("sumcheck error: {0}")]
25 Sumcheck(#[from] crate::protocols::sumcheck::Error),
26 #[error("HAL error: {0}")]
27 HalError(#[from] binius_hal::Error),
28 #[error("Math error: {0}")]
29 MathError(#[from] binius_math::Error),
30 #[error("Evalcheck serialization error")]
31 EvalcheckSerializationError,
32 #[error("transcript error: {0}")]
33 TranscriptError(#[from] crate::transcript::Error),
34}
35
36#[derive(Debug, thiserror::Error)]
37pub enum VerificationError {
38 #[error("evaluation is incorrect for oracle: {0}")]
39 IncorrectEvaluation(String),
40 #[error("CompositePolyOracle verification failed: {0}")]
41 IncorrectCompositePolyEvaluation(String),
42 #[error("subproof type or shape does not match the claim")]
43 SubproofMismatch,
44}
45
46impl VerificationError {
47 pub fn incorrect_composite_poly_evaluation<F: TowerField>(
48 oracle: &CompositePolyOracle<F>,
49 ) -> Self {
50 let names = oracle
51 .inner_polys()
52 .iter()
53 .map(|inner| inner.label())
54 .collect::<Vec<_>>();
55 let s = format!("Composition: {:?} with inner: {:?}", oracle.composition(), names);
56 Self::IncorrectCompositePolyEvaluation(s)
57 }
58}