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; only has {n_vars}, must be at least {min_vars}")]
13	OracleTooSmall {
14		id: OracleId,
15		n_vars: usize,
16		min_vars: usize,
17	},
18	#[error("committed polynomials are not sorted in ascending order by number of variables")]
19	CommittedsNotSorted,
20	#[error("transparent polynomials are not sorted in ascending order by number of variables")]
21	TransparentsNotSorted,
22	#[error("committed polynomial witness for oracle {id} is missing packed evaluations")]
23	CommittedPackedEvaluationsMissing { id: OracleId },
24	#[error("invalid committed ID")]
25	InvalidCommittedId { max_index: usize },
26	#[error("invalid transparent ID")]
27	InvalidTransparentId { max_index: usize },
28	#[error("the number of variables recorded for oracle {id} is incorrect")]
29	OracleToCommitIndexMalformed { id: OracleId },
30	#[error("the number of variables of the polynomials in sumcheck claim {index} do not match")]
31	SumcheckClaimVariablesMismatch { index: usize },
32	#[error("binius_math error: {0}")]
33	Math(#[from] binius_math::Error),
34	#[error("Polynomial error: {0}")]
35	Polynomial(#[from] polynomial::Error),
36	#[error("FRI error: {0}")]
37	FRI(#[from] fri::Error),
38	#[error("Sumcheck error: {0}")]
39	Sumcheck(#[from] sumcheck::Error),
40	#[error("witness error: {0}")]
41	Witness(#[from] witness::Error),
42	#[error("NTT error: {0}")]
43	NTT(#[from] binius_ntt::Error),
44	#[error("verification error: {0}")]
45	VerificationError(#[from] VerificationError),
46}
47
48#[derive(Debug, thiserror::Error)]
49pub enum VerificationError {
50	#[error("sumcheck claimed evaluation for transparent {index} is incorrect")]
51	IncorrectTransparentEvaluation { index: usize },
52	#[error("sumcheck final evaluation is incorrect")]
53	IncorrectSumcheckEvaluation,
54	#[error("Transcript error: {0}")]
55	Transcript(#[from] transcript::Error),
56}