LCOV - code coverage report
Current view: top level - app/firedancer - callbacks.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 85 0.0 %
Date: 2026-06-29 05:51:35 Functions: 0 25 0.0 %

          Line data    Source code
       1             : #include "../../util/pod/fd_pod_format.h"
       2             : 
       3             : #include "../../disco/topo/fd_topo.h"
       4             : #include "../../disco/store/fd_store.h"
       5             : #include "../../flamenco/runtime/fd_bank.h"
       6             : #include "../../flamenco/runtime/fd_txncache_shmem.h"
       7             : #include "../../flamenco/progcache/fd_progcache.h"
       8             : #include "../../disco/shred/fd_rnonce_ss.h"
       9             : 
      10           0 : #define VAL(name) (__extension__({                                                             \
      11           0 :   ulong __x = fd_pod_queryf_ulong( topo->props, ULONG_MAX, "obj.%lu.%s", obj->id, name );      \
      12           0 :   if( FD_UNLIKELY( __x==ULONG_MAX ) ) FD_LOG_ERR(( "obj.%lu.%s was not set", obj->id, name )); \
      13           0 :   __x; }))
      14             : 
      15             : static ulong
      16             : banks_footprint( fd_topo_t const *     topo,
      17           0 :                  fd_topo_obj_t const * obj ) {
      18           0 :   return fd_banks_footprint( VAL("max_live_slots"), VAL("max_fork_width"), FD_RUNTIME_MAX_STAKE_ACCOUNTS, FD_RUNTIME_MAX_VOTE_ACCOUNTS );
      19           0 : }
      20             : 
      21             : static ulong
      22             : banks_align( fd_topo_t const *     topo FD_FN_UNUSED,
      23           0 :              fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
      24           0 :   return fd_banks_align();
      25           0 : }
      26             : 
      27             : static void
      28             : banks_new( fd_topo_t const *     topo,
      29           0 :            fd_topo_obj_t const * obj ) {
      30           0 :   int larger_max_cost_per_block = fd_pod_queryf_int( topo->props, 0, "obj.%lu.larger_max_cost_per_block", obj->id );
      31           0 :   ulong seed = fd_pod_queryf_ulong( topo->props, 0UL, "obj.%lu.seed", obj->id );
      32           0 :   FD_TEST( fd_banks_new( fd_topo_obj_laddr( topo, obj->id ), VAL("max_live_slots"), VAL("max_fork_width"), FD_RUNTIME_MAX_STAKE_ACCOUNTS, FD_RUNTIME_MAX_VOTE_ACCOUNTS, larger_max_cost_per_block, seed ) );
      33           0 : }
      34             : 
      35             : fd_topo_obj_callbacks_t fd_obj_cb_banks = {
      36             :   .name      = "banks",
      37             :   .footprint = banks_footprint,
      38             :   .align     = banks_align,
      39             :   .new       = banks_new,
      40             : };
      41             : 
      42             : static ulong
      43             : progcache_align( fd_topo_t const *     topo,
      44           0 :                  fd_topo_obj_t const * obj ) {
      45           0 :   (void)topo; (void)obj;
      46           0 :   return fd_progcache_shmem_align();
      47           0 : }
      48             : 
      49             : static ulong
      50             : progcache_footprint( fd_topo_t const *     topo,
      51           0 :                      fd_topo_obj_t const * obj ) {
      52           0 :   return fd_progcache_shmem_footprint( VAL("txn_max"), VAL("rec_max") );
      53           0 : }
      54             : 
      55             : static ulong
      56             : progcache_loose( fd_topo_t const *     topo,
      57           0 :                  fd_topo_obj_t const * obj ) {
      58           0 :   return VAL("heap_max");
      59           0 : }
      60             : 
      61             : static void
      62             : progcache_new( fd_topo_t const *     topo,
      63           0 :                fd_topo_obj_t const * obj ) {
      64           0 :   ulong seed = fd_pod_queryf_ulong( topo->props, 0UL, "obj.%lu.seed", obj->id );
      65           0 :   if( !seed ) FD_TEST( fd_rng_secure( &seed, sizeof(ulong) ) );
      66           0 :   FD_TEST( fd_progcache_shmem_new( fd_topo_obj_laddr( topo, obj->id ), 2UL, seed, VAL("txn_max"), VAL("rec_max") ) );
      67           0 : }
      68             : 
      69             : fd_topo_obj_callbacks_t fd_obj_cb_progcache = {
      70             :   .name      = "progcache",
      71             :   .footprint = progcache_footprint,
      72             :   .loose     = progcache_loose,
      73             :   .align     = progcache_align,
      74             :   .new       = progcache_new,
      75             : };
      76             : 
      77             : /* cnc: a tile admin message queue */
      78             : 
      79             : static ulong
      80             : cnc_align( fd_topo_t const *     topo,
      81           0 :            fd_topo_obj_t const * obj ) {
      82           0 :   (void)topo; (void)obj;
      83           0 :   return fd_cnc_align();
      84           0 : }
      85             : 
      86             : static ulong
      87             : cnc_footprint( fd_topo_t const *     topo,
      88           0 :                fd_topo_obj_t const * obj ) {
      89           0 :   return fd_cnc_footprint( VAL("app_sz") );
      90           0 : }
      91             : 
      92             : static void
      93             : cnc_new( fd_topo_t const *     topo,
      94           0 :          fd_topo_obj_t const * obj ) {
      95           0 :   FD_TEST( fd_cnc_new( fd_topo_obj_laddr( topo, obj->id ), VAL("app_sz"), VAL("type"), fd_log_wallclock() ) );
      96           0 : }
      97             : 
      98             : fd_topo_obj_callbacks_t fd_obj_cb_cnc = {
      99             :   .name      = "cnc",
     100             :   .footprint = cnc_footprint,
     101             :   .align     = cnc_align,
     102             :   .new       = cnc_new,
     103             : };
     104             : 
     105             : static ulong
     106             : fec_sets_footprint( fd_topo_t const *     topo,
     107           0 :                     fd_topo_obj_t const * obj ) {
     108           0 :   return VAL("sz");
     109           0 : }
     110             : 
     111             : static ulong
     112             : fec_sets_align( fd_topo_t const *     topo FD_FN_UNUSED,
     113           0 :                   fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     114           0 :   return fd_dcache_align();
     115           0 : }
     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           0 :                  fd_topo_obj_t const * obj ) {
     133           0 :   return fd_store_footprint( VAL("fec_max"), VAL("fec_data_max") );
     134           0 : }
     135             : 
     136             : static ulong
     137             : store_align( fd_topo_t const *     topo FD_FN_UNUSED,
     138           0 :              fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     139           0 :   return fd_store_align();
     140           0 : }
     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("part_cnt"), VAL("fec_max"), VAL("fec_data_max") ) );
     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             : accdb_footprint( fd_topo_t const *     topo,
     157           0 :                  fd_topo_obj_t const * obj ) {
     158           0 :   return fd_accdb_shmem_footprint( VAL("max_accounts"), VAL("max_live_slots"), VAL("max_account_writes_per_slot"), VAL("partition_cnt"), VAL("cache_footprint"), VAL("cache_min_reserved"), VAL("joiner_cnt") );
     159           0 : }
     160             : 
     161             : static ulong
     162             : accdb_align( fd_topo_t const *     topo FD_FN_UNUSED,
     163           0 :              fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     164           0 :   return fd_accdb_shmem_align();
     165           0 : }
     166             : 
     167             : static void
     168             : accdb_new( fd_topo_t const *     topo,
     169           0 :            fd_topo_obj_t const * obj ) {
     170           0 :   FD_TEST( fd_accdb_shmem_new( fd_topo_obj_laddr( topo, obj->id ), VAL("max_accounts"), VAL("max_live_slots"), VAL("max_account_writes_per_slot"), VAL("partition_cnt"), VAL("partition_sz"), VAL("cache_footprint"), VAL("cache_min_reserved"), (int)VAL("bundle_enabled"), VAL("seed"), VAL("joiner_cnt") ) );
     171           0 : }
     172             : 
     173             : fd_topo_obj_callbacks_t fd_obj_cb_accdb = {
     174             :   .name      = "accdb",
     175             :   .footprint = accdb_footprint,
     176             :   .align     = accdb_align,
     177             :   .new       = accdb_new,
     178             : };
     179             : 
     180             : static ulong
     181             : txncache_footprint( fd_topo_t const *     topo,
     182           0 :                     fd_topo_obj_t const * obj ) {
     183           0 :   return fd_txncache_shmem_footprint( VAL("max_live_slots"), VAL("max_txn_per_slot") );
     184           0 : }
     185             : 
     186             : static ulong
     187             : txncache_align( fd_topo_t const *     topo FD_FN_UNUSED,
     188           0 :                 fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     189           0 :   return fd_txncache_shmem_align();
     190           0 : }
     191             : 
     192             : static void
     193             : txncache_new( fd_topo_t const *     topo,
     194           0 :               fd_topo_obj_t const * obj ) {
     195           0 :   FD_TEST( fd_txncache_shmem_new( fd_topo_obj_laddr( topo, obj->id ), VAL("max_live_slots"), VAL("max_txn_per_slot"), VAL("seed") ) );
     196           0 : }
     197             : 
     198             : fd_topo_obj_callbacks_t fd_obj_cb_txncache = {
     199             :   .name      = "txncache",
     200             :   .footprint = txncache_footprint,
     201             :   .align     = txncache_align,
     202             :   .new       = txncache_new,
     203             : };
     204             : 
     205             : static ulong
     206             : rnonce_ss_footprint( fd_topo_t const *     topo FD_FN_UNUSED,
     207           0 :                      fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     208           0 :   return sizeof(fd_rnonce_ss_t);
     209           0 : }
     210             : 
     211             : static ulong
     212             : rnonce_ss_align( fd_topo_t const *     topo FD_FN_UNUSED,
     213           0 :                 fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     214           0 :   return alignof(fd_rnonce_ss_t);
     215           0 : }
     216             : 
     217             : static void
     218             : rnonce_ss_new( fd_topo_t const *     topo,
     219           0 :                fd_topo_obj_t const * obj ) {
     220           0 :   FD_TEST( fd_rng_secure( fd_topo_obj_laddr( topo, obj->id ), sizeof(fd_rnonce_ss_t) ) );
     221           0 : }
     222             : 
     223             : fd_topo_obj_callbacks_t fd_obj_cb_rnonce_ss = {
     224             :   .name      = "rnonce_ss",
     225             :   .footprint = rnonce_ss_footprint,
     226             :   .align     = rnonce_ss_align,
     227             :   .new       = rnonce_ss_new,
     228             : };
     229             : 
     230             : #undef VAL

Generated by: LCOV version 1.14