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