Skip to main content

jito_bundle/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum JitoError {
5    #[error("bundle must contain at least 1 transaction, got {count}")]
6    InvalidBundleSize { count: usize },
7    #[error(
8        "tip account {tip_account} found in address lookup table — this will cause a runtime failure"
9    )]
10    TipAccountInLut { tip_account: String },
11    #[error("transaction {index} exceeds max size: {size}/{max} bytes")]
12    TransactionOversized {
13        index: usize,
14        size: usize,
15        max: usize,
16    },
17    #[error("failed to compile v0 message for transaction {index}: {reason}")]
18    MessageCompileFailed { index: usize, reason: String },
19    #[error("failed to create versioned transaction {index}: {reason}")]
20    TransactionCreationFailed { index: usize, reason: String },
21    #[error("simulation failed: {details}")]
22    SimulationFailed { details: String },
23    #[error("bundle rejected by Jito: {reason}")]
24    BundleRejected { reason: String },
25    #[error("all {count} endpoints failed, last error: {last_error}")]
26    AllEndpointsFailed { count: usize, last_error: String },
27    #[error("bundle confirmation timed out after {attempts} attempts")]
28    ConfirmationTimeout { attempts: u32 },
29    #[error("bundle failed on-chain: {reason}")]
30    OnChainFailure { reason: String },
31    #[error("failed to fetch tip floor: {reason}")]
32    TipFloorFetchFailed { reason: String },
33    #[error("serialization error: {reason}")]
34    Serialization { reason: String },
35    #[error("JSON-RPC error ({code}): {message}")]
36    JsonRpc { code: i64, message: String },
37    #[error("network error: {reason}")]
38    Network { reason: String },
39    #[error("invalid signature format: {reason}")]
40    InvalidSignature { reason: String },
41}