binius_core/constraint_system/
error.rs1use super::channel::ChannelId;
4use crate::{
5 oracle,
6 oracle::OracleId,
7 piop, polynomial, protocols,
8 protocols::{gkr_gpa, greedy_evalcheck},
9 ring_switch, witness,
10};
11
12#[derive(Debug, thiserror::Error)]
13pub enum Error {
14 #[error("flushes must have a non-empty list of oracles")]
15 EmptyFlushOracles,
16
17 #[error("All flushes within a channel must have the same width. Expected flushed values with length {expected}, got {got}")]
18 ChannelFlushWidthMismatch { expected: usize, got: usize },
19
20 #[error("All oracles within a single flush must have the same n_vars. Expected oracle with n_vars={expected} got {got}")]
21 ChannelFlushNvarsMismatch { expected: usize, got: usize },
22
23 #[error("Channel id out of range. Got {got}, expected max={max}")]
24 ChannelIdOutOfRange { max: ChannelId, got: ChannelId },
25
26 #[error("{oracle} failed witness validation at index={index}. {reason}")]
27 VirtualOracleEvalMismatch {
28 oracle: String,
29 index: usize,
30 reason: String,
31 },
32
33 #[error("{oracle} witness has unexpected n_vars={witness_num_vars}. Expected n_vars={oracle_num_vars}")]
34 VirtualOracleNvarsMismatch {
35 oracle: String,
36 oracle_num_vars: usize,
37 witness_num_vars: usize,
38 },
39
40 #[error("flush selector oracle {selector} incompatible with oracle {id}")]
41 IncompatibleFlushSelector { id: OracleId, selector: OracleId },
42
43 #[error("Non-zero oracles contain zeros")]
44 Zeros,
45
46 #[error("False eq evaluation claim")]
47 FalseEqEvaluationClaim,
48
49 #[error("cannot commit tower level {tower_level}")]
50 CannotCommitTowerLevel { tower_level: usize },
51
52 #[error("Tower level cannot be more than 7")]
53 IncorrectTowerLevel,
54
55 #[error("{oracle} underlier witness data does not match")]
56 PackedUnderlierMismatch { oracle: String },
57
58 #[error("witness error: {0}")]
59 Witness(#[from] witness::Error),
60
61 #[error("constraint error: {0}")]
62 Constraint(#[from] protocols::sumcheck::Error),
63
64 #[error("polynomial error: {0}")]
65 Polynomial(#[from] polynomial::Error),
66
67 #[error("greedy evalcheck error: {0}")]
68 Evalcheck(#[from] greedy_evalcheck::Error),
69
70 #[error("prodcheck error: {0}")]
71 Prodcheck(#[from] gkr_gpa::Error),
72
73 #[error("oracle error: {0}")]
74 Oracle(#[from] oracle::Error),
75
76 #[error("HAL error: {0}")]
77 HalError(#[from] binius_hal::Error),
78
79 #[error("math error: {0}")]
80 MathError(#[from] binius_math::Error),
81
82 #[error("polynomial commitment error: {0}")]
83 PolyCommitError(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
84
85 #[error("PIOP compilation error: {0}")]
86 PIOPCompilerError(#[from] piop::Error),
87
88 #[error("ring switch reduction error: {0}")]
89 RingSwitch(#[from] ring_switch::Error),
90
91 #[error("verification error: {0}")]
92 Verification(#[from] VerificationError),
93
94 #[error("transcript error: {0}")]
95 TranscriptError(#[from] crate::transcript::Error),
96
97 #[error("gkr exp error: {0}")]
98 GkrExp(#[from] crate::protocols::gkr_exp::Error),
99}
100
101#[derive(Debug, thiserror::Error)]
102pub enum VerificationError {
103 #[error("the number of commitments must equal the number of committed batches")]
104 IncorrectNumberOfCommitments,
105 #[error("the number of flush products must equal the number of flushes")]
106 IncorrectNumberOfFlushProducts,
107 #[error(
108 "Channel with id={id} is not balanced. Pushes and pulls do not contain the same elements"
109 )]
110 ChannelUnbalanced { id: ChannelId },
111}