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("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("decompressed output exceeds maximum allowed size")]
109 DecompressionTooLarge,
110
111 #[cfg(feature = "offer-compression")]
112 #[error("flate2 error: {0}")]
113 Flate2(#[from] flate2::DecompressError),
114
115 #[cfg(feature = "offer-compression")]
116 #[error("error when decoding address: {0}")]
117 Decode(#[from] chia_sdk_utils::Bech32Error),
118
119 #[error("incompatible asset info")]
120 IncompatibleAssetInfo,
121
122 #[error("missing required singleton asset info")]
123 MissingAssetInfo,
124
125 #[error("conflicting inputs in offers")]
126 ConflictingOfferInputs,
127
128 #[error("signer error: {0}")]
129 Signer(#[from] SignerError),
130
131 #[error("invalid delegated spend format")]
132 InvalidDelegatedSpendFormat,
133
134 #[error("invalid vault message format")]
135 InvalidVaultMessageFormat,
136
137 #[error("puzzle hash mismatch for coin spend")]
138 WrongPuzzleHash,
139
140 #[error("nested clawbacks are not allowed")]
141 NestedClawback,
142
143 #[error("linked spend has unknown custody puzzle but was sent a message")]
144 InvalidLinkedCustody,
145
146 #[error("the transaction is not guaranteed to expire when its clawed back spends expire")]
147 UnguaranteedClawBack,
148
149 #[error("the revocation layer of the child does not match the parent")]
150 RevocableChild,
151
152 #[error("conflicting vault launcher ids")]
153 ConflictingVaultLauncherIds,
154
155 #[error("conditions do not match message")]
156 WrongConditions,
157
158 #[error("vault message did not match any custody auth or TAIL invocation")]
159 UnmatchedVaultMessage,
160
161 #[error("missing message for linked custody puzzle")]
162 MissingVaultMessage,
163
164 #[error("multiple vault messages matched the same custody slot")]
165 DuplicateVaultMessage,
166
167 #[error("wrong linked offer launcher id")]
168 WrongLinkedOfferLauncherId,
169
170 #[error("missing required bulletin conditions")]
171 MissingBulletinConditions,
172
173 #[error(
174 "p2 conditions or singleton spend is missing AssertMyCoinId condition to prevent swapping the spend path"
175 )]
176 MissingP2ConditionsOrSingletonAssertion,
177}