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 0 : #define FD_SYSVAR_SLOT_HASHES_ALIGN (FD_SLOT_HASHES_GLOBAL_ALIGN) 17 : 18 : FD_PROTOTYPES_BEGIN 19 : 20 : 21 : ulong 22 : fd_sysvar_slot_hashes_footprint( ulong slot_hashes_cap ); 23 : 24 : void * 25 : fd_sysvar_slot_hashes_new( void * mem, 26 : ulong slot_hashes_cap ); 27 : 28 : fd_slot_hashes_global_t * 29 : fd_sysvar_slot_hashes_join( void * shmem, 30 : fd_slot_hash_t ** slot_hash ); 31 : 32 : void * 33 : fd_sysvar_slot_hashes_leave( fd_slot_hashes_global_t * slot_hashes_global, 34 : fd_slot_hash_t * slot_hash ); 35 : 36 : void * 37 : fd_sysvar_slot_hashes_delete( void * mem ); 38 : 39 : /* Write a funk entry for the slot hashes sysvar account (exposed for tests) */ 40 : void 41 : fd_sysvar_slot_hashes_write( fd_exec_slot_ctx_t * slot_ctx, 42 : fd_slot_hashes_global_t * slot_hashes_global ); 43 : 44 : void 45 : fd_sysvar_slot_hashes_init( fd_exec_slot_ctx_t * slot_ctx, 46 : fd_spad_t * runtime_spad ); 47 : 48 : /* Update the slot hashes sysvar account. This should be called at the end of every slot, before execution commences. */ 49 : void 50 : fd_sysvar_slot_hashes_update( fd_exec_slot_ctx_t * slot_ctx, fd_spad_t * runtime_spad ); 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_t * funk_txn, 58 : fd_spad_t * spad ); 59 : 60 : FD_PROTOTYPES_END 61 : 62 : #endif /* HEADER_fd_src_flamenco_runtime_sysvar_fd_slot_hashes_h */