1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use {
crate::{range_proof::errors::RangeProofError, sigma_proofs::errors::*},
thiserror::Error,
};
#[derive(Error, Clone, Debug, Eq, PartialEq)]
pub enum ProofError {
#[error("invalid transfer amount range")]
TransferAmount,
#[error("proof generation failed")]
Generation,
#[error("proof failed to verify")]
Verification,
#[error("range proof failed to verify")]
RangeProof,
#[error("equality proof failed to verify")]
EqualityProof,
#[error("fee proof failed to verify")]
FeeProof,
#[error("zero-balance proof failed to verify")]
ZeroBalanceProof,
#[error("validity proof failed to verify")]
ValidityProof,
#[error(
"`zk_token_elgamal::pod::ElGamalCiphertext` contains invalid ElGamalCiphertext ciphertext"
)]
InconsistentCTData,
#[error("failed to decrypt ciphertext from transfer data")]
Decryption,
}
#[derive(Error, Clone, Debug, Eq, PartialEq)]
pub enum TranscriptError {
#[error("point is the identity")]
ValidationError,
}
impl From<RangeProofError> for ProofError {
fn from(_err: RangeProofError) -> Self {
Self::RangeProof
}
}
impl From<EqualityProofError> for ProofError {
fn from(_err: EqualityProofError) -> Self {
Self::EqualityProof
}
}
impl From<FeeSigmaProofError> for ProofError {
fn from(_err: FeeSigmaProofError) -> Self {
Self::FeeProof
}
}
impl From<ZeroBalanceProofError> for ProofError {
fn from(_err: ZeroBalanceProofError) -> Self {
Self::ZeroBalanceProof
}
}
impl From<ValidityProofError> for ProofError {
fn from(_err: ValidityProofError) -> Self {
Self::ValidityProof
}
}