sigma_rs/
errors.rs

1//! # Error: Error Types for Zero-Knowledge Proofs.
2//!
3//! This module defines the [`Error`] enum, which enumerates the possible failure modes
4//! encountered during the execution of interactive or non-interactive Sigma protocols.
5//!
6//! These errors include:
7//! - Failed proof verification,
8//! - Mismatched parameter lengths (e.g., during batch verification),
9//! - Access to unassigned group variables in constraint systems.
10
11/// Represents an error encountered during the execution of a Sigma protocol.
12///
13/// This may occur during proof generation, response computation, or verification.
14#[non_exhaustive]
15#[derive(Debug, thiserror::Error)]
16pub enum Error {
17    /// The proof is invalid: verification failed.
18    #[error("Verification failed.")]
19    VerificationFailure,
20    /// Indicates an invalid statement/witness pair
21    #[error("Invalid instance/witness pair.")]
22    InvalidInstanceWitnessPair,
23    /// Uninitialized group element variable.
24    #[error("Uninitialized group element variable: {var_debug}")]
25    UnassignedGroupVar {
26        /// Debug representation of the unassigned variable.
27        var_debug: String,
28    },
29}