|
4 | 4 | use serde_derive::{Deserialize, Serialize};
|
5 | 5 | #[cfg(feature = "frozen-abi")]
|
6 | 6 | use solana_frozen_abi_macro::{AbiEnumVisitor, AbiExample};
|
7 |
| -use {core::fmt, solana_instruction::error::InstructionError, solana_sanitize::SanitizeError}; |
| 7 | +use { |
| 8 | + core::fmt, solana_instruction::error::InstructionError, solana_pubkey::Pubkey, |
| 9 | + solana_sanitize::SanitizeError, |
| 10 | +}; |
8 | 11 |
|
9 | 12 | pub type TransactionResult<T> = Result<T, TransactionError>;
|
10 | 13 |
|
@@ -43,8 +46,10 @@ pub enum TransactionError {
|
43 | 46 | BlockhashNotFound,
|
44 | 47 |
|
45 | 48 | /// An error occurred while processing an instruction. The first element of the tuple
|
46 |
| - /// indicates the instruction index in which the error occurred. |
47 |
| - InstructionError(u8, InstructionError), |
| 49 | + /// indicates the instruction index in which the error occurred. For avoidance of doubt, the |
| 50 | + /// third element indicates the address of the program that raised the error; the error could |
| 51 | + /// after all have been raised during a cross-program invocation (ie. in an inner instruction). |
| 52 | + InstructionError(u8, InstructionError, Option<Pubkey>), |
48 | 53 |
|
49 | 54 | /// Loader call chain is too deep
|
50 | 55 | CallChainTooDeep,
|
@@ -163,7 +168,10 @@ impl fmt::Display for TransactionError {
|
163 | 168 | => f.write_str("This transaction has already been processed"),
|
164 | 169 | Self::BlockhashNotFound
|
165 | 170 | => f.write_str("Blockhash not found"),
|
166 |
| - Self::InstructionError(idx, err) => write!(f, "Error processing Instruction {idx}: {err}"), |
| 171 | + Self::InstructionError(idx, err, None) |
| 172 | + => write!(f, "Error processing Instruction {idx}: {err}"), |
| 173 | + Self::InstructionError(idx, err, Some(program_address)) |
| 174 | + => write!(f, "Error processing Instruction {idx}: {err} (from program {program_address})"), |
167 | 175 | Self::CallChainTooDeep
|
168 | 176 | => f.write_str("Loader call chain is too deep"),
|
169 | 177 | Self::MissingSignatureForFee
|
|
0 commit comments