binius_core/piop/
error.rs

1// Copyright 2024-2025 Irreducible Inc.
2
3use crate::{
4	oracle::OracleId,
5	polynomial,
6	protocols::{fri, sumcheck},
7	transcript, witness,
8};
9
10#[derive(Debug, thiserror::Error)]
11pub enum Error {
12	#[error("committed oracle {id} has too few variables, must be at least {min_vars}")]
13	OracleTooSmall { id: OracleId, min_vars: usize },
14	#[error("committed polynomials are not sorted in ascending order by number of variables")]
15	CommittedsNotSorted,
16	#[error("transparent polynomials are not sorted in ascending order by number of variables")]
17	TransparentsNotSorted,
18	#[error("committed polynomial witness for oracle {id} is missing packed evaluations")]
19	CommittedPackedEvaluationsMissing { id: OracleId },
20	#[error("invalid committed ID")]
21	InvalidCommittedId { max_index: usize },
22	#[error("invalid transparent ID")]
23	InvalidTransparentId { max_index: usize },
24	#[error("the number of variables recorded for oracle {id} is incorrect")]
25	OracleToCommitIndexMalformed { id: OracleId },
26	#[error("the number of variables of the polynomials in sumcheck claim {index} do not match")]
27	SumcheckClaimVariablesMismatch { index: usize },
28	#[error("binius_math error: {0}")]
29	Math(#[from] binius_math::Error),
30	#[error("Polynomial error: {0}")]
31	Polynomial(#[from] polynomial::Error),
32	#[error("FRI error: {0}")]
33	FRI(#[from] fri::Error),
34	#[error("Sumcheck error: {0}")]
35	Sumcheck(#[from] sumcheck::Error),
36	#[error("witness error: {0}")]
37	Witness(#[from] witness::Error),
38	#[error("NTT error: {0}")]
39	NTT(#[from] binius_ntt::Error),
40	#[error("verification error: {0}")]
41	VerificationError(#[from] VerificationError),
42}
43
44#[derive(Debug, thiserror::Error)]
45pub enum VerificationError {
46	#[error("sumcheck claimed evaluation for transparent {index} is incorrect")]
47	IncorrectTransparentEvaluation { index: usize },
48	#[error("sumcheck final evaluation is incorrect")]
49	IncorrectSumcheckEvaluation,
50	#[error("Transcript error: {0}")]
51	Transcript(#[from] transcript::Error),
52}