25
25
#include "program/fd_stake_program.h"
26
26
#include "program/fd_builtin_programs.h"
27
27
#include "program/fd_vote_program.h"
28
- #include "program/fd_bpf_program_util .h"
28
+ #include "program/fd_program_cache .h"
29
29
#include "program/fd_bpf_loader_program.h"
30
30
#include "program/fd_address_lookup_table_program.h"
31
31
@@ -1027,12 +1027,6 @@ fd_runtime_block_execute_finalize_start( fd_exec_slot_ctx_t * slot_c
1027
1027
/* This slot is now "frozen" and can't be changed anymore. */
1028
1028
fd_runtime_freeze ( slot_ctx );
1029
1029
1030
- int result = fd_bpf_scan_and_create_bpf_program_cache_entry ( slot_ctx , runtime_spad );
1031
- if ( FD_UNLIKELY ( result ) ) {
1032
- FD_LOG_WARNING (( "update bpf program cache failed" ));
1033
- return ;
1034
- }
1035
-
1036
1030
/* Collect list of changed accounts to be added to bank hash */
1037
1031
* task_data = fd_spad_alloc ( runtime_spad ,
1038
1032
alignof(fd_accounts_hash_task_data_t ),
@@ -1390,6 +1384,16 @@ fd_runtime_finalize_txn( fd_funk_t * funk,
1390
1384
1391
1385
fd_txn_account_save ( & txn_ctx -> accounts [i ], funk , funk_txn , txn_ctx -> spad_wksp );
1392
1386
}
1387
+
1388
+ /* We need to queue any existing program accounts that may have
1389
+ been deployed / upgraded for reverification in the program
1390
+ cache since their programdata may have changed. ELF / sBPF
1391
+ metadata will need to be updated. */
1392
+ ulong current_slot = fd_bank_slot_get ( bank );
1393
+ for ( uchar i = 0 ; i < txn_ctx -> programs_to_reverify_cnt ; i ++ ) {
1394
+ fd_pubkey_t const * program_key = & txn_ctx -> programs_to_reverify [i ];
1395
+ fd_program_cache_queue_program_for_reverification ( funk , funk_txn , program_key , current_slot );
1396
+ }
1393
1397
}
1394
1398
1395
1399
int is_vote = fd_txn_is_simple_vote_transaction ( txn_ctx -> txn_descriptor , txn_ctx -> _txn_raw -> raw );
@@ -1889,6 +1893,7 @@ fd_migrate_builtin_to_core_bpf( fd_exec_slot_ctx_t * slot_ctx,
1889
1893
/* Deploy the new target Core BPF program.
1890
1894
https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank/builtins/core_bpf_migration/mod.rs#L268-L271 */
1891
1895
err = fd_directly_invoke_loader_v3_deploy ( slot_ctx ,
1896
+ builtin_program_id ,
1892
1897
new_target_program_data_account -> vt -> get_data ( new_target_program_data_account ) + PROGRAMDATA_METADATA_SIZE ,
1893
1898
new_target_program_data_account -> vt -> get_data_len ( new_target_program_data_account ) - PROGRAMDATA_METADATA_SIZE ,
1894
1899
runtime_spad );
@@ -2222,7 +2227,7 @@ fd_runtime_update_program_cache( fd_exec_slot_ctx_t * slot_ctx,
2222
2227
fd_acct_addr_t const * acc_addrs = fd_txn_get_acct_addrs ( txn_descriptor , txn_p );
2223
2228
for ( ushort acc_idx = 0 ; acc_idx < txn_descriptor -> acct_addr_cnt ; acc_idx ++ ) {
2224
2229
fd_pubkey_t const * account = fd_type_pun_const ( & acc_addrs [acc_idx ] );
2225
- fd_bpf_program_update_program_cache ( slot_ctx , account , runtime_spad );
2230
+ fd_program_cache_update_program ( slot_ctx , account , runtime_spad );
2226
2231
}
2227
2232
2228
2233
if ( txn_descriptor -> transaction_version == FD_TXN_V0 ) {
@@ -2236,6 +2241,11 @@ fd_runtime_update_program_cache( fd_exec_slot_ctx_t * slot_ctx,
2236
2241
2237
2242
fd_slot_hash_t * slot_hash = deq_fd_slot_hash_t_join ( (uchar * )slot_hashes_global + slot_hashes_global -> hashes_offset );
2238
2243
2244
+ /* TODO: This is done twice, once in the replay tile and once in the
2245
+ exec tile. We should consolidate the account resolution into a
2246
+ single place, but also keep in mind from a conformance
2247
+ perspective that these ALUT resolution checks happen after some
2248
+ things like compute budget instruction parsing */
2239
2249
if ( FD_UNLIKELY ( fd_runtime_load_txn_address_lookup_tables (
2240
2250
txn_descriptor ,
2241
2251
txn_p -> payload ,
@@ -2249,7 +2259,7 @@ fd_runtime_update_program_cache( fd_exec_slot_ctx_t * slot_ctx,
2249
2259
2250
2260
for ( ushort alut_idx = 0 ; alut_idx < txn_descriptor -> addr_table_adtl_cnt ; alut_idx ++ ) {
2251
2261
fd_pubkey_t const * account = fd_type_pun_const ( & alut_accounts [alut_idx ] );
2252
- fd_bpf_program_update_program_cache ( slot_ctx , account , runtime_spad );
2262
+ fd_program_cache_update_program ( slot_ctx , account , runtime_spad );
2253
2263
}
2254
2264
}
2255
2265
0 commit comments