LCOV - code coverage report
Current view: top level - choreo/votor - ag_parent_ready_tracker.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 5 0.0 %
Date: 2026-10-22 18:10:43 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_choreo_votor_ag_parent_ready_tracker_h
       2             : #define HEADER_fd_src_choreo_votor_ag_parent_ready_tracker_h
       3             : 
       4             : #include "ag_votor_base.h"
       5             : 
       6             : struct ag_parent_ready {
       7             :   ulong         slot;
       8             :   ag_block_id_t parent;
       9             : };
      10             : typedef struct ag_parent_ready ag_parent_ready_t;
      11             : 
      12             : struct ag_parent_ready_state {
      13             :   ulong slot; /* map key */
      14             :   ulong next; /* reserved for fd_pool, fd_map_chain */
      15             : 
      16             :   int skip;
      17             : 
      18             :   ag_block_hash_t notar_fallbacks[AG_NOTAR_FALLBACK_CERT_MAX];
      19             :   uchar           notar_fallbacks_cnt;
      20             : 
      21             :   /* window starts only.  The ready parents of a window start are the
      22             :      notar fallbacks of slots [b_lo,slot), Definition 15 with every
      23             :      slot strictly between b_lo and slot skip certified. */
      24             : 
      25             :   ulong         b_lo;            /* highest slot below that is not skipped, ULONG_MAX if slot-1 */
      26             :   ag_block_id_t parent_ready_lo; /* lowest ready parent by (slot,hash), slot ULONG_MAX if none */
      27             :   int           ready;           /* a ParentReady for this slot is queued but not delivered */
      28             : };
      29             : typedef struct ag_parent_ready_state ag_parent_ready_state_t;
      30             : 
      31             : #define POOL_NAME ag_parent_ready_state_pool
      32           0 : #define POOL_T    ag_parent_ready_state_t
      33             : #include "../../util/tmpl/fd_pool.c"
      34             : 
      35             : #define MAP_NAME               ag_parent_ready_state_map
      36             : #define MAP_ELE_T              ag_parent_ready_state_t
      37           0 : #define MAP_KEY                slot
      38             : #define MAP_KEY_T              ulong
      39           0 : #define MAP_KEY_EQ(k0,k1)      ((*(k0))==(*(k1)))
      40           0 : #define MAP_KEY_HASH(key,seed) (fd_ulong_hash( (*(key)) ^ (seed) ))
      41           0 : #define MAP_NEXT               next
      42             : #include "../../util/tmpl/fd_map_chain.c"
      43             : 
      44             : struct ag_parent_ready_states {
      45             :   ag_parent_ready_state_t *     pool;
      46             :   ag_parent_ready_state_map_t * map;
      47             : };
      48             : typedef struct ag_parent_ready_states ag_parent_ready_states_t;
      49             : 
      50             : struct __attribute__((aligned(128UL))) ag_parent_ready_tracker {
      51             :   ag_parent_ready_states_t states;
      52             :   ulong                    root;
      53             :   ulong                    highest_ready;
      54             : };
      55             : typedef struct ag_parent_ready_tracker ag_parent_ready_tracker_t;
      56             : 
      57             : FD_PROTOTYPES_BEGIN
      58             : 
      59             : FD_FN_CONST ulong
      60             : ag_parent_ready_tracker_align( void );
      61             : 
      62             : FD_FN_CONST ulong
      63             : ag_parent_ready_tracker_footprint( ulong slot_max );
      64             : 
      65             : void *
      66             : ag_parent_ready_tracker_new( void * shmem,
      67             :                              ulong  slot_max,
      68             :                              ulong  seed );
      69             : 
      70             : ag_parent_ready_tracker_t *
      71             : ag_parent_ready_tracker_join( void * shtracker );
      72             : 
      73             : void *
      74             : ag_parent_ready_tracker_leave( ag_parent_ready_tracker_t const * tracker );
      75             : 
      76             : void *
      77             : ag_parent_ready_tracker_delete( void * shtracker );
      78             : 
      79             : /* ag_parent_ready_tracker_mark_root marks root notarized-fallback and
      80             :    makes root+1 ParentReady with root as its parent, even if root+1
      81             :    does not start a window.  Only a window start emits an event.
      82             : 
      83             :    https://github.com/anza-xyz/agave/blob/v4.3.0-beta.0/votor/src/consensus_pool/parent_ready_tracker.rs#L65-L108 */
      84             : 
      85             : ulong
      86             : ag_parent_ready_tracker_mark_root( ag_parent_ready_tracker_t * self,
      87             :                                    ag_block_id_t const *       root,
      88             :                                    ag_parent_ready_t *         newly_certified );
      89             : 
      90             : /* Definition 15. ParentReadyTracker::mark_notar_fallback */
      91             : 
      92             : ulong
      93             : ag_parent_ready_tracker_mark_notar_fallback( ag_parent_ready_tracker_t * self,
      94             :                                              ag_block_id_t const *       id,
      95             :                                              ag_parent_ready_t *         newly_certified );
      96             : 
      97             : /* Definition 15. ParentReadyTracker::mark_skipped */
      98             : 
      99             : ulong
     100             : ag_parent_ready_tracker_mark_skipped( ag_parent_ready_tracker_t * self,
     101             :                                       ulong                       marked_slot,
     102             :                                       ag_parent_ready_t *         newly_certified );
     103             : 
     104             : /* Definition 15. ParentReadyTracker::parents_ready.  Writes up to
     105             :    out_max ready parents of slot to out and returns how many are ready. */
     106             : 
     107             : ulong
     108             : ag_parent_ready_tracker_parents_ready( ag_parent_ready_tracker_t const * self,
     109             :                                        ulong                             slot,
     110             :                                        ag_block_id_t *                   out,
     111             :                                        ulong                             out_max );
     112             : 
     113             : /* Definition 15. Pool::is_parent_ready */
     114             : 
     115             : int
     116             : ag_parent_ready_tracker_is_parent_ready( ag_parent_ready_tracker_t const * self,
     117             :                                          ulong                             slot,
     118             :                                          ag_block_id_t const *             parent );
     119             : 
     120             : /* Definition 15. ParentReadyTracker::wait_for_parent_ready; slot ULONG_MAX is the pending receiver */
     121             : 
     122             : ag_block_id_t
     123             : ag_parent_ready_tracker_wait_for_parent_ready( ag_parent_ready_tracker_t const * self,
     124             :                                                ulong                             slot );
     125             : 
     126             : /* Section 2.9. ParentReadyTracker::prune */
     127             : 
     128             : void
     129             : ag_parent_ready_tracker_prune( ag_parent_ready_tracker_t * self,
     130             :                                ulong                       new_root );
     131             : 
     132             : FD_PROTOTYPES_END
     133             : 
     134             : #endif

Generated by: LCOV version 1.14