Skip to content

Commit f0dc71a

Browse files
riptlripatel-fd
authored andcommitted
runtime: fix stray executor funk access
1 parent e1e15b6 commit f0dc71a

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/flamenco/runtime/program/fd_system_program_nonce.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
#include "../fd_borrowed_account.h"
33
#include "../fd_acc_mgr.h"
44
#include "../fd_system_ids.h"
5-
#include "../context/fd_exec_slot_ctx.h"
65
#include "../context/fd_exec_txn_ctx.h"
76
#include "../sysvar/fd_sysvar_rent.h"
87
#include "../sysvar/fd_sysvar_recent_hashes.h"
9-
#include "../fd_executor.h"
108

119
static int
1210
require_acct( fd_exec_instr_ctx_t * ctx,
@@ -27,18 +25,16 @@ require_acct( fd_exec_instr_ctx_t * ctx,
2725
static int
2826
require_acct_rent( fd_exec_instr_ctx_t * ctx,
2927
ushort idx,
30-
fd_rent_t const ** out_rent ) {
28+
fd_rent_t * rent ) {
3129

3230
do {
3331
int err = require_acct( ctx, idx, &fd_sysvar_rent_id );
3432
if( FD_UNLIKELY( err ) ) return err;
3533
} while(0);
3634

37-
fd_rent_t const * rent = fd_sysvar_rent_read( ctx->txn_ctx->funk, ctx->txn_ctx->funk_txn, ctx->txn_ctx->spad );
38-
if( FD_UNLIKELY( !rent ) )
35+
if( FD_UNLIKELY( !fd_sysvar_cache_rent_read( ctx->sysvar_cache, rent ) ) )
3936
return FD_EXECUTOR_INSTR_ERR_UNSUPPORTED_SYSVAR;
4037

41-
*out_rent = rent;
4238
return FD_EXECUTOR_INSTR_SUCCESS;
4339
}
4440

@@ -489,9 +485,9 @@ fd_system_program_exec_withdraw_nonce_account( fd_exec_instr_ctx_t * ctx,
489485

490486
/* https://github.com/solana-labs/solana/blob/v1.17.23/programs/system/src/system_processor.rs#L450 */
491487

492-
fd_rent_t const * rent = NULL;
488+
fd_rent_t rent[1];
493489
do {
494-
int err = require_acct_rent( ctx, 3UL, &rent );
490+
int err = require_acct_rent( ctx, 3UL, rent );
495491
if( FD_UNLIKELY( err ) ) return err;
496492
} while(0);
497493

@@ -652,9 +648,9 @@ fd_system_program_exec_initialize_nonce_account( fd_exec_instr_ctx_t * ctx,
652648

653649
/* https://github.com/solana-labs/solana/blob/v1.17.23/programs/system/src/system_processor.rs#L479 */
654650

655-
fd_rent_t const * rent = NULL;
651+
fd_rent_t rent[1];
656652
do {
657-
err = require_acct_rent( ctx, 2UL, &rent );
653+
err = require_acct_rent( ctx, 2UL, rent );
658654
if( FD_UNLIKELY( err ) ) return err;
659655
} while(0);
660656

0 commit comments

Comments
 (0)