LCOV - code coverage report
Current view: top level - flamenco/runtime - fd_hashes.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 2 0.0 %
Date: 2025-01-08 12:08:44 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             : FD_PROTOTYPES_BEGIN
      18             : 
      19             : int
      20             : fd_update_hash_bank_tpool( fd_exec_slot_ctx_t * slot_ctx,
      21             :                            fd_capture_ctx_t *   capture_ctx,
      22             :                            fd_hash_t *          hash,
      23             :                            ulong                signature_cnt,
      24             :                            fd_tpool_t *         tpool );
      25             : 
      26             : int
      27             : fd_print_account_hashes( fd_exec_slot_ctx_t * slot_ctx,
      28             :                          fd_tpool_t *         tpool );
      29             : /* fd_hash_account is the method to compute the account
      30             :    hash.  It includes the following content:
      31             :     - lamports
      32             :     - rent_epoch
      33             :     - data
      34             :     - executable
      35             :     - owner
      36             :     - pubkey
      37             : 
      38             :    Writes the resulting hash to hash, and returns hash. */
      39             : 
      40             : void const *
      41             : fd_hash_account( uchar                     hash  [ static 32 ],
      42             :                  fd_lthash_value_t       * lthash,
      43             :                  fd_account_meta_t const * account,
      44             :                  uchar const               pubkey[ static 32 ],
      45             :                  uchar const             * data );
      46             : 
      47             : /* fd_hash_account_current chooses the correct account hash function
      48             :    based on feature activation state. */
      49             : 
      50             : void const *
      51             : fd_hash_account_current( uchar                      hash  [ static 32 ],
      52             :                          fd_lthash_value_t         *lthash,
      53             :                          fd_account_meta_t const   *account,
      54             :                          uchar const                pubkey[ static 32 ],
      55             :                          uchar const *              data );
      56             : 
      57             : /* Generate a complete accounts_hash of the entire account database. */
      58             : 
      59             : int
      60             : fd_accounts_hash( fd_funk_t          * funk,
      61             :                   fd_slot_bank_t     * slot_bank,
      62             :                   fd_valloc_t          valloc,
      63             :                   fd_tpool_t         * tpool,
      64             :                   fd_hash_t          * accounts_hash );
      65             : 
      66             : /* Special version for verifying incremental snapshot. */
      67             : 
      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             : /* Same as fd_accounts_hash_inc_only but takes a list of pubkeys to hash.
      75             :    Query the accounts from the root of funk. This is done as a read-only
      76             :    way to generate an accounts hash from a subset of accounts from funk. */
      77             : 
      78             : int
      79             : fd_accounts_hash_inc_no_txn( fd_funk_t *                 funk,
      80             :                              fd_valloc_t                 valloc,
      81             :                              fd_hash_t *                 accounts_hash,
      82             :                              fd_funk_rec_key_t const * * pubkeys,
      83             :                              ulong                       pubkeys_len,
      84             :                              ulong                       do_hash_verify );
      85             : 
      86             : /* Generate a non-incremental hash of the entire account database, including epoch bank hash. */
      87             : int
      88             : fd_snapshot_hash( fd_exec_slot_ctx_t * slot_ctx,
      89             :                   fd_tpool_t * tpool,
      90             :                   fd_hash_t * accounts_hash,
      91             :                   uint check_hash );
      92             : 
      93             : /* Generate a non-incremental hash of the entire account database, including
      94             :    the epoch account hash. It differs from fd_snapshot_hash in that this version
      95             :    is used by the snapshot service which doesn't have access to a slot_ctx 
      96             :    handle. However, it retains a copy of funk, slot_bank, and epoch_bank. 
      97             :    Do the same for the incremental hash. These functions are also
      98             :    responsible for conditionally including the epoch account hash into
      99             :    the account hash. These hashes are used by the snapshot service.
     100             :    TODO: These should be used to generate the hashes from snapshot loading. */
     101             :  
     102             : int
     103             : fd_snapshot_service_hash( fd_hash_t *       accounts_hash,
     104             :                           fd_hash_t *       snapshot_hash,
     105             :                           fd_slot_bank_t *  slot_bank,
     106             :                           fd_epoch_bank_t * epoch_bank,
     107             :                           fd_funk_t *       funk,
     108             :                           fd_tpool_t *      tpool,
     109             :                           fd_valloc_t       valloc );
     110             : 
     111             : int
     112             : fd_snapshot_service_inc_hash( fd_hash_t *                 accounts_hash,
     113             :                               fd_hash_t *                 snapshot_hash,
     114             :                               fd_slot_bank_t *            slot_bank,
     115             :                               fd_epoch_bank_t *           epoch_bank,
     116             :                               fd_funk_t *                 funk,
     117             :                               fd_funk_rec_key_t const * * pubkeys,
     118             :                               ulong                       pubkeys_len,
     119             :                               fd_valloc_t                 valloc );
     120             : 
     121             : void
     122             : fd_accounts_check_lthash( fd_funk_t     *  funk,
     123             :                           fd_funk_txn_t *  funk_txn,
     124             :                           fd_slot_bank_t * slot_bank,
     125             :                           fd_valloc_t      valloc );
     126             : 
     127             : void
     128             : fd_calculate_epoch_accounts_hash_values(fd_exec_slot_ctx_t * slot_ctx);
     129             : 
     130             : FD_PROTOTYPES_END
     131             : 
     132             : #endif /* HEADER_fd_src_flamenco_runtime_fd_hashes_h */

Generated by: LCOV version 1.14