1use std::io;
4use thiserror::Error;
5
6#[derive(Error, Copy, Clone, Debug, PartialEq, Eq)]
10pub enum RandError {
11 #[error("failed to generate a secure stream of random bytes")]
13 FillBytes,
14}
15
16#[derive(Error, Copy, Clone, Debug, PartialEq, Eq)]
18pub enum NoteError {
19 #[error("Randomness generation failure")]
21 InsufficientRandomness(#[from] RandError),
22 #[error("failed to generate an Orchard note's rho.")]
24 InvalidRho,
25}
26
27#[derive(Error, Copy, Clone, Debug, PartialEq, Eq)]
29pub enum NoteCommitmentError {
30 #[error("Randomness generation failure")]
32 InsufficientRandomness(#[from] RandError),
33 #[error("failed to generate a sapling::NoteCommitment from a diversifier")]
35 InvalidDiversifier,
36}
37
38#[derive(Error, Copy, Clone, Debug, PartialEq, Eq)]
41pub enum KeyError {
42 #[error("Randomness generation failure")]
44 InsufficientRandomness(#[from] RandError),
45}
46
47#[derive(Error, Copy, Clone, Debug, PartialEq, Eq)]
50pub enum AddressError {
51 #[error("Randomness generation failure")]
53 InsufficientRandomness(#[from] RandError),
54 #[error("Randomness did not hash into the Jubjub group for producing a new diversifier")]
56 DiversifierGenerationFailure,
57}
58
59#[derive(Error, Debug)]
61pub enum Error {
62 #[error("invalid consensus branch id")]
64 InvalidConsensusBranchId,
65
66 #[error("Zebra's type could not be converted to its librustzcash equivalent: ")]
68 Conversion(#[from] io::Error),
69
70 #[error("the transaction is missing a network upgrade")]
72 MissingNetworkUpgrade,
73}