binius_core/ring_switch/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2024-2025 Irreducible Inc.

use crate::{oracle::OracleId, polynomial, transcript};

#[derive(Debug, thiserror::Error)]
pub enum Error {
	#[error("committed oracle {id} tower level exceeds maximum of {max}")]
	OracleTowerLevelTooHigh { id: OracleId, max: usize },
	#[error("packing degree {kappa} not supported")]
	PackingDegreeNotSupported { kappa: usize },
	#[error("cannot call function when argument tower heights do not match")]
	TowerLevelMismatch,
	#[error("invalid arguments: {0}")]
	InvalidArgs(String),
	#[error("invalid witness: {0}")]
	InvalidWitness(String),
	#[error("the PIOP compiler cannot handle evaluation claim for derived oracle {id}")]
	EvalcheckClaimForDerivedPoly { id: OracleId },
	#[error("the committed oracle {id} is missing from the index")]
	OracleToCommitIndexMissingEntry { id: OracleId },
	#[error("binius_math error: {0}")]
	Math(#[from] binius_math::Error),
	#[error("transcript error: {0}")]
	Transcript(#[from] transcript::Error),
	#[error("Polynomial error: {0}")]
	Polynomial(#[from] polynomial::Error),
	#[error("HAL error: {0}")]
	HAL(#[from] binius_hal::Error),
	#[error("verification error: {0}")]
	VerificationError(#[from] VerificationError),
}

#[derive(Debug, thiserror::Error)]
pub enum VerificationError {
	#[error("evaluation value is inconsistent with the tensor evaluation")]
	IncorrectEvaluation,
	#[error("the claimed row-batched sum is inconsistent with the tensor evaluation")]
	IncorrectRowBatchedSum,
	#[error("Transcript error: {0}")]
	Transcript(#[from] transcript::Error),
}