use alloc::string::String;
use snafu::prelude::*;
#[derive(Debug, Clone, Snafu, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum RangeProofError {
#[snafu(display("Could not construct range proof: `{reason}'"))]
ProofConstructionError {
reason: String,
},
#[snafu(display("The deserialization of the range proof failed"))]
InvalidProof {},
#[snafu(display("Invalid input was provided to the RangeProofService constructor: `{reason}'"))]
InitializationError {
reason: String,
},
#[snafu(display("Invalid range proof provided: `{reason}"))]
InvalidRangeProof {
reason: String,
},
#[snafu(display("Invalid range proof rewind, the rewind keys provided must be invalid: `{reason}'"))]
InvalidRewind {
reason: String,
},
#[snafu(display("Inconsistent extension degree: `{reason}'"))]
RPExtensionDegree {
reason: String,
},
}
#[derive(Debug, Clone, Snafu, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum CommitmentError {
#[snafu(display("Inconsistent extension degree: `{reason}'"))]
CommitmentExtensionDegree {
reason: String,
},
}
#[derive(Debug, Snafu, PartialEq, Eq)]
pub enum HashingError {
#[snafu(display("The input to the hashing function is too short."))]
InputTooShort {},
#[snafu(display("Converting a byte string into a secret key failed. `{reason}'"))]
ConversionFromBytes {
reason: String,
},
#[snafu(display("The digest does not produce enough output.`{bytes}' bytes are required."))]
DigestTooShort {
bytes: usize,
},
}
#[derive(Debug, Clone, Snafu, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum SliceError {
#[snafu(display("Cannot create fixed slice of length '{target}' from a slice of length '{provided}'"))]
CopyFromSlice {
target: usize,
provided: usize,
},
}