@@ -794,11 +794,20 @@ process_loader_upgradeable_instruction( fd_exec_instr_ctx_t * instr_ctx ) {
794
794
return err ;
795
795
}
796
796
797
- fd_sol_sysvar_clock_t clock = {0 };
798
- if ( FD_UNLIKELY ( !fd_sysvar_clock_read ( & clock ,
799
- instr_ctx -> txn_ctx -> sysvar_cache ,
800
- instr_ctx -> txn_ctx -> funk ,
801
- instr_ctx -> txn_ctx -> funk_txn ) ) ) {
797
+ // fd_sol_sysvar_clock_t clock = {0};
798
+ // if( FD_UNLIKELY( !fd_sysvar_clock_read( &clock,
799
+ // instr_ctx->txn_ctx->sysvar_cache,
800
+ // instr_ctx->txn_ctx->funk,
801
+ // instr_ctx->txn_ctx->funk_txn,
802
+ // NULL ) ) ) {
803
+ // return FD_EXECUTOR_INSTR_ERR_GENERIC_ERR;
804
+ // }
805
+
806
+ fd_sol_sysvar_clock_t const * clock = fd_sysvar_clock_read ( instr_ctx -> txn_ctx -> sysvar_cache ,
807
+ instr_ctx -> txn_ctx -> funk ,
808
+ instr_ctx -> txn_ctx -> funk_txn ,
809
+ instr_ctx -> txn_ctx -> spad );
810
+ if ( FD_UNLIKELY ( !clock ) ) {
802
811
return FD_EXECUTOR_INSTR_ERR_GENERIC_ERR ;
803
812
}
804
813
@@ -1036,7 +1045,7 @@ process_loader_upgradeable_instruction( fd_exec_instr_ctx_t * instr_ctx ) {
1036
1045
fd_bpf_upgradeable_loader_state_t programdata_loader_state = {
1037
1046
.discriminant = fd_bpf_upgradeable_loader_state_enum_program_data ,
1038
1047
.inner .program_data = {
1039
- .slot = clock . slot ,
1048
+ .slot = clock -> slot ,
1040
1049
.upgrade_authority_address = (fd_pubkey_t * )authority_key ,
1041
1050
},
1042
1051
};
@@ -1227,7 +1236,6 @@ process_loader_upgradeable_instruction( fd_exec_instr_ctx_t * instr_ctx ) {
1227
1236
1228
1237
ulong programdata_data_offset = PROGRAMDATA_METADATA_SIZE ;
1229
1238
fd_bpf_upgradeable_loader_state_t * programdata_state = NULL ;
1230
- fd_sol_sysvar_clock_t clock = {0 };
1231
1239
ulong programdata_balance_required = 0UL ;
1232
1240
1233
1241
/* https://github.com/anza-xyz/agave/blob/v2.1.4/programs/bpf_loader/src/lib.rs#L778-L779 */
@@ -1251,15 +1259,16 @@ process_loader_upgradeable_instruction( fd_exec_instr_ctx_t * instr_ctx ) {
1251
1259
return err ;
1252
1260
}
1253
1261
1254
- if ( FD_UNLIKELY ( !fd_sysvar_clock_read ( & clock ,
1255
- instr_ctx -> txn_ctx -> sysvar_cache ,
1256
- instr_ctx -> txn_ctx -> funk ,
1257
- instr_ctx -> txn_ctx -> funk_txn ) ) ) {
1262
+ fd_sol_sysvar_clock_t const * clock = fd_sysvar_clock_read ( instr_ctx -> txn_ctx -> sysvar_cache ,
1263
+ instr_ctx -> txn_ctx -> funk ,
1264
+ instr_ctx -> txn_ctx -> funk_txn ,
1265
+ instr_ctx -> txn_ctx -> spad );
1266
+ if ( FD_UNLIKELY ( !clock ) ) {
1258
1267
return FD_EXECUTOR_INSTR_ERR_GENERIC_ERR ;
1259
1268
}
1260
1269
1261
1270
if ( fd_bpf_upgradeable_loader_state_is_program_data ( programdata_state ) ) {
1262
- if ( FD_UNLIKELY ( clock . slot == programdata_state -> inner .program_data .slot ) ) {
1271
+ if ( FD_UNLIKELY ( clock -> slot == programdata_state -> inner .program_data .slot ) ) {
1263
1272
fd_log_collector_msg_literal ( instr_ctx , "Program was deployed in this block already" );
1264
1273
return FD_EXECUTOR_INSTR_ERR_INVALID_ARG ;
1265
1274
}
@@ -1309,7 +1318,7 @@ process_loader_upgradeable_instruction( fd_exec_instr_ctx_t * instr_ctx ) {
1309
1318
/* Update the ProgramData account, record the upgraded data, and zero the rest in a local scope */
1310
1319
do {
1311
1320
programdata_state -> discriminant = fd_bpf_upgradeable_loader_state_enum_program_data ;
1312
- programdata_state -> inner .program_data .slot = clock . slot ;
1321
+ programdata_state -> inner .program_data .slot = clock -> slot ;
1313
1322
programdata_state -> inner .program_data .upgrade_authority_address = (fd_pubkey_t * )authority_key ;
1314
1323
err = fd_bpf_loader_v3_program_set_state ( & programdata , programdata_state );
1315
1324
if ( FD_UNLIKELY ( err != FD_BINCODE_SUCCESS ) ) {
@@ -1663,14 +1672,14 @@ process_loader_upgradeable_instruction( fd_exec_instr_ctx_t * instr_ctx ) {
1663
1672
fd_log_collector_msg_literal ( instr_ctx , "Program account not owned by loader" );
1664
1673
return FD_EXECUTOR_INSTR_ERR_INCORRECT_PROGRAM_ID ;
1665
1674
}
1666
- fd_sol_sysvar_clock_t clock = { 0 };
1667
- if ( FD_UNLIKELY ( ! fd_sysvar_clock_read ( & clock ,
1668
- instr_ctx -> txn_ctx -> sysvar_cache ,
1669
- instr_ctx -> txn_ctx -> funk ,
1670
- instr_ctx -> txn_ctx -> funk_txn ) ) ) {
1675
+ fd_sol_sysvar_clock_t const * clock = fd_sysvar_clock_read ( instr_ctx -> txn_ctx -> sysvar_cache ,
1676
+ instr_ctx -> txn_ctx -> funk ,
1677
+ instr_ctx -> txn_ctx -> funk_txn ,
1678
+ instr_ctx -> txn_ctx -> spad );
1679
+ if ( FD_UNLIKELY ( ! clock ) ) {
1671
1680
return FD_EXECUTOR_INSTR_ERR_UNSUPPORTED_SYSVAR ;
1672
1681
}
1673
- if ( FD_UNLIKELY ( clock . slot == close_account_state -> inner .program_data .slot ) ) {
1682
+ if ( FD_UNLIKELY ( clock -> slot == close_account_state -> inner .program_data .slot ) ) {
1674
1683
fd_log_collector_msg_literal ( instr_ctx ,"Program was deployed in this block already" );
1675
1684
return FD_EXECUTOR_INSTR_ERR_INVALID_ARG ;
1676
1685
}
@@ -1787,22 +1796,21 @@ process_loader_upgradeable_instruction( fd_exec_instr_ctx_t * instr_ctx ) {
1787
1796
return FD_EXECUTOR_INSTR_ERR_INVALID_REALLOC ;
1788
1797
}
1789
1798
1790
- fd_sol_sysvar_clock_t clock = { 0 };
1791
- if ( FD_UNLIKELY ( ! fd_sysvar_clock_read ( & clock ,
1792
- instr_ctx -> txn_ctx -> sysvar_cache ,
1793
- instr_ctx -> txn_ctx -> funk ,
1794
- instr_ctx -> txn_ctx -> funk_txn ) ) ) {
1799
+ fd_sol_sysvar_clock_t const * clock = fd_sysvar_clock_read ( instr_ctx -> txn_ctx -> sysvar_cache ,
1800
+ instr_ctx -> txn_ctx -> funk ,
1801
+ instr_ctx -> txn_ctx -> funk_txn ,
1802
+ instr_ctx -> txn_ctx -> spad );
1803
+ if ( FD_UNLIKELY ( ! clock ) ) {
1795
1804
return FD_EXECUTOR_INSTR_ERR_UNSUPPORTED_SYSVAR ;
1796
1805
}
1797
1806
1798
-
1799
1807
fd_pubkey_t * upgrade_authority_address = NULL ;
1800
1808
fd_bpf_upgradeable_loader_state_t * programdata_state = fd_bpf_loader_program_get_state ( programdata_account .acct , spad , & err );
1801
1809
if ( FD_UNLIKELY ( err != FD_BINCODE_SUCCESS ) ) {
1802
1810
return err ;
1803
1811
}
1804
1812
if ( fd_bpf_upgradeable_loader_state_is_program_data ( programdata_state ) ) {
1805
- if ( FD_UNLIKELY ( clock . slot == programdata_state -> inner .program_data .slot ) ) {
1813
+ if ( FD_UNLIKELY ( clock -> slot == programdata_state -> inner .program_data .slot ) ) {
1806
1814
fd_log_collector_msg_literal ( instr_ctx , "Program was extended in this block already" );
1807
1815
return FD_EXECUTOR_INSTR_ERR_INVALID_ARG ;
1808
1816
}
@@ -1916,7 +1924,7 @@ process_loader_upgradeable_instruction( fd_exec_instr_ctx_t * instr_ctx ) {
1916
1924
FD_TRY_BORROW_INSTR_ACCOUNT_DEFAULT_ERR_CHECK ( instr_ctx , 0UL , & programdata_account );
1917
1925
1918
1926
programdata_state -> discriminant = fd_bpf_upgradeable_loader_state_enum_program_data ;
1919
- programdata_state -> inner .program_data .slot = clock . slot ;
1927
+ programdata_state -> inner .program_data .slot = clock -> slot ;
1920
1928
programdata_state -> inner .program_data .upgrade_authority_address = upgrade_authority_address ;
1921
1929
1922
1930
err = fd_bpf_loader_v3_program_set_state ( & programdata_account , programdata_state );
0 commit comments