@@ -74,30 +74,31 @@ fd_sysvar_clock_write( fd_bank_t * bank,
7474 fd_sysvar_account_update ( bank , accdb , xid , capture_ctx , & fd_sysvar_clock_id , enc , sizeof (fd_sol_sysvar_clock_t ) );
7575}
7676
77-
7877fd_sol_sysvar_clock_t *
79- fd_sysvar_clock_read ( fd_funk_t * funk ,
78+ fd_sysvar_clock_read ( fd_accdb_user_t * accdb ,
8079 fd_funk_txn_xid_t const * xid ,
8180 fd_sol_sysvar_clock_t * clock ) {
82- fd_txn_account_t acc [1 ];
83- int rc = fd_txn_account_init_from_funk_readonly ( acc , & fd_sysvar_clock_id , funk , xid );
84- if ( FD_UNLIKELY ( rc != FD_ACC_MGR_SUCCESS ) ) {
85- return NULL ;
86- }
81+ FD_ACCDB_RO_BEGIN ( accdb , acc , xid , & fd_sysvar_clock_id ) {
82+
83+ /* This check is needed as a quirk of the fuzzer. If a sysvar account
84+ exists in the accounts database, but doesn't have any lamports,
85+ this means that the account does not exist. This wouldn't happen
86+ in a real execution environment. */
87+ if ( FD_UNLIKELY ( fd_accdb_ref_lamports ( acc )== 0UL ) ) {
88+ return NULL ;
89+ }
90+
91+ return fd_bincode_decode_static (
92+ sol_sysvar_clock , clock ,
93+ fd_accdb_ref_data_const ( acc ),
94+ fd_accdb_ref_data_sz ( acc ),
95+ NULL );
96+
97+ } FD_ACCDB_RO_NOT_FOUND {
8798
88- /* This check is needed as a quirk of the fuzzer. If a sysvar account
89- exists in the accounts database, but doesn't have any lamports,
90- this means that the account does not exist. This wouldn't happen
91- in a real execution environment. */
92- if ( FD_UNLIKELY ( fd_txn_account_get_lamports ( acc )== 0UL ) ) {
9399 return NULL ;
94- }
95100
96- return fd_bincode_decode_static (
97- sol_sysvar_clock , clock ,
98- fd_txn_account_get_data ( acc ),
99- fd_txn_account_get_data_len ( acc ),
100- NULL );
101+ } FD_ACCDB_RO_END ;
101102}
102103
103104void
@@ -268,9 +269,8 @@ fd_sysvar_clock_update( fd_bank_t * bank,
268269 fd_capture_ctx_t * capture_ctx ,
269270 fd_runtime_stack_t * runtime_stack ,
270271 ulong const * parent_epoch ) {
271- fd_funk_t * funk = fd_accdb_user_v1_funk ( accdb );
272272 fd_sol_sysvar_clock_t clock_ [1 ];
273- fd_sol_sysvar_clock_t * clock = fd_sysvar_clock_read ( funk , xid , clock_ );
273+ fd_sol_sysvar_clock_t * clock = fd_sysvar_clock_read ( accdb , xid , clock_ );
274274 if ( FD_UNLIKELY ( !clock ) ) FD_LOG_ERR (( "fd_sysvar_clock_read failed" ));
275275
276276 fd_epoch_schedule_t const * epoch_schedule = fd_bank_epoch_schedule_query ( bank );
0 commit comments