Skip to content

Commit 5d401f4

Browse files
committed
Add the index of the inner instruction to TransactionError::InstructionError
1 parent e18cf20 commit 5d401f4

File tree

7 files changed

+202
-48
lines changed

7 files changed

+202
-48
lines changed

cli/src/cli.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1768,7 +1768,7 @@ where
17681768
match result {
17691769
Err(err) => {
17701770
let maybe_tx_err = err.get_transaction_error();
1771-
if let Some(TransactionError::InstructionError(_, ix_error, _)) = maybe_tx_err {
1771+
if let Some(TransactionError::InstructionError(_, ix_error, _, _)) = maybe_tx_err {
17721772
if let Some(specific_error) = error_adapter(&ix_error) {
17731773
return Err(specific_error.into());
17741774
}

cli/src/program.rs

+4
Original file line numberDiff line numberDiff line change
@@ -2215,13 +2215,15 @@ fn close(
22152215
_,
22162216
InstructionError::InvalidInstructionData,
22172217
_,
2218+
_,
22182219
)) = err.kind()
22192220
{
22202221
return Err("Closing a buffer account is not supported by the cluster".into());
22212222
} else if let ClientErrorKind::TransactionError(TransactionError::InstructionError(
22222223
_,
22232224
InstructionError::InvalidArgument,
22242225
_,
2226+
_,
22252227
)) = err.kind()
22262228
{
22272229
return Err("Closing a program account is not supported by the cluster".into());
@@ -2440,6 +2442,7 @@ fn process_extend_program(
24402442
_,
24412443
InstructionError::InvalidInstructionData,
24422444
_,
2445+
_,
24432446
)) = err.kind()
24442447
{
24452448
return Err("Extending a program is not supported by the cluster".into());
@@ -2536,6 +2539,7 @@ fn process_migrate_program(
25362539
_,
25372540
InstructionError::InvalidInstructionData,
25382541
_,
2542+
_,
25392543
)) = err.kind()
25402544
{
25412545
return Err("Migrating a program is not supported by the cluster".into());

compute-budget-instruction/src/compute_budget_instruction_details.rs

+2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ impl ComputeBudgetInstructionDetails {
112112
index,
113113
InstructionError::InvalidInstructionData,
114114
None,
115+
None,
115116
));
116117
}
117118
} else {
@@ -157,6 +158,7 @@ impl ComputeBudgetInstructionDetails {
157158
let invalid_instruction_data_error = TransactionError::InstructionError(
158159
index,
159160
InstructionError::InvalidInstructionData,
161+
None,
160162
Some(instruction.program_id_index),
161163
);
162164
let duplicate_instruction_error = TransactionError::DuplicateInstruction(index);

storage-proto/proto/transaction_by_addr.proto

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ message InstructionError {
7070
uint32 index = 1;
7171
InstructionErrorType error = 2;
7272
CustomError custom = 3;
73-
optional uint32 responsible_program_account_index = 4;
73+
optional uint32 inner_instruction_index = 4;
74+
optional uint32 responsible_program_account_index = 5;
7475
}
7576

7677
message TransactionDetails {

0 commit comments

Comments
 (0)