Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_runtime_context_fd_exec_slot_ctx_h 2 : #define HEADER_fd_src_flamenco_runtime_context_fd_exec_slot_ctx_h 3 : 4 : #include "../fd_blockstore.h" 5 : #include "../../../funk/fd_funk.h" 6 : #include "../../../util/rng/fd_rng.h" 7 : #include "../../../util/wksp/fd_wksp.h" 8 : 9 : #include "../sysvar/fd_sysvar_cache.h" 10 : #include "../../types/fd_types.h" 11 : #include "../fd_txncache.h" 12 : 13 : /* fd_exec_slot_ctx_t is the context that stays constant during all 14 : transactions in a block. */ 15 : 16 : struct __attribute__((aligned(8UL))) fd_exec_slot_ctx { 17 : ulong magic; /* ==FD_EXEC_SLOT_CTX_MAGIC */ 18 : 19 : fd_funk_txn_t * funk_txn; 20 : 21 : /* External joins, pointers to be set by caller */ 22 : 23 : fd_acc_mgr_t * acc_mgr; 24 : fd_blockstore_t * blockstore; 25 : fd_block_rewards_t block_rewards; 26 : ulong txns_meta_gaddr; 27 : ulong txns_meta_sz; 28 : fd_exec_epoch_ctx_t * epoch_ctx; 29 : 30 : fd_slot_bank_t slot_bank; 31 : 32 : ulong total_compute_units_requested; 33 : 34 : /* TODO figure out what to do with this */ 35 : fd_epoch_reward_status_t epoch_reward_status; 36 : 37 : /* TODO remove this stuff */ 38 : ulong signature_cnt; 39 : fd_hash_t account_delta_hash; 40 : ulong prev_lamports_per_signature; 41 : ulong parent_transaction_count; 42 : ulong txn_count; 43 : ulong nonvote_txn_count; 44 : ulong failed_txn_count; 45 : ulong nonvote_failed_txn_count; 46 : ulong total_compute_units_used; 47 : 48 : fd_sysvar_cache_t * sysvar_cache; 49 : 50 : fd_txncache_t * status_cache; 51 : fd_slot_history_t * slot_history; 52 : 53 : int enable_exec_recording; /* Enable/disable execution metadata 54 : recording, e.g. txn logs. Analogue 55 : of Agave's ExecutionRecordingConfig. */ 56 : 57 : ulong root_slot; 58 : ulong snapshot_freq; 59 : ulong incremental_freq; 60 : ulong last_snapshot_slot; 61 : 62 : fd_rent_fresh_accounts_t rent_fresh_accounts; 63 : fd_wksp_t * runtime_wksp; /* TODO: this should hold wksp for runtime_spad. */ 64 : fd_wksp_t * funk_wksp; /* TODO: this should hold wksp for funk. */ 65 : }; 66 : 67 7665 : #define FD_EXEC_SLOT_CTX_ALIGN (alignof(fd_exec_slot_ctx_t)) 68 7665 : #define FD_EXEC_SLOT_CTX_FOOTPRINT (sizeof (fd_exec_slot_ctx_t)) 69 0 : #define FD_EXEC_SLOT_CTX_MAGIC (0xC2287BA2A5E6FC3DUL) /* random */ 70 : 71 : FD_PROTOTYPES_BEGIN 72 : 73 : void * 74 : fd_exec_slot_ctx_new( void * mem, 75 : fd_spad_t * spad ); 76 : 77 : fd_exec_slot_ctx_t * 78 : fd_exec_slot_ctx_join( void * mem ); 79 : 80 : void * 81 : fd_exec_slot_ctx_leave( fd_exec_slot_ctx_t * ctx ); 82 : 83 : void * 84 : fd_exec_slot_ctx_delete( void * mem ); 85 : 86 : /* fd_exec_slot_ctx_recover re-initializes the current epoch/slot 87 : context and recovers it from the manifest of a Solana Labs snapshot. 88 : Moves ownership of manifest to this function. Assumes objects in 89 : manifest were allocated using a spad which is scoped to the replay tile. 90 : Assumes that slot context and epoch context use same allocator. 91 : On return, manifest is destroyed. Returns ctx on success. 92 : On failure, logs reason for error and returns NULL. */ 93 : 94 : fd_exec_slot_ctx_t * 95 : fd_exec_slot_ctx_recover( fd_exec_slot_ctx_t * ctx, 96 : fd_solana_manifest_t * manifest, 97 : fd_spad_t * spad ); 98 : 99 : /* fd_exec_slot_ctx_recover re-initializes the current slot 100 : context's status cache from the provided solana slot deltas. 101 : Assumes objects in slot deltas were allocated using slot ctx valloc 102 : (U.B. otherwise). 103 : On return, slot deltas is destroyed. Returns ctx on success. 104 : On failure, logs reason for error and returns NULL. */ 105 : 106 : fd_exec_slot_ctx_t * 107 : fd_exec_slot_ctx_recover_status_cache( fd_exec_slot_ctx_t * ctx, 108 : fd_bank_slot_deltas_t * slot_deltas, 109 : fd_spad_t * runtime_spad ); 110 : 111 : FD_PROTOTYPES_END 112 : 113 : #endif /* HEADER_fd_src_flamenco_runtime_context_fd_exec_slot_ctx_h */