Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_runtime_fd_hashes_h 2 : #define HEADER_fd_src_flamenco_runtime_fd_hashes_h 3 : 4 : #include "../fd_flamenco_base.h" 5 : #include "../types/fd_types.h" 6 : #include "../../funk/fd_funk.h" 7 : #include "../../ballet/lthash/fd_lthash.h" 8 : 9 0 : #define FD_PUBKEY_HASH_PAIR_ALIGN (16UL) 10 : struct __attribute__((aligned(FD_PUBKEY_HASH_PAIR_ALIGN))) fd_pubkey_hash_pair { 11 : fd_funk_rec_t const * rec; 12 : fd_hash_t const * hash; 13 : }; 14 : typedef struct fd_pubkey_hash_pair fd_pubkey_hash_pair_t; 15 0 : #define FD_PUBKEY_HASH_PAIR_FOOTPRINT (sizeof(fd_pubkey_hash_pair_t)) 16 : 17 : FD_PROTOTYPES_BEGIN 18 : 19 : int fd_update_hash_bank( fd_exec_slot_ctx_t * slot_ctx, 20 : fd_capture_ctx_t * capture_ctx, 21 : fd_hash_t * hash, 22 : ulong signature_cnt ); 23 : int 24 : fd_update_hash_bank_tpool( fd_exec_slot_ctx_t * slot_ctx, 25 : fd_capture_ctx_t * capture_ctx, 26 : fd_hash_t * hash, 27 : ulong signature_cnt, 28 : fd_tpool_t * tpool ); 29 : 30 : int 31 : fd_print_account_hashes( fd_exec_slot_ctx_t * slot_ctx, 32 : fd_tpool_t * tpool ); 33 : /* fd_hash_account is the method to compute the account 34 : hash. It includes the following content: 35 : - lamports 36 : - rent_epoch 37 : - data 38 : - executable 39 : - owner 40 : - pubkey 41 : 42 : Writes the resulting hash to hash, and returns hash. */ 43 : 44 : void const * 45 : fd_hash_account( uchar hash [ static 32 ], 46 : fd_lthash_value_t * lthash, 47 : fd_account_meta_t const * account, 48 : uchar const pubkey[ static 32 ], 49 : uchar const * data ); 50 : 51 : /* fd_hash_account_current chooses the correct account hash function 52 : based on feature activation state. */ 53 : 54 : void const * 55 : fd_hash_account_current( uchar hash [ static 32 ], 56 : fd_lthash_value_t *lthash, 57 : fd_account_meta_t const *account, 58 : uchar const pubkey[ static 32 ], 59 : uchar const * data ); 60 : 61 : /* Generate a complete accounts_hash of the entire account database. */ 62 : int 63 : fd_accounts_hash( fd_exec_slot_ctx_t * slot_ctx, 64 : fd_tpool_t * tpool, 65 : fd_hash_t * accounts_hash ); 66 : 67 : /* Special version for verifying incremental snapshot */ 68 : int 69 : fd_accounts_hash_inc_only( fd_exec_slot_ctx_t * slot_ctx, 70 : fd_hash_t * accounts_hash, 71 : fd_funk_txn_t * child_txn, 72 : ulong do_hash_verify ); 73 : 74 : /* Generate a non-incremental hash of the entire account database, including epoch bank hash. */ 75 : int 76 : fd_snapshot_hash( fd_exec_slot_ctx_t * slot_ctx, 77 : fd_tpool_t * tpool, 78 : fd_hash_t * accounts_hash, 79 : uint check_hash ); 80 : 81 : void 82 : fd_accounts_check_lthash( fd_exec_slot_ctx_t * slot_ctx ); 83 : 84 : void 85 : fd_calculate_epoch_accounts_hash_values(fd_exec_slot_ctx_t * slot_ctx); 86 : 87 : FD_PROTOTYPES_END 88 : 89 : #endif /* HEADER_fd_src_flamenco_runtime_fd_hashes_h */