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_exec_slot_ctx_t * slot_ctx, 40 : fd_slot_hashes_global_t * slot_hashes_global ); 41 : 42 : void 43 : fd_sysvar_slot_hashes_init( fd_exec_slot_ctx_t * slot_ctx, 44 : fd_spad_t * runtime_spad ); 45 : 46 : /* Update the slot hashes sysvar account. This should be called at the end of every slot, before execution commences. */ 47 : void 48 : fd_sysvar_slot_hashes_update( fd_exec_slot_ctx_t * slot_ctx, fd_spad_t * runtime_spad ); 49 : 50 : /* fd_sysvar_slot_hashes_read reads the slot hashes sysvar from funk. 51 : If the account doesn't exist in funk or if the account has zero 52 : lamports, this function returns NULL. */ 53 : fd_slot_hashes_global_t * 54 : fd_sysvar_slot_hashes_read( fd_funk_t * funk, 55 : fd_funk_txn_t * funk_txn, 56 : fd_spad_t * spad ); 57 : 58 : FD_PROTOTYPES_END 59 : 60 : #endif /* HEADER_fd_src_flamenco_runtime_sysvar_fd_slot_hashes_h */