binius_core/piop/
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
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2024-2025 Irreducible Inc.

use crate::{
	oracle::OracleId,
	polynomial,
	protocols::{fri, sumcheck},
	transcript, witness,
};

#[derive(Debug, thiserror::Error)]
pub enum Error {
	#[error("committed oracle {id} has too few variables, must be at least {min_vars}")]
	OracleTooSmall { id: OracleId, min_vars: usize },
	#[error("committed polynomials are not sorted in ascending order by number of variables")]
	CommittedsNotSorted,
	#[error("transparent polynomials are not sorted in ascending order by number of variables")]
	TransparentsNotSorted,
	#[error("committed polynomial witness for oracle {id} is missing packed evaluations")]
	CommittedPackedEvaluationsMissing { id: OracleId },
	#[error("invalid committed ID")]
	InvalidCommittedId { max_index: usize },
	#[error("invalid transparent ID")]
	InvalidTransparentId { max_index: usize },
	#[error("the number of variables recorded for oracle {id} is incorrect")]
	OracleToCommitIndexMalformed { id: OracleId },
	#[error("the number of variables of the polynomials in sumcheck claim {index} do not match")]
	SumcheckClaimVariablesMismatch { index: usize },
	#[error("binius_math error: {0}")]
	Math(#[from] binius_math::Error),
	#[error("Polynomial error: {0}")]
	Polynomial(#[from] polynomial::Error),
	#[error("FRI error: {0}")]
	FRI(#[from] fri::Error),
	#[error("Sumcheck error: {0}")]
	Sumcheck(#[from] sumcheck::Error),
	#[error("witness error: {0}")]
	Witness(#[from] witness::Error),
	#[error("NTT error: {0}")]
	NTT(#[from] binius_ntt::Error),
	#[error("verification error: {0}")]
	VerificationError(#[from] VerificationError),
}

#[derive(Debug, thiserror::Error)]
pub enum VerificationError {
	#[error("sumcheck claimed evaluation for transparent {index} is incorrect")]
	IncorrectTransparentEvaluation { index: usize },
	#[error("sumcheck final evaluation is incorrect")]
	IncorrectSumcheckEvaluation,
	#[error("Transcript error: {0}")]
	Transcript(#[from] transcript::Error),
}