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
// Copyright 2024 Ulvetanna Inc.

use crate::polynomial::Error as PolynomialError;

#[derive(Debug, thiserror::Error)]
pub enum Error {
	#[error("oracles must be sorted in descending order by number of variables")]
	OraclesOutOfOrder,
	#[error("batch was empty")]
	EmptyBatch,
	#[error("the inputted claims are not eligible for batch proving")]
	IneligibleBatch,
	#[error("no witness stored for a specified index")]
	WitnessNotFound,
	#[error("prover has mismatch between claim and witness")]
	ProverClaimWitnessMismatch,
	#[error("cannot extract witness past introduction round")]
	CannotExtractWitnessPastIntroductionRound,
	#[error("the evaluation domain does not match the expected size")]
	EvaluationDomainMismatch,
	#[error("prover was given a previous rd challenge in the initial rd")]
	PreviousRoundChallengePresent,
	#[error("prover was not given a previous rd challenge in a later rd")]
	PreviousRoundChallengeAbsent,
	#[error("polynomial error: {0}")]
	Polynomial(#[from] PolynomialError),
	#[error("verification failure: {0}")]
	Verification(#[from] VerificationError),
}

#[derive(Debug, thiserror::Error)]
pub enum VerificationError {
	#[error("incorrect number of rounds")]
	NumberOfRounds,
	#[error("incorrect number of batch mixing coefficients")]
	NumberOfBatchCoeffs,
	#[error("the number of final evaluations must match the number of instances")]
	NumberOfFinalEvaluations,
}