binius_ip/sumcheck/
error.rs1use binius_transcript::Error as TranscriptError;
4
5use crate::channel;
6
7#[derive(Debug, thiserror::Error)]
8pub enum Error {
9 #[error("transcript error: {0}")]
10 Transcript(#[source] TranscriptError),
11 #[error("verification error: {0}")]
12 Verification(#[from] VerificationError),
13}
14
15#[derive(Debug, thiserror::Error)]
16pub enum VerificationError {
17 #[error("transcript is empty")]
18 TranscriptIsEmpty,
19 #[error("invalid assertion: value is not zero")]
20 InvalidAssert,
21}
22
23impl From<TranscriptError> for Error {
24 fn from(err: TranscriptError) -> Self {
25 match err {
26 TranscriptError::NotEnoughBytes => VerificationError::TranscriptIsEmpty.into(),
27 _ => Error::Transcript(err),
28 }
29 }
30}
31
32impl From<channel::Error> for Error {
33 fn from(err: channel::Error) -> Self {
34 match err {
35 channel::Error::ProofEmpty => VerificationError::TranscriptIsEmpty.into(),
36 channel::Error::InvalidAssert => VerificationError::InvalidAssert.into(),
37 }
38 }
39}