Derive thiserror::Error for ProofError

This commit is contained in:
Michael Vines 2021-10-28 11:56:39 -07:00
parent 2c51288afd
commit 88ce934bd7
2 changed files with 11 additions and 10 deletions

View File

@ -1,19 +1,20 @@
//! Errors related to proving and verifying proofs. //! Errors related to proving and verifying proofs.
use thiserror::Error;
#[derive(Clone, Debug, Eq, PartialEq)] #[derive(Error, Clone, Debug, Eq, PartialEq)]
pub enum ProofError { pub enum ProofError {
/// This error occurs when a proof failed to verify. #[error("proof failed to verify")]
VerificationError, VerificationError,
/// This error occurs when the proof encoding is malformed. #[error("malformed proof")]
FormatError, FormatError,
/// This error occurs during proving if the number of blinding #[error("number of blinding factors do not match the number of values")]
/// factors does not match the number of values.
WrongNumBlindingFactors, WrongNumBlindingFactors,
/// This error occurs when attempting to create a proof with #[error("attempted to create a proof with bitsize other than \\(8\\), \\(16\\), \\(32\\), or \\(64\\)")]
/// bitsize other than \\(8\\), \\(16\\), \\(32\\), or \\(64\\).
InvalidBitsize, InvalidBitsize,
/// This error occurs when there are insufficient generators for the proof. #[error("insufficient generators for the proof")]
InvalidGeneratorsLength, InvalidGeneratorsLength,
/// This error occurs a `zk_token_elgamal::pod::ElGamalCiphertext` contains invalid ElGamalCiphertext ciphertext #[error(
"`zk_token_elgamal::pod::ElGamalCiphertext` contains invalid ElGamalCiphertext ciphertext"
)]
InconsistentCTData, InconsistentCTData,
} }

View File

@ -16,7 +16,7 @@ pub trait Verifiable {
} }
#[cfg(not(target_arch = "bpf"))] #[cfg(not(target_arch = "bpf"))]
#[derive(Debug,Copy,Clone)] #[derive(Debug, Copy, Clone)]
pub enum Role { pub enum Role {
Source, Source,
Dest, Dest,