Skip to main content

veilocity_prover/
error.rs

1//! Error types for the prover crate
2
3use thiserror::Error;
4
5/// Errors that can occur during proof generation
6#[derive(Error, Debug)]
7pub enum ProverError {
8    /// Witness generation failed
9    #[error("Failed to generate witness: {0}")]
10    WitnessGeneration(String),
11
12    /// Proof generation failed
13    #[error("Failed to generate proof: {0}")]
14    ProofGeneration(String),
15
16    /// Proof verification failed
17    #[error("Proof verification failed: {0}")]
18    ProofVerification(String),
19
20    /// Invalid input provided
21    #[error("Invalid input: {0}")]
22    InvalidInput(String),
23
24    /// IO error
25    #[error("IO error: {0}")]
26    Io(#[from] std::io::Error),
27
28    /// Serialization error
29    #[error("Serialization error: {0}")]
30    Serialization(#[from] serde_json::Error),
31
32    /// Circuit not found
33    #[error("Circuit not found: {0}")]
34    CircuitNotFound(String),
35
36    /// Command execution failed
37    #[error("Command execution failed: {0}")]
38    CommandFailed(String),
39
40    /// Insufficient balance
41    #[error("Insufficient balance: have {have}, need {need}")]
42    InsufficientBalance { have: u128, need: u128 },
43
44    /// Invalid Merkle proof
45    #[error("Invalid Merkle proof")]
46    InvalidMerkleProof,
47
48    /// Circuit compilation required
49    #[error("Circuit needs to be compiled first. Run: cd circuits && nargo compile")]
50    CircuitNotCompiled,
51}