chia_sdk_driver/
driver_error.rs1use 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("metadata updater puzzle hash mismatch")]
32 MetadataUpdaterPuzzleHashMismatch,
33
34 #[error("non-standard inner puzzle layer")]
35 NonStandardLayer,
36
37 #[error("invalid state schedule: must be nonempty and strictly increasing by timestamp")]
38 InvalidStateSchedule,
39
40 #[error("missing child")]
41 MissingChild,
42
43 #[error("missing hint")]
44 MissingHint,
45
46 #[error("missing memo")]
47 MissingMemo,
48
49 #[error("invalid memo")]
50 InvalidMemo,
51
52 #[error("invalid singleton struct")]
53 InvalidSingletonStruct,
54
55 #[error("expected even oracle fee, but it was odd")]
56 OddOracleFee,
57
58 #[error("fee overflow")]
59 FeeOverflow,
60
61 #[error("custom driver error: {0}")]
62 Custom(String),
63
64 #[error("invalid merkle proof")]
65 InvalidMerkleProof,
66
67 #[error("unknown puzzle")]
68 UnknownPuzzle,
69
70 #[error("invalid spend count for vault subpath")]
71 InvalidSubpathSpendCount,
72
73 #[error("missing spend for vault subpath")]
74 MissingSubpathSpend,
75
76 #[error("delegated puzzle wrapper conflict")]
77 DelegatedPuzzleWrapperConflict,
78
79 #[error("cannot emit conditions from spend")]
80 CannotEmitConditions,
81
82 #[error("cannot settle from spend")]
83 CannotSettleFromSpend,
84
85 #[error("singleton spend already finalized")]
86 AlreadyFinalized,
87
88 #[error("there is no spendable source coin that can create the output without a conflict")]
89 NoSourceForOutput,
90
91 #[error("invalid asset id")]
92 InvalidAssetId,
93
94 #[error("missing key")]
95 MissingKey,
96
97 #[error("missing spend")]
98 MissingSpend,
99
100 #[cfg(feature = "offer-compression")]
101 #[error("missing compression version prefix")]
102 MissingVersionPrefix,
103
104 #[cfg(feature = "offer-compression")]
105 #[error("unsupported compression version")]
106 UnsupportedVersion,
107
108 #[cfg(feature = "offer-compression")]
109 #[error("streamable error: {0}")]
110 Streamable(#[from] chia_traits::Error),
111
112 #[cfg(feature = "offer-compression")]
113 #[error("cannot decompress uncompressed input")]
114 NotCompressed,
115
116 #[cfg(feature = "offer-compression")]
117 #[error("decompressed output exceeds maximum allowed size")]
118 DecompressionTooLarge,
119
120 #[cfg(feature = "offer-compression")]
121 #[error("flate2 error: {0}")]
122 Flate2(#[from] flate2::DecompressError),
123
124 #[cfg(feature = "offer-compression")]
125 #[error("error when decoding address: {0}")]
126 Decode(#[from] chia_sdk_utils::Bech32Error),
127
128 #[error("incompatible asset info")]
129 IncompatibleAssetInfo,
130
131 #[error("missing required singleton asset info")]
132 MissingAssetInfo,
133
134 #[error("conflicting inputs in offers")]
135 ConflictingOfferInputs,
136
137 #[error("signer error: {0}")]
138 Signer(#[from] SignerError),
139
140 #[error("invalid delegated spend format")]
141 InvalidDelegatedSpendFormat,
142
143 #[error("invalid vault message format")]
144 InvalidVaultMessageFormat,
145
146 #[error("puzzle hash mismatch for coin spend")]
147 WrongPuzzleHash,
148
149 #[error("nested clawbacks are not allowed")]
150 NestedClawback,
151
152 #[error("linked spend has unknown custody puzzle but was sent a message")]
153 InvalidLinkedCustody,
154
155 #[error("the transaction is not guaranteed to expire when its clawed back spends expire")]
156 UnguaranteedClawBack,
157
158 #[error("the revocation layer of the child does not match the parent")]
159 RevocableChild,
160
161 #[error("conflicting vault launcher ids")]
162 ConflictingVaultLauncherIds,
163
164 #[error("conditions do not match message")]
165 WrongConditions,
166
167 #[error("vault message did not match any custody auth or TAIL invocation")]
168 UnmatchedVaultMessage,
169
170 #[error("missing message for linked custody puzzle")]
171 MissingVaultMessage,
172
173 #[error("multiple vault messages matched the same custody slot")]
174 DuplicateVaultMessage,
175
176 #[error("wrong linked offer launcher id")]
177 WrongLinkedOfferLauncherId,
178
179 #[error("missing required bulletin conditions")]
180 MissingBulletinConditions,
181
182 #[error(
183 "p2 conditions or singleton spend is missing AssertMyCoinId condition to prevent swapping the spend path"
184 )]
185 MissingP2ConditionsOrSingletonAssertion,
186}