LCOV - code coverage report
Current view: top level - flamenco/runtime/sysvar - fd_sysvar_clock.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 7 0.0 %
Date: 2024-11-13 11:58:15 Functions: 0 9 0.0 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_flamenco_runtime_sysvar_fd_clock_h
       2             : #define HEADER_fd_src_flamenco_runtime_sysvar_fd_clock_h
       3             : 
       4             : /* The clock sysvar provides an approximate measure of network time. */
       5             : 
       6             : #include "../../fd_flamenco_base.h"
       7             : #include "../context/fd_exec_instr_ctx.h"
       8             : 
       9             : /* https://github.com/solana-labs/solana/blob/8f2c8b8388a495d2728909e30460aa40dcc5d733/sdk/program/src/clock.rs#L10 */
      10           0 : #define FD_SYSVAR_CLOCK_DEFAULT_TICKS_PER_SECOND ( 160UL )
      11           0 : #define FD_SYSVAR_CLOCK_DEFAULT_HASHES_PER_TICK  (12500UL)
      12             : 
      13             : FD_PROTOTYPES_BEGIN
      14             : 
      15             : /* The clock sysvar provides an approximate measure of network time. */
      16             : 
      17             : /* Initialize the clock sysvar account. */
      18             : 
      19             : void
      20             : fd_sysvar_clock_init( fd_exec_slot_ctx_t * slot_ctx );
      21             : 
      22             : /* Update the clock sysvar account.  This should be called at the start
      23             :    of every slot, before execution commences. */
      24             : 
      25             : int
      26             : fd_sysvar_clock_update( fd_exec_slot_ctx_t * slot_ctx );
      27             : 
      28             : /* Reads the current value of the clock sysvar */
      29             : 
      30             : fd_sol_sysvar_clock_t *
      31             : fd_sysvar_clock_read( fd_sol_sysvar_clock_t *    result,
      32             :                       fd_exec_slot_ctx_t const * slot_ctx );
      33             : 
      34             : /* fd_slot_cnt_2day returns the number of slots in two days.
      35             :    Used in rent collection. */
      36             : 
      37             : static inline ulong
      38           0 : fd_slot_cnt_2day( ulong ticks_per_slot ) {
      39           0 :   ulong seconds = (2UL * 24UL * 60UL * 60UL);
      40           0 :   ulong ticks   = seconds * FD_SYSVAR_CLOCK_DEFAULT_HASHES_PER_TICK;
      41           0 :   return ticks / ticks_per_slot;
      42           0 : }
      43             : 
      44             : FD_PROTOTYPES_END
      45             : 
      46             : #endif /* HEADER_fd_src_flamenco_runtime_sysvar_fd_clock_h */

Generated by: LCOV version 1.14