chia_sdk_driver/
driver_error.rs1use std::{array::TryFromSliceError, num::TryFromIntError};
2
3use chia_sdk_signer::SignerError;
4use clvm_traits::{FromClvmError, ToClvmError};
5use clvmr::reduction::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 #[cfg(feature = "offer-compression")]
89 #[error("missing compression version prefix")]
90 MissingVersionPrefix,
91
92 #[cfg(feature = "offer-compression")]
93 #[error("unsupported compression version")]
94 UnsupportedVersion,
95
96 #[cfg(feature = "offer-compression")]
97 #[error("streamable error: {0}")]
98 Streamable(#[from] chia_traits::Error),
99
100 #[cfg(feature = "offer-compression")]
101 #[error("cannot decompress uncompressed input")]
102 NotCompressed,
103
104 #[cfg(feature = "offer-compression")]
105 #[error("flate2 error: {0}")]
106 Flate2(#[from] flate2::DecompressError),
107
108 #[cfg(feature = "offer-compression")]
109 #[error("invalid prefix: {0}")]
110 InvalidPrefix(String),
111
112 #[cfg(feature = "offer-compression")]
113 #[error("encoding is not bech32m")]
114 InvalidFormat,
115
116 #[cfg(feature = "offer-compression")]
117 #[error("error when decoding address: {0}")]
118 Decode(#[from] bech32::Error),
119
120 #[error("incompatible asset info")]
121 IncompatibleAssetInfo,
122
123 #[error("missing required singleton asset info")]
124 MissingAssetInfo,
125
126 #[error("conflicting inputs in offers")]
127 ConflictingOfferInputs,
128
129 #[error("signer error: {0}")]
130 Signer(#[from] SignerError),
131}