binius_core/ring_switch/
error.rs

1// Copyright 2024-2025 Irreducible Inc.
2
3use binius_compute::{alloc, layer};
4
5use crate::{oracle::OracleId, polynomial, transcript};
6
7#[derive(Debug, thiserror::Error)]
8pub enum Error {
9	#[error("committed oracle {id} tower level exceeds maximum of {max}")]
10	OracleTowerLevelTooHigh { id: OracleId, max: usize },
11	#[error("packing degree {kappa} not supported")]
12	PackingDegreeNotSupported { kappa: usize },
13	#[error("cannot call function when argument tower heights do not match")]
14	TowerLevelMismatch,
15	#[error("invalid arguments: {0}")]
16	InvalidArgs(String),
17	#[error("invalid witness: {0}")]
18	InvalidWitness(String),
19	#[error("the PIOP compiler cannot handle evaluation claim for derived oracle {id}")]
20	EvalcheckClaimForDerivedPoly { id: OracleId },
21	#[error("the committed oracle {id} is missing from the index")]
22	OracleToCommitIndexMissingEntry { id: OracleId },
23	#[error("binius_math error: {0}")]
24	Math(#[from] binius_math::Error),
25	#[error("transcript error: {0}")]
26	Transcript(#[from] transcript::Error),
27	#[error("Polynomial error: {0}")]
28	Polynomial(#[from] polynomial::Error),
29	#[error("HAL error: {0}")]
30	HAL(#[from] binius_hal::Error),
31	#[error("compute error: {0}")]
32	ComputeError(#[from] layer::Error),
33	#[error("allocation error: {0}")]
34	AllocError(#[from] alloc::Error),
35	#[error("verification error: {0}")]
36	VerificationError(#[from] VerificationError),
37}
38
39#[derive(Debug, thiserror::Error)]
40pub enum VerificationError {
41	#[error("evaluation value is inconsistent with the tensor evaluation")]
42	IncorrectEvaluation,
43	#[error("the claimed row-batched sum is inconsistent with the tensor evaluation")]
44	IncorrectRowBatchedSum,
45	#[error("Transcript error: {0}")]
46	Transcript(#[from] transcript::Error),
47}