Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_runtime_sysvar_fd_slot_hashes_h 2 : #define HEADER_fd_src_flamenco_runtime_sysvar_fd_slot_hashes_h 3 : 4 : #include "../../../funk/fd_funk.h" 5 : #include "../../../funk/fd_funk_txn.h" 6 : #include "../../fd_flamenco_base.h" 7 : #include "../../types/fd_types.h" 8 : /* The slot hashes sysvar contains the most recent hashes of the slot's parent bank hashes. */ 9 : 10 : /* FD_SYSVAR_SLOT_HASHES_CAP is the max number of entries that the 11 : "slot hashes" sysvar will include. 12 : 13 : https://github.com/anza-xyz/agave/blob/6398ddf6ab8a8f81017bf675ab315a70067f0bf0/sdk/program/src/slot_hashes.rs#L19 */ 14 : 15 0 : #define FD_SYSVAR_SLOT_HASHES_CAP (512UL) 16 : 17 : FD_PROTOTYPES_BEGIN 18 : 19 : ulong 20 : fd_sysvar_slot_hashes_footprint( ulong slot_hashes_cap ); 21 : 22 : void * 23 : fd_sysvar_slot_hashes_new( void * mem, 24 : ulong slot_hashes_cap ); 25 : 26 : fd_slot_hashes_global_t * 27 : fd_sysvar_slot_hashes_join( void * shmem, 28 : fd_slot_hash_t ** slot_hash ); 29 : 30 : void * 31 : fd_sysvar_slot_hashes_leave( fd_slot_hashes_global_t * slot_hashes_global, 32 : fd_slot_hash_t * slot_hash ); 33 : 34 : void * 35 : fd_sysvar_slot_hashes_delete( void * mem ); 36 : 37 : /* Write a funk entry for the slot hashes sysvar account (exposed for tests) */ 38 : void 39 : fd_sysvar_slot_hashes_write( fd_bank_t * bank, 40 : fd_funk_t * funk, 41 : fd_funk_txn_xid_t const * xid, 42 : fd_capture_ctx_t * capture_ctx, 43 : fd_slot_hashes_global_t * slot_hashes_global ); 44 : 45 : void 46 : fd_sysvar_slot_hashes_init( fd_bank_t * bank, 47 : fd_funk_t * funk, 48 : fd_funk_txn_xid_t const * xid, 49 : fd_capture_ctx_t * capture_ctx, 50 : fd_spad_t * runtime_spad ); 51 : 52 : /* Update the slot hashes sysvar account. This should be called at the end of every slot, before execution commences. */ 53 : void 54 : fd_sysvar_slot_hashes_update( fd_bank_t * bank, 55 : fd_funk_t * funk, 56 : fd_funk_txn_xid_t const * xid, 57 : fd_capture_ctx_t * capture_ctx, 58 : fd_spad_t * runtime_spad ); 59 : 60 : /* fd_sysvar_slot_hashes_read reads the slot hashes sysvar from funk. 61 : If the account doesn't exist in funk or if the account has zero 62 : lamports, this function returns NULL. */ 63 : fd_slot_hashes_global_t * 64 : fd_sysvar_slot_hashes_read( fd_funk_t * funk, 65 : fd_funk_txn_xid_t const * xid, 66 : fd_spad_t * spad ); 67 : 68 : FD_PROTOTYPES_END 69 : 70 : #endif /* HEADER_fd_src_flamenco_runtime_sysvar_fd_slot_hashes_h */