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
53
use thiserror::Error;
/// Errors from sumcheck protocol verification.
#[derive(Error, Debug, PartialEq, Eq)]
pub enum SumcheckError {
/// The proof contains a different number of rounds than expected.
#[error("Sumcheck round count mismatch: expected {expected}, got {actual}")]
RoundCountMismatch { expected: usize, actual: usize },
/// The proof is missing sumcheck data when rounds > 0.
#[error("Missing sumcheck data for {expected_rounds} expected rounds")]
MissingSumcheckData { expected_rounds: usize },
/// Proof-of-work witness verification failed.
#[error("Invalid proof-of-work witness")]
InvalidPowWitness,
/// The proof carries fewer PoW witnesses than sumcheck rounds.
#[error("Sumcheck PoW witness count mismatch: expected {expected}, got {actual}")]
PowWitnessCountMismatch { expected: usize, actual: usize },
/// HVZK sumcheck: a per-round wire payload had the wrong number of field
/// elements. Each round must carry `max(ℓ_zk - 1, 2)` elements (after the
/// linear coefficient is skipped per Lemma 6.4 / paper §6).
#[error("HVZK round {round}: wire size mismatch, expected {expected}, got {actual}")]
WireSizeMismatch {
round: usize,
expected: usize,
actual: usize,
},
/// HVZK sumcheck: the proof's claimed `ell_zk` (mask code message length)
/// does not match the verifier's expected value. Catches caller-side
/// configuration mismatch between prover and verifier before the wire
/// shape check.
#[error("HVZK ell_zk mismatch: expected {expected}, got {actual}")]
EllZkMismatch { expected: usize, actual: usize },
/// An opening claim's evaluations do not match the requested column shape.
///
/// The evaluations come from the proof, so a malformed proof must be
/// rejected here rather than aborting the verifier.
#[error(
"Opening shape mismatch for table {table_idx}: requested {expected_current} current and {expected_next} next, got {actual_current} current and {actual_next} next"
)]
OpeningShapeMismatch {
table_idx: usize,
expected_current: usize,
expected_next: usize,
actual_current: usize,
actual_next: usize,
},
}