Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flamenco: add instruction failed index #1876

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/flamenco/capture/fd_solcap.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/flamenco/capture/fd_solcap.proto
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,5 @@ message Transaction {

// instr_err is the instruction processing error code.
uint32 instr_err = 9;
int32 instr_err_idx = 10;
}
6 changes: 4 additions & 2 deletions src/flamenco/capture/fd_solcap_yaml.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,12 @@ if ( verbose < 3 )
printf(
" - txn_sig: '%64J'\n"
" txn_err: %d\n"
" cus_used: %lu\n",
" cus_used: %lu\n"
" instr_err_idx: %d\n",
meta.txn_sig,
meta.fd_txn_err,
meta.fd_cus_used );
meta.fd_cus_used,
meta.instr_err_idx);

/* Only print custom error if it has been set*/
if ( meta.fd_txn_err == FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR) {
Expand Down
1 change: 1 addition & 0 deletions src/flamenco/runtime/context/fd_exec_txn_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ fd_exec_txn_ctx_setup( fd_exec_txn_ctx_t * txn_ctx,
txn_ctx->dirty_vote_acc = 0;
txn_ctx->dirty_stake_acc = 0;
txn_ctx->failed_instr = NULL;
txn_ctx->instr_err_idx = INT_MAX;
txn_ctx->capture_ctx = NULL;
}

Expand Down
1 change: 1 addition & 0 deletions src/flamenco/runtime/context/fd_exec_txn_ctx.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct __attribute__((aligned(8UL))) fd_exec_txn_ctx {
uchar instr_stack_sz; /* Current depth of the instruction execution stack. */
fd_exec_instr_ctx_t instr_stack[6]; /* Instruction execution stack. */
fd_exec_instr_ctx_t * failed_instr;
int instr_err_idx;
ulong accounts_cnt; /* Number of account pubkeys accessed by this transaction. */
fd_pubkey_t accounts[128]; /* Array of account pubkeys accessed by this transaction. */
ulong executable_cnt; /* Number of BPF upgradeable loader accounts. */
Expand Down
4 changes: 4 additions & 0 deletions src/flamenco/runtime/fd_executor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,10 @@ fd_execute_txn( fd_exec_txn_ctx_t * txn_ctx ) {

int exec_result = fd_execute_instr( txn_ctx, &instrs[i] );
if( exec_result != FD_EXECUTOR_INSTR_SUCCESS ) {
if ( txn_ctx->instr_err_idx == INT_MAX )
{
txn_ctx->instr_err_idx = i;
}
#ifdef VLOG
if ( 257037453 == txn_ctx->slot_ctx->slot_bank.slot ) {
#endif
Expand Down
1 change: 1 addition & 0 deletions src/flamenco/runtime/fd_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,7 @@ fd_runtime_write_transaction_status( fd_capture_ctx_t * capture_ctx,
.solana_txn_err = solana_txn_err,
.fd_cus_used = fd_cus_consumed,
.solana_cus_used = solana_cus_consumed,
.instr_err_idx = txn_ctx->instr_err_idx == INT_MAX ? -1 : txn_ctx->instr_err_idx,
};
memcpy( txn.txn_sig, sig, sizeof(fd_signature_t) );

Expand Down
1 change: 1 addition & 0 deletions src/flamenco/runtime/tests/fd_exec_instr_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ _context_create( fd_exec_instr_test_runner_t * runner,
txn_ctx->dirty_vote_acc = 0;
txn_ctx->dirty_stake_acc = 0;
txn_ctx->failed_instr = NULL;
txn_ctx->instr_err_idx = INT_MAX;
txn_ctx->capture_ctx = NULL;
txn_ctx->vote_accounts_pool = NULL;

Expand Down