chia_sdk_driver/
driver_error.rs

1use std::{array::TryFromSliceError, num::TryFromIntError};
2
3use chia_sdk_signer::SignerError;
4use clvm_traits::{FromClvmError, ToClvmError};
5use clvmr::error::EvalErr;
6use thiserror::Error;
7
8#[derive(Debug, Error)]
9pub enum DriverError {
10    #[error("io error: {0}")]
11    Io(#[from] std::io::Error),
12
13    #[error("try from int error")]
14    TryFromInt(#[from] TryFromIntError),
15
16    #[error("try from slice error: {0}")]
17    TryFromSlice(#[from] TryFromSliceError),
18
19    #[error("failed to serialize clvm value: {0}")]
20    ToClvm(#[from] ToClvmError),
21
22    #[error("failed to deserialize clvm value: {0}")]
23    FromClvm(#[from] FromClvmError),
24
25    #[error("clvm eval error: {0}")]
26    Eval(#[from] EvalErr),
27
28    #[error("invalid mod hash")]
29    InvalidModHash,
30
31    #[error("non-standard inner puzzle layer")]
32    NonStandardLayer,
33
34    #[error("missing child")]
35    MissingChild,
36
37    #[error("missing hint")]
38    MissingHint,
39
40    #[error("missing memo")]
41    MissingMemo,
42
43    #[error("invalid memo")]
44    InvalidMemo,
45
46    #[error("invalid singleton struct")]
47    InvalidSingletonStruct,
48
49    #[error("expected even oracle fee, but it was odd")]
50    OddOracleFee,
51
52    #[error("custom driver error: {0}")]
53    Custom(String),
54
55    #[error("invalid merkle proof")]
56    InvalidMerkleProof,
57
58    #[error("unknown puzzle")]
59    UnknownPuzzle,
60
61    #[error("invalid spend count for vault subpath")]
62    InvalidSubpathSpendCount,
63
64    #[error("missing spend for vault subpath")]
65    MissingSubpathSpend,
66
67    #[error("delegated puzzle wrapper conflict")]
68    DelegatedPuzzleWrapperConflict,
69
70    #[error("cannot emit conditions from spend")]
71    CannotEmitConditions,
72
73    #[error("cannot settle from spend")]
74    CannotSettleFromSpend,
75
76    #[error("singleton spend already finalized")]
77    AlreadyFinalized,
78
79    #[error("there is no spendable source coin that can create the output without a conflict")]
80    NoSourceForOutput,
81
82    #[error("invalid asset id")]
83    InvalidAssetId,
84
85    #[error("missing key")]
86    MissingKey,
87
88    #[error("missing spend")]
89    MissingSpend,
90
91    #[cfg(feature = "offer-compression")]
92    #[error("missing compression version prefix")]
93    MissingVersionPrefix,
94
95    #[cfg(feature = "offer-compression")]
96    #[error("unsupported compression version")]
97    UnsupportedVersion,
98
99    #[cfg(feature = "offer-compression")]
100    #[error("streamable error: {0}")]
101    Streamable(#[from] chia_traits::Error),
102
103    #[cfg(feature = "offer-compression")]
104    #[error("cannot decompress uncompressed input")]
105    NotCompressed,
106
107    #[cfg(feature = "offer-compression")]
108    #[error("flate2 error: {0}")]
109    Flate2(#[from] flate2::DecompressError),
110
111    #[cfg(feature = "offer-compression")]
112    #[error("error when decoding address: {0}")]
113    Decode(#[from] chia_sdk_utils::Bech32Error),
114
115    #[error("incompatible asset info")]
116    IncompatibleAssetInfo,
117
118    #[error("missing required singleton asset info")]
119    MissingAssetInfo,
120
121    #[error("conflicting inputs in offers")]
122    ConflictingOfferInputs,
123
124    #[error("signer error: {0}")]
125    Signer(#[from] SignerError),
126}