Skip to main content

hpsvm_fixture_fd/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum AdapterError {
5    #[error("I/O error: {0}")]
6    Io(#[from] std::io::Error),
7    #[cfg(feature = "json-codec")]
8    #[error("JSON codec error: {0}")]
9    Json(#[from] serde_json::Error),
10    #[error("protobuf codec decode error: {0}")]
11    Decode(#[from] prost::DecodeError),
12    #[error("unsupported firedancer fixture format for {path}")]
13    UnsupportedFormat { path: String },
14    #[error("missing firedancer fixture field {field}")]
15    MissingField { field: &'static str },
16    #[error("invalid 32-byte address length for {field}: got {actual}")]
17    InvalidAddressLength { field: &'static str, actual: usize },
18    #[error("instruction account index {index} is out of range for {accounts_len} accounts")]
19    InvalidInstructionAccountIndex { index: usize, accounts_len: usize },
20    #[error("instruction account {address} is missing from pre_accounts")]
21    MissingInstructionAccount { address: String },
22    #[error("seed-derived account metadata is not supported in {field}")]
23    UnsupportedSeedAddress { field: &'static str },
24    #[error("firedancer compute units are inconsistent: before={before}, after={after}")]
25    InconsistentComputeUnits { before: u64, after: u64 },
26    #[error("hpsvm fixture consumed {consumed} compute units but runtime budget is {budget}")]
27    ComputeUnitsExceedBudget { budget: u64, consumed: u64 },
28    #[error(
29        "firedancer execution status is inconsistent: result={result}, custom_err={custom_err}"
30    )]
31    InconsistentExecutionStatus { result: i32, custom_err: u32 },
32    #[error("execution status {kind} cannot be exported to firedancer status fields")]
33    UnsupportedExecutionStatus { kind: String },
34    #[error(
35        "return data program {program_id} cannot be exported to firedancer fixture for instruction program {instruction_program_id}"
36    )]
37    UnsupportedReturnDataProgram { program_id: String, instruction_program_id: String },
38    #[error("hpsvm fixture kind {kind} cannot be exported to firedancer; expected {expected}")]
39    UnsupportedFixtureKind { kind: &'static str, expected: &'static str },
40    #[error(
41        "exporting hpsvm instruction fixtures requires the initial compute unit budget, which the canonical fixture model does not store"
42    )]
43    MissingComputeUnitBudget,
44}