LCOV - code coverage report
Current view: top level - flamenco/runtime - fd_hashes.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 5 0.0 %
Date: 2025-03-20 12:08:36 Functions: 0 0 -

          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             : union fd_features;
      18             : typedef union fd_features fd_features_t;
      19             : 
      20             : FD_PROTOTYPES_BEGIN
      21             : 
      22             : int
      23             : fd_update_hash_bank_tpool( fd_exec_slot_ctx_t * slot_ctx,
      24             :                            fd_capture_ctx_t *   capture_ctx,
      25             :                            fd_hash_t *          hash,
      26             :                            ulong                signature_cnt,
      27             :                            fd_tpool_t *         tpool,
      28             :                            fd_spad_t *          runtime_spad );
      29             : 
      30             : int
      31             : fd_print_account_hashes( fd_exec_slot_ctx_t * slot_ctx,
      32             :                          fd_tpool_t *         tpool,
      33             :                          fd_spad_t *          runtime_spad );
      34             : 
      35             : /* fd_hash_account is the method to compute the account
      36             :    hash.  It includes the following content:
      37             :     - lamports
      38             :     - rent_epoch
      39             :     - data
      40             :     - executable
      41             :     - owner
      42             :     - pubkey
      43             : 
      44             :    Writes the resulting hash to hash, and returns hash. */
      45             : 
      46             : void const *
      47             : fd_hash_account( uchar                     hash  [ static 32 ],
      48             :                  fd_lthash_value_t       * lthash,
      49             :                  fd_account_meta_t const * account,
      50             :                  uchar const               pubkey[ static 32 ],
      51             :                  uchar const             * data,
      52             :                  int                       hash_needed,
      53             :                  fd_features_t            *features
      54             :  );
      55             : 
      56             : /* fd_hash_account_current chooses the correct account hash function
      57             :    based on feature activation state. */
      58             : 
      59           0 : #define FD_HASH_JUST_ACCOUNT_HASH   (1)
      60           0 : #define FD_HASH_JUST_LTHASH         (2)
      61           0 : #define FD_HASH_BOTH_HASHES         (3)
      62             : 
      63             : void const *
      64             : fd_hash_account_current( uchar                      hash  [ static 32 ],
      65             :                          fd_lthash_value_t         *lthash,
      66             :                          fd_account_meta_t const   *account,
      67             :                          uchar const                pubkey[ static 32 ],
      68             :                          uchar const *              data,
      69             :                          int                        hash_needed,
      70             :                          fd_features_t            *features );
      71             : 
      72             : /* Generate a complete accounts_hash of the entire account database. */
      73             : 
      74             : int
      75             : fd_accounts_hash( fd_funk_t *      funk,
      76             :                   fd_slot_bank_t * slot_bank,
      77             :                   fd_tpool_t *     tpool,
      78             :                   fd_hash_t *      accounts_hash,
      79             :                   fd_spad_t *      runtime_spad,
      80             :                   int              lthash_enabled,
      81             :                   fd_features_t   *features );
      82             : 
      83             : /* Generate a non-incremental hash of the entire account database, conditionally including in the epoch account hash. */
      84             : int
      85             : fd_snapshot_hash( fd_exec_slot_ctx_t * slot_ctx,
      86             :                   fd_tpool_t *         tpool,
      87             :                   fd_hash_t *          accounts_hash,
      88             :                   uint                 check_hash,
      89             :                   fd_spad_t *          runtime_spad );
      90             : 
      91             : /* Generate an incremental hash of the entire account database, conditionally including in the epoch account hash. */
      92             : int
      93             : fd_snapshot_inc_hash( fd_exec_slot_ctx_t * slot_ctx,
      94             :                       fd_hash_t *          accounts_hash,
      95             :                       fd_funk_txn_t *      child_txn,
      96             :                       uint                 check_hash,
      97             :                       fd_spad_t *          spad );
      98             : 
      99             : /* Generate a non-incremental hash of the entire account database, including
     100             :    the epoch account hash. It differs from fd_snapshot_hash in that this version
     101             :    is used by the snapshot service which doesn't have access to a slot_ctx
     102             :    handle. However, it retains a copy of funk, slot_bank, and epoch_bank.
     103             :    Do the same for the incremental hash. These functions are also
     104             :    responsible for conditionally including the epoch account hash into
     105             :    the account hash. These hashes are used by the snapshot service.
     106             :    TODO: These should be used to generate the hashes from snapshot loading. */
     107             : 
     108             : int
     109             : fd_snapshot_service_hash( fd_hash_t *       accounts_hash,
     110             :                           fd_hash_t *       snapshot_hash,
     111             :                           fd_slot_bank_t *  slot_bank,
     112             :                           fd_epoch_bank_t * epoch_bank,
     113             :                           fd_funk_t *       funk,
     114             :                           fd_tpool_t *      tpool,
     115             :                           fd_spad_t *       runtime_spad,
     116             :                           fd_features_t    *features );
     117             : 
     118             : int
     119             : fd_snapshot_service_inc_hash( fd_hash_t *                 accounts_hash,
     120             :                               fd_hash_t *                 snapshot_hash,
     121             :                               fd_slot_bank_t *            slot_bank,
     122             :                               fd_epoch_bank_t *           epoch_bank,
     123             :                               fd_funk_t *                 funk,
     124             :                               fd_funk_rec_key_t const * * pubkeys,
     125             :                               ulong                       pubkeys_len,
     126             :                               fd_spad_t *                 spad,
     127             :                               fd_features_t              *features  );
     128             : 
     129             : void
     130             : fd_accounts_check_lthash( fd_funk_t *      funk,
     131             :                           fd_funk_txn_t *  funk_txn,
     132             :                           fd_slot_bank_t * slot_bank,
     133             :                           fd_spad_t *      runtime_spad,
     134             :                           fd_features_t  * features );
     135             : 
     136             : void
     137             : fd_calculate_epoch_accounts_hash_values(fd_exec_slot_ctx_t * slot_ctx);
     138             : 
     139             : FD_PROTOTYPES_END
     140             : 
     141             : #endif /* HEADER_fd_src_flamenco_runtime_fd_hashes_h */

Generated by: LCOV version 1.14