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.
use thiserror::Error;
#[derive(Clone, Debug, Eq, PartialEq)]
#[derive(Error, Clone, Debug, Eq, PartialEq)]
pub enum ProofError {
/// This error occurs when a proof failed to verify.
#[error("proof failed to verify")]
VerificationError,
/// This error occurs when the proof encoding is malformed.
#[error("malformed proof")]
FormatError,
/// This error occurs during proving if the number of blinding
/// factors does not match the number of values.
#[error("number of blinding factors do not match the number of values")]
WrongNumBlindingFactors,
/// This error occurs when attempting to create a proof with
/// bitsize other than \\(8\\), \\(16\\), \\(32\\), or \\(64\\).
#[error("attempted to create a proof with bitsize other than \\(8\\), \\(16\\), \\(32\\), or \\(64\\)")]
InvalidBitsize,
/// This error occurs when there are insufficient generators for the proof.
#[error("insufficient generators for the proof")]
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,
}

View File

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