binius_core/protocols/fri/
error.rs1use binius_ntt::Error as NttError;
4
5use crate::transcript;
6
7#[derive(Debug, thiserror::Error)]
8pub enum Error {
9 #[error("cannot calculate parameters satisfying the security target")]
10 ParameterError,
11 #[error("conflicting or incorrect constructor argument: {0}")]
12 InvalidArgs(String),
13 #[error("FRI message dimension is too small")]
14 MessageDimensionIsTooSmall,
15 #[error("fold arities total exceeds the number of fold rounds")]
16 InvalidFoldAritySequence,
17 #[error("fold arity at index {index} in sequence is zero")]
18 FoldArityIsZero { index: usize },
19 #[error("the fold arity for the first fold should be at least the log batch size")]
20 FirstFoldArityTooSmall,
21 #[error("attempted to fold more than maximum of {max_folds} times")]
22 TooManyFoldExecutions { max_folds: usize },
23 #[error("attempted to finish prover before executing all fold rounds")]
24 EarlyProverFinish,
25 #[error("round VCS vector_length values must be strictly decreasing")]
26 RoundVCSLengthsNotDescending,
27 #[error("log round VCS vector_length must be in range between log_inv_rate and log_len")]
28 RoundVCSLengthsOutOfRange,
29 #[error("round VCS vector_length must be a power of two")]
30 RoundVCSLengthsNotPowerOfTwo,
31 #[error("Reed-Solomon encoding error: {0}")]
32 EncodeError(#[from] NttError),
33 #[error("vector commit error: {0}")]
34 VectorCommit(#[source] Box<dyn std::error::Error + Send + Sync>),
35 #[error("verification error: {0}")]
36 Verification(#[from] VerificationError),
37 #[error("transcript error: {0}")]
38 TranscriptError(#[from] transcript::Error),
39}
40
41#[derive(Debug, thiserror::Error)]
42pub enum VerificationError {
43 #[error("incorrect codeword folding in query round {query_round} at index {index}")]
44 IncorrectFold { query_round: usize, index: usize },
45 #[error("the size of the query proof is incorrect, expected {expected}")]
46 IncorrectQueryProofLength { expected: usize },
47 #[error("the number of values in round {round} of the query proof is incorrect, expected {coset_size}")]
48 IncorrectQueryProofValuesLength { round: usize, coset_size: usize },
49 #[error("The dimension-1 codeword must contain the same values")]
50 IncorrectDegree,
51}