LCOV - code coverage report
Current view: top level - flamenco/runtime/sysvar - fd_sysvar.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 4 4 100.0 %
Date: 2026-08-26 04:41:07 Functions: 3 18 16.7 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_flamenco_runtime_sysvar_fd_sysvar_h
       2             : #define HEADER_fd_src_flamenco_runtime_sysvar_fd_sysvar_h
       3             : 
       4             : #include "../fd_bank.h"
       5             : #include "fd_sysvar_rent.h"
       6             : 
       7             : /* https://github.com/anza-xyz/agave/blob/cbc8320d35358da14d79ebcada4dfb6756ffac79/runtime/src/bank.rs#L1833 */
       8        5955 : #define FD_SYSVAR_RENT_UNADJUSTED_INITIAL_BALANCE ( 1UL )
       9             : /* https://github.com/anza-xyz/agave/blob/cbc8320d35358da14d79ebcada4dfb6756ffac79/runtime/src/bank.rs#L1843 */
      10             : #define FD_SYSVAR_INITIAL_RENT_EPOCH              ( 0UL )
      11             : 
      12             : /* fd_sysvar_account_update persists a sysvar data update to the account
      13             :    database.  Does not update the sysvar cache. */
      14             : 
      15             : void
      16             : fd_sysvar_account_update( fd_bank_t *         bank,
      17             :                           fd_accdb_t *        accdb,
      18             :                           fd_capture_ctx_t *  capture_ctx,
      19             :                           fd_pubkey_t const * address,
      20             :                           void const *        data,
      21             :                           ulong               sz );
      22             : 
      23             : /* fd_sysvar_adjust_balance_for_rent raises a sysvar account's balance
      24             :    to the rent exempt minimum.
      25             :    https://github.com/anza-xyz/agave/blob/v4.2.0-rc.1/runtime/src/bank.rs#L6284-L6289 */
      26             : 
      27             : static inline void
      28             : fd_sysvar_adjust_balance_for_rent( fd_bank_t const * bank,
      29        6657 :                                    fd_acc_t *        acc ) {
      30        6657 :   acc->lamports = fd_ulong_max( acc->lamports, fd_rent_exempt_minimum_balance( &bank->f.rent, acc->data_len ) );
      31        6657 : }
      32             : 
      33             : int
      34             : fd_sysvar_instr_acct_check( fd_exec_instr_ctx_t const * ctx,
      35             :                             ulong                       idx,
      36             :                             fd_pubkey_t const *         addr_want );
      37             : 
      38             : /* TODO: Some common functions that exist in all sysvar accounts should
      39             :    be templatized/factored out into this common header file.
      40             :    Notably, fd_sysvar_{*}_{read,write} should be factored out here. */
      41             : 
      42             : #endif /* HEADER_fd_src_flamenco_runtime_sysvar_fd_sysvar_h */

Generated by: LCOV version 1.14