LCOV - code coverage report
Current view: top level - app/firedancer - callbacks.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 54 78 69.2 %
Date: 2025-09-18 04:41:32 Functions: 15 44 34.1 %

          Line data    Source code
       1             : #include "../shared/fd_config.h"
       2             : #include "../../util/pod/fd_pod_format.h"
       3             : 
       4             : #include "../../disco/store/fd_store.h"
       5             : #include "../../discof/replay/fd_exec.h"
       6             : #include "../../flamenco/runtime/fd_bank.h"
       7             : #include "../../flamenco/runtime/fd_runtime.h"
       8             : #include "../../flamenco/runtime/fd_txncache.h"
       9             : 
      10          30 : #define VAL(name) (__extension__({                                                             \
      11          30 :   ulong __x = fd_pod_queryf_ulong( topo->props, ULONG_MAX, "obj.%lu.%s", obj->id, name );      \
      12          30 :   if( FD_UNLIKELY( __x==ULONG_MAX ) ) FD_LOG_ERR(( "obj.%lu.%s was not set", obj->id, name )); \
      13          30 :   __x; }))
      14             : 
      15             : static ulong
      16             : banks_footprint( fd_topo_t const *     topo,
      17           3 :                  fd_topo_obj_t const * obj ) {
      18           3 :   return fd_banks_footprint( VAL("max_total_banks"), VAL("max_fork_width") );
      19           3 : }
      20             : 
      21             : static ulong
      22             : banks_align( fd_topo_t const *     topo FD_FN_UNUSED,
      23           3 :              fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
      24           3 :   return fd_banks_align();
      25           3 : }
      26             : 
      27             : static void
      28             : banks_new( fd_topo_t const *     topo,
      29           0 :            fd_topo_obj_t const * obj ) {
      30           0 :   FD_TEST( fd_banks_new( fd_topo_obj_laddr( topo, obj->id ), VAL("max_total_banks"), VAL("max_fork_width") ) );
      31           0 : }
      32             : 
      33             : fd_topo_obj_callbacks_t fd_obj_cb_banks = {
      34             :   .name      = "banks",
      35             :   .footprint = banks_footprint,
      36             :   .align     = banks_align,
      37             :   .new       = banks_new,
      38             : };
      39             : 
      40             : static ulong
      41             : bh_cmp_footprint( fd_topo_t const *     topo,
      42           3 :                   fd_topo_obj_t const * obj ) {
      43           3 :   (void)topo; (void)obj;
      44           3 :   return fd_bank_hash_cmp_footprint();
      45           3 : }
      46             : 
      47             : static ulong
      48             : bh_cmp_align( fd_topo_t const *     topo,
      49           3 :               fd_topo_obj_t const * obj ) {
      50           3 :   (void)topo; (void)obj;
      51           3 :   return fd_bank_hash_cmp_align();
      52           3 : }
      53             : 
      54             : static void
      55             : bh_cmp_new( fd_topo_t const *     topo,
      56           0 :                    fd_topo_obj_t const * obj ) {
      57           0 :   (void)topo; (void)obj;
      58           0 :   FD_TEST( fd_bank_hash_cmp_new( fd_topo_obj_laddr( topo, obj->id ) ) );
      59           0 : }
      60             : 
      61             : fd_topo_obj_callbacks_t fd_obj_cb_bank_hash_cmp = {
      62             :   .name      = "bh_cmp",
      63             :   .footprint = bh_cmp_footprint,
      64             :   .align     = bh_cmp_align,
      65             :   .new       = bh_cmp_new,
      66             : };
      67             : 
      68             : static ulong
      69             : funk_align( fd_topo_t const *     topo,
      70           3 :             fd_topo_obj_t const * obj ) {
      71           3 :   (void)topo; (void)obj;
      72           3 :   return fd_funk_align();
      73           3 : }
      74             : 
      75             : static ulong
      76             : funk_footprint( fd_topo_t const *     topo,
      77           3 :                 fd_topo_obj_t const * obj ) {
      78           3 :   (void)topo;
      79           3 :   return fd_funk_footprint( VAL("txn_max"), VAL("rec_max") );
      80           3 : }
      81             : 
      82             : static ulong
      83             : funk_loose( fd_topo_t const *     topo,
      84           3 :             fd_topo_obj_t const * obj ) {
      85           3 :   (void)topo;
      86           3 :   return VAL("heap_max");
      87           3 : }
      88             : 
      89             : static void
      90             : funk_new( fd_topo_t const *     topo,
      91           0 :            fd_topo_obj_t const * obj ) {
      92           0 :   ulong funk_seed = fd_pod_queryf_ulong( topo->props, 0UL, "obj.%lu.seed", obj->id );
      93           0 :   if( !funk_seed ) FD_TEST( fd_rng_secure( &funk_seed, sizeof(ulong) ) );
      94           0 :   FD_TEST( fd_funk_new( fd_topo_obj_laddr( topo, obj->id ), 2UL, funk_seed, VAL("txn_max"), VAL("rec_max") ) );
      95           0 : }
      96             : 
      97             : fd_topo_obj_callbacks_t fd_obj_cb_funk = {
      98             :   .name      = "funk",
      99             :   .footprint = funk_footprint,
     100             :   .loose     = funk_loose,
     101             :   .align     = funk_align,
     102             :   .new       = funk_new,
     103             : };
     104             : 
     105             : static ulong
     106             : fec_sets_footprint( fd_topo_t const *     topo,
     107           3 :                     fd_topo_obj_t const * obj ) {
     108           3 :   return VAL("sz");
     109           3 : }
     110             : 
     111             : static ulong
     112             : fec_sets_align( fd_topo_t const *     topo FD_FN_UNUSED,
     113           3 :                   fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     114           3 :   return fd_dcache_align();
     115           3 : }
     116             : 
     117             : static void
     118             : fec_sets_new( FD_PARAM_UNUSED fd_topo_t const *     topo,
     119           0 :               FD_PARAM_UNUSED fd_topo_obj_t const * obj ) {
     120           0 :   FD_TEST( fd_topo_obj_laddr( topo, obj->id ) );
     121           0 : }
     122             : 
     123             : fd_topo_obj_callbacks_t fd_obj_cb_fec_sets = {
     124             :   .name      = "fec_sets",
     125             :   .footprint = fec_sets_footprint,
     126             :   .align     = fec_sets_align,
     127             :   .new       = fec_sets_new,
     128             : };
     129             : 
     130             : static ulong
     131             : store_footprint( fd_topo_t const * topo,
     132           3 :                  fd_topo_obj_t const * obj ) {
     133           3 :   return fd_store_footprint( VAL("fec_max") );
     134           3 : }
     135             : 
     136             : static ulong
     137             : store_align( fd_topo_t const *     topo FD_FN_UNUSED,
     138           3 :              fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     139           3 :   return fd_store_align();
     140           3 : }
     141             : 
     142             : static void
     143             : store_new( fd_topo_t const *     topo,
     144           0 :            fd_topo_obj_t const * obj ) {
     145           0 :   FD_TEST( fd_store_new( fd_topo_obj_laddr( topo, obj->id ), VAL("fec_max"), VAL("part_cnt") ) );
     146           0 : }
     147             : 
     148             : fd_topo_obj_callbacks_t fd_obj_cb_store = {
     149             :   .name      = "store",
     150             :   .footprint = store_footprint,
     151             :   .align     = store_align,
     152             :   .new       = store_new,
     153             : };
     154             : 
     155             : static ulong
     156             : txncache_footprint( fd_topo_t const *     topo,
     157           3 :                     fd_topo_obj_t const * obj ) {
     158           3 :   return fd_txncache_footprint( VAL("max_rooted_slots"), VAL("max_live_slots"), VAL("max_txn_per_slot") );
     159           3 : }
     160             : 
     161             : static ulong
     162             : txncache_align( fd_topo_t const *     topo FD_FN_UNUSED,
     163           3 :                 fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     164           3 :   return fd_txncache_align();
     165           3 : }
     166             : 
     167             : static void
     168             : txncache_new( fd_topo_t const *     topo,
     169           0 :               fd_topo_obj_t const * obj ) {
     170           0 :   FD_TEST( fd_txncache_new( fd_topo_obj_laddr( topo, obj->id ), VAL("max_rooted_slots"), VAL("max_live_slots"), VAL("max_txn_per_slot") ) );
     171           0 : }
     172             : 
     173             : fd_topo_obj_callbacks_t fd_obj_cb_txncache = {
     174             :   .name      = "txncache",
     175             :   .footprint = txncache_footprint,
     176             :   .align     = txncache_align,
     177             :   .new       = txncache_new,
     178             : };
     179             : 
     180             : static ulong
     181             : exec_spad_footprint( fd_topo_t const *     topo FD_FN_UNUSED,
     182          24 :                      fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     183          24 :   return fd_spad_footprint( FD_RUNTIME_TRANSACTION_EXECUTION_FOOTPRINT_DEFAULT );
     184          24 : }
     185             : 
     186             : static ulong
     187             : exec_spad_align( fd_topo_t const *     topo FD_FN_UNUSED,
     188          24 :                  fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     189          24 :   return fd_spad_align();
     190          24 : }
     191             : 
     192             : static void
     193             : exec_spad_new( fd_topo_t const *     topo,
     194           0 :                fd_topo_obj_t const * obj ) {
     195           0 :   FD_TEST( fd_spad_new( fd_topo_obj_laddr( topo, obj->id ), FD_RUNTIME_TRANSACTION_EXECUTION_FOOTPRINT_DEFAULT ) );
     196           0 : }
     197             : 
     198             : fd_topo_obj_callbacks_t fd_obj_cb_exec_spad = {
     199             :   .name      = "exec_spad",
     200             :   .footprint = exec_spad_footprint,
     201             :   .align     = exec_spad_align,
     202             :   .new       = exec_spad_new,
     203             : };
     204             : 
     205             : #undef VAL

Generated by: LCOV version 1.14