LCOV - code coverage report
Current view: top level - flamenco/runtime - fd_acc_mgr.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 13 14 92.9 %
Date: 2026-05-26 08:02:49 Functions: 3 144 2.1 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_flamenco_runtime_fd_acc_mgr_h
       2             : #define HEADER_fd_src_flamenco_runtime_fd_acc_mgr_h
       3             : 
       4             : /* fd_acc_mgr provides APIs for the Solana account database. */
       5             : 
       6             : #include "../fd_flamenco_base.h"
       7             : 
       8             : #if FD_HAS_AVX
       9             : #include "../../util/simd/fd_avx.h"
      10             : #endif
      11             : 
      12             : /* FD_ACC_TOT_SZ_MAX is the size limit of a Solana account in the firedancer
      13             :    client. This means that it includes the max size of the account (10MiB)
      14             :    and the associated metadata. */
      15             : 
      16           0 : #define FD_ACC_TOT_SZ_MAX (FD_RUNTIME_ACC_SZ_MAX + sizeof(fd_account_meta_t))
      17             : 
      18             : FD_PROTOTYPES_BEGIN
      19             : 
      20             : /* Account Management APIs **************************************************/
      21             : 
      22             : /* The following account management APIs are helpers for fd_account_meta_t creation,
      23             :    existence, and retrieval from funk */
      24             : 
      25             : static inline fd_account_meta_t *
      26        1638 : fd_account_meta_init( fd_account_meta_t * m ) {
      27        1638 :   fd_memset( m, 0, sizeof(fd_account_meta_t) );
      28        1638 :   return m;
      29        1638 : }
      30             : 
      31             : /* fd_account_meta_exists checks if the account in a funk record exists or was
      32             :    deleted.  Handles NULL input safely.  Returns 0 if the account was
      33             :    deleted (zero lamports, empty data, zero owner).  Otherwise, returns
      34             :    1. */
      35             : 
      36             : static inline int
      37         660 : fd_account_meta_exists( fd_account_meta_t const * m ) {
      38             : 
      39         660 :   if( !m ) return 0;
      40             : 
      41         660 : # if FD_HAS_AVX
      42         660 :   wl_t o = wl_ldu( m->owner );
      43         660 :   int has_owner = !_mm256_testz_si256( o, o );
      44             : # else
      45             :   int has_owner = 0;
      46             :   for( ulong i=0UL; i<32UL; i++ )
      47             :     has_owner |= m->owner[i];
      48             :   has_owner = !!has_owner;
      49             : # endif
      50             : 
      51         660 :   return ((m->lamports > 0UL) |
      52         660 :           (m->dlen     > 0UL) |
      53         660 :           (has_owner        ) );
      54             : 
      55         660 : }
      56             : 
      57             : FD_PROTOTYPES_END
      58             : 
      59             : #endif /* HEADER_fd_src_flamenco_runtime_fd_acc_mgr_h */

Generated by: LCOV version 1.14