drive_abci/error/
execution.rs

1use dpp::bls_signatures::BlsError;
2use dpp::dashcore::consensus::encode::Error as DashCoreConsensusEncodeError;
3use dpp::identity::TimestampMillis;
4use dpp::version::FeatureVersion;
5use drive::error::Error as DriveError;
6
7// @append_only
8/// Execution errors
9#[derive(Debug, thiserror::Error)]
10pub enum ExecutionError {
11    /// A required key is missing.
12    #[error("missing required key: {0}")]
13    MissingRequiredKey(&'static str),
14
15    /// The state has not been initialized.
16    #[error("state not initialized: {0}")]
17    StateNotInitialized(&'static str),
18
19    /// An overflow error occurred.
20    #[error("overflow error: {0}")]
21    Overflow(&'static str),
22
23    /// A conversion error occurred.
24    #[error("conversion error: {0}")]
25    Conversion(String),
26
27    /// The platform encountered a corrupted code execution error.
28    #[error("platform corrupted code execution error: {0}")]
29    CorruptedCodeExecution(&'static str),
30
31    /// Platform expected a specific version but got another.
32    #[error("platform corrupted code version mismatch: {0}")]
33    CorruptedCodeVersionMismatch(&'static str),
34
35    /// Platform expected some specific versions
36    #[error("platform unknown version on {method}, received: {received}")]
37    UnknownVersionMismatch {
38        /// method
39        method: String,
40        /// the allowed versions for this method
41        known_versions: Vec<FeatureVersion>,
42        /// requested core height
43        received: FeatureVersion,
44    },
45
46    /// Platform expected some specific versions
47    #[error("{method} not active for drive version")]
48    VersionNotActive {
49        /// method
50        method: String,
51        /// the allowed versions for this method
52        known_versions: Vec<FeatureVersion>,
53    },
54
55    /// The platform encountered a corrupted cache state error.
56    #[error("platform corrupted cached state error: {0}")]
57    CorruptedCachedState(String),
58
59    /// The fork is not yet active for core.
60    #[error("initialization fork not active: {0}")]
61    InitializationForkNotActive(String),
62
63    /// Invalid core chain locked height
64    #[error("initial height {initial_height} is not chain locked. latest chainlocked height is {chain_lock_height}")]
65    InitializationHeightIsNotLocked {
66        /// initial height (requested or fork)
67        initial_height: u32,
68        /// best core lock height
69        chain_lock_height: u32,
70    },
71
72    /// Genesis time is in the future.
73    #[error("genesis time {genesis_time} for initial height {initial_height} is in the future. current time is {current_time}")]
74    InitializationGenesisTimeInFuture {
75        /// initial height (requested or fork)
76        initial_height: u32,
77        /// genesis time
78        genesis_time: TimestampMillis,
79        /// current time
80        current_time: TimestampMillis,
81    },
82
83    /// An error occurred during initialization.
84    #[error("initialization error: {0}")]
85    InitializationError(&'static str),
86
87    /// A drive incoherence error occurred.
88    #[error("drive incoherence error: {0}")]
89    DriveIncoherence(&'static str),
90
91    /// A protocol upgrade incoherence error occurred.
92    #[error("protocol upgrade incoherence error: {0}")]
93    ProtocolUpgradeIncoherence(&'static str),
94
95    /// Data is missing from the drive.
96    #[error("drive missing data error: {0}")]
97    DriveMissingData(String),
98
99    /// Corrupted credits are not balanced.
100    #[error("corrupted credits not balanced error: {0}")]
101    CorruptedCreditsNotBalanced(String),
102
103    /// Corrupted tokens are not balanced.
104    #[error("corrupted tokens not balanced error: {0}")]
105    CorruptedTokensNotBalanced(String),
106
107    /// The transaction is not present.
108    #[error("transaction not present error: {0}")]
109    NotInTransaction(&'static str),
110
111    /// An error occurred while updating the proposed app version.
112    #[error("cannot update proposed app version: {0}")]
113    UpdateValidatorProposedAppVersionError(#[from] DriveError),
114
115    /// Drive responded in a way that was impossible (e.g., requested 2 items but got 3).
116    #[error("corrupted drive response error: {0}")]
117    CorruptedDriveResponse(String),
118
119    /// An error received from DashCore during consensus encoding.
120    #[error("dash core consensus encode error: {0}")]
121    DashCoreConsensusEncodeError(#[from] DashCoreConsensusEncodeError),
122
123    /// DashCore responded with a bad response error.
124    #[error("dash core bad response error: {0}")]
125    DashCoreBadResponseError(String),
126
127    /// An error received for a data trigger.
128    #[error("data trigger execution error: {0}")]
129    DataTriggerExecutionError(String),
130
131    /// Error occurred during deserializing a BLS primitive received from core
132    #[error("dash core response bls error: {0}")]
133    BlsErrorFromDashCoreResponse(BlsError),
134
135    /// General Bls Error
136    #[error("bls error: {0}")]
137    BlsErrorGeneral(#[from] BlsError),
138
139    /// General IO Error
140    #[error("io error: {0}")]
141    IOError(#[from] std::io::Error),
142}