binius_core/piop/
error.rs

1// Copyright 2024-2025 Irreducible Inc.
2
3use binius_compute::layer;
4
5use crate::{
6	oracle::OracleId,
7	polynomial,
8	protocols::{fri, sumcheck},
9	reed_solomon, transcript, witness,
10};
11
12#[derive(Debug, thiserror::Error)]
13pub enum Error {
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("Compute layer allocation error: {0}")]
29	Alloc(#[from] binius_compute::alloc::Error),
30	#[error("compute error: {0}")]
31	ComputeError(#[from] layer::Error),
32	#[error("binius_math error: {0}")]
33	Math(#[from] binius_math::Error),
34	#[error("Reed-Solomon error: {0}")]
35	ReedSolomon(#[from] reed_solomon::Error),
36	#[error("Polynomial error: {0}")]
37	Polynomial(#[from] polynomial::Error),
38	#[error("FRI error: {0}")]
39	FRI(#[from] fri::Error),
40	#[error("Sumcheck error: {0}")]
41	Sumcheck(#[from] sumcheck::Error),
42	#[error("witness error: {0}")]
43	Witness(#[from] witness::Error),
44	#[error("NTT error: {0}")]
45	NTT(#[from] binius_ntt::Error),
46	#[error("verification error: {0}")]
47	VerificationError(#[from] VerificationError),
48}
49
50#[derive(Debug, thiserror::Error)]
51pub enum VerificationError {
52	#[error("sumcheck claimed evaluation for transparent {index} is incorrect")]
53	IncorrectTransparentEvaluation { index: usize },
54	#[error("sumcheck final evaluation is incorrect")]
55	IncorrectSumcheckEvaluation,
56	#[error("Transcript error: {0}")]
57	Transcript(#[from] transcript::Error),
58}