LCOV - code coverage report
Current view: top level - app/firedancer - callbacks.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 105 0.0 %
Date: 2026-10-23 17:13:25 Functions: 0 30 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 "../../flamenco/alpenglow/fd_footer_cache.h"
       9             : #include "../../disco/shred/fd_rnonce_ss.h"
      10             : #include "../../discof/backup/fd_backup_shmem.h"
      11             : 
      12             : #include "../../discof/admin/fd_adminctl.h"
      13             : 
      14           0 : #define VAL(name) (__extension__({                                                             \
      15           0 :   ulong __x = fd_pod_queryf_ulong( topo->props, ULONG_MAX, "obj.%lu.%s", obj->id, name );      \
      16           0 :   if( FD_UNLIKELY( __x==ULONG_MAX ) ) FD_LOG_ERR(( "obj.%lu.%s was not set", obj->id, name )); \
      17           0 :   __x; }))
      18             : 
      19             : static ulong
      20             : banks_footprint( fd_topo_t const *     topo,
      21           0 :                  fd_topo_obj_t const * obj ) {
      22           0 :   return fd_banks_footprint( VAL("max_live_slots"), VAL("cache_cnt"), VAL("stake_delegation_cache_cnt"), FD_RUNTIME_MAX_VAT_VOTE_ACCOUNTS );
      23           0 : }
      24             : 
      25             : static ulong
      26             : banks_align( fd_topo_t const *     topo FD_FN_UNUSED,
      27           0 :              fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
      28           0 :   return fd_banks_align();
      29           0 : }
      30             : 
      31             : static void
      32             : banks_new( fd_topo_t const *     topo,
      33           0 :            fd_topo_obj_t const * obj ) {
      34           0 :   ulong seed = fd_pod_queryf_ulong( topo->props, 0UL, "obj.%lu.seed", obj->id );
      35           0 :   FD_TEST( fd_banks_new( fd_topo_obj_laddr( topo, obj->id ), FD_STAKE_DELEGATIONS_FD, VAL("max_live_slots"), VAL("cache_cnt"), VAL("stake_delegation_cache_cnt"), FD_RUNTIME_MAX_STAKE_DELEGATION_DISK_RECORDS, FD_RUNTIME_MAX_VAT_VOTE_ACCOUNTS, VAL("bench_max_cost_per_block"), seed ) );
      36           0 : }
      37             : 
      38             : fd_topo_obj_callbacks_t fd_obj_cb_banks = {
      39             :   .name      = "banks",
      40             :   .footprint = banks_footprint,
      41             :   .align     = banks_align,
      42             :   .new       = banks_new,
      43             : };
      44             : 
      45             : static ulong
      46             : progcache_align( fd_topo_t const *     topo,
      47           0 :                  fd_topo_obj_t const * obj ) {
      48           0 :   (void)topo; (void)obj;
      49           0 :   return fd_progcache_shmem_align();
      50           0 : }
      51             : 
      52             : static ulong
      53             : progcache_footprint( fd_topo_t const *     topo,
      54           0 :                      fd_topo_obj_t const * obj ) {
      55           0 :   return fd_progcache_shmem_footprint( VAL("txn_max"), VAL("progcache_sz") );
      56           0 : }
      57             : 
      58             : static void
      59             : progcache_new( fd_topo_t const *     topo,
      60           0 :                fd_topo_obj_t const * obj ) {
      61           0 :   ulong seed = fd_pod_queryf_ulong( topo->props, 0UL, "obj.%lu.seed", obj->id );
      62           0 :   if( !seed ) FD_TEST( fd_rng_secure( &seed, sizeof(ulong) ) );
      63           0 :   FD_TEST( fd_progcache_shmem_new( fd_topo_obj_laddr( topo, obj->id ), 2UL, seed, VAL("txn_max"), VAL("progcache_sz") ) );
      64           0 : }
      65             : 
      66             : fd_topo_obj_callbacks_t fd_obj_cb_progcache = {
      67             :   .name      = "progcache",
      68             :   .footprint = progcache_footprint,
      69             :   .align     = progcache_align,
      70             :   .new       = progcache_new,
      71             : };
      72             : 
      73             : /* adminctl: admin tile command channel */
      74             : 
      75             : static ulong
      76             : adminctl_align( fd_topo_t const *     topo,
      77           0 :                 fd_topo_obj_t const * obj ) {
      78           0 :   (void)topo; (void)obj;
      79           0 :   return fd_adminctl_align();
      80           0 : }
      81             : 
      82             : static ulong
      83             : adminctl_footprint( fd_topo_t const *     topo,
      84           0 :                     fd_topo_obj_t const * obj ) {
      85           0 :   (void)topo; (void)obj;
      86           0 :   return fd_adminctl_footprint();
      87           0 : }
      88             : 
      89             : static void
      90             : adminctl_new( fd_topo_t const *     topo,
      91           0 :               fd_topo_obj_t const * obj ) {
      92           0 :   FD_TEST( fd_adminctl_new( fd_topo_obj_laddr( topo, obj->id ) ) );
      93           0 : }
      94             : 
      95             : fd_topo_obj_callbacks_t fd_obj_cb_adminctl = {
      96             :   .name      = "adminctl",
      97             :   .footprint = adminctl_footprint,
      98             :   .align     = adminctl_align,
      99             :   .new       = adminctl_new,
     100             : };
     101             : 
     102             : static ulong
     103             : fec_sets_footprint( fd_topo_t const *     topo,
     104           0 :                     fd_topo_obj_t const * obj ) {
     105           0 :   return VAL("sz");
     106           0 : }
     107             : 
     108             : static ulong
     109             : fec_sets_align( fd_topo_t const *     topo FD_FN_UNUSED,
     110           0 :                   fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     111           0 :   return fd_dcache_align();
     112           0 : }
     113             : 
     114             : static void
     115             : fec_sets_new( FD_PARAM_UNUSED fd_topo_t const *     topo,
     116           0 :               FD_PARAM_UNUSED fd_topo_obj_t const * obj ) {
     117           0 :   FD_TEST( fd_topo_obj_laddr( topo, obj->id ) );
     118           0 : }
     119             : 
     120             : fd_topo_obj_callbacks_t fd_obj_cb_fec_sets = {
     121             :   .name      = "fec_sets",
     122             :   .footprint = fec_sets_footprint,
     123             :   .align     = fec_sets_align,
     124             :   .new       = fec_sets_new,
     125             : };
     126             : 
     127             : static ulong
     128             : store_footprint( fd_topo_t const * topo,
     129           0 :                  fd_topo_obj_t const * obj ) {
     130           0 :   return fd_store_footprint( VAL("fec_max"), VAL("fec_data_max"), VAL("shred_storage_gib"), VAL("shred_cache_bytes"), VAL("fec_set_cnt"), 1, VAL("shred_tile_cnt") );
     131           0 : }
     132             : 
     133             : static ulong
     134             : store_align( fd_topo_t const *     topo FD_FN_UNUSED,
     135           0 :              fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     136           0 :   return fd_store_align();
     137           0 : }
     138             : 
     139             : static void
     140             : store_new( fd_topo_t const *     topo,
     141           0 :            fd_topo_obj_t const * obj ) {
     142           0 :   ulong        disk_seed = fd_pod_queryf_ulong( topo->props, 0UL, "obj.%lu.seed",      obj->id );
     143           0 :   FD_TEST( fd_store_new( fd_topo_obj_laddr( topo, obj->id ),
     144           0 :                          VAL("fec_max"), VAL("fec_data_max"),
     145           0 :                          VAL("shred_storage_gib"), VAL("shred_cache_bytes"),
     146           0 :                          VAL("fec_set_cnt"), VAL("max_shreds_per_block"),
     147           0 :                          disk_seed, 1, VAL("shred_tile_cnt") ) );
     148           0 : }
     149             : 
     150             : fd_topo_obj_callbacks_t fd_obj_cb_store = {
     151             :   .name      = "store",
     152             :   .footprint = store_footprint,
     153             :   .align     = store_align,
     154             :   .new       = store_new,
     155             : };
     156             : 
     157             : static ulong
     158             : accdb_footprint( fd_topo_t const *     topo,
     159           0 :                  fd_topo_obj_t const * obj ) {
     160           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"), VAL("max_incremental_accounts") );
     161           0 : }
     162             : 
     163             : static ulong
     164             : accdb_align( fd_topo_t const *     topo FD_FN_UNUSED,
     165           0 :              fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     166           0 :   return fd_accdb_shmem_align();
     167           0 : }
     168             : 
     169             : static void
     170             : accdb_new( fd_topo_t const *     topo,
     171           0 :            fd_topo_obj_t const * obj ) {
     172           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"), VAL("max_incremental_accounts") ) );
     173           0 : }
     174             : 
     175             : fd_topo_obj_callbacks_t fd_obj_cb_accdb = {
     176             :   .name      = "accdb",
     177             :   .footprint = accdb_footprint,
     178             :   .align     = accdb_align,
     179             :   .new       = accdb_new,
     180             : };
     181             : 
     182             : static ulong
     183             : txncache_footprint( fd_topo_t const *     topo,
     184           0 :                     fd_topo_obj_t const * obj ) {
     185           0 :   return fd_txncache_shmem_footprint( VAL("max_live_slots"), VAL("max_txn_per_slot") );
     186           0 : }
     187             : 
     188             : static ulong
     189             : txncache_align( fd_topo_t const *     topo FD_FN_UNUSED,
     190           0 :                 fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     191           0 :   return fd_txncache_shmem_align();
     192           0 : }
     193             : 
     194             : static void
     195             : txncache_new( fd_topo_t const *     topo,
     196           0 :               fd_topo_obj_t const * obj ) {
     197           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") ) );
     198           0 : }
     199             : 
     200             : fd_topo_obj_callbacks_t fd_obj_cb_txncache = {
     201             :   .name      = "txncache",
     202             :   .footprint = txncache_footprint,
     203             :   .align     = txncache_align,
     204             :   .new       = txncache_new,
     205             : };
     206             : 
     207             : static ulong
     208             : footer_cache_footprint( fd_topo_t const *     topo FD_FN_UNUSED,
     209           0 :                         fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     210           0 :   return fd_footer_cache_footprint();
     211           0 : }
     212             : 
     213             : static ulong
     214             : footer_cache_align( fd_topo_t const *     topo FD_FN_UNUSED,
     215           0 :                     fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     216           0 :   return fd_footer_cache_align();
     217           0 : }
     218             : 
     219             : static void
     220             : footer_cache_new( fd_topo_t const *     topo,
     221           0 :                   fd_topo_obj_t const * obj ) {
     222           0 :   FD_TEST( fd_footer_cache_new( fd_topo_obj_laddr( topo, obj->id ) ) );
     223           0 : }
     224             : 
     225             : fd_topo_obj_callbacks_t fd_obj_cb_footer_cache = {
     226             :   .name      = "footer_cache",
     227             :   .footprint = footer_cache_footprint,
     228             :   .align     = footer_cache_align,
     229             :   .new       = footer_cache_new,
     230             : };
     231             : 
     232             : static ulong
     233             : rnonce_ss_footprint( fd_topo_t const *     topo FD_FN_UNUSED,
     234           0 :                      fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     235           0 :   return sizeof(fd_rnonce_ss_t);
     236           0 : }
     237             : 
     238             : static ulong
     239             : rnonce_ss_align( fd_topo_t const *     topo FD_FN_UNUSED,
     240           0 :                 fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     241           0 :   return alignof(fd_rnonce_ss_t);
     242           0 : }
     243             : 
     244             : static void
     245             : rnonce_ss_new( fd_topo_t const *     topo,
     246           0 :                fd_topo_obj_t const * obj ) {
     247           0 :   FD_TEST( fd_rng_secure( fd_topo_obj_laddr( topo, obj->id ), sizeof(fd_rnonce_ss_t) ) );
     248           0 : }
     249             : 
     250             : fd_topo_obj_callbacks_t fd_obj_cb_rnonce_ss = {
     251             :   .name      = "rnonce_ss",
     252             :   .footprint = rnonce_ss_footprint,
     253             :   .align     = rnonce_ss_align,
     254             :   .new       = rnonce_ss_new,
     255             : };
     256             : 
     257             : static ulong
     258             : backup_footprint_cb( fd_topo_t const *     topo,
     259           0 :                          fd_topo_obj_t const * obj ) {
     260           0 :   return fd_backup_footprint( VAL("max_accounts") );
     261           0 : }
     262             : 
     263             : static ulong
     264             : backup_align_cb( fd_topo_t const *     topo FD_FN_UNUSED,
     265           0 :                      fd_topo_obj_t const * obj  FD_FN_UNUSED ) {
     266           0 :   return fd_backup_align();
     267           0 : }
     268             : 
     269             : static void
     270             : backup_new_cb( fd_topo_t const *     topo,
     271           0 :                    fd_topo_obj_t const * obj ) {
     272           0 :   FD_TEST( fd_backup_new( fd_topo_obj_laddr( topo, obj->id ), VAL("max_accounts") ) );
     273           0 : }
     274             : 
     275             : fd_topo_obj_callbacks_t fd_obj_cb_backup = {
     276             :   .name      = "backup",
     277             :   .footprint = backup_footprint_cb,
     278             :   .align     = backup_align_cb,
     279             :   .new       = backup_new_cb,
     280             : };
     281             : 
     282             : #undef VAL

Generated by: LCOV version 1.14