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-11-15 04:25:17 Functions: 3 20 15.0 %

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

Generated by: LCOV version 1.14