Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_runtime_sysvar_fd_sysvar_slot_hashes_h 2 : #define HEADER_fd_src_flamenco_runtime_sysvar_fd_sysvar_slot_hashes_h 3 : 4 : #include "../../../funk/fd_funk_base.h" 5 : #include "../../accdb/fd_accdb_user.h" 6 : #include "../../types/fd_types.h" 7 : 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_accdb_user_t * accdb, 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 : /* Update the slot hashes sysvar account. This should be called at the end of every slot, before execution commences. */ 46 : void 47 : fd_sysvar_slot_hashes_update( fd_bank_t * bank, 48 : fd_accdb_user_t * accdb, 49 : fd_funk_txn_xid_t const * xid, 50 : fd_capture_ctx_t * capture_ctx ); 51 : 52 : /* fd_sysvar_slot_hashes_read reads the slot hashes sysvar from funk. 53 : If the account doesn't exist in funk or if the account has zero 54 : lamports, this function returns NULL. */ 55 : fd_slot_hashes_global_t * 56 : fd_sysvar_slot_hashes_read( fd_funk_t * funk, 57 : fd_funk_txn_xid_t const * xid, 58 : uchar * slot_hashes_mem ); 59 : 60 : FD_PROTOTYPES_END 61 : 62 : #endif /* HEADER_fd_src_flamenco_runtime_sysvar_fd_sysvar_slot_hashes_h */