Skip to content

Commit bb3d6b7

Browse files
wip
1 parent 34ad731 commit bb3d6b7

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/flamenco/runtime/context/fd_exec_txn_ctx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ struct fd_exec_txn_ctx {
149149
/* Execution error and type, to match Agave. */
150150
int exec_err;
151151
int exec_err_kind;
152+
int is_fees_only;
152153

153154
/* The current instruction index being executed */
154155
int current_instr_idx;

src/flamenco/runtime/fd_runtime.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ fd_runtime_pre_execute_check( fd_exec_txn_ctx_t * txn_ctx ) {
663663
/* Regardless of whether transaction accounts were loaded successfully, the transaction is
664664
included in the block and transaction fees are collected.
665665
https://github.com/anza-xyz/agave/blob/v2.1.6/svm/src/transaction_processor.rs#L341-L357 */
666-
txn_ctx->flags |= FD_TXN_P_FLAGS_FEES_ONLY;
666+
txn_ctx->is_fees_only = 1;
667667

668668
/* If the transaction fails to load, the "rollback" accounts will include one of the following:
669669
1. Nonce account only
@@ -1045,6 +1045,7 @@ fd_runtime_prepare_and_execute_txn( fd_banks_t * banks,
10451045
ulong slot = fd_bank_slot_get( bank );
10461046

10471047
/* Setup and execute the transaction. */
1048+
txn_ctx->is_fees_only = 0;
10481049
txn_ctx->bank = bank;
10491050
txn_ctx->slot = fd_bank_slot_get( bank );
10501051
txn_ctx->bank_idx = bank_idx;
@@ -1055,7 +1056,7 @@ fd_runtime_prepare_and_execute_txn( fd_banks_t * banks,
10551056
txn_ctx->exec_stack = exec_stack;
10561057
txn_ctx->dumping_mem = dumping_mem;
10571058
txn_ctx->tracing_mem = tracing_mem;
1058-
txn_ctx->flags = FD_TXN_P_FLAGS_SANITIZE_SUCCESS;
1059+
txn_ctx->flags = FD_TXN_P_FLAGS_SANITIZE_SUCCESS | FD_TXN_P_FLAGS_EXECUTE_SUCCESS;
10591060
fd_exec_txn_ctx_setup_basic( txn_ctx );
10601061
txn_ctx->capture_ctx = capture_ctx;
10611062

@@ -1067,14 +1068,14 @@ fd_runtime_prepare_and_execute_txn( fd_banks_t * banks,
10671068

10681069
/* Pre-execution checks */
10691070
exec_res = fd_runtime_pre_execute_check( txn_ctx );
1070-
if( FD_UNLIKELY( !( txn_ctx->flags & FD_TXN_P_FLAGS_SANITIZE_SUCCESS ) ) ) {
1071+
1072+
if( FD_UNLIKELY( exec_res!=FD_RUNTIME_EXECUTE_SUCCESS && !txn_ctx->is_fees_only ) ) {
10711073
return exec_res;
10721074
}
10731075

10741076
/* Execute the transaction. Note that fees-only transactions are still
10751077
marked as "executed". */
1076-
txn_ctx->flags |= FD_TXN_P_FLAGS_EXECUTE_SUCCESS;
1077-
if( FD_LIKELY( !( txn_ctx->flags & FD_TXN_P_FLAGS_FEES_ONLY ) ) ) {
1078+
if( FD_LIKELY( !txn_ctx->is_fees_only ) ) {
10781079
exec_res = fd_execute_txn( txn_ctx );
10791080
}
10801081

src/flamenco/runtime/tests/fd_txn_harness.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ fd_solfuzz_pb_txn_run( fd_solfuzz_runner_t * runner,
431431

432432
if( txn_result->sanitization_error ) {
433433
/* Collect fees for transactions that failed to load */
434-
if( txn_ctx->flags & FD_TXN_P_FLAGS_FEES_ONLY ) {
434+
if( txn_ctx->is_fees_only ) {
435435
txn_result->has_fee_details = true;
436436
txn_result->fee_details.prioritization_fee = txn_ctx->priority_fee;
437437
txn_result->fee_details.transaction_fee = txn_ctx->execution_fee;
@@ -502,7 +502,7 @@ fd_solfuzz_pb_txn_run( fd_solfuzz_runner_t * runner,
502502
/* If the transaction is a fees-only transaction, we have to create rollback accounts to iterate over and save. */
503503
fd_txn_account_t * accounts_to_save = txn_ctx->accounts;
504504
ulong accounts_cnt = txn_ctx->accounts_cnt;
505-
if( txn_ctx->flags & FD_TXN_P_FLAGS_FEES_ONLY ) {
505+
if( txn_ctx->is_fees_only ) {
506506
accounts_to_save = fd_spad_alloc( runner->spad, alignof(fd_txn_account_t), sizeof(fd_txn_account_t) * 2 );
507507
accounts_cnt = 0UL;
508508

0 commit comments

Comments
 (0)