hopr_protocol_pix/
errors.rs1use crate::SsaIndex;
2
3#[derive(Debug, thiserror::Error)]
5pub enum PixError<P: std::fmt::Display> {
6 #[error("invalid input to the function")]
7 InvalidInput,
8 #[error("invalid configuration: {0}")]
9 InvalidConfiguration(#[from] validator::ValidationErrors),
10 #[error("acknowledgement from this peer is not paired to any encrypted share")]
11 UnexpectedShare,
12 #[error("received an ssa share from pseudonym {0} #{1} that could not be verified")]
20 InvalidShare(P, SsaIndex),
21 #[error("encrypted partial ssa share is empty")]
22 ShareIsEmpty,
23 #[error("awaiting-acknowledgement buffer is at its configured byte budget; share dropped")]
30 AckBufferFull,
31 #[error("ssa commitment does not match ssa")]
32 InvalidSsa,
33 #[error("received duplicate commitment")]
34 DuplicateCommitment,
35 #[error("missing commitment for building ssa")]
36 MissingSsaCommitment,
37 #[error(
38 "client ssa commitment is not accompanied by a valid proof of knowledge of its discrete logarithm — the \
39 sender may be attempting to make the deposit key recoverable by itself alone"
40 )]
41 UnprovenSsaCommitment,
42 #[error("ssa index will overflow")]
43 SsaIndexOverflow,
44 #[error("crypto error: {0}")]
45 CryptoError(#[from] hopr_types::crypto::errors::CryptoError),
46 #[error("ecc calculation error: {0}")]
47 EccError(#[from] vsss_rs::elliptic_curve::Error),
48 #[error("secret sharing error: {0}")]
49 VsssError(vsss_rs::Error),
50}
51
52impl<P: std::fmt::Display> From<vsss_rs::Error> for PixError<P> {
53 fn from(err: vsss_rs::Error) -> Self {
54 PixError::VsssError(err)
55 }
56}
57
58pub type Result<T, P> = std::result::Result<T, PixError<P>>;