LCOV - code coverage report
Current view: top level - app/firedancer - topology.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 1592 0.0 %
Date: 2026-11-26 02:16:43 Functions: 0 18 0.0 %

          Line data    Source code
       1             : #include "topology.h"
       2             : #include "../../disco/keyguard/fd_keyload.h"
       3             : #include "../shared/fd_config_json.h"
       4             : 
       5             : #include "../../discof/poh/fd_poh.h"
       6             : #include "../../discof/replay/fd_execrp.h"
       7             : #include "../../discof/genesis/fd_genesi_tile.h"
       8             : #include "../../discof/gossip/fd_gossip_tile.h"
       9             : #include "../../discof/resolv/fd_resolv_tile.h"
      10             : #include "../../discof/replay/fd_replay_tile.h"
      11             : #include "../../discof/replay/fd_sched.h"
      12             : #include "../../discof/votor/fd_votor_tile.h"
      13             : #include "../../disco/keyguard/fd_keyguard.h"
      14             : #include "../../ballet/bls/fd_bls.h"
      15             : #include "../../discof/failover/fd_failover_bus.h"
      16             : #include "../../discof/failover/fd_failover_proto.h"
      17             : #include "../../discof/backup/fd_snapmk_tile.h"
      18             : #include "../../discof/backup/fd_snapsv_tile.h"
      19             : #include "../../disco/shred/fd_shred_tile.h"
      20             : #include "../../disco/store/fd_store.h"
      21             : #include "../../disco/repair/fd_repair_tile.h"
      22             : #include "../../disco/repair/fd_repair.h"
      23             : #include "../../disco/repair/fd_repair_serde.h"
      24             : #include "../../disco/net/fd_net_tile.h"
      25             : #include "../../discof/backup/fd_backup.h"
      26             : #include "../../discof/restore/fd_snapct_tile.h"
      27             : #include "../../disco/gui/fd_gui_config_parse.h"
      28             : #include "../../disco/quic/fd_tpu.h"
      29             : #include "../../disco/tiles.h"
      30             : #include "../../disco/topo/fd_topob.h"
      31             : #include "../../disco/topo/fd_cpu_topo.h"
      32             : #include "../../disco/bundle/fd_bundle_tile.h"
      33             : #include "../../disco/verify/fd_verify_tile.h"
      34             : #include "../../tango/dcache/fd_dcache.h"
      35             : #include "../../disco/diag/fd_diag_tile.h"
      36             : #include "../../util/pod/fd_pod_format.h"
      37             : #include "../../discof/restore/utils/fd_ssctrl.h"
      38             : #include "../../discof/restore/utils/fd_ssmsg.h"
      39             : #include "../../flamenco/accdb/fd_accdb_cache.h"
      40             : #include "../../flamenco/accdb/fd_accdb_shmem.h"
      41             : #include "../../flamenco/capture/fd_solcap_writer.h"
      42             : #include "../../flamenco/events/fd_event_runtime.h"
      43             : #include "../../flamenco/progcache/fd_progcache.h"
      44             : #include "../../flamenco/runtime/fd_bpf_frames.h"
      45             : #include "../../flamenco/runtime/fd_cost_tracker.h"
      46             : 
      47             : #include <sys/random.h>
      48             : #include <sys/types.h>
      49             : #include <sys/socket.h>
      50             : #include <netdb.h>
      51             : 
      52             : extern fd_topo_obj_callbacks_t * CALLBACKS[];
      53             : extern fd_topo_run_tile_t *      TILES[];
      54             : 
      55             : static ulong
      56           0 : tile_max_event_sz( fd_topo_tile_t const * tile ) {
      57           0 :   for( fd_topo_run_tile_t ** t=TILES; *t; t++ ) {
      58           0 :     if( FD_UNLIKELY( !strcmp( (*t)->name, tile->name ) ) ) {
      59           0 :       return (*t)->max_event_sz ? (*t)->max_event_sz( tile ) : 0UL;
      60           0 :     }
      61           0 :   }
      62           0 :   return 0UL;
      63           0 : }
      64             : 
      65             : void
      66           0 : wire_event_links( fd_topo_t * topo ) {
      67           0 :   fd_topob_wksp( topo, "event_in" );
      68             : 
      69           0 :   ulong tile_cnt = topo->tile_cnt;
      70           0 :   for( ulong i=0UL; i<tile_cnt; i++ ) {
      71           0 :     fd_topo_tile_t * tile = &topo->tiles[ i ];
      72           0 :     if( FD_UNLIKELY( !strcmp( tile->name, "event" ) ) ) continue;
      73             : 
      74           0 :     ulong max_sz = tile_max_event_sz( tile );
      75           0 :     if( FD_LIKELY( !max_sz ) ) continue;
      76             : 
      77           0 :     char link_name[ sizeof(((fd_topo_link_t *)0)->name) ];
      78           0 :     FD_TEST( fd_cstr_printf_check( link_name, sizeof(link_name), NULL, "%s_event", tile->name ) );
      79             : 
      80             :     /* The dcache must cover depth*MTU (a smaller region risks undetected
      81             :        torn reads), so big-MTU links trade depth away to fit the budget. */
      82           0 :     ulong const event_link_dcache_max = 64UL<<20; /* 64 MiB data region per event link */
      83           0 :     ulong depth = 1024UL;
      84           0 :     while( depth>1UL && fd_dcache_req_data_sz( max_sz, depth, 1UL, 1 )>event_link_dcache_max ) depth >>= 1;
      85             : 
      86           0 :     fd_topo_link_t * link = fd_topob_link( topo, link_name, "event_in", depth, max_sz, 1UL );
      87           0 :     link->permit_no_producers = 1; /* written outside fd_stem; topo sees no producer */
      88             : 
      89           0 :     tile->event_link_id = link->id;
      90             : 
      91           0 :     fd_topob_tile_uses( topo, tile, &topo->objs[ link->mcache_obj_id ], FD_SHMEM_JOIN_MODE_READ_WRITE );
      92           0 :     fd_topob_tile_uses( topo, tile, &topo->objs[ link->dcache_obj_id ], FD_SHMEM_JOIN_MODE_READ_WRITE );
      93             : 
      94           0 :     fd_topob_tile_in( topo, "event", 0UL, "metric_in", link_name, link->kind_id, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
      95           0 :   }
      96           0 : }
      97             : 
      98             : void
      99           0 : wire_replay_diff_link( fd_topo_t * topo ) {
     100           0 :   ulong replay_tile_id = fd_topo_find_tile( topo, "replay", 0UL );
     101           0 :   if( FD_UNLIKELY( replay_tile_id==ULONG_MAX || !topo->tiles[ replay_tile_id ].replay.report_runtime_diffs ) ) return;
     102           0 :   fd_topo_tile_t * replay = &topo->tiles[ replay_tile_id ];
     103             : 
     104           0 :   fd_topo_link_t * link = fd_topob_link( topo, "replay_diff", "event_in", 65536UL, FD_EVENT_RUNTIME_DIFF_MTU, 1UL );
     105           0 :   link->permit_no_producers = 1;
     106             : 
     107           0 :   fd_topob_tile_uses( topo, replay, &topo->objs[ link->mcache_obj_id ], FD_SHMEM_JOIN_MODE_READ_WRITE );
     108           0 :   fd_topob_tile_uses( topo, replay, &topo->objs[ link->dcache_obj_id ], FD_SHMEM_JOIN_MODE_READ_WRITE );
     109             : 
     110           0 :   fd_topob_tile_in( topo, "event", 0UL, "metric_in", "replay_diff", link->kind_id, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
     111           0 : }
     112             : 
     113             : fd_topo_obj_t *
     114             : setup_topo_banks( fd_topo_t *  topo,
     115             :                   char const * wksp_name,
     116             :                   ulong        max_live_slots,
     117             :                   ulong        cache_cnt,
     118             :                   ulong        stake_delegation_cache_cnt,
     119           0 :                   ulong        bench_max_cost_per_block ) {
     120           0 :   fd_topo_obj_t * obj = fd_topob_obj( topo, "banks", wksp_name );
     121           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, max_live_slots,             "obj.%lu.max_live_slots",             obj->id ) );
     122           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, cache_cnt,                  "obj.%lu.cache_cnt",                  obj->id ) );
     123           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, stake_delegation_cache_cnt, "obj.%lu.stake_delegation_cache_cnt", obj->id ) );
     124           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, bench_max_cost_per_block,   "obj.%lu.bench_max_cost_per_block",   obj->id ) );
     125           0 :   ulong seed;
     126           0 :   FD_TEST( fd_rng_secure( &seed, sizeof( ulong ) ) );
     127           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, seed, "obj.%lu.seed", obj->id ) );
     128           0 :   return obj;
     129           0 : }
     130             : 
     131             : fd_topo_obj_t *
     132             : setup_topo_footer_cache( fd_topo_t *  topo,
     133           0 :                          char const * wksp_name ) {
     134           0 :   fd_topo_obj_t * obj = fd_topob_obj( topo, "footer_cache", wksp_name );
     135           0 :   fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
     136           0 :   ulong execrp_tile_cnt = fd_topo_tile_name_cnt( topo, "execrp" );
     137           0 :   for( ulong i=0UL; i<execrp_tile_cnt; i++ ) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i ) ], obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
     138           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, obj->id, "footer_cache" ) );
     139           0 :   return obj;
     140           0 : }
     141             : 
     142             : fd_topo_obj_t *
     143             : setup_topo_execrp_result( fd_topo_t *  topo,
     144             :                           char const * wksp_name,
     145           0 :                           ulong        execrp_tile_cnt ) {
     146           0 :   fd_topo_obj_t * obj = fd_topob_obj( topo, "execrp_result", wksp_name );
     147           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, execrp_tile_cnt, "obj.%lu.execrp_tile_cnt", obj->id ) );
     148           0 :   fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
     149           0 :   for( ulong i=0UL; i<execrp_tile_cnt; i++ ) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i ) ], obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
     150           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, obj->id, "execrp_result" ) );
     151           0 :   return obj;
     152           0 : }
     153             : 
     154             : fd_topo_obj_t *
     155             : setup_topo_fec_sets( fd_topo_t *  topo,
     156             :                      char const * wksp_name,
     157           0 :                      ulong        sz ) {
     158           0 :   fd_topo_obj_t * obj = fd_topob_obj( topo, "fec_sets", wksp_name );
     159           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, sz, "obj.%lu.sz",   obj->id ) );
     160           0 :   return obj;
     161           0 : }
     162             : 
     163             : /* Workspace bytes reserved for the topology's own layout around the cache. */
     164           0 : #define PROGCACHE_WKSP_OVERHEAD_SZ ( 3UL * fd_topo_workspace_align() )
     165             : 
     166             : ulong
     167           0 : setup_topo_progcache_min_sz( ulong txn_max ) {
     168           0 :   ulong min_sz = fd_progcache_shmem_min_sz( txn_max );
     169           0 :   if( FD_UNLIKELY( !min_sz ) ) return 0UL;
     170             :   /* Smallest huge-page multiple holding the cache minimum plus the overhead,
     171             :      so a workspace of exactly this size is what gets locked. */
     172           0 :   return fd_ulong_align_up( min_sz + PROGCACHE_WKSP_OVERHEAD_SZ, FD_SHMEM_HUGE_PAGE_SZ );
     173           0 : }
     174             : 
     175             : void
     176             : setup_topo_progcache( fd_topo_t *  topo,
     177             :                       char const * wksp_name,
     178             :                       ulong        txn_max,
     179           0 :                       ulong        wksp_size ) {
     180           0 :   fd_topo_obj_t * obj = fd_topob_obj( topo, "progcache", wksp_name );
     181           0 :   FD_TEST( fd_pod_insert_ulong(  topo->props, "progcache", obj->id ) );
     182             : 
     183           0 :   ulong min_wksp_sz = setup_topo_progcache_min_sz( txn_max );
     184           0 :   if( FD_UNLIKELY( !min_wksp_sz ) ) {
     185           0 :     FD_LOG_ERR(( "Invalid [runtime]: max_live_slots is invalid" ));
     186           0 :   }
     187           0 :   if( FD_UNLIKELY( wksp_size<min_wksp_sz ) ) {
     188           0 :     FD_LOG_ERR(( "Invalid [runtime]: program_cache_size_mib must be at least %lu", min_wksp_sz>>20 ));
     189           0 :   }
     190             : 
     191             :   /* The workspace is exactly program_cache_size_mib: the cache gets what is
     192             :      left after the overhead.  For the default 2048 that is 2 gigantic pages. */
     193           0 :   ulong progcache_sz        = wksp_size - PROGCACHE_WKSP_OVERHEAD_SZ;
     194           0 :   ulong progcache_footprint = fd_progcache_shmem_footprint( txn_max, progcache_sz );
     195           0 :   if( FD_UNLIKELY( !progcache_footprint ) ) {
     196           0 :     FD_LOG_ERR(( "Invalid [runtime]: program_cache_size_mib must be at least %lu", min_wksp_sz>>20 ));
     197           0 :   }
     198             : 
     199           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, txn_max, "obj.%lu.txn_max", obj->id ) );
     200           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, progcache_sz, "obj.%lu.progcache_sz", obj->id ) );
     201           0 : }
     202             : 
     203             : fd_topo_obj_t *
     204             : setup_topo_bpf_frames( fd_topo_t *  topo,
     205             :                        char const * wksp_name,
     206             :                        ulong        frame_cnt,
     207             :                        ulong        local_cnt,
     208           0 :                        ulong        join_cnt ) {
     209           0 :   if( FD_UNLIKELY( local_cnt>FD_MAX_INSTRUCTION_STACK_DEPTH ) ) {
     210           0 :     FD_LOG_ERR(( "Invalid [runtime]: bpf_local_frames must be at most %lu", FD_MAX_INSTRUCTION_STACK_DEPTH ));
     211           0 :   }
     212           0 :   ulong frame_max = FD_BPF_FRAMES_CNT_MAX-join_cnt*local_cnt;
     213           0 :   if( FD_UNLIKELY( frame_cnt<FD_BPF_FRAMES_HELD_CNT( local_cnt ) || frame_cnt>frame_max ) ) {
     214           0 :     FD_LOG_ERR(( "Invalid [runtime]: bpf_shared_frames must be in [%lu,%lu]", FD_BPF_FRAMES_HELD_CNT( local_cnt ), frame_max ));
     215           0 :   }
     216           0 :   fd_topo_obj_t * obj = fd_topob_obj( topo, "bpf_frames", wksp_name );
     217           0 :   FD_TEST( fd_pod_insert_ulong(  topo->props, "bpf_frames", obj->id ) );
     218           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, frame_cnt, "obj.%lu.frame_cnt",      obj->id ) );
     219           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, join_cnt,  "obj.%lu.joiner_cnt_max", obj->id ) );
     220           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, local_cnt, "obj.%lu.local_cnt",      obj->id ) );
     221           0 :   return obj;
     222           0 : }
     223             : 
     224             : fd_topo_obj_t *
     225             : setup_topo_store( fd_topo_t *  topo,
     226             :                   char const * wksp_name,
     227             :                   ulong        fec_max,
     228             :                   ulong        fec_data_max,
     229             :                   ulong        shred_storage_gib,
     230             :                   ulong        shred_cache_mib,
     231             :                   ulong        fec_set_cnt,
     232             :                   ulong        max_shreds_per_block,
     233             :                   char const * db_path,
     234           0 :                   ulong        shred_tile_cnt ) {
     235           0 :   if( FD_UNLIKELY( !shred_cache_mib ) )
     236           0 :     FD_LOG_ERR(( "tiles.shred.shred_cache_size_mib must be non-zero; the FEC payload cache cannot be disabled" ));
     237           0 :   if( FD_UNLIKELY( shred_cache_mib>(ULONG_MAX>>20) ) )
     238           0 :     FD_LOG_ERR(( "tiles.shred.shred_cache_size_mib is too large: %lu", shred_cache_mib ));
     239           0 :   if( FD_UNLIKELY( shred_storage_gib>FD_SHREDB_MAX_SIZE_GIB ) )
     240           0 :     FD_LOG_ERR(( "tiles.rserve.shred_storage_limit_gib is %lu, but the maximum supported size is %lu GiB",
     241           0 :                  shred_storage_gib, FD_SHREDB_MAX_SIZE_GIB ));
     242             : 
     243           0 :   ulong seed;
     244           0 :   FD_TEST( fd_rng_secure( &seed, sizeof( ulong ) ) );
     245             : 
     246           0 :   fd_topo_obj_t * obj = fd_topob_obj( topo, "store", wksp_name );
     247           0 :   ulong shred_cache_bytes = shred_cache_mib << 20;
     248           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, fec_max,           "obj.%lu.fec_max",           obj->id ) );
     249           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, fec_data_max,      "obj.%lu.fec_data_max",      obj->id ) );
     250           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, shred_storage_gib, "obj.%lu.shred_storage_gib", obj->id ) );
     251           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, shred_cache_bytes, "obj.%lu.shred_cache_bytes", obj->id ) );
     252           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, fec_set_cnt,       "obj.%lu.fec_set_cnt",       obj->id ) );
     253           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, max_shreds_per_block, "obj.%lu.max_shreds_per_block", obj->id ) );
     254           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, seed,              "obj.%lu.seed",              obj->id ) );
     255           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, shred_tile_cnt,    "obj.%lu.shred_tile_cnt",    obj->id ) );
     256           0 :   if( db_path ) {
     257           0 :     FD_TEST( fd_pod_insertf_cstr( topo->props, db_path,          "obj.%lu.disk_path",         obj->id ) );
     258           0 :   }
     259           0 :   return obj;
     260           0 : }
     261             : 
     262             : fd_topo_obj_t *
     263             : setup_topo_txncache( fd_topo_t *  topo,
     264             :                      char const * wksp_name,
     265             :                      ulong        max_live_slots,
     266             :                      ulong        max_txn_per_slot,
     267           0 :                      ulong        cache_footprint ) {
     268           0 :   ulong seed;
     269           0 :   FD_TEST( fd_rng_secure( &seed, sizeof( ulong ) ) );
     270             : 
     271           0 :   fd_topo_obj_t * obj = fd_topob_obj( topo, "txncache", wksp_name );
     272           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, max_live_slots,   "obj.%lu.max_live_slots",   obj->id ) );
     273           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, max_txn_per_slot, "obj.%lu.max_txn_per_slot", obj->id ) );
     274           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, cache_footprint,  "obj.%lu.cache_footprint",  obj->id ) );
     275           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, seed,             "obj.%lu.seed",             obj->id ) );
     276             : 
     277           0 :   return obj;
     278           0 : }
     279             : 
     280             : fd_topo_obj_t *
     281             : setup_topo_accdb( fd_topo_t *  topo,
     282             :                   char const * wksp_name,
     283             :                   ulong        max_accounts,
     284             :                   ulong        max_live_slots,
     285             :                   ulong        max_account_writes_per_slot,
     286             :                   ulong        partition_cnt,
     287             :                   ulong        partition_sz,
     288             :                   ulong        cache_footprint,
     289             :                   int          bundle_enabled,
     290             :                   ulong        joiner_cnt,
     291           0 :                   ulong        max_incremental_accounts ) {
     292           0 :   fd_topo_obj_t * obj = fd_topob_obj( topo, "accdb", wksp_name );
     293             : 
     294           0 :   ulong seed;
     295           0 :   FD_TEST( fd_rng_secure( &seed, sizeof( ulong ) ) );
     296             : 
     297           0 :   ulong cache_min_reserved = fd_accdb_cache_min_reserved( bundle_enabled );
     298             : 
     299             :   /* partition_cnt is a cap: the file cannot outgrow FD_ACCDB_FILE_SZ_MAX */
     300           0 :   FD_CHECK_ERR( partition_sz, "invalid [development.accdb.partition_size_gib]: must be non-zero" );
     301           0 :   partition_cnt = fd_ulong_min( partition_cnt, FD_ACCDB_FILE_SZ_MAX/partition_sz );
     302             : 
     303           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, max_accounts,       "obj.%lu.max_accounts",       obj->id ) );
     304           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, max_live_slots,     "obj.%lu.max_live_slots",     obj->id ) );
     305           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, max_account_writes_per_slot, "obj.%lu.max_account_writes_per_slot", obj->id ) );
     306           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, partition_cnt,      "obj.%lu.partition_cnt",      obj->id ) );
     307           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, partition_sz,       "obj.%lu.partition_sz",       obj->id ) );
     308           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, cache_footprint,    "obj.%lu.cache_footprint",    obj->id ) );
     309           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, cache_min_reserved, "obj.%lu.cache_min_reserved", obj->id ) );
     310           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, (ulong)!!bundle_enabled, "obj.%lu.bundle_enabled", obj->id ) );
     311           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, joiner_cnt,         "obj.%lu.joiner_cnt",         obj->id ) );
     312           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, max_incremental_accounts, "obj.%lu.max_incremental_accounts", obj->id ) );
     313           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, seed,               "obj.%lu.seed",               obj->id ) );
     314             : 
     315           0 :   return obj;
     316           0 : }
     317             : 
     318             : void
     319           0 : fd_topo_initialize( config_t * config ) {
     320           0 :   ulong net_tile_cnt    = config->layout.net_tile_count;
     321           0 :   ulong shred_tile_cnt  = config->layout.shred_tile_count;
     322           0 :   ulong quic_tile_cnt   = config->layout.quic_tile_count;
     323           0 :   ulong verify_tile_cnt = config->layout.verify_tile_count;
     324           0 :   ulong resolv_tile_cnt = config->firedancer.layout.resolv_tile_count;
     325           0 :   ulong execle_tile_cnt = config->firedancer.layout.execle_tile_count;
     326           0 :   ulong snapzp_tile_cnt = config->firedancer.layout.enable_snapshot_production
     327           0 :                           ? config->firedancer.layout.snapzp_tile_count : 0UL;
     328           0 :   ulong snapsv_tile_cnt = ( config->firedancer.snapshots.server.enabled &&
     329           0 :                             config->firedancer.layout.enable_snapshot_production )
     330           0 :                           ? config->firedancer.layout.snapsv_tile_count : 0UL;
     331           0 :   ulong snapdc_tile_cnt = config->firedancer.layout.snapdc_tile_count;
     332           0 :   ulong snapin_tile_cnt = config->firedancer.layout.snapin_tile_count;
     333             : 
     334           0 :   ulong gossvf_tile_cnt = config->firedancer.layout.gossvf_tile_count;
     335           0 :   ulong execrp_tile_cnt = config->firedancer.layout.execrp_tile_count;
     336           0 :   ulong sign_tile_cnt   = config->firedancer.layout.sign_tile_count;
     337             : 
     338           0 :   ulong genesis_max_message_size = config->firedancer.development.genesis.max_file_size_mib << 20;
     339             : 
     340           0 :   int snapshots_enabled   = !!config->gossip.entrypoints_cnt;
     341           0 :   int snapmk_enabled      = !!snapzp_tile_cnt;
     342           0 :   int rpc_enabled         = config->tiles.rpc.enabled;
     343           0 :   int telemetry_enabled   = config->telemetry && strcmp( config->tiles.event.url, "" );
     344           0 :   int leader_enabled      = !!config->firedancer.layout.enable_block_production;
     345           0 :   int rserve_enabled      = config->tiles.rserve.enabled;
     346           0 :   int efficient_mode      = !strcmp( config->firedancer.layout.mode, "efficient" );
     347           0 :   int failover_enabled    = 1;
     348             : 
     349           0 :   if( FD_UNLIKELY( snapmk_enabled ) ) {
     350           0 :     FD_CHECK_ERR( config->firedancer.snapshots.max_full_snapshots_to_keep,
     351           0 :                   "[snapshots.max_full_snapshots_to_keep] must be nonzero when [layout.snapzp_tile_count] is nonzero" );
     352           0 :     FD_CHECK_ERR( !config->firedancer.snapshots.incremental_snapshot_interval_blocks ||
     353           0 :                   config->firedancer.snapshots.max_incremental_snapshots_to_keep,
     354           0 :                   "[snapshots.max_incremental_snapshots_to_keep] must be nonzero when incremental snapshot production is enabled" );
     355           0 :   }
     356             : 
     357           0 :   fd_topo_t * topo = fd_topob_new( &config->topo, config->name );
     358             : 
     359           0 :   topo->max_page_size = fd_cstr_to_shmem_page_sz( config->hugetlbfs.max_page_size );
     360           0 :   topo->gigantic_page_threshold = config->hugetlbfs.gigantic_page_threshold_mib << 20;
     361             : 
     362           0 :   int solcap_enabled = strlen( config->capture.solcap_capture ) > 0;
     363             : 
     364             :   /*             topo, name */
     365           0 :   fd_topob_wksp( topo, "metric" );
     366           0 :   fd_topob_wksp( topo, "diag"   );
     367           0 :   fd_topob_wksp( topo, "genesi" );
     368           0 :   fd_topob_wksp( topo, "ipecho" );
     369           0 :   fd_topob_wksp( topo, "gossvf" );
     370           0 :   fd_topob_wksp( topo, "gossip" );
     371           0 :   fd_topob_wksp( topo, "shred"  );
     372           0 :   fd_topob_wksp( topo, "repair" );
     373           0 :   if( rserve_enabled ) fd_topob_wksp( topo, "rserve" );
     374           0 :   fd_topob_wksp( topo, "replay" );
     375           0 :   fd_topob_wksp( topo, "accdb"  );
     376           0 :   fd_topob_wksp( topo, "execrp" );
     377           0 :   fd_topob_wksp( topo, "votor" );
     378           0 :   fd_topob_wksp( topo, "sign"   )->core_dump_level = FD_TOPO_CORE_DUMP_LEVEL_NEVER;
     379           0 :   fd_topob_wksp( topo, "admin"  )->core_dump_level = FD_TOPO_CORE_DUMP_LEVEL_NEVER;
     380             :   /* The failov tile keeps TLS session keys in its scratch, so its
     381             :      workspace stays out of core dumps like admin and sign. */
     382           0 :   if( FD_LIKELY( failover_enabled ) ) fd_topob_wksp( topo, "failov" )->core_dump_level = FD_TOPO_CORE_DUMP_LEVEL_NEVER;
     383             : 
     384           0 :   if( leader_enabled ) {
     385           0 :     fd_topob_wksp( topo, "quic"   );
     386           0 :     fd_topob_wksp( topo, "verify" );
     387           0 :     fd_topob_wksp( topo, "dedup"  );
     388           0 :     fd_topob_wksp( topo, "resolv" );
     389           0 :     fd_topob_wksp( topo, "pack"   );
     390           0 :     fd_topob_wksp( topo, "execle" );
     391           0 :     fd_topob_wksp( topo, "motor"  );
     392           0 :   } else {
     393           0 :     execle_tile_cnt = 0UL;
     394           0 :     resolv_tile_cnt = 0UL;
     395           0 :     quic_tile_cnt   = 0UL;
     396           0 :     verify_tile_cnt = 0UL;
     397           0 :     config->tiles.bundle.enabled = 0;
     398           0 :   }
     399           0 :   fd_topob_wksp( topo, "metric_in"    );
     400           0 :   if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "diag_gui" );
     401           0 :   if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "gossip_gui" );
     402             : 
     403           0 :   fd_topob_wksp( topo, "net_gossip"   );
     404           0 :   fd_topob_wksp( topo, "net_shred"    );
     405           0 :   fd_topob_wksp( topo, "net_repair"   );
     406           0 :   if( rserve_enabled ) fd_topob_wksp( topo, "net_rserve" );
     407           0 :   fd_topob_wksp( topo, "net_votor" );
     408           0 :   if( leader_enabled ) fd_topob_wksp( topo, "net_quic" );
     409             : 
     410           0 :   fd_topob_wksp( topo, "genesi_out"    );
     411           0 :   fd_topob_wksp( topo, "ipecho_out"    );
     412           0 :   fd_topob_wksp( topo, "gossvf_gossip" );
     413           0 :   fd_topob_wksp( topo, "gossip_gossvf" );
     414           0 :   fd_topob_wksp( topo, "gossip_ciaddr" );
     415           0 :   if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "gossip_ciseen" );
     416           0 :   fd_topob_wksp( topo, "gossip_misc"   );
     417             : 
     418           0 :   fd_topob_wksp( topo, "shred_out"     );
     419           0 :   fd_topob_wksp( topo, "shred_repair"  );
     420           0 :   fd_topob_wksp( topo, "repair_out" );
     421           0 :   fd_topob_wksp( topo, "replay_epoch"  );
     422           0 :   fd_topob_wksp( topo, "replay_execrp" );
     423           0 :   fd_topob_wksp( topo, "replay_out"    );
     424           0 :   fd_topob_wksp( topo, "replay_slot"   );
     425           0 :   fd_topob_wksp( topo, "votor_out" );
     426             : 
     427           0 :   if( leader_enabled ) {
     428           0 :     fd_topob_wksp( topo, "quic_verify"   );
     429           0 :     fd_topob_wksp( topo, "verify_dedup"  );
     430           0 :     fd_topob_wksp( topo, "dedup_resolv"  );
     431           0 :     fd_topob_wksp( topo, "resolv_pack"   );
     432           0 :     fd_topob_wksp( topo, "pack_poh"      );
     433           0 :     fd_topob_wksp( topo, "pack_execle"   );
     434           0 :     fd_topob_wksp( topo, "resolv_replay" );
     435           0 :     if( FD_LIKELY( config->tiles.pack.use_consumed_cus ) ) {
     436           0 :       fd_topob_wksp( topo, "execle_pack" );
     437           0 :     }
     438           0 :     fd_topob_wksp( topo, "execle_poh"    );
     439           0 :     fd_topob_wksp( topo, "execle_busy"   );
     440           0 :     fd_topob_wksp( topo, "poh_shred"     );
     441           0 :     fd_topob_wksp( topo, "poh_replay"    );
     442           0 :   }
     443             : 
     444           0 :   fd_topob_wksp( topo, "adminctl"      )->core_dump_level = FD_TOPO_CORE_DUMP_LEVEL_NEVER;
     445             : 
     446           0 :   fd_topob_wksp( topo, "progcache"     );
     447           0 :   fd_topob_wksp( topo, "txncache"      );
     448           0 :   fd_topob_wksp( topo, "accdb_data"    )->core_dump_level = FD_TOPO_CORE_DUMP_LEVEL_FULL;
     449           0 :   fd_topob_wksp( topo, "banks"         );
     450           0 :   fd_topob_wksp( topo, "store"         )->core_dump_level = FD_TOPO_CORE_DUMP_LEVEL_FULL;
     451           0 :   fd_topob_wksp( topo, "rnonce"        );
     452             : 
     453           0 :   fd_topob_wksp( topo, "gossip_sign"   );
     454           0 :   fd_topob_wksp( topo, "sign_gossip"   );
     455             : 
     456           0 :   fd_topob_wksp( topo, "shred_sign"    );
     457           0 :   fd_topob_wksp( topo, "sign_shred"    );
     458             : 
     459           0 :   fd_topob_wksp( topo, "repair_sign"   );
     460           0 :   fd_topob_wksp( topo, "sign_repair"   );
     461             : 
     462           0 :   if( rserve_enabled ) {
     463           0 :     fd_topob_wksp( topo, "rserve_sign"   );
     464           0 :     fd_topob_wksp( topo, "sign_rserve"   );
     465           0 :     fd_topob_wksp( topo, "repair_rserve" );
     466           0 :   }
     467             : 
     468           0 :   fd_topob_wksp( topo, "votor_sign"  );
     469           0 :   fd_topob_wksp( topo, "sign_votor"  );
     470             : 
     471           0 :   if( FD_LIKELY( failover_enabled ) ) {
     472           0 :     fd_topob_wksp( topo, "failov_sign" );
     473           0 :     fd_topob_wksp( topo, "sign_failov" );
     474           0 :   }
     475             : 
     476           0 :   fd_topob_wksp( topo, "execrp_replay" );
     477           0 :   fd_topob_wksp( topo, "admin_replay"  );
     478           0 :   if( FD_LIKELY( failover_enabled ) ) {
     479           0 :     fd_topob_wksp( topo, "admin_failov" );
     480           0 :     fd_topob_wksp( topo, "failov_admin" );
     481           0 :     fd_topob_wksp( topo, "failov_votor" );
     482           0 :     fd_topob_wksp( topo, "votor_hist"   );
     483           0 :     if( !config->tiles.gui.enabled ) fd_topob_wksp( topo, "gossip_ciseen" );
     484           0 :   }
     485             : 
     486           0 :   if( FD_LIKELY( snapshots_enabled ) ) {
     487           0 :     fd_topob_wksp( topo, "snapct"      );
     488           0 :     fd_topob_wksp( topo, "snapld"      );
     489           0 :     fd_topob_wksp( topo, "snapdc"      );
     490           0 :     fd_topob_wksp( topo, "snapin"      );
     491           0 :     fd_topob_wksp( topo, "snapct_ld"   );
     492           0 :     fd_topob_wksp( topo, "snapld_dc"   );
     493           0 :     fd_topob_wksp( topo, "snapdc_in"   );
     494           0 :     fd_topob_wksp( topo, "snapin_ct"   );
     495           0 :     fd_topob_wksp( topo, "snapin_shmem" );
     496             : 
     497           0 :     if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "snapct_gui"  );
     498           0 :     if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "snapin_gui"  );
     499           0 :     fd_topob_wksp( topo, "snapin_manif" );
     500           0 :     fd_topob_wksp( topo, "snapct_repr"  );
     501           0 :   }
     502           0 :   if( snapmk_enabled ) {
     503           0 :     fd_topob_wksp( topo, "snapmk"        );
     504           0 :     fd_topob_wksp( topo, "snapzp"        );
     505           0 :     fd_topob_wksp( topo, "snapmk_zp"     );
     506           0 :     fd_topob_wksp( topo, "replay_snapmk" );
     507           0 :     fd_topob_wksp( topo, "snapmk_out"    );
     508           0 :     fd_topob_wksp( topo, "snaprd"        );
     509           0 :     fd_topob_wksp( topo, "snaprd_out"    );
     510           0 :     if( snapsv_tile_cnt ) {
     511           0 :       fd_topob_wksp( topo, "snapsv"     );
     512           0 :       fd_topob_wksp( topo, "snapsv_out" );
     513           0 :     }
     514           0 :   }
     515             : 
     516           0 :   #define FOR(cnt) for( ulong i=0UL; i<cnt; i++ )
     517             : 
     518           0 :   ulong shred_depth = 65536UL;
     519             : 
     520             :   /* Under Alpenglow, repair redelivers every FEC set replay can hold when
     521             :      replay loses a parent bank, and polls nothing until that is
     522             :      published, so repair_out holds all of it. */
     523             : 
     524           0 :   ulong repair_out_depth = fd_ulong_pow2_up( config->firedancer.runtime.max_live_slots * (config->limits.max_shreds_per_block/FD_FEC_SHRED_CNT) );
     525             : 
     526             :   /*                                  topo, link_name,       wksp_name,       depth,                                    mtu,                           burst */
     527           0 :   /**/                 fd_topob_link( topo, "gossip_net",    "net_gossip",    32768UL,                                  FD_NET_MTU,                    1UL );
     528           0 :   FOR(shred_tile_cnt)  fd_topob_link( topo, "shred_net",     "net_shred",     32768UL,                                  FD_NET_MTU,                    1UL );
     529           0 :   /**/                 fd_topob_link( topo, "repair_net",    "net_repair",    config->net.ingress_buffer_size,          FD_NET_MTU,                    1UL );
     530           0 :   FOR(quic_tile_cnt)   fd_topob_link( topo, "quic_net",      "net_quic",      config->net.ingress_buffer_size,          FD_NET_MTU,                    1UL );
     531             : 
     532           0 :   if( FD_LIKELY( rserve_enabled ) ) {
     533           0 :     /**/               fd_topob_link( topo, "rserve_net",    "net_rserve",    config->net.ingress_buffer_size,          FD_NET_MTU,                    1UL );
     534           0 :     /**/               fd_topob_link( topo, "rserve_sign",   "rserve_sign",   128UL,                                    32UL,                          1UL );
     535           0 :     /**/               fd_topob_link( topo, "sign_rserve",   "sign_rserve",   128UL,                                    sizeof(fd_ed25519_sig_t),      1UL );
     536           0 :     /**/               fd_topob_link( topo, "repair_rserve",  "repair_rserve", 2048UL,                                   sizeof(fd_repair_out_blk_t),   1UL );
     537           0 :   }
     538             : 
     539           0 :   if( FD_LIKELY( snapshots_enabled ) ) {
     540             :     /* TODO: Revisit the depths of all the snapshot links */
     541           0 :     /**/                 fd_topob_link( topo, "snapct_ld",     "snapct_ld",     128UL,                                    sizeof(fd_ssctrl_msg_t),       1UL );
     542           0 :     /**/                 fd_topob_link( topo, "snapld_dc",     "snapld_dc",     FD_SNAPSHOT_DATA_DEPTH,                   FD_SNAPSHOT_DATA_MTU,          1UL );
     543           0 :     FOR(snapdc_tile_cnt) fd_topob_link( topo, "snapdc_in",     "snapdc_in",     FD_SNAPSHOT_DC_IN_DEPTH,                  FD_SNAPSHOT_DATA_MTU,          1UL );
     544             : 
     545             :     /**/                 fd_topob_link( topo, "snapin_manif",  "snapin_manif",  4UL,                                      sizeof(fd_snapshot_manifest_t),1UL ); /* FULL, INCREMENTAL and DONE; snapshot retries may publish again */
     546           0 :     /**/                 fd_topob_link( topo, "snapct_repr",   "snapct_repr",   128UL,                                    0UL,                           1UL )->permit_no_consumers = 1; /* TODO: wire in repair later */
     547           0 :     if( FD_LIKELY( config->tiles.gui.enabled ) ) {
     548           0 :       /**/               fd_topob_link( topo, "snapct_gui",    "snapct_gui",    128UL,                                    sizeof(fd_snapct_update_t),    1UL );
     549           0 :       FOR(snapin_tile_cnt) fd_topob_link( topo, "snapin_gui",    "snapin_gui",    128UL,                                    FD_GUI_CONFIG_PARSE_MAX_VALID_ACCT_SZ, 1UL );
     550           0 :     }
     551           0 :     FOR(snapin_tile_cnt) fd_topob_link( topo, "snapin_ct",     "snapin_ct",     128UL,                                    0UL,                           1UL );
     552           0 :   }
     553           0 :   FOR(snapzp_tile_cnt) fd_topob_link( topo, "snapmk_zp",     "snapmk_zp",     1024UL,                                   sizeof(fd_backup_frag_t),      1UL );
     554           0 :   if( snapmk_enabled ) fd_topob_link( topo, "replay_snapmk", "replay_snapmk", 16UL,                                     sizeof(fd_replay_snap_start_t),1UL );
     555           0 :   if( snapmk_enabled ) fd_topob_link( topo, "snapmk_out",    "snapmk_out",    128UL,                                    sizeof(fd_snapmk_msg_t),       1UL );
     556           0 :   if( snapmk_enabled ) fd_topob_link( topo, "snaprd_out",    "snaprd_out",    16UL,                                     FD_BACKUP_RD_MTU,              1UL );
     557           0 :   FOR(snapsv_tile_cnt) fd_topob_link( topo, "snapsv_out",    "snapsv_out",    16384UL,                                  sizeof(fd_snapsv_msg_t),       1UL )->permit_no_consumers = 1;
     558           0 :   fd_topo_obj_t * zp_fseq = NULL;
     559           0 :   if( snapmk_enabled ) {
     560           0 :     zp_fseq = fd_topob_obj( topo, "fseq", "snapmk" );
     561           0 :     FD_TEST( fd_pod_insert_ulong( topo->props, "snapzp.fseq", zp_fseq->id ) );
     562             : 
     563           0 :     fd_topo_obj_t * backup = fd_topob_obj( topo, "backup", "snapmk" );
     564           0 :     FD_TEST( fd_pod_insertf_ulong( topo->props, config->firedancer.accounts.max_accounts, "obj.%lu.max_accounts", backup->id ) );
     565           0 :     FD_TEST( fd_pod_insert_ulong( topo->props, "backup", backup->id ) );
     566           0 :   }
     567             : 
     568           0 :   /**/                 fd_topob_link( topo, "genesi_out",    "genesi_out",    1UL,                                      fd_genesi_tile_mtu( genesis_max_message_size ), 1UL );
     569           0 :   /**/                 fd_topob_link( topo, "ipecho_out",    "ipecho_out",    2UL,                                      0UL,                           1UL );
     570           0 :   FOR(gossvf_tile_cnt) fd_topob_link( topo, "gossvf_gossip", "gossvf_gossip", config->net.ingress_buffer_size,          FD_GOSSIP_GOSSVF_MTU,          1UL );
     571           0 :   /**/                 fd_topob_link( topo, "gossip_gossvf", "gossip_gossvf", 65536UL*4UL,                              sizeof(fd_gossip_ping_update_t), 1UL ); /* TODO: Unclear where this depth comes from ... fix */
     572           0 :   /**/                 fd_topob_link( topo, "gossip_ciaddr", "gossip_ciaddr", 65536UL*2UL,                              sizeof(fd_gossip_update_message_t), 1UL ); /* min pow2 >= gossip's STEM_BURST */
     573           0 :   if( FD_LIKELY( config->tiles.gui.enabled ) ) {
     574           0 :                        fd_topob_link( topo, "gossip_ciseen", "gossip_ciseen", 65536UL*2UL,                              sizeof(fd_gossip_update_message_t), 1UL );
     575           0 :   }
     576           0 :   /**/                 fd_topob_link( topo, "gossip_misc",   "gossip_misc",   65536UL*2UL,                              sizeof(fd_gossip_update_message_t), 1UL );
     577             : 
     578           0 :   FOR(quic_tile_cnt)   fd_topob_link( topo, "quic_verify",   "quic_verify",   config->tiles.verify.receive_buffer_size, sizeof(fd_tpu_msg_t),          config->tiles.quic.txn_reassembly_count );
     579           0 :   FOR(verify_tile_cnt) fd_topob_link( topo, "verify_dedup",  "verify_dedup",  1024UL,                                   FD_TPU_PARSED_MTU,             FD_VERIFY_BATCH_TXN_MAX ); /* shallow enough to stay in cache */
     580           0 :   /**/                 fd_topob_link( topo, "replay_epoch",  "replay_epoch",  32UL,                                     FD_EPOCH_OUT_MTU,              1UL ); /* replay publishes two epochs at boot and must keep replay's STEM_BURST credits after */
     581           0 :   /**/                 fd_topob_link( topo, "replay_out",    "replay_out",    65536UL,                                  sizeof(fd_replay_message_t),   1UL )->permit_no_consumers = 1;
     582           0 :   /**/                 fd_topob_link( topo, "replay_slot",   "replay_slot",   4096UL,                                   sizeof(fd_replay_message_t),   1UL );
     583           0 :   /**/                 fd_topob_link( topo, "replay_repair", "replay_slot",   16UL,                                     sizeof(fd_replay_message_t),   1UL ); /* REPLAY_SIG_MISSING_FEC; depth >= replay's STEM_BURST */
     584           0 :   FOR(execrp_tile_cnt) fd_topob_link( topo, "replay_execrp", "replay_execrp", 64UL,                                     sizeof(fd_execrp_task_msg_t),  1UL ); /* one task in flight per tile; depth >= replay's STEM_BURST plus slack for credits refreshed only at housekeeping */
     585           0 :   /**/                 fd_topob_link( topo, "admin_replay",  "admin_replay",  32UL,                                     0UL,                           1UL );
     586           0 :   /**/                 fd_topob_link( topo, "replay_admin",  "admin_replay",  32UL,                                     0UL,                           1UL );
     587           0 :   if( FD_LIKELY( failover_enabled ) ) {
     588           0 :     /**/               fd_topob_link( topo, "admin_failov",  "admin_failov",  32UL,                                     FD_FAILOVER_BUS_MTU,           1UL );
     589           0 :     /**/               fd_topob_link( topo, "failov_admin",  "failov_admin",  32UL,                                     FD_FAILOVER_BUS_MTU,           1UL );
     590           0 :     /**/               fd_topob_link( topo, "failov_votor",  "failov_votor",  32UL,                                     FD_VOTOR_ADOPT_REQ_HDR_SZ+FD_FAILOVER_STATE_MAX, 1UL );
     591           0 :     /**/               fd_topob_link( topo, "votor_failov",  "failov_votor",  32UL,                                     sizeof(fd_votor_adopt_result_t), 1UL );
     592           0 :     /**/               fd_topob_link( topo, "votor_hist",    "votor_hist",    1024UL,                                   sizeof(fd_votor_hist_msg_t),     1UL );
     593           0 :     if( !config->tiles.gui.enabled ) {
     594           0 :                        fd_topob_link( topo, "gossip_ciseen", "gossip_ciseen", 65536UL*2UL,                              sizeof(fd_gossip_update_message_t), 1UL );
     595           0 :     }
     596           0 :   }
     597           0 :   if( leader_enabled ) {
     598           0 :     /**/                   fd_topob_link( topo, "dedup_resolv",  "dedup_resolv",  16384UL,                                  FD_TPU_PARSED_MTU,             1UL );
     599           0 :     FOR(resolv_tile_cnt)   fd_topob_link( topo, "resolv_pack",   "resolv_pack",   4096UL,                                   FD_TPU_RESOLVED_MTU,           1UL );
     600           0 :     /**/                   fd_topob_link( topo, "pack_poh",      "pack_poh",      4096UL,                                   sizeof(fd_done_packing_t),     1UL );
     601           0 :     FOR(execle_tile_cnt)   fd_topob_link( topo, "execle_poh",    "execle_poh",    4096UL,                                   FD_EXECLE_POH_MTU,             1UL );
     602           0 :     FOR(execle_tile_cnt)   fd_topob_link( topo, "pack_execle",   "pack_execle",   128UL,                                     FD_PACK_EXECLE_MTU,           1UL ); /* execle returns credits per frag, so this can be shallow enough for pack to keep in cache */
     603           0 :     if( FD_LIKELY( config->tiles.pack.use_consumed_cus ) ) {
     604           0 :       FOR(execle_tile_cnt) fd_topob_link( topo, "execle_pack",   "execle_pack",   1024UL,                                   FD_PACK_REBATE_MAX_SZ,         1UL );
     605           0 :     }
     606           0 :     /**/                   fd_topob_link( topo, "poh_shred",     "poh_shred",     4096UL,                                   FD_POH_SHRED_MTU,              1UL );
     607           0 :     /**/                   fd_topob_link( topo, "poh_replay",    "poh_replay",    4096UL,                                   sizeof(fd_poh_leader_slot_ended_t), 1UL );
     608           0 :   }
     609             : 
     610           0 :   FOR(resolv_tile_cnt) fd_topob_link( topo, "resolv_replay", "resolv_replay", 4096UL,                                   sizeof(fd_resolv_slot_exchanged_t), 1UL );
     611             : 
     612           0 :   FOR(shred_tile_cnt)  fd_topob_link( topo, "shred_sign",    "shred_sign",    128UL,                                    32UL,                          1UL );
     613           0 :   FOR(shred_tile_cnt)  fd_topob_link( topo, "sign_shred",    "sign_shred",    128UL,                                    sizeof(fd_ed25519_sig_t),      1UL );
     614             : 
     615             :   /**/                 fd_topob_link( topo, "gossip_sign",   "gossip_sign",   128UL,                                    2048UL,                        1UL ); /* TODO: Where does 2048 come from? Depth probably doesn't need to be 128 */
     616           0 :   /**/                 fd_topob_link( topo, "sign_gossip",   "sign_gossip",   128UL,                                    sizeof(fd_ed25519_sig_t),      1UL ); /* TODO: Depth probably doesn't need to be 128 */
     617             : 
     618           0 :   FOR(sign_tile_cnt-1) fd_topob_link( topo, "repair_sign",   "repair_sign",   256UL,                                    FD_REPAIR_SIG_SER_MAX,         1UL ); /* See repair_tile.c for explanation */
     619           0 :   FOR(sign_tile_cnt-1) fd_topob_link( topo, "sign_repair",   "sign_repair",   256UL,                                    sizeof(fd_ed25519_sig_t),      1UL );
     620             : 
     621           0 :   if( FD_LIKELY( failover_enabled ) ) {
     622           0 :     /**/               fd_topob_link( topo, "failov_sign",   "failov_sign",   128UL,                                    130UL,                         1UL );
     623           0 :     /**/               fd_topob_link( topo, "sign_failov",   "sign_failov",   128UL,                                    sizeof(fd_ed25519_sig_t),      1UL );
     624           0 :   }
     625             : 
     626           0 :   FOR(shred_tile_cnt)  fd_topob_link( topo, "shred_out",     "shred_out",     shred_depth,                              sizeof(fd_shred_message_t),     FD_SHRED_STEM_BURST );
     627           0 :   FOR(shred_tile_cnt)  fd_topob_link( topo, "shred_repair",  "shred_repair",  1024UL,                                   FD_REPAIR_NET_FRAME_MAX,        1UL                 );
     628           0 :   /**/                 fd_topob_link( topo, "repair_out",    "repair_out",    repair_out_depth,                         sizeof(fd_repair_out_fec_t),    1UL );
     629             : 
     630           0 :   FOR(execrp_tile_cnt) fd_topob_link( topo, "execrp_replay", "execrp_replay", 16384UL,                                  sizeof(fd_execrp_task_done_msg_t), 1UL );
     631           0 :   if( FD_LIKELY( config->tiles.gui.enabled ) ) {
     632           0 :     fd_topob_link( topo, "diag_gui", "diag_gui", 4UL, sizeof(fd_diag_system_resources_t), 1UL );
     633           0 :     /**/                 fd_topob_link( topo, "gossip_gui",  "gossip_gui",    256UL,                                    FD_GUI_GOSSIP_BW_MTU,          1UL );
     634           0 :     FOR(gossvf_tile_cnt) fd_topob_link( topo, "gossvf_gui",  "gossip_gui",    256UL,                                    FD_GUI_GOSSIP_BW_MTU,          1UL );
     635           0 :   }
     636             : 
     637           0 :   ushort parsed_tile_to_cpu[ FD_TILE_MAX ];
     638             :   /* Unassigned tiles will be floating, unless auto topology is enabled. */
     639           0 :   for( ulong i=0UL; i<FD_TILE_MAX; i++ ) parsed_tile_to_cpu[ i ] = USHORT_MAX;
     640             : 
     641           0 :   int is_auto_affinity = !strcmp( config->layout.affinity, "auto" );
     642             : 
     643           0 :   fd_topo_cpus_t cpus[1];
     644           0 :   fd_topo_cpus_init( cpus );
     645             : 
     646           0 :   ulong affinity_tile_cnt = 0UL;
     647           0 :   if( FD_LIKELY( !is_auto_affinity ) ) affinity_tile_cnt = fd_topob_parse_affinity_cstr( config->layout.affinity, parsed_tile_to_cpu, 1, 1 );
     648             : 
     649           0 :   ulong tile_to_cpu[ FD_TILE_MAX ];
     650           0 :   for( ulong i=0UL; i<FD_TILE_MAX; i++ ) tile_to_cpu[ i ] = ULONG_MAX;
     651             : 
     652           0 :   for( ulong i=0UL; i<affinity_tile_cnt; i++ ) {
     653           0 :     ushort cpu_idx = (ushort)( parsed_tile_to_cpu[ i ] & ~FD_TOPOB_CPU_SHARED );
     654           0 :     if( FD_UNLIKELY( parsed_tile_to_cpu[ i ]!=USHORT_MAX && cpu_idx>=cpus->cpu_cnt ) )
     655           0 :       FD_LOG_ERR(( "The CPU affinity string in the configuration file under [layout.affinity] specifies a CPU index of %hu, but the system "
     656           0 :                    "only has %lu CPUs. You should either change the CPU allocations in the affinity string, or increase the number of CPUs "
     657           0 :                    "in the system.",
     658           0 :                    cpu_idx, cpus->cpu_cnt ));
     659           0 :     tile_to_cpu[ i ] = fd_ulong_if( parsed_tile_to_cpu[ i ]==USHORT_MAX, ULONG_MAX, (ulong)parsed_tile_to_cpu[ i ] );
     660           0 :   }
     661             : 
     662           0 :   if( FD_UNLIKELY( efficient_mode ) ) fd_topob_sleep( topo, "metric_in", tile_to_cpu[ topo->tile_cnt ] );
     663             : 
     664           0 :   fd_topos_net_tiles( topo, net_tile_cnt, &config->net, config->tiles.netlink.max_routes, config->tiles.netlink.max_peer_routes, config->tiles.netlink.max_neighbors, tile_to_cpu );
     665             : 
     666           0 :   FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_gossvf", i, config->net.ingress_buffer_size );
     667           0 :   FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_shred",  i, config->net.ingress_buffer_size );
     668           0 :   if( rserve_enabled ) FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_rserve", i, config->net.ingress_buffer_size );
     669           0 :   if( leader_enabled ) FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_quic",   i, config->net.ingress_buffer_size );
     670             : 
     671             :   /*                                  topo, tile_name, tile_wksp, metrics_wksp, cpu_idx,                       uses_id_keyswitch, uses_av_keyswitch, is_waker_client */
     672             :   /**/                 fd_topob_tile( topo, "metric",  "metric",  "metric_in",  tile_to_cpu[ topo->tile_cnt ], 0,                 0,                 1 );
     673           0 :   /**/                 fd_topob_tile( topo, "diag",    "diag",    "metric_in",  tile_to_cpu[ topo->tile_cnt ], 0,                 0,                 0 );
     674           0 :   if( FD_LIKELY( config->tiles.gui.enabled ) )
     675           0 :     fd_topob_tile_out( topo, "diag", 0UL, "diag_gui", 0UL );
     676             : 
     677           0 :   if( FD_LIKELY( snapshots_enabled ) ) {
     678           0 :     /**/                 fd_topob_tile( topo, "snapct", "snapct", "metric_in", tile_to_cpu[ topo->tile_cnt ],    0,                 0,                 1 )->allow_shutdown = 1;
     679           0 :     /**/                 fd_topob_tile( topo, "snapld", "snapld", "metric_in", tile_to_cpu[ topo->tile_cnt ],    0,                 0,                 1 )->allow_shutdown = 1;
     680           0 :     FOR(snapdc_tile_cnt) fd_topob_tile( topo, "snapdc", "snapdc", "metric_in", tile_to_cpu[ topo->tile_cnt ],    0,                 0,                 0 )->allow_shutdown = 1;
     681           0 :     FOR(snapin_tile_cnt) fd_topob_tile( topo, "snapin", "snapin", "metric_in", tile_to_cpu[ topo->tile_cnt ],    0,                 0,                 0 )->allow_shutdown = 1;
     682           0 :   }
     683           0 :   if( snapmk_enabled ) {
     684           0 :     /**/                 fd_topob_tile( topo, "snapmk", "snapmk", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0, 0 );
     685           0 :     FOR(snapzp_tile_cnt) fd_topob_tile( topo, "snapzp", "snapzp", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0, 0 );
     686           0 :     /**/                 fd_topob_tile( topo, "snaprd", "snaprd", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0, 0 );
     687           0 :     FOR(snapsv_tile_cnt) fd_topob_tile( topo, "snapsv", "snapsv", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0, 0 );
     688           0 :   }
     689             : 
     690             :   /**/                 fd_topob_tile( topo, "genesi",  "genesi",  "metric_in",  tile_to_cpu[ topo->tile_cnt ], 0,                 0,                 1 )->allow_shutdown = 1;
     691           0 :   /**/                 fd_topob_tile( topo, "ipecho",  "ipecho",  "metric_in",  tile_to_cpu[ topo->tile_cnt ], 0,                 0,                 1 );
     692           0 :   FOR(gossvf_tile_cnt) fd_topob_tile( topo, "gossvf",  "gossvf",  "metric_in",  tile_to_cpu[ topo->tile_cnt ], 1,                 0,                 0 );
     693           0 :   /**/                 fd_topob_tile( topo, "gossip",  "gossip",  "metric_in",  tile_to_cpu[ topo->tile_cnt ], 1,                 0,                 0 );
     694             : 
     695           0 :   FOR(shred_tile_cnt)  fd_topob_tile( topo, "shred",   "shred",   "metric_in",  tile_to_cpu[ topo->tile_cnt ], 1,                 0,                 0 );
     696           0 :   /**/                 fd_topob_tile( topo, "repair",  "repair",  "metric_in",  tile_to_cpu[ topo->tile_cnt ], 1,                 0,                 0 );
     697           0 :   if( rserve_enabled) {
     698           0 :     /**/               fd_topob_tile( topo, "rserve",  "rserve",  "metric_in",  tile_to_cpu[ topo->tile_cnt ], 1,                 0,                 0 );
     699           0 :   }
     700           0 :   /**/                 fd_topob_tile( topo, "replay",  "replay",  "metric_in",  tile_to_cpu[ topo->tile_cnt ], 1,                 0,                 0 );
     701           0 :   /**/                 fd_topob_tile( topo, "accdb",   "accdb",   "metric_in",  tile_to_cpu[ topo->tile_cnt ], 0,                 0,                 0 );
     702           0 :   FOR(execrp_tile_cnt) fd_topob_tile( topo, "execrp",  "execrp",  "metric_in",  tile_to_cpu[ topo->tile_cnt ], 0,                 0,                 0 );
     703           0 :   /**/                 fd_topob_tile( topo, "votor",   "votor",   "metric_in",  tile_to_cpu[ topo->tile_cnt ], 1,                 1,                 0 );
     704             : 
     705           0 :   if( leader_enabled ) {
     706           0 :     FOR(quic_tile_cnt)   fd_topob_tile( topo, "quic",    "quic",    "metric_in",  tile_to_cpu[ topo->tile_cnt ], 0,               0,               0 );
     707           0 :     FOR(verify_tile_cnt) fd_topob_tile( topo, "verify",  "verify",  "metric_in",  tile_to_cpu[ topo->tile_cnt ], 0,               0,               0 );
     708           0 :     /**/                 fd_topob_tile( topo, "dedup",   "dedup",   "metric_in",  tile_to_cpu[ topo->tile_cnt ], 0,               0,               0 );
     709           0 :     FOR(resolv_tile_cnt) fd_topob_tile( topo, "resolv",  "resolv",  "metric_in",  tile_to_cpu[ topo->tile_cnt ], 0,               0,               0 );
     710           0 :     /**/                 fd_topob_tile( topo, "pack",    "pack",    "metric_in",  tile_to_cpu[ topo->tile_cnt ], config->tiles.bundle.enabled, 0, 0 );
     711           0 :     FOR(execle_tile_cnt) fd_topob_tile( topo, "execle",  "execle",  "metric_in",  tile_to_cpu[ topo->tile_cnt ], 0,               0,               0 );
     712           0 :     /**/                 fd_topob_tile( topo, "motor",   "motor",   "metric_in",  tile_to_cpu[ topo->tile_cnt ], 0,               0,               0 );
     713           0 :   }
     714           0 :   FOR(sign_tile_cnt)   fd_topob_tile( topo, "sign",    "sign",    "metric_in",  tile_to_cpu[ topo->tile_cnt ], 1,               1,               0 );
     715             : 
     716           0 :   if( FD_UNLIKELY( rpc_enabled ) ) {
     717           0 :     fd_topob_wksp( topo, "rpc" );
     718           0 :     fd_topob_wksp( topo, "rpc_replay" );
     719           0 :     fd_topob_tile( topo, "rpc", "rpc", "metric_in", tile_to_cpu[ topo->tile_cnt ], 1, 0, 1 );
     720           0 :   }
     721             : 
     722           0 :   if( FD_UNLIKELY( solcap_enabled ) ) {
     723           0 :     fd_topob_wksp( topo, "solcap" );
     724           0 :     fd_topob_tile( topo, "solcap", "solcap", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0, 0 );
     725           0 :   }
     726             : 
     727           0 :   fd_topo_tile_t * admin_tile = fd_topob_tile( topo, "admin", "admin", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0, 0 );
     728             : 
     729             :   /*                                        topo, tile_name, tile_kind_id, fseq_wksp,   link_name,       link_kind_id, reliable,            polled */
     730           0 :   FOR(gossvf_tile_cnt) for( ulong j=0UL; j<net_tile_cnt; j++ )
     731           0 :                       fd_topob_tile_in(     topo, "gossvf",  i,            "metric_in", "net_gossvf",    j,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
     732           0 :   FOR(shred_tile_cnt) for( ulong j=0UL; j<net_tile_cnt; j++ )
     733           0 :                       fd_topob_tile_in (    topo, "shred",   i,            "metric_in", "net_shred",     j,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
     734           0 :   FOR(shred_tile_cnt) fd_topob_tile_in(     topo, "repair",  0UL,          "metric_in", "shred_repair",  i,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* Repair pings and metadata responses are retried, may be dropped or overrun */
     735           0 :   /**/                fd_topob_tile_out(    topo, "repair",  0UL,                       "repair_net",    0UL                                                );
     736           0 :   FOR(quic_tile_cnt) for( ulong j=0UL; j<net_tile_cnt; j++ )
     737           0 :                       fd_topob_tile_in(     topo, "quic",    i,            "metric_in", "net_quic",      j,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
     738           0 :   FOR(shred_tile_cnt) fd_topos_tile_in_net( topo,                          "metric_in", "shred_net",     i,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
     739           0 :   /**/                fd_topos_tile_in_net( topo,                          "metric_in", "gossip_net",    0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
     740           0 :   /**/                fd_topos_tile_in_net( topo,                          "metric_in", "repair_net",    0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
     741           0 :   FOR(quic_tile_cnt)  fd_topos_tile_in_net( topo,                          "metric_in", "quic_net",      i,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
     742             : 
     743           0 :   /**/                 fd_topob_tile_out(   topo, "genesi", 0UL,                        "genesi_out",    0UL                                                );
     744           0 :   /**/                 fd_topob_tile_in (   topo, "ipecho", 0UL,           "metric_in", "genesi_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     745           0 :   /**/                 fd_topob_tile_out(   topo, "ipecho", 0UL,                        "ipecho_out",    0UL                                                );
     746             : 
     747           0 :   FOR(gossvf_tile_cnt) fd_topob_tile_out(   topo, "gossvf", i,                          "gossvf_gossip", i                                                  );
     748           0 :   FOR(gossvf_tile_cnt) fd_topob_tile_in (   topo, "gossvf", i,             "metric_in", "gossip_ciaddr", 0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     749           0 :   FOR(gossvf_tile_cnt) fd_topob_tile_in (   topo, "gossvf", i,             "metric_in", "gossip_gossvf", 0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     750           0 :   FOR(gossvf_tile_cnt) fd_topob_tile_in (   topo, "gossvf", i,             "metric_in", "ipecho_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     751           0 :   FOR(gossvf_tile_cnt) fd_topob_tile_in (   topo, "gossvf", i,             "metric_in", "replay_epoch",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     752           0 :   /**/                 fd_topob_tile_in (   topo, "gossip", 0UL,           "metric_in", "replay_epoch",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     753           0 :   /**/                 fd_topob_tile_out(   topo, "gossip", 0UL,                        "gossip_ciaddr", 0UL                                                );
     754           0 :   if( FD_LIKELY( config->tiles.gui.enabled ) ) {
     755           0 :                        fd_topob_tile_out(   topo, "gossip", 0UL,                        "gossip_ciseen", 0UL                                                );
     756           0 :   }
     757           0 :   /**/                 fd_topob_tile_out(   topo, "gossip", 0UL,                        "gossip_misc",   0UL                                                );
     758           0 :   /**/                 fd_topob_tile_out(   topo, "gossip", 0UL,                        "gossip_net",    0UL                                                );
     759           0 :   /**/                 fd_topob_tile_in (   topo, "gossip", 0UL,           "metric_in", "ipecho_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     760           0 :   FOR(gossvf_tile_cnt) fd_topob_tile_in (   topo, "gossip", 0UL,           "metric_in", "gossvf_gossip", i,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
     761           0 :   /**/                 fd_topob_tile_out(   topo, "gossip", 0UL,                        "gossip_gossvf", 0UL                                                );
     762           0 :   if( rserve_enabled ) {
     763           0 :     FOR(net_tile_cnt) fd_topob_tile_in(     topo, "rserve",  0UL,          "metric_in", "net_rserve",    i,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
     764           0 :     FOR(shred_tile_cnt) fd_topob_tile_in(   topo, "rserve",  0UL,          "metric_in", "shred_out",     i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     765           0 :     /**/              fd_topob_tile_out(    topo, "rserve",  0UL,                       "rserve_net",    0UL                                                );
     766           0 :     /**/              fd_topos_tile_in_net( topo,                          "metric_in", "rserve_net",    0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
     767           0 :     /**/              fd_topob_tile_out(    topo, "repair",  0UL,                       "repair_rserve", 0UL                                                );
     768           0 :     /**/              fd_topob_tile_in(     topo, "rserve",  0UL,          "metric_in", "repair_rserve", 0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
     769           0 :   }
     770           0 :   if( snapshots_enabled ) {
     771           0 :                        fd_topob_tile_in (   topo, "gossip",  0UL,          "metric_in", "snapin_manif",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     772           0 :   }
     773           0 :   int snapshots_gossip_enabled = config->firedancer.snapshots.sources.gossip.allow_any || config->firedancer.snapshots.sources.gossip.allow_list_cnt>0UL;
     774           0 :   if( FD_LIKELY( snapshots_enabled ) ) {
     775           0 :     if( FD_LIKELY( snapshots_gossip_enabled ) ) {
     776           0 :       /**/            fd_topob_tile_in (    topo, "snapct",  0UL,          "metric_in", "gossip_ciaddr", 0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     777           0 :     }
     778             : 
     779           0 :                       fd_topob_tile_in (    topo, "snapct",  0UL,          "metric_in", "snapld_dc",     0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     780           0 :                       fd_topob_tile_out(    topo, "snapct",  0UL,                       "snapct_ld",     0UL                                                );
     781           0 :                       fd_topob_tile_out(    topo, "snapct",  0UL,                       "snapct_repr",   0UL                                                );
     782           0 :     if( FD_LIKELY( config->tiles.gui.enabled ) ) {
     783           0 :       /**/            fd_topob_tile_out(    topo, "snapct",  0UL,                       "snapct_gui",    0UL                                                );
     784           0 :     }
     785             : 
     786             : 
     787           0 :     FOR(snapin_tile_cnt) fd_topob_tile_out(    topo, "snapin",  i,                       "snapin_ct",    i                                                   );
     788           0 :     FOR(snapin_tile_cnt) fd_topob_tile_in (    topo, "snapct",  0UL,          "metric_in", "snapin_ct",    i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     789           0 :     /**/              fd_topob_tile_in (    topo, "snapld",  0UL,          "metric_in", "snapct_ld",     0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     790           0 :     /**/              fd_topob_tile_out(    topo, "snapld",  0UL,                       "snapld_dc",     0UL                                                );
     791             : 
     792           0 :     FOR(snapdc_tile_cnt) fd_topob_tile_in (    topo, "snapdc",  i,            "metric_in", "snapld_dc",     0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     793           0 :     FOR(snapdc_tile_cnt) fd_topob_tile_out(    topo, "snapdc",  i,                      "snapdc_in",     i                                                  );
     794             : 
     795           0 :     for( ulong t=0UL; t<snapin_tile_cnt; t++ ) {
     796           0 :       FOR(snapdc_tile_cnt) fd_topob_tile_in( topo, "snapin", t, "metric_in", "snapdc_in", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
     797           0 :     }
     798           0 :     if( FD_LIKELY( config->tiles.gui.enabled ) ) {
     799           0 :       FOR(snapin_tile_cnt) fd_topob_tile_out(    topo, "snapin", i,                          "snapin_gui",    i                                                  );
     800           0 :     }
     801           0 :                       fd_topob_tile_out(    topo, "snapin",  0UL,                       "snapin_manif",  0UL                                                );
     802           0 :   }
     803             : 
     804           0 :   /**/                 fd_topob_tile_in(    topo, "repair",  0UL,          "metric_in", "genesi_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     805           0 :   /**/                 fd_topob_tile_in(    topo, "repair",  0UL,          "metric_in", "gossip_ciaddr", 0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     806           0 :   /**/                 fd_topob_tile_in(    topo, "repair",  0UL,          "metric_in", "replay_epoch",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     807           0 :   /**/                 fd_topob_tile_in(    topo, "repair",  0UL,          "metric_in", "replay_slot",   0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
     808           0 :   /**/                 fd_topob_tile_in(    topo, "repair",  0UL,          "metric_in", "replay_repair", 0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     809           0 :   FOR(shred_tile_cnt)  fd_topob_tile_in(    topo, "repair",  0UL,          "metric_in", "shred_out",     i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     810           0 :   if( snapshots_enabled ) {
     811           0 :                        fd_topob_tile_in(    topo, "repair",  0UL,          "metric_in", "snapin_manif",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     812           0 :   }
     813           0 :   /**/                 fd_topob_tile_out(   topo, "repair",  0UL,                       "repair_out",    0                                                  );
     814             : 
     815           0 :   /**/                 fd_topob_tile_in (   topo, "replay",  0UL,          "metric_in", "repair_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     816           0 :   /**/                 fd_topob_tile_in (   topo, "replay",  0UL,          "metric_in", "genesi_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     817           0 :   /**/                 fd_topob_tile_out(   topo, "replay",  0UL,                       "replay_out",    0UL                                                );
     818           0 :   /**/                 fd_topob_tile_out(   topo, "replay",  0UL,                       "replay_slot",   0UL                                                );
     819           0 :   /**/                 fd_topob_tile_out(   topo, "replay",  0UL,                       "replay_repair", 0UL                                                );
     820           0 :   /**/                 fd_topob_tile_out(   topo, "replay",  0UL,                       "replay_epoch",  0UL                                                );
     821           0 :   FOR(execrp_tile_cnt) fd_topob_tile_out(   topo, "replay",  0UL,                       "replay_execrp", i                                                  );
     822           0 :   FOR(execrp_tile_cnt) fd_topob_tile_in (   topo, "replay",  0UL,          "metric_in", "execrp_replay", i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     823           0 :   if(leader_enabled)  {fd_topob_tile_in (   topo, "replay",  0UL,          "metric_in", "poh_replay",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );}
     824           0 :   FOR(resolv_tile_cnt) fd_topob_tile_in (   topo, "replay",  0UL,          "metric_in", "resolv_replay", i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     825           0 :   /**/                 fd_topob_tile_in (   topo, "replay",  0UL,          "metric_in", "ipecho_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     826           0 :   /**/                 fd_topob_tile_in (   topo, "replay",  0UL,          "metric_in", "gossip_misc",   0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     827           0 :   if( FD_LIKELY( snapshots_enabled ) ) {
     828           0 :                        fd_topob_tile_in (   topo, "replay",  0UL,          "metric_in", "snapin_manif",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     829           0 :   }
     830           0 :   if( snapmk_enabled ) {
     831           0 :     /*               */fd_topob_tile_in (   topo, "replay",  0UL,          "metric_in", "snapmk_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     832           0 :     /*               */fd_topob_tile_in (   topo, "gossip",  0UL,          "metric_in", "snapmk_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     833           0 :   }
     834           0 :   FOR(snapsv_tile_cnt) fd_topob_tile_in (   topo, "snapsv",  i,            "metric_in", "snapmk_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     835           0 :   FOR(snapsv_tile_cnt) fd_topob_tile_out(   topo, "snapsv",  i,                         "snapsv_out",    i                                                  );
     836           0 :   /**/                 fd_topob_tile_in (   topo, "replay",  0UL,          "metric_in", "admin_replay",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     837           0 :   /**/                 fd_topob_tile_out(   topo, "replay",  0UL,                       "replay_admin",  0UL                                                );
     838           0 :   /**/                 fd_topob_tile_out(   topo, "admin",   0UL,                       "admin_replay",  0UL                                                );
     839           0 :   /**/                 fd_topob_tile_in (   topo, "admin",   0UL,          "metric_in", "replay_admin",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     840           0 :   if( FD_LIKELY( failover_enabled ) ) {
     841           0 :     if( !config->tiles.gui.enabled ) {
     842           0 :                        fd_topob_tile_out(   topo, "gossip",  0UL,                       "gossip_ciseen", 0UL                                                );
     843           0 :     }
     844           0 :     /**/               fd_topob_tile_out(   topo, "admin",   0UL,                       "admin_failov",  0UL                                                );
     845           0 :     /**/               fd_topob_tile_in (   topo, "admin",   0UL,          "metric_in", "failov_admin",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     846           0 :   }
     847             : 
     848           0 :   FOR(execrp_tile_cnt) fd_topob_tile_in (   topo, "execrp",  i,            "metric_in", "replay_execrp", i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     849           0 :   FOR(execrp_tile_cnt) fd_topob_tile_out(   topo, "execrp",  i,                         "execrp_replay", i                                                  );
     850             : 
     851           0 :   if( leader_enabled ) {
     852           0 :     FOR(quic_tile_cnt)   fd_topob_tile_out( topo, "quic",    i,                         "quic_verify",   i                                                  );
     853           0 :     FOR(quic_tile_cnt)   fd_topob_tile_out( topo, "quic",    i,                         "quic_net",      i                                                  );
     854             :     /* All verify tiles read from all QUIC tiles, packets are round robin. */
     855           0 :     FOR(verify_tile_cnt) for( ulong j=0UL; j<quic_tile_cnt; j++ )
     856           0 :                          fd_topob_tile_in(  topo, "verify",  i,            "metric_in", "quic_verify",   j,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers, verify tiles may be overrun */
     857           0 :     FOR(verify_tile_cnt) fd_topob_tile_out( topo, "verify",  i,                         "verify_dedup",  i                                                  );
     858           0 :     FOR(verify_tile_cnt) fd_topob_tile_in(  topo, "dedup",   0UL,          "metric_in", "verify_dedup",  i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     859           0 :     /**/                 fd_topob_tile_in(  topo, "dedup",   0UL,          "metric_in", "replay_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     860           0 :     /**/                 fd_topob_tile_out( topo, "dedup",   0UL,                       "dedup_resolv",  0UL                                                );
     861           0 :     FOR(resolv_tile_cnt) fd_topob_tile_in(  topo, "resolv",  i,            "metric_in", "dedup_resolv",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     862           0 :     FOR(resolv_tile_cnt) fd_topob_tile_in(  topo, "resolv",  i,            "metric_in", "replay_slot",   0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     863           0 :     FOR(resolv_tile_cnt) fd_topob_tile_out( topo, "resolv",  i,                         "resolv_pack",   i                                                  );
     864           0 :     FOR(resolv_tile_cnt) fd_topob_tile_out( topo, "resolv",  i,                         "resolv_replay", i                                                  );
     865           0 :     FOR(resolv_tile_cnt) fd_topob_tile_in(  topo, "pack",    0UL,          "metric_in", "resolv_pack",   i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     866           0 :     /**/                 fd_topob_tile_in(  topo, "pack",    0UL,          "metric_in", "replay_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     867           0 :     FOR(execle_tile_cnt) fd_topob_tile_out(  topo, "pack",   0UL,                       "pack_execle",   i                                                  );
     868           0 :     /**/                 fd_topob_tile_out(  topo, "pack",   0UL,                       "pack_poh" ,     0UL                                                );
     869           0 :     if( FD_LIKELY( config->tiles.pack.use_consumed_cus ) ) {
     870           0 :       FOR(execle_tile_cnt) fd_topob_tile_in(  topo, "pack",  0UL,          "metric_in", "execle_pack",   i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     871           0 :     }
     872           0 :     FOR(execle_tile_cnt) fd_topob_tile_in ( topo, "execle",  i,            "metric_in", "pack_execle",   i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     873           0 :     FOR(execle_tile_cnt) fd_topob_tile_out( topo, "execle",  i,                         "execle_poh",    i                                                  );
     874           0 :     if( FD_LIKELY( config->tiles.pack.use_consumed_cus ) ) {
     875           0 :       FOR(execle_tile_cnt)fd_topob_tile_out(topo, "execle",  i,                         "execle_pack",   i                                                  );
     876           0 :     }
     877           0 :     FOR(execle_tile_cnt) fd_topob_tile_in ( topo, "motor",   0UL,          "metric_in", "execle_poh",    i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     878           0 :     /**/                 fd_topob_tile_in ( topo, "motor",   0UL,          "metric_in", "pack_poh",      0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     879           0 :     /**/                 fd_topob_tile_in ( topo, "motor",   0UL,          "metric_in", "replay_slot",   0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     880           0 :     /**/                 fd_topob_tile_out( topo, "motor",   0UL,                       "poh_shred",     0UL                                                );
     881           0 :     /**/                 fd_topob_tile_out( topo, "motor",   0UL,                       "poh_replay",    0UL                                                );
     882           0 :     FOR(shred_tile_cnt)  fd_topob_tile_in ( topo, "shred",   i,            "metric_in", "poh_shred",     0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     883           0 :   }
     884             : 
     885           0 :   FOR(shred_tile_cnt)    fd_topob_tile_in ( topo, "shred",   i,            "metric_in", "replay_epoch",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     886           0 :   FOR(shred_tile_cnt)    fd_topob_tile_in ( topo, "shred",   i,            "metric_in", "gossip_ciaddr", 0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     887           0 :   FOR(shred_tile_cnt)    fd_topob_tile_out( topo, "shred",   i,                         "shred_out",     i                                                  );
     888           0 :   FOR(shred_tile_cnt)    fd_topob_tile_in ( topo, "shred",   i,            "metric_in", "ipecho_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
     889           0 :   FOR(shred_tile_cnt)    fd_topob_tile_in ( topo, "shred",   i,            "metric_in", "replay_slot",   0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
     890           0 :   FOR(shred_tile_cnt)    fd_topob_tile_out( topo, "shred",   i,                         "shred_net",     i                                                  );
     891             : 
     892           0 :   if( FD_LIKELY( telemetry_enabled ) ) {
     893           0 :     fd_topob_wksp( topo, "event"      );
     894           0 :     fd_topob_wksp( topo, "event_sign" );
     895           0 :     fd_topob_wksp( topo, "sign_event" );
     896           0 :     fd_topob_link( topo, "event_sign", "event_sign", 128UL, 317UL, 1UL );
     897           0 :     fd_topob_link( topo, "sign_event", "sign_event", 128UL, 64UL, 1UL );
     898           0 :     fd_topob_tile( topo, "event", "event", "metric_in",  tile_to_cpu[ topo->tile_cnt ], 1, 0, 1 );
     899           0 :     fd_topob_tile_in(  topo, "event",  0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   );
     900           0 :     fd_topob_tile_in(  topo, "event",  0UL, "metric_in", "ipecho_out", 0UL, FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   );
     901             : 
     902           0 :     if( FD_UNLIKELY( config->development.event.report_shreds ) ) {
     903             :       /* TODO: This needs to be reliable, else we could miss shreds that
     904             :          are required to replay the chain, but we can't change it yet as
     905             :          the XDP tile does not support reliable consumers. */
     906           0 :       FOR(net_tile_cnt) fd_topob_tile_in(  topo, "event", 0UL, "metric_in", "net_shred", i, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
     907           0 :     }
     908             : 
     909           0 :     if( FD_UNLIKELY( config->development.event.report_transactions && leader_enabled ) ) {
     910           0 :       fd_topob_tile_in( topo, "event", 0UL, "metric_in", "dedup_resolv", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
     911           0 :     }
     912             : 
     913           0 :     fd_topob_tile_in(  topo, "sign",   0UL, "metric_in", "event_sign", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED   );
     914           0 :     fd_topob_tile_out( topo, "event",  0UL,              "event_sign", 0UL                                         );
     915           0 :     fd_topob_tile_in(  topo, "event",  0UL, "metric_in", "sign_event", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
     916           0 :     fd_topob_tile_out( topo, "sign",   0UL,              "sign_event", 0UL                                         );
     917           0 :   }
     918             : 
     919           0 :   if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) {
     920           0 :     fd_topob_wksp( topo, "bundle_verif" );
     921           0 :     fd_topob_wksp( topo, "bundle_sign"  );
     922           0 :     fd_topob_wksp( topo, "sign_bundle"  );
     923           0 :     fd_topob_wksp( topo, "pack_sign"    );
     924           0 :     fd_topob_wksp( topo, "sign_pack"    );
     925           0 :     fd_topob_wksp( topo, "bundle"       );
     926             : 
     927           0 :     /**/                 fd_topob_link( topo, "bundle_verif", "bundle_verif", config->tiles.verify.receive_buffer_size, FD_TPU_PARSED_MTU,         1UL );
     928           0 :     /**/                 fd_topob_link( topo, "bundle_sign",  "bundle_sign",  65536UL,                                  9UL,                       1UL );
     929           0 :     /**/                 fd_topob_link( topo, "sign_bundle",  "sign_bundle",  128UL,                                    64UL,                      1UL );
     930           0 :     /**/                 fd_topob_link( topo, "pack_sign",    "pack_sign",    65536UL,                                  1232UL,                    1UL );
     931           0 :     /**/                 fd_topob_link( topo, "sign_pack",    "sign_pack",    128UL,                                    64UL,                      1UL );
     932             : 
     933             :     /**/                 fd_topob_tile( topo, "bundle",  "bundle",  "metric_in", tile_to_cpu[ topo->tile_cnt ], 1, 0, 1 );
     934             : 
     935             :     /**/                 fd_topob_tile_out( topo, "bundle", 0UL, "bundle_verif", 0UL );
     936           0 :     FOR(verify_tile_cnt) fd_topob_tile_in(  topo, "verify", i,             "metric_in", "bundle_verif",   0UL,        FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   );
     937             : 
     938           0 :     /**/                 fd_topob_tile_in(  topo, "sign",   0UL,           "metric_in", "bundle_sign",    0UL,        FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED   );
     939           0 :     /**/                 fd_topob_tile_out( topo, "bundle", 0UL,                        "bundle_sign",    0UL                                                );
     940           0 :     /**/                 fd_topob_tile_in(  topo, "bundle", 0UL,           "metric_in", "sign_bundle",    0UL,        FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
     941           0 :     /**/                 fd_topob_tile_out( topo, "sign",   0UL,                        "sign_bundle",    0UL                                                );
     942             : 
     943           0 :     if( leader_enabled ) {
     944           0 :       /**/               fd_topob_tile_in(  topo, "sign",   0UL,           "metric_in", "pack_sign",      0UL,        FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED   );
     945           0 :       /**/               fd_topob_tile_out( topo, "pack",   0UL,                        "pack_sign",      0UL                                                );
     946           0 :       /**/               fd_topob_tile_in(  topo, "pack",   0UL,           "metric_in", "sign_pack",      0UL,        FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
     947           0 :       /**/               fd_topob_tile_out( topo, "sign",   0UL,                        "sign_pack",      0UL                                                );
     948           0 :     }
     949             : 
     950           0 :     if( leader_enabled ) fd_topob_tile_in(  topo, "bundle", 0UL,           "metric_in", "replay_slot",    0UL,        FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED   );
     951             : 
     952           0 :     if( config->tiles.gui.enabled ) { /* GUI is the only consumer of bundle_status */
     953           0 :       fd_topob_wksp( topo, "bundle_status" );
     954             :       /* bundle_status must be kind of deep, to prevent exhausting
     955             :          shared flow control credits when publishing many packets at
     956             :          once. */
     957           0 :       fd_topob_link( topo, "bundle_status", "bundle_status", 128UL, sizeof(fd_bundle_block_engine_update_t), 1UL );
     958           0 :       fd_topob_tile_out( topo, "bundle", 0UL, "bundle_status", 0UL );
     959           0 :     }
     960           0 :   }
     961             : 
     962             :   /* Sign links don't need to be reliable because each requester has a
     963             :      small bounded number of requests in flight: one for the tiles that
     964             :      sign synchronously and read the response out of band in a spin
     965             :      loop (their response link is not polled by fd_stem), and up to
     966             :      FD_SHRED_SIGN_PEND_MAX for shred, which takes its responses as
     967             :      ordinary polled frags.
     968             : 
     969             :      TODO: This can probably be fixed now to be reliable ... ? */
     970             :   /*                                        topo, tile_name, tile_kind_id, fseq_wksp,   link_name,      link_kind_id, reliable,            polled */
     971           0 :   /**/                 fd_topob_tile_in (   topo, "sign",    0UL,          "metric_in", "gossip_sign",  0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED   );
     972           0 :   /**/                 fd_topob_tile_out(   topo, "gossip",  0UL,                       "gossip_sign",  0UL                                                  );
     973           0 :   /**/                 fd_topob_tile_in (   topo, "gossip",  0UL,          "metric_in", "sign_gossip",  0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED   );
     974           0 :   /**/                 fd_topob_tile_out(   topo, "sign",    0UL,                       "sign_gossip",  0UL                                                  );
     975             : 
     976           0 :   for( ulong i=0UL; i<shred_tile_cnt; i++ ) {
     977           0 :     /**/               fd_topob_tile_in (   topo, "sign",    0UL,          "metric_in", "shred_sign",   i,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED   );
     978           0 :     /**/               fd_topob_tile_out(   topo, "shred",   i,                         "shred_sign",   i                                                    );
     979           0 :     /**/               fd_topob_tile_in (   topo, "shred",   i,            "metric_in", "sign_shred",   i,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED   );
     980           0 :     /**/               fd_topob_tile_out(   topo, "sign",    0UL,                       "sign_shred",   i                                                    );
     981           0 :     /**/               fd_topob_tile_out(   topo, "shred",   i,                         "shred_repair", i                                                    ); /* after the fixed NET_OUT_IDX and SIGN_OUT_IDX */
     982           0 :   }
     983             : 
     984           0 :   FOR(sign_tile_cnt-1UL) fd_topob_tile_out( topo, "repair",  0UL,                       "repair_sign",  i                                                    );
     985           0 :   FOR(sign_tile_cnt-1UL) fd_topob_tile_in ( topo, "sign",    i+1UL,        "metric_in", "repair_sign",  i,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED   );
     986           0 :   FOR(sign_tile_cnt-1UL) fd_topob_tile_out( topo, "sign",    i+1UL,                     "sign_repair",  i                                                    );
     987           0 :   FOR(sign_tile_cnt-1UL) fd_topob_tile_in ( topo, "repair",  0UL,          "metric_in", "sign_repair",  i,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED   ); /* This link is polled because the signing requests are asynchronous */
     988             : 
     989           0 :   if( rserve_enabled ) {
     990           0 :     /**/                 fd_topob_tile_in (   topo, "sign",    0UL,          "metric_in", "rserve_sign",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   );
     991           0 :     /**/                 fd_topob_tile_out(   topo, "rserve",  0UL,                       "rserve_sign",  0UL                                                  );
     992           0 :     /**/                 fd_topob_tile_in (   topo, "rserve",  0UL,          "metric_in", "sign_rserve",  0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
     993           0 :     /**/                 fd_topob_tile_out(   topo, "sign",    0UL,                       "sign_rserve",  0UL                                                  );
     994           0 :   }
     995             : 
     996           0 :   if( FD_LIKELY( failover_enabled ) ) {
     997           0 :     /**/               fd_topob_tile_in (   topo, "sign",    0UL,          "metric_in", "failov_sign",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   );
     998           0 :     /**/               fd_topob_tile_out(   topo, "sign",    0UL,                       "sign_failov",  0UL                                                  );
     999           0 :   }
    1000             : 
    1001           0 :   if( FD_UNLIKELY( rpc_enabled ) ) {
    1002           0 :     fd_topob_link( topo, "rpc_replay", "rpc_replay", 8UL, 0UL, 1UL );
    1003           0 :     fd_topob_tile_out( topo, "rpc", 0UL, "rpc_replay", 0UL );
    1004             : 
    1005           0 :     fd_topob_tile_in( topo, "rpc",    0UL, "metric_in", "replay_slot",  0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
    1006           0 :     fd_topob_tile_in( topo, "rpc",    0UL, "metric_in", "genesi_out",   0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
    1007           0 :     fd_topob_tile_in( topo, "replay", 0UL, "metric_in", "rpc_replay",   0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
    1008           0 :     fd_topob_tile_in( topo, "rpc",    0UL, "metric_in", "gossip_ciaddr", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
    1009           0 :     fd_topob_tile_in( topo, "rpc",    0UL, "metric_in", "replay_epoch", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
    1010           0 :   }
    1011             : 
    1012           0 :   if( FD_UNLIKELY( solcap_enabled ) ) {
    1013           0 :     fd_topob_link( topo, "cap_repl", "solcap", 32UL, SOLCAP_WRITE_ACCOUNT_DATA_MTU, 1UL );
    1014           0 :     fd_topob_tile_out( topo, "replay", 0UL, "cap_repl", 0UL );
    1015           0 :     fd_topob_tile_in( topo, "solcap", 0UL, "metric_in", "cap_repl", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
    1016           0 :     FOR(execrp_tile_cnt) fd_topob_link( topo, "cap_execrp", "solcap", 32UL, SOLCAP_WRITE_ACCOUNT_DATA_MTU, 1UL );
    1017           0 :     FOR(execrp_tile_cnt) fd_topob_tile_out( topo, "execrp", i, "cap_execrp", i );
    1018           0 :     FOR(execrp_tile_cnt) fd_topob_tile_in( topo, "solcap", 0UL, "metric_in", "cap_execrp", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
    1019           0 :   }
    1020             : 
    1021           0 :   if( snapmk_enabled ) {
    1022           0 :     /**/                 fd_topob_tile_out( topo, "replay", 0UL,              "replay_snapmk", 0UL                                     );
    1023           0 :     /**/                 fd_topob_tile_in ( topo, "snapmk", 0UL, "metric_in", "replay_snapmk", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
    1024           0 :     /**/                 fd_topob_tile_in ( topo, "snapmk", 0UL, "metric_in", "snaprd_out",    0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
    1025           0 :     FOR(snapzp_tile_cnt) fd_topob_tile_out( topo, "snapmk", 0UL,              "snapmk_zp",     i                                       );
    1026           0 :     FOR(snapzp_tile_cnt) fd_topob_tile_in ( topo, "snapzp", i,   "metric_in", "snapmk_zp",     i,   FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
    1027           0 :     /**/                 fd_topob_tile_out( topo, "snapmk", 0UL,              "snapmk_out",    0UL                                     );
    1028           0 :     /**/                 fd_topob_tile_out( topo, "snaprd", 0UL,              "snaprd_out",    0UL                                     );
    1029           0 :   }
    1030             : 
    1031           0 :   fd_topo_obj_t * admin_ctl = fd_topob_obj_named( topo, "adminctl", "adminctl", "admin" );
    1032           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, admin_ctl->id, "adminctl" ) );
    1033           0 :   fd_topob_tile_uses( topo, admin_tile, admin_ctl, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1034             : 
    1035             :   /* There is a special fseq that sits between the pack, execle, and poh
    1036             :      tiles to indicate when the execle/poh tiles are done processing a
    1037             :      microblock.  Pack uses this to determine when to "unlock" accounts
    1038             :      that it marked as locked because they were being used. */
    1039             : 
    1040           0 :   for( ulong i=0UL; i<execle_tile_cnt; i++ ) {
    1041           0 :     fd_topo_obj_t * busy_obj = fd_topob_obj( topo, "fseq", "execle_busy" );
    1042             : 
    1043           0 :     fd_topo_tile_t * pack_tile = &topo->tiles[ fd_topo_find_tile( topo, "pack", 0UL ) ];
    1044           0 :     fd_topo_tile_t * execle_tile = &topo->tiles[ fd_topo_find_tile( topo, "execle", i ) ];
    1045           0 :     fd_topob_tile_uses( topo, pack_tile, busy_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
    1046           0 :     fd_topob_tile_uses( topo, execle_tile, busy_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1047           0 :     FD_TEST( fd_pod_insertf_ulong( topo->props, busy_obj->id, "execle_busy.%lu", i ) );
    1048           0 :   }
    1049             : 
    1050             :   /* Repair and shred share a secret they use to generate the nonces.
    1051             :      It's not super security sensitive, but for good hygiene, we make it
    1052             :      an object. */
    1053           0 :   if( 1 /* just restrict the scope for these variables in this big function */ ) {
    1054           0 :     fd_topo_obj_t * rnonce_ss_obj = fd_topob_obj( topo, "rnonce_ss", "rnonce" );
    1055           0 :     fd_topo_tile_t * repair_tile = &topo->tiles[ fd_topo_find_tile( topo, "repair", 0UL ) ];
    1056           0 :     fd_topob_tile_uses( topo, repair_tile, rnonce_ss_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1057           0 :     for( ulong i=0UL; i<shred_tile_cnt; i++ ) {
    1058           0 :       fd_topo_tile_t * shred_tile = &topo->tiles[ fd_topo_find_tile( topo, "shred", i ) ];
    1059           0 :       fd_topob_tile_uses( topo, shred_tile, rnonce_ss_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
    1060           0 :     }
    1061           0 :     FD_TEST( fd_pod_insertf_ulong( topo->props, rnonce_ss_obj->id, "rnonce_ss" ) );
    1062           0 :   }
    1063             : 
    1064             :   /* node_info holds various rarely-changing config that cannot be
    1065             :      represented as simple scalar metrics */
    1066           0 :   fd_topo_obj_t * node_info_obj = fd_topob_obj( topo, "node_info", "replay" );
    1067           0 :   fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], node_info_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1068           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, node_info_obj->id, "node_info" ) );
    1069             : 
    1070             :   /* wait_info holds data for the wait command's safe-restart-window checks */
    1071           0 :   fd_topo_obj_t * wait_info_obj = fd_topob_obj( topo, "wait_info", "replay" );
    1072           0 :   fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], wait_info_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1073           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, wait_info_obj->id, "wait_info" ) );
    1074             : 
    1075           0 :   if( leader_enabled ) {
    1076           0 :     fd_topo_obj_t * ldr_tt_obj = fd_topob_obj( topo, "ldr_tt", "motor" );
    1077           0 :     FD_TEST( fd_pod_insertf_ulong( topo->props, config->limits.max_txn_per_slot, "obj.%lu.max_txn_per_slot", ldr_tt_obj->id ) );
    1078           0 :     fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "motor",  0UL ) ], ldr_tt_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1079           0 :     fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], ldr_tt_obj, FD_SHMEM_JOIN_MODE_READ_ONLY  );
    1080           0 :     FD_TEST( fd_pod_insertf_ulong( topo->props, ldr_tt_obj->id, "ldr_tt" ) );
    1081           0 :   }
    1082             : 
    1083           0 :   ulong min_bank_cache_cnt = fd_ulong_min( execrp_tile_cnt, FD_SCHED_MAX_STAGING_LANES )+2UL;
    1084           0 :   if( FD_UNLIKELY( config->firedancer.runtime.bank_cache_cnt<min_bank_cache_cnt ) ) {
    1085           0 :     FD_LOG_ERR(( "Invalid [runtime]: bank_cache_cnt is %lu, but it must be at least %lu (2 more than the smaller of [layout] "
    1086           0 :                  "execrp_tile_count %lu and %lu replay staging lanes).  Increase [runtime] bank_cache_cnt.",
    1087           0 :                  config->firedancer.runtime.bank_cache_cnt, min_bank_cache_cnt, execrp_tile_cnt, FD_SCHED_MAX_STAGING_LANES ));
    1088           0 :   }
    1089           0 :   fd_topo_obj_t * banks_obj = setup_topo_banks( topo, "banks", config->firedancer.runtime.max_live_slots, config->firedancer.runtime.bank_cache_cnt, config->firedancer.runtime.stake_delegation_cache_cnt, config->development.bench.max_cost_per_block );
    1090           0 :   /**/                 fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1091           0 :   FOR(execrp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i   ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1092           0 :   setup_topo_footer_cache( topo, "banks" );
    1093           0 :   setup_topo_execrp_result( topo, "execrp_replay", execrp_tile_cnt );
    1094           0 :   FOR(execle_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execle", i   ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1095           0 :   FOR(resolv_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "resolv", i   ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_ONLY  );
    1096           0 :   if( snapmk_enabled ) {
    1097           0 :     fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapmk", 0UL ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1098           0 :   }
    1099           0 :   if( FD_LIKELY( snapshots_enabled ) ) {
    1100           0 :     FOR(snapin_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapin", i ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1101           0 :   }
    1102           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, banks_obj->id, "banks" ) );
    1103             : 
    1104           0 :   if( FD_UNLIKELY( config->firedancer.runtime.max_live_slots<32UL ) ) FD_LOG_ERR(( "max_live_slots must be >= 32" ));
    1105             : 
    1106           0 :   setup_topo_progcache( topo, "progcache",
    1107           0 :       config->firedancer.runtime.max_live_slots,
    1108           0 :       config->firedancer.runtime.program_cache_size_mib<<20 );
    1109           0 :   ulong progcache_obj_id; FD_TEST( (progcache_obj_id = fd_pod_query_ulong( topo->props, "progcache", ULONG_MAX ))!=ULONG_MAX );
    1110           0 :   fd_topo_obj_t * progcache_obj = &topo->objs[ progcache_obj_id ];
    1111             : 
    1112           0 :   /**/                 fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], progcache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1113           0 :   /**/                 fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "accdb",  0UL ) ], progcache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1114           0 :   FOR(execrp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i   ) ], progcache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1115           0 :   FOR(execle_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execle", i   ) ], progcache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1116             : 
    1117           0 :   fd_topob_wksp( topo, "bpf_frames" );
    1118           0 :   fd_topo_obj_t * bpf_frames_obj = setup_topo_bpf_frames( topo, "bpf_frames", config->firedancer.runtime.bpf_shared_frames, config->firedancer.runtime.bpf_local_frames, execrp_tile_cnt+execle_tile_cnt );
    1119           0 :   FOR(execrp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i   ) ], bpf_frames_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1120           0 :   FOR(execle_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execle", i   ) ], bpf_frames_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1121             : 
    1122           0 :   if( FD_LIKELY( config->tiles.gui.enabled ) ) {
    1123           0 :     fd_topob_wksp( topo, "gui"        );
    1124             : 
    1125             :     /**/                 fd_topob_tile(     topo, "gui",     "gui",     "metric_in",  tile_to_cpu[ topo->tile_cnt ], 1, 0, 1 );
    1126             : 
    1127             :     /**/                   fd_topob_tile_out( topo, "gossip", 0UL,                        "gossip_gui",    0UL                                                );
    1128           0 :     FOR(gossvf_tile_cnt)   fd_topob_tile_out( topo, "gossvf", i,                          "gossvf_gui",    i                                                  );
    1129             : 
    1130             :     /*                                        topo, tile_name, tile_kind_id, fseq_wksp,   link_name,       link_kind_id, reliable,            polled */
    1131           0 :     FOR(gossvf_tile_cnt)   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "gossvf_gui",    i,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
    1132           0 :     /**/                   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "repair_net",    0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
    1133           0 :     FOR(shred_tile_cnt)    fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "shred_out",     i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1134           0 :     /**/                   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "gossip_gui",    0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
    1135           0 :     /**/                   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "gossip_ciseen", 0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1136           0 :     /**/                   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "replay_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1137           0 :     /**/                   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "replay_epoch",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1138           0 :     /**/                   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "genesi_out",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1139           0 :     /**/                   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "diag_gui",      0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
    1140           0 :     if( leader_enabled ) {
    1141           0 :       /**/                 fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "pack_poh",      0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1142           0 :       FOR(execle_tile_cnt) fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "pack_execle",   i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1143           0 :       FOR(execle_tile_cnt) fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "execle_poh",    i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1144           0 :     }
    1145           0 :     FOR(execrp_tile_cnt)   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "execrp_replay", i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1146             : 
    1147           0 :     if( FD_LIKELY( snapshots_enabled ) ) {
    1148           0 :     /**/                   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "snapct_gui",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1149           0 :     FOR(snapin_tile_cnt)   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "snapin_gui",    i,            FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1150           0 :     /**/                   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "snapin_manif",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1151           0 :     }
    1152           0 :     FOR(snapsv_tile_cnt)   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "snapsv_out",    i,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
    1153           0 :     if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) {
    1154           0 :     /**/                   fd_topob_tile_in(  topo, "gui",    0UL,           "metric_in", "bundle_status", 0UL,         FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1155           0 :     }
    1156           0 :   }
    1157             : 
    1158           0 :   if( FD_LIKELY( failover_enabled ) ) {
    1159           0 :     /**/               fd_topob_tile(       topo, "failov",  "failov",  "metric_in",  tile_to_cpu[ topo->tile_cnt ], 0, 0, 0 );
    1160             : 
    1161           0 :     /**/               fd_topob_tile_in (   topo, "failov",  0UL,          "metric_in", "gossip_ciseen", 0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1162           0 :     /**/               fd_topob_tile_in (   topo, "failov",  0UL,          "metric_in", "admin_failov",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1163           0 :     /**/               fd_topob_tile_out(   topo, "failov",  0UL,                       "failov_admin",  0UL                                                );
    1164           0 :     /**/               fd_topob_tile_in (   topo, "failov",  0UL,          "metric_in", "votor_hist",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1165           0 :     /**/               fd_topob_tile_out(   topo, "failov",  0UL,                       "failov_votor",  0UL                                                );
    1166           0 :     /**/               fd_topob_tile_in (   topo, "failov",  0UL,          "metric_in", "votor_failov",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED );
    1167           0 :     /**/               fd_topob_tile_out(   topo, "failov",  0UL,                       "failov_sign",   0UL                                                );
    1168           0 :     /**/               fd_topob_tile_in (   topo, "failov",  0UL,          "metric_in", "sign_failov",   0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
    1169           0 :   }
    1170           0 :   if( FD_LIKELY( !is_auto_affinity ) ) {
    1171           0 :     if( FD_UNLIKELY( affinity_tile_cnt<topo->tile_cnt ) )
    1172           0 :       FD_LOG_ERR(( "The topology you are using has %lu tiles, but the CPU affinity specified in the config tile as [layout.affinity] only provides for %lu cores. "
    1173           0 :                    "You should either increase the number of cores dedicated to Firedancer in the affinity string, or decrease the number of cores needed by reducing "
    1174           0 :                    "the total tile count. You can reduce the tile count by decreasing individual tile counts in the [layout] section of the configuration file.",
    1175           0 :                    topo->tile_cnt, affinity_tile_cnt ));
    1176           0 :     if( FD_UNLIKELY( affinity_tile_cnt>topo->tile_cnt ) )
    1177           0 :       FD_LOG_WARNING(( "The topology you are using has %lu tiles, but the CPU affinity specified in the config tile as [layout.affinity] provides for %lu cores. "
    1178           0 :                        "Not all cores in the affinity will be used by Firedancer. You may wish to increase the number of tiles in the system by increasing "
    1179           0 :                        "individual tile counts in the [layout] section of the configuration file.",
    1180           0 :                        topo->tile_cnt, affinity_tile_cnt ));
    1181           0 :   } else {
    1182           0 :     ushort blocklist_cores[ FD_TILE_MAX ];
    1183           0 :     topo->blocklist_cores_cnt = fd_topob_parse_affinity_cstr( config->layout.blocklist_cores, blocklist_cores, 0, 0 );
    1184           0 :     if( FD_UNLIKELY( topo->blocklist_cores_cnt>FD_TILE_MAX ) ) {
    1185           0 :       FD_LOG_ERR(( "The CPU string in the configuration file under [layout.blocklist_cores] specifies more CPUs than Firedancer can use. "
    1186           0 :                     "You should reduce the number of CPUs in the excluded cores string." ));
    1187           0 :     }
    1188             : 
    1189           0 :     for( ulong i=0UL; i<topo->blocklist_cores_cnt; i++ ) {
    1190             :       /* Since we use fd_topob_parse_affinity_cstr() like for affinity, the user
    1191             :          may input a string containing `f`. That's parsed correctly, but it's
    1192             :          meaningless for blocklisted cores, so we reject it here.  */
    1193           0 :       if( FD_UNLIKELY( blocklist_cores[ i ]==USHORT_MAX ) ) {
    1194           0 :         FD_LOG_ERR(( "The CPU string in the configuration file under [layout.blocklist_cores] contains invalid values: `f`. "
    1195           0 :                       "You should fix the excluded cores string." ));
    1196           0 :       }
    1197           0 :       topo->blocklist_cores_cpu_idx[ i ] = blocklist_cores[ i ];
    1198           0 :     }
    1199           0 :   }
    1200             : 
    1201             :   /* Alpenglow links and tile connections.  The optional GUI tile has
    1202             :      been created by this point. */
    1203           0 :   /**/               fd_topob_link( topo, "votor_out",     "votor_out",     8192UL,                                   sizeof(fd_votor_msg_t),                        FD_VOTOR_OUT_BURST );
    1204           0 :   /**/               fd_topob_link( topo, "votor_net",     "net_votor",     32768UL,                                  FD_NET_MTU,                                    FD_VOTOR_NET_BURST ); /* as shred_net: fan-out publishes as it goes and rides depth, burst covers only the deferred aio flush */
    1205           0 :   /**/               fd_topob_link( topo, "votor_sign",    "votor_sign",    128UL,                                    FD_KEYGUARD_SIGN_REQ_MTU,                      1UL ); /* TLS 1.3 CertificateVerify payload or vote history file body */
    1206           0 :   /**/               fd_topob_link( topo, "sign_votor",    "sign_votor",    128UL,                                    FD_BLS_SIG_SZ,                                 1UL ); /* ed25519 sig (TLS) or BLS sig (vote) */
    1207           0 :   FOR(net_tile_cnt)  fd_topos_net_rx_link( topo, "net_votor", i, config->net.ingress_buffer_size );
    1208             : 
    1209           0 :   /**/               fd_topob_tile_in (   topo, "votor",  0UL,          "metric_in", "replay_slot",   0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   );
    1210           0 :   /**/               fd_topob_tile_in (   topo, "votor",  0UL,          "metric_in", "replay_epoch",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   );
    1211           0 :   /**/               fd_topob_tile_in (   topo, "votor",  0UL,          "metric_in", "gossip_ciaddr", 0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   );
    1212           0 :   /**/               fd_topob_tile_in (   topo, "votor",  0UL,          "metric_in", "ipecho_out",    0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED   );
    1213           0 :   FOR(net_tile_cnt)  fd_topob_tile_in (   topo, "votor",  0UL,          "metric_in", "net_votor",     i,            FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED   ); /* No reliable consumers of networking fragments, may be dropped or overrun */
    1214             : 
    1215             :   /* Votor's first two outputs must be votor_out and votor_net. */
    1216           0 :   /**/               fd_topob_tile_out(   topo, "votor",  0UL,                       "votor_out",     0UL                                                  );
    1217           0 :   /**/               fd_topob_tile_out(   topo, "votor",  0UL,                       "votor_net",     0UL                                                  );
    1218           0 :   /**/               fd_topos_tile_in_net( topo,                        "metric_in", "votor_net",     0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED   ); /* No reliable consumers of networking fragments, may be dropped or overrun */
    1219             : 
    1220           0 :   /**/               fd_topob_tile_in (   topo, "repair", 0UL,          "metric_in", "votor_out",     0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   ); /* certified blocks to repair */
    1221           0 :   /**/               fd_topob_tile_in (   topo, "replay", 0UL,          "metric_in", "votor_out",     0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   );
    1222           0 :   if( config->tiles.gui.enabled ) {
    1223           0 :     /**/             fd_topob_tile_in (   topo, "gui",    0UL,          "metric_in", "votor_out",     0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   );
    1224           0 :   }
    1225           0 :   if( rpc_enabled ) {
    1226           0 :     /**/             fd_topob_tile_in (   topo, "rpc",    0UL,          "metric_in", "votor_out",     0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   );
    1227           0 :   }
    1228             : 
    1229           0 :   if( FD_LIKELY( failover_enabled ) ) {
    1230           0 :     /**/             fd_topob_tile_in (   topo, "votor",  0UL,          "metric_in", "failov_votor",  0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   );
    1231           0 :     /**/             fd_topob_tile_out(   topo, "votor",  0UL,                       "votor_hist",    0UL                                                  );
    1232           0 :     /**/             fd_topob_tile_out(   topo, "votor",  0UL,                       "votor_failov",  0UL                                                  );
    1233           0 :   }
    1234           0 :   /**/               fd_topob_tile_in (   topo, "sign",   0UL,          "metric_in", "votor_sign",    0UL,          FD_TOPOB_RELIABLE,   FD_TOPOB_POLLED   );
    1235           0 :   /**/               fd_topob_tile_out(   topo, "votor",  0UL,                       "votor_sign",    0UL                                                  );
    1236           0 :   /**/               fd_topob_tile_in (   topo, "votor",  0UL,          "metric_in", "sign_votor",    0UL,          FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
    1237           0 :   /**/               fd_topob_tile_out(   topo, "sign",   0UL,                       "sign_votor",    0UL                                                  );
    1238             : 
    1239             :   /* Grant the admin tile access to every keyswitch object in the
    1240             :      topology for add authorized voters and set identity. */
    1241           0 :   for( ulong i=0UL; i<topo->tile_cnt; i++ ) {
    1242           0 :     if( topo->tiles[ i ].id_keyswitch_obj_id!=ULONG_MAX ) fd_topob_tile_uses( topo, admin_tile, &topo->objs[ topo->tiles[ i ].id_keyswitch_obj_id ], FD_SHMEM_JOIN_MODE_READ_WRITE );
    1243           0 :     if( topo->tiles[ i ].av_keyswitch_obj_id!=ULONG_MAX ) fd_topob_tile_uses( topo, admin_tile, &topo->objs[ topo->tiles[ i ].av_keyswitch_obj_id ], FD_SHMEM_JOIN_MODE_READ_WRITE );
    1244           0 :   }
    1245             : 
    1246           0 :   if( 0==strcmp( config->net.provider, "mlx5" ) || 0==strcmp( config->net.provider, "iavf" ) ) {
    1247           0 :     ulong net_tile_id = fd_topo_find_tile( topo, fd_net_tile_name( config->net.provider ), 0UL );
    1248           0 :     FD_TEST( net_tile_id!=ULONG_MAX );
    1249           0 :     fd_topos_sock_lo( topo, &topo->tiles[ net_tile_id ] );
    1250           0 :   }
    1251             : 
    1252             :   /* Auto layout must run after all fd_topob_tile() calls so every tile gets a blocklist-aware CPU assignment. */
    1253           0 :   if( FD_UNLIKELY( is_auto_affinity ) ) fd_topob_auto_layout( topo );
    1254             : 
    1255           0 :   ulong fec_set_cnt = fd_shred_tile_fec_set_cnt( FD_SHRED_FIREDANCER_FEC_EXPOSURE,
    1256           0 :                                                   config->tiles.shred.max_pending_shred_sets );
    1257           0 :   ulong store_fec_set_cnt = shred_tile_cnt*fec_set_cnt;
    1258             : 
    1259             :   /* store_fec_max is the maximum number of FEC sets Store retains.
    1260             : 
    1261             :       With Alpenglow, Store is sized to repair's window of
    1262             :       N = max_live_slots slots, each of which can hold up to
    1263             :       fec_sets_per_slot FEC sets per version of its block.  The number of versions in the window
    1264             :       is bounded as follows.
    1265             : 
    1266             :       Assume 20% of stake is malicious, every malicious leader
    1267             :       equivocates FD_VOTOR_EQVOC_MAX (7) versions of each of its
    1268             :       slots, and honest leaders produce one.  The expected number of
    1269             :       versions is then (0.8 + 0.2*7)*N = 2.2*N.  In general, bounding
    1270             :       P(V > budget) to z standard deviations needs a budget of
    1271             :       ~N*(2.2 + 4.8*z/sqrt(N)).
    1272             : 
    1273             :       We size for 2.5*N (the same factor fd_repair_footprint sizes its
    1274             :       blk pool with), which leaves 0.3*N of headroom, ie.
    1275             :       ~0.0625*sqrt(N) standard deviations.  The probability that a
    1276             :       window holds more than 2.5*N versions is:
    1277             : 
    1278             :         N =  2048  ~2.5e-3
    1279             :         N =  4096  ~4.2e-5
    1280             :         N = 30000  ~3e-26
    1281             : 
    1282             :       This is for a uniformly random window.  The leader schedule is
    1283             :       known an epoch in advance, so an adversary can target the densest
    1284             :       window in the epoch, which is somewhat worse.
    1285             : 
    1286             :       Fixed 32-data-shred sets need 1024 FEC sets per slot; legacy
    1287             :       variable sets can contain one data shred and need up to 32768. */
    1288             : 
    1289           0 :   ulong fec_sets_per_slot = fd_ulong_if( config->firedancer.development.fixed_fec_sets,
    1290           0 :                                          config->limits.max_shreds_per_block/FD_FEC_SHRED_CNT, config->limits.max_shreds_per_block );
    1291           0 :   ulong store_fec_max = ( 5UL*config->firedancer.runtime.max_live_slots+1UL )/2UL * fec_sets_per_slot; /* every FEC set of every blk repair holds */
    1292             : 
    1293             :   /* 32 shreds * 995 payload bytes = 31840 bytes with fixed_fec_sets = true
    1294             :      67 shreds * 955 payload bytes = 63985 bytes with fixed_fec_sets = false */
    1295             : 
    1296           0 :   ulong store_fec_data_max = fd_ulong_if( config->firedancer.development.fixed_fec_sets, 31840UL, 63985UL );
    1297           0 :   fd_topo_obj_t * store_obj = setup_topo_store( topo, "store", store_fec_max, store_fec_data_max,
    1298           0 :                                                 rserve_enabled ? config->tiles.rserve.shred_storage_limit_gib : 0UL,
    1299           0 :                                                 config->tiles.shred.shred_cache_size_mib,
    1300           0 :                                                 store_fec_set_cnt,
    1301           0 :                                                 config->limits.max_shreds_per_block,
    1302           0 :                                                 config->paths.shredb,
    1303           0 :                                                 shred_tile_cnt );
    1304           0 :   FOR(shred_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "shred", i ) ], store_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1305           0 :   fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], store_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1306           0 :   fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "repair", 0UL ) ], store_obj, FD_SHMEM_JOIN_MODE_READ_WRITE ); /* repair */
    1307           0 :   if( rserve_enabled ) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "rserve", 0UL ) ], store_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1308           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, store_obj->id, "store" ) );
    1309             : 
    1310           0 :   fd_topo_obj_t * txncache_obj = setup_topo_txncache( topo, "txncache", config->firedancer.runtime.max_live_slots, 2UL*config->limits.max_txn_per_slot /* sig + message hash */, config->firedancer.runtime.transaction_cache_size_mib<<20 );
    1311           0 :   fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], txncache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1312           0 :   if( FD_LIKELY( snapshots_enabled ) ) {
    1313           0 :     fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapin", 0UL ) ], txncache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1314           0 :   }
    1315           0 :   if( snapmk_enabled ) {
    1316           0 :     fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapmk", 0UL ) ], txncache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1317           0 :   }
    1318           0 :   FOR(execle_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execle", i ) ], txncache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1319           0 :   FOR(execrp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i ) ], txncache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1320           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, txncache_obj->id, "txncache" ) );
    1321             : 
    1322             :   /* Snapin and genesi are mutually exclusive accdb writers. */
    1323           0 :   ulong accdb_joiners = 3UL+execle_tile_cnt+execrp_tile_cnt+resolv_tile_cnt
    1324           0 :                       + fd_ulong_if( snapshots_enabled, snapin_tile_cnt, 1UL );
    1325           0 :   ulong partition_sz = config->development.accdb.partition_size_gib*(1UL<<30UL);
    1326           0 :   fd_topo_obj_t * accdb_obj = setup_topo_accdb( topo, "accdb_data",
    1327           0 :       config->firedancer.accounts.max_accounts,
    1328           0 :       config->firedancer.runtime.max_live_slots,
    1329           0 :       FD_RUNTIME_MAX_ACC_WRITES_PER_SLOT,
    1330           0 :       8192UL,
    1331           0 :       partition_sz,
    1332           0 :       config->firedancer.accounts.cache_size_gib*(1UL<<30UL),
    1333           0 :       config->tiles.bundle.enabled,
    1334           0 :       accdb_joiners,
    1335           0 :       snapmk_enabled ? config->firedancer.snapshots.max_incremental_snapshot_accounts : 0UL );
    1336           0 :   fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "accdb", 0UL ) ], accdb_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1337           0 :   fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], accdb_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1338           0 :   if( FD_UNLIKELY( !snapshots_enabled ) ) {
    1339           0 :     fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "genesi", 0UL ) ], accdb_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1340           0 :   }
    1341           0 :   if( FD_LIKELY( snapshots_enabled ) ) {
    1342           0 :     fd_topo_obj_t * shmem_obj = fd_topob_obj( topo, "snapin_shmem", "snapin_shmem" );
    1343           0 :     FD_TEST( fd_pod_insertf_ulong( topo->props, shmem_obj->id, "snapin_shmem" ) );
    1344             : 
    1345           0 :     fd_topo_obj_t * dc_ticket_obj = fd_topob_obj_named( topo, "fseq", "snapdc", "frame_ticket" );
    1346           0 :     FOR(snapdc_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapdc", i ) ], dc_ticket_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1347             : 
    1348           0 :     FOR(snapin_tile_cnt) {
    1349           0 :       fd_topo_tile_t * snapin_tile = &topo->tiles[ fd_topo_find_tile( topo, "snapin", i ) ];
    1350           0 :       fd_topob_tile_uses( topo, snapin_tile, accdb_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1351           0 :       fd_topob_tile_uses( topo, snapin_tile, shmem_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1352           0 :     }
    1353           0 :   }
    1354           0 :   fd_topo_obj_t * backup_obj = NULL;
    1355           0 :   if( snapmk_enabled ) {
    1356           0 :     ulong backup_obj_id = fd_pod_query_ulong( topo->props, "backup", ULONG_MAX );
    1357           0 :     FD_TEST( backup_obj_id!=ULONG_MAX );
    1358           0 :     backup_obj = &topo->objs[ backup_obj_id ];
    1359             : 
    1360           0 :     fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapmk", 0UL ) ], accdb_obj,       FD_SHMEM_JOIN_MODE_READ_WRITE );
    1361           0 :     fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapmk", 0UL ) ], zp_fseq,         FD_SHMEM_JOIN_MODE_READ_WRITE );
    1362           0 :     fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapmk", 0UL ) ], backup_obj,  FD_SHMEM_JOIN_MODE_READ_WRITE );
    1363           0 :     fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snaprd", 0UL ) ], accdb_obj,       FD_SHMEM_JOIN_MODE_READ_ONLY  );
    1364           0 :   }
    1365           0 :   FOR(snapzp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapzp", i ) ], accdb_obj,       FD_SHMEM_JOIN_MODE_READ_ONLY  );
    1366           0 :   FOR(snapzp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapzp", i ) ], zp_fseq,         FD_SHMEM_JOIN_MODE_READ_WRITE );
    1367           0 :   FOR(snapzp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapzp", i ) ], backup_obj,  FD_SHMEM_JOIN_MODE_READ_WRITE );
    1368           0 :   if( snapmk_enabled ) {
    1369           0 :     ulong snaprd_out_link_id = fd_topo_find_link( topo, "snaprd_out", 0UL );
    1370           0 :     FD_TEST( snaprd_out_link_id!=ULONG_MAX );
    1371           0 :     fd_topo_obj_t * snaprd_out_dcache_obj = &topo->objs[ topo->links[ snaprd_out_link_id ].dcache_obj_id ];
    1372           0 :     FOR(snapzp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapzp", i ) ], snaprd_out_dcache_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
    1373           0 :   }
    1374             : 
    1375           0 :   FOR(execle_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execle", i ) ], accdb_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1376           0 :   FOR(execrp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i ) ], accdb_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1377           0 :   if( FD_UNLIKELY( rpc_enabled ) ) {
    1378           0 :     fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "rpc", 0UL ) ], accdb_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
    1379           0 :   }
    1380           0 :   FOR(resolv_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "resolv", i ) ], accdb_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
    1381           0 :   if( FD_LIKELY( config->tiles.gui.enabled ) ) {
    1382           0 :     fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "gui", 0UL ) ], accdb_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
    1383           0 :   }
    1384           0 :   FD_TEST( fd_pod_insertf_ulong( topo->props, accdb_obj->id, "accdb" ) );
    1385             : 
    1386             :   /* Each shred tile publishes the highest slot it relayed on turbine
    1387             :      (getMaxRetransmitSlot) into an fseq that rpc reads on request. */
    1388           0 :   if( FD_UNLIKELY( rpc_enabled ) ) {
    1389           0 :     fd_topo_tile_t * rpc_tile = &topo->tiles[ fd_topo_find_tile( topo, "rpc", 0UL ) ];
    1390           0 :     FOR(shred_tile_cnt) {
    1391           0 :       fd_topo_obj_t * fseq_obj = fd_topob_obj( topo, "fseq", "metric" );
    1392           0 :       fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "shred", i ) ], fseq_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1393           0 :       fd_topob_tile_uses( topo, rpc_tile,                                              fseq_obj, FD_SHMEM_JOIN_MODE_READ_ONLY  );
    1394           0 :       FD_TEST( fd_pod_insertf_ulong( topo->props, fseq_obj->id, "shred_rtx.%lu", i ) );
    1395           0 :     }
    1396           0 :   }
    1397             : 
    1398             :   /* Per-RO-joiner accdb epoch fseq objects.  Each read-only accdb
    1399             :      consumer (e.g. the rpc tile) owns a small fseq that it writes its
    1400             :      current epoch into, so that the accdb compaction tile can defer
    1401             :      partition reclamation while the RO consumer is mid-read.  The
    1402             :      accdb tile maps each of these fseqs read-only and passes the
    1403             :      pointer array to fd_accdb_new via external_epoch_slots[]. */
    1404           0 :   if( FD_UNLIKELY( rpc_enabled ) ) {
    1405           0 :     fd_topo_obj_t * fseq_obj = fd_topob_obj( topo, "fseq", "metric" );
    1406           0 :     fd_topo_tile_t * rpc_tile   = &topo->tiles[ fd_topo_find_tile( topo, "rpc",   0UL ) ];
    1407           0 :     fd_topo_tile_t * accdb_tile = &topo->tiles[ fd_topo_find_tile( topo, "accdb", 0UL ) ];
    1408           0 :     fd_topob_tile_uses( topo, rpc_tile,   fseq_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1409           0 :     fd_topob_tile_uses( topo, accdb_tile, fseq_obj, FD_SHMEM_JOIN_MODE_READ_ONLY  );
    1410           0 :     FD_TEST( fd_pod_insertf_ulong( topo->props, fseq_obj->id, "accdb_epoch.rpc" ) );
    1411           0 :   }
    1412           0 :   for( ulong i=0UL; i<resolv_tile_cnt; i++ ) {
    1413           0 :     fd_topo_obj_t * fseq_obj = fd_topob_obj( topo, "fseq", "metric" );
    1414           0 :     fd_topo_tile_t * resolv_tile = &topo->tiles[ fd_topo_find_tile( topo, "resolv", i   ) ];
    1415           0 :     fd_topo_tile_t * accdb_tile  = &topo->tiles[ fd_topo_find_tile( topo, "accdb",  0UL ) ];
    1416           0 :     fd_topob_tile_uses( topo, resolv_tile, fseq_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1417           0 :     fd_topob_tile_uses( topo, accdb_tile,  fseq_obj, FD_SHMEM_JOIN_MODE_READ_ONLY  );
    1418           0 :     FD_TEST( fd_pod_insertf_ulong( topo->props, fseq_obj->id, "accdb_epoch.resolv.%lu", i ) );
    1419           0 :   }
    1420           0 :   for( ulong i=0UL; i<snapzp_tile_cnt; i++ ) {
    1421           0 :     fd_topo_obj_t * fseq_obj = fd_topob_obj( topo, "fseq", "metric" );
    1422           0 :     fd_topo_tile_t * snapzp_tile = &topo->tiles[ fd_topo_find_tile( topo, "snapzp", i   ) ];
    1423           0 :     fd_topo_tile_t * accdb_tile  = &topo->tiles[ fd_topo_find_tile( topo, "accdb",  0UL ) ];
    1424           0 :     fd_topob_tile_uses( topo, snapzp_tile, fseq_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1425           0 :     fd_topob_tile_uses( topo, accdb_tile,  fseq_obj, FD_SHMEM_JOIN_MODE_READ_ONLY  );
    1426           0 :     FD_TEST( fd_pod_insertf_ulong( topo->props, fseq_obj->id, "accdb_epoch.snapzp.%lu", i ) );
    1427           0 :   }
    1428           0 :   if( snapmk_enabled ) {
    1429           0 :     fd_topo_obj_t * fseq_obj = fd_topob_obj( topo, "fseq", "metric" );
    1430           0 :     fd_topo_tile_t * snapmk_tile = &topo->tiles[ fd_topo_find_tile( topo, "snapmk", 0UL ) ];
    1431           0 :     fd_topo_tile_t * accdb_tile  = &topo->tiles[ fd_topo_find_tile( topo, "accdb",  0UL ) ];
    1432           0 :     fd_topob_tile_uses( topo, snapmk_tile, fseq_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
    1433           0 :     fd_topob_tile_uses( topo, accdb_tile,  fseq_obj, FD_SHMEM_JOIN_MODE_READ_ONLY  );
    1434           0 :     FD_TEST( fd_pod_insert_ulong( topo->props, "accdb_epoch.snapmk", fseq_obj->id ) );
    1435           0 :   }
    1436             : 
    1437           0 :   fd_pod_insert_int( topo->props, "sandbox", config->development.sandbox ? 1 : 0 );
    1438             : 
    1439           0 :   fd_topob_waker( topo );
    1440             : 
    1441           0 :   fd_topob_sleep_finish( topo );
    1442             : 
    1443           0 :   for( ulong i=0UL; i<topo->tile_cnt; i++ ) {
    1444           0 :     fd_topo_configure_tile( &topo->tiles[ i ], config );
    1445           0 :     if( FD_UNLIKELY( !strcmp( topo->tiles[ i ].name, "gui" ) ) ) topo->tiles[ i ].gui.tile_cnt = topo->tile_cnt;
    1446           0 :     if( FD_UNLIKELY( ( !strcmp( topo->tiles[ i ].name, "net" ) || !strcmp( topo->tiles[ i ].name, "sock" ) || !strcmp( topo->tiles[ i ].name, "mlx5" ) || !strcmp( topo->tiles[ i ].name, "iavf" ) ) ) ) {
    1447           0 :       topo->tiles[ i ].net.votor_quic_client_listen_port = config->firedancer.development.votor.quic_client_listen_port;
    1448           0 :       topo->tiles[ i ].net.votor_quic_server_listen_port = config->firedancer.development.votor.quic_server_listen_port;
    1449           0 :     }
    1450           0 :   }
    1451             : 
    1452           0 :   if( FD_LIKELY( telemetry_enabled ) ) {
    1453           0 :     wire_event_links( topo );
    1454           0 :     wire_replay_diff_link( topo );
    1455             : 
    1456           0 :     fd_topo_tile_t * event_tile = &topo->tiles[ fd_topo_find_tile( topo, "event", 0UL ) ];
    1457           0 :     for( ulong i=0UL; i<topo->tile_cnt; i++ ) {
    1458           0 :       fd_topob_tile_uses( topo, event_tile, &topo->objs[ topo->tiles[ i ].metrics_obj_id ], FD_SHMEM_JOIN_MODE_READ_ONLY );
    1459           0 :     }
    1460           0 :   }
    1461             : 
    1462           0 :   if( FD_LIKELY( telemetry_enabled ) ) {
    1463           0 :     topo->resolved_config_json_len = fd_config_to_json( config, topo->resolved_config_json, sizeof(topo->resolved_config_json) );
    1464           0 :     topo->user_config_json_len     = fd_config_user_toml_to_json( config, topo->user_config_json, sizeof(topo->user_config_json) );
    1465           0 :   }
    1466             : 
    1467           0 :   FOR(net_tile_cnt) fd_topos_net_tile_finish( topo, i );
    1468           0 :   fd_topob_finish( topo, CALLBACKS );
    1469           0 :   config->topo = *topo;
    1470           0 : }
    1471             : 
    1472             : static void
    1473             : parse_listen_addr( char const *    cstr,
    1474             :                    char const *    key,
    1475           0 :                    fd_ip6_addr_t * out ) {
    1476           0 :   if( FD_UNLIKELY( !fd_cstr_to_ip46_addr( cstr, out ) ) )
    1477           0 :     FD_LOG_ERR(( "[%s] `%s` is not a valid IPv4 or IPv6 address", key, cstr ));
    1478           0 :   if( FD_UNLIKELY( fd_ip6_addr_is_scoped( out->addr ) && !out->scope_id ) )
    1479           0 :     FD_LOG_ERR(( "[%s] `%s` is scoped to a network interface, which must be named by a "
    1480           0 :                  "zone ID (e.g. `%s%%eth0`)", key, cstr, cstr ));
    1481           0 : }
    1482             : 
    1483             : static int
    1484           0 : wfs_hash_is_zero( fd_config_t const * config ) {
    1485           0 :   return !strcmp( config->firedancer.consensus.wait_for_supermajority_with_bank_hash, "" );
    1486           0 : }
    1487             : 
    1488             : static void
    1489             : wfs_decode_bank_hash( fd_config_t const * config,
    1490           0 :                       fd_hash_t *         out ) {
    1491           0 :   if( FD_LIKELY( wfs_hash_is_zero( config ) ) ) {
    1492           0 :     memset( out->uc, 0, sizeof(fd_hash_t) );
    1493           0 :   } else if( FD_UNLIKELY( !fd_base58_decode_32( config->firedancer.consensus.wait_for_supermajority_with_bank_hash, out->uc ) ) ) {
    1494           0 :     FD_LOG_ERR(( "[consensus.wait_for_supermajority_with_bank_hash] failed to parse" ));
    1495           0 :   }
    1496           0 : }
    1497             : 
    1498             : void
    1499             : fd_topo_configure_tile( fd_topo_tile_t * tile,
    1500           0 :                         fd_config_t *    config ) {
    1501             :   /* With [failover.boot_to_standby] every tile boots under the junk key
    1502             :      generated at boot, and [paths.identity_key] is only the identity
    1503             :      failover hands off.  The sign and failov tiles get that path too,
    1504             :      they load the failover identity from it. */
    1505           0 :   int          boot_to_standby   = config->firedancer.failover.boot_to_standby;
    1506           0 :   char const * identity_key_path = boot_to_standby ? FD_KEYLOAD_FAILOVER_JUNK : config->paths.identity_key;
    1507             : 
    1508           0 :   if( FD_UNLIKELY( !strcmp( tile->name, "metric" ) ) ) {
    1509             : 
    1510           0 :     if( FD_UNLIKELY( !fd_cstr_to_ip4_addr( config->tiles.metric.prometheus_listen_address, &tile->metric.prometheus_listen_addr ) ) )
    1511           0 :       FD_LOG_ERR(( "failed to parse prometheus listen address `%s`", config->tiles.metric.prometheus_listen_address ));
    1512           0 :     tile->metric.prometheus_listen_port = config->tiles.metric.prometheus_listen_port;
    1513             : 
    1514           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "event" ) ) ) {
    1515             : 
    1516           0 :     fd_cstr_ncpy( tile->event.identity_key_path, identity_key_path, sizeof(tile->event.identity_key_path) );
    1517           0 :     fd_cstr_ncpy( tile->event.url, config->tiles.event.url, sizeof(tile->event.url) );
    1518           0 :     tile->event.tx_rate_mbps = config->development.event.max_upload_rate_mbps;
    1519           0 :     fd_cstr_ncpy( tile->event.action, config->action, sizeof(tile->event.action) );
    1520           0 :     FD_TEST( fd_cstr_printf_check( tile->event.accounts_path,  sizeof(tile->event.accounts_path),  NULL, "%s", config->paths.accounts  ) );
    1521           0 :     FD_TEST( fd_cstr_printf_check( tile->event.snapshots_path, sizeof(tile->event.snapshots_path), NULL, "%s", config->paths.snapshots ) );
    1522           0 :     FD_TEST( fd_cstr_printf_check( tile->event.log_path,       sizeof(tile->event.log_path),       NULL, "%s", config->log.path        ) );
    1523           0 :     FD_TEST( fd_cstr_printf_check( tile->event.shredb_path,    sizeof(tile->event.shredb_path),    NULL, "%s", config->paths.shredb    ) );
    1524           0 :     FD_TEST( fd_cstr_printf_check( tile->event.guidb_path,     sizeof(tile->event.guidb_path),     NULL, "%s", config->paths.guidb     ) );
    1525           0 :     FD_TEST( fd_cstr_printf_check( tile->event.net_interface,  sizeof(tile->event.net_interface),  NULL, "%s", config->net.interface   ) );
    1526           0 :     tile->event.boot_timestamp_nanos = config->boot_timestamp_nanos;
    1527           0 :     fd_memcpy( tile->event.launch_cpus, config->launch_cpus, sizeof(tile->event.launch_cpus) );
    1528           0 :     FD_TEST( fd_cstr_printf_check( tile->event.launch_cgroup, sizeof(tile->event.launch_cgroup), NULL, "%s", config->launch_cgroup ) );
    1529             : 
    1530           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "net"   ) ||
    1531           0 :                           !strcmp( tile->name, "sock"  ) ||
    1532           0 :                           !strcmp( tile->name, "mlx5" ) ||
    1533           0 :                           !strcmp( tile->name, "iavf" ) ) ) {
    1534             : 
    1535           0 :     tile->net.shred_listen_port                = config->tiles.shred.shred_listen_port;
    1536           0 :     if( config->firedancer.layout.enable_block_production ) {
    1537           0 :       tile->net.quic_transaction_listen_port   = config->tiles.quic.quic_transaction_listen_port;
    1538           0 :       tile->net.legacy_transaction_listen_port = config->tiles.quic.regular_transaction_listen_port;
    1539           0 :     }
    1540           0 :     tile->net.gossip_listen_port               = config->gossip.port;
    1541           0 :     tile->net.repair_client_listen_port        = config->tiles.repair.repair_client_listen_port;
    1542           0 :     tile->net.repair_serve_listen_port         = fd_ushort_if( config->tiles.rserve.enabled, config->tiles.rserve.repair_serve_listen_port, 0 );
    1543             : 
    1544           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "netlnk" ) ) ) {
    1545             : 
    1546           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "ipecho") ) ) {
    1547             : 
    1548           0 :     tile->ipecho.expected_shred_version = config->consensus.expected_shred_version;
    1549           0 :     tile->ipecho.bind_address           = config->net.ip_addr;
    1550           0 :     tile->ipecho.bind_port              = config->gossip.port;
    1551           0 :     tile->ipecho.entrypoints_cnt        = config->gossip.entrypoints_cnt;
    1552           0 :     for( ulong i=0UL; i<tile->ipecho.entrypoints_cnt; i++ )
    1553           0 :       fd_cstr_ncpy( tile->ipecho.entrypoints[ i ], config->gossip.entrypoints[ i ], sizeof(tile->ipecho.entrypoints[ i ]) );
    1554             : 
    1555           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "genesi" ) ) ) {
    1556             : 
    1557           0 :     tile->genesi.validate_genesis_hash = config->firedancer.development.genesis.validate_genesis_hash;
    1558           0 :     tile->genesi.allow_download = config->firedancer.snapshots.genesis_download;
    1559           0 :     fd_cstr_ncpy( tile->genesi.genesis_path, config->paths.genesis, sizeof(tile->genesi.genesis_path) );
    1560           0 :     tile->genesi.expected_shred_version = config->consensus.expected_shred_version;
    1561           0 :     tile->genesi.entrypoints_cnt        = config->gossip.entrypoints_cnt;
    1562           0 :     for( ulong i=0UL; i<tile->genesi.entrypoints_cnt; i++ )
    1563           0 :       fd_cstr_ncpy( tile->genesi.entrypoints[ i ], config->gossip.entrypoints[ i ], sizeof(tile->genesi.entrypoints[ i ]) );
    1564             : 
    1565           0 :     tile->genesi.has_expected_genesis_hash = !!strcmp( config->consensus.expected_genesis_hash, "" );
    1566             : 
    1567           0 :     if( FD_UNLIKELY( strcmp( config->consensus.expected_genesis_hash, "" ) && !fd_base58_decode_32( config->consensus.expected_genesis_hash, tile->genesi.expected_genesis_hash ) ) ) {
    1568           0 :       FD_LOG_ERR(( "failed to decode [consensus.expected_genesis_hash] \"%s\" as base58", config->consensus.expected_genesis_hash ));
    1569           0 :     }
    1570             : 
    1571           0 :     tile->genesi.target_gid      = config->gid;
    1572           0 :     tile->genesi.target_uid      = config->uid;
    1573             : 
    1574           0 :     tile->genesi.max_live_slots   = config->firedancer.runtime.max_live_slots;
    1575           0 :     tile->genesi.accdb_obj_id     = fd_pod_query_ulong( config->topo.props, "accdb", ULONG_MAX );
    1576           0 :     tile->genesi.max_message_size = config->firedancer.development.genesis.max_file_size_mib << 20;
    1577           0 :     FD_TEST( tile->genesi.accdb_obj_id!=ULONG_MAX );
    1578             : 
    1579           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "admin" ) ) ) {
    1580             : 
    1581           0 :     fd_cstr_ncpy( tile->admin.identity_key_path, identity_key_path, sizeof(tile->admin.identity_key_path) );
    1582             : 
    1583           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "failov" ) ) ) {
    1584             : 
    1585           0 :     fd_cstr_ncpy( tile->failov.identity_key_path, identity_key_path,           sizeof(tile->failov.identity_key_path) );
    1586           0 :     fd_cstr_ncpy( tile->failov.target_key_path,   config->paths.identity_key,  sizeof(tile->failov.target_key_path)   );
    1587           0 :     tile->failov.listen = config->firedancer.failover.enabled;
    1588           0 :     if( FD_UNLIKELY( tile->failov.listen && !fd_cstr_to_ip4_addr( config->firedancer.failover.listen_address, &tile->failov.listen_addr ) ) )
    1589           0 :       FD_LOG_ERR(( "[failover.listen_address] `%s` must be an IPv4 address, host names are not accepted", config->firedancer.failover.listen_address ));
    1590           0 :     tile->failov.port = config->firedancer.failover.listen_port;
    1591           0 :     fd_cstr_ncpy( tile->failov.gossip_host, config->firedancer.gossip.host, sizeof(tile->failov.gossip_host) );
    1592           0 :     tile->failov.gossip_addr.addr = config->net.ip_addr;
    1593           0 :     tile->failov.gossip_addr.port = fd_ushort_bswap( config->gossip.port );
    1594             : 
    1595           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "gossvf") ) ) {
    1596             : 
    1597           0 :     fd_cstr_ncpy( tile->gossvf.identity_key_path, identity_key_path, sizeof(tile->gossvf.identity_key_path) );
    1598           0 :     tile->gossvf.tcache_depth          = 1<<22UL; /* TODO: user defined option */
    1599           0 :     tile->gossvf.shred_version         = 0U;
    1600           0 :     tile->gossvf.allow_private_address = config->development.gossip.allow_private_address;
    1601           0 :     tile->gossvf.boot_timestamp_nanos   = config->boot_timestamp_nanos;
    1602             : 
    1603           0 :     tile->gossvf.entrypoints_cnt = config->gossip.entrypoints_cnt;
    1604           0 :     for( ulong i=0UL; i<tile->gossvf.entrypoints_cnt; i++ ) {
    1605           0 :       fd_cstr_ncpy( tile->gossvf.entrypoints[ i ], config->gossip.entrypoints[ i ], sizeof(tile->gossvf.entrypoints[ i ]) );
    1606           0 :     }
    1607             : 
    1608           0 :     fd_cstr_ncpy( tile->gossvf.gossip_host, config->firedancer.gossip.host, sizeof(tile->gossvf.gossip_host) );
    1609           0 :     tile->gossvf.gossip_addr.addr = config->net.ip_addr;
    1610           0 :     tile->gossvf.gossip_addr.port = fd_ushort_bswap( config->gossip.port );
    1611             : 
    1612           0 :     tile->gossvf.src_addr.addr = config->net.ip_addr;
    1613           0 :     tile->gossvf.src_addr.port = fd_ushort_bswap( config->gossip.port );
    1614             : 
    1615           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "gossip" ) ) ) {
    1616             : 
    1617           0 :     fd_cstr_ncpy( tile->gossip.gossip_host, config->firedancer.gossip.host, sizeof(tile->gossip.gossip_host) );
    1618           0 :     tile->gossip.net_ip_addr            = config->net.ip_addr;
    1619           0 :     tile->gossip.ip_addr                = config->net.ip_addr;
    1620           0 :     tile->gossip.bind_ip_addr           = config->net.ip_addr;
    1621           0 :     fd_cstr_ncpy( tile->gossip.identity_key_path, identity_key_path, sizeof(tile->gossip.identity_key_path) );
    1622           0 :     tile->gossip.expected_shred_version = config->consensus.expected_shred_version;
    1623           0 :     tile->gossip.max_entries            = config->tiles.gossip.max_entries;
    1624           0 :     tile->gossip.boot_timestamp_nanos   = config->boot_timestamp_nanos;
    1625             : 
    1626           0 :     tile->gossip.wait_for_supermajority_at_slot      = config->firedancer.consensus.wait_for_supermajority_at_slot;
    1627           0 :     tile->gossip.wait_for_supermajority_hash_is_zero = wfs_hash_is_zero( config );
    1628             : 
    1629           0 :     tile->gossip.ports.gossip           = config->gossip.port;
    1630           0 :     tile->gossip.ports.tvu              = config->tiles.shred.shred_listen_port;
    1631           0 :     tile->gossip.ports.tpu              = config->tiles.quic.regular_transaction_listen_port;
    1632           0 :     tile->gossip.ports.tpu_quic         = config->tiles.quic.quic_transaction_listen_port;
    1633           0 :     tile->gossip.ports.repair           = config->tiles.repair.repair_client_listen_port;
    1634           0 :     tile->gossip.ports.rserve           = fd_ushort_if( config->tiles.rserve.enabled, config->tiles.rserve.repair_serve_listen_port, 0 );
    1635           0 :     tile->gossip.ports.votor            = config->firedancer.development.votor.quic_server_listen_port;
    1636             : 
    1637             :     /* Peers download snapshots through the rpc port, which redirects
    1638             :        to the snapshot server.  We advertise an IPv4 address, so both
    1639             :        must take IPv4 connections from other hosts. */
    1640           0 :     tile->gossip.ports.rpc = 0;
    1641           0 :     int snapsv_enabled = fd_topo_find_tile( &config->topo, "snapsv", 0UL )!=ULONG_MAX;
    1642           0 :     if( config->tiles.rpc.enabled && snapsv_enabled ) {
    1643           0 :       char const * rpc_address    = config->tiles.rpc.rpc_listen_address;
    1644           0 :       char const * snapsv_address = config->firedancer.snapshots.server.http_listen_address;
    1645           0 :       if( !snapsv_address[0] ) snapsv_address = rpc_address;
    1646             : 
    1647           0 :       fd_ip6_addr_t rpc_addr;
    1648           0 :       fd_ip6_addr_t snapsv_addr;
    1649           0 :       parse_listen_addr( rpc_address,    "tiles.rpc.rpc_listen_address",         &rpc_addr    );
    1650           0 :       parse_listen_addr( snapsv_address, "snapshots.server.http_listen_address", &snapsv_addr );
    1651             : 
    1652             :       /* An IPv4 address or the IPv6 wildcard takes IPv4 connections. */
    1653           0 :       int rpc_takes_ip4    = fd_ip6_addr_is_ip4_mapped( rpc_addr.addr    ) || fd_ip6_addr_is_unspecified( rpc_addr.addr    );
    1654           0 :       int snapsv_takes_ip4 = fd_ip6_addr_is_ip4_mapped( snapsv_addr.addr ) || fd_ip6_addr_is_unspecified( snapsv_addr.addr );
    1655           0 :       int any_loopback     = fd_ip6_addr_is_loopback( rpc_addr.addr ) || fd_ip6_addr_is_loopback( snapsv_addr.addr );
    1656           0 :       if( rpc_takes_ip4 && snapsv_takes_ip4 && !any_loopback ) {
    1657           0 :         tile->gossip.ports.rpc = (ushort)config->tiles.rpc.rpc_listen_port;
    1658           0 :       }
    1659           0 :     }
    1660             : 
    1661           0 :     tile->gossip.entrypoints_cnt        = config->gossip.entrypoints_cnt;
    1662           0 :     for( ulong i=0UL; i<tile->gossip.entrypoints_cnt; i++ ) {
    1663           0 :       fd_cstr_ncpy( tile->gossip.entrypoints[ i ], config->gossip.entrypoints[ i ], sizeof(tile->gossip.entrypoints[ i ]) );
    1664           0 :     }
    1665             : 
    1666           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "snapct" ) ) ) {
    1667             : 
    1668           0 :     fd_memcpy( tile->snapct.snapshots_path, config->paths.snapshots, PATH_MAX );
    1669           0 :     tile->snapct.entrypoints_cnt = fd_ulong_min( config->gossip.entrypoints_cnt, FD_TOPO_GOSSIP_ENTRYPOINTS_MAX );
    1670           0 :     for( ulong i=0UL; i<tile->snapct.entrypoints_cnt; i++ ) {
    1671           0 :       fd_cstr_ncpy( tile->snapct.entrypoints[ i ], config->gossip.entrypoints[ i ], sizeof(tile->snapct.entrypoints[ i ]) );
    1672           0 :     }
    1673           0 :     tile->snapct.sources.max_local_full_effective_age = config->firedancer.snapshots.sources.max_local_full_effective_age;
    1674           0 :     tile->snapct.sources.max_local_incremental_age    = config->firedancer.snapshots.sources.max_local_incremental_age;
    1675           0 :     tile->snapct.incremental_snapshots                = config->firedancer.snapshots.incremental_snapshots;
    1676           0 :     tile->snapct.max_full_snapshots_to_keep           = config->firedancer.snapshots.max_full_snapshots_to_keep;
    1677           0 :     tile->snapct.max_incremental_snapshots_to_keep    = config->firedancer.snapshots.max_incremental_snapshots_to_keep;
    1678           0 :     tile->snapct.max_retry_abort                      = config->firedancer.snapshots.max_retry_abort;
    1679           0 :     tile->snapct.wait_for_peers_timeout_nanos         = (long)( config->firedancer.snapshots.wait_for_peers_timeout_seconds * (ulong)1e9 );
    1680           0 :     tile->snapct.wfs_slot                             = config->firedancer.consensus.wait_for_supermajority_at_slot;
    1681           0 :     tile->snapct.wfs_hash_is_zero                     = wfs_hash_is_zero( config );
    1682           0 :     tile->snapct.wfs_shred_version                    = config->consensus.expected_shred_version;
    1683           0 :     tile->snapct.sources.gossip.allow_any             = config->firedancer.snapshots.sources.gossip.allow_any;
    1684           0 :     tile->snapct.sources.gossip.allow_list_cnt        = config->firedancer.snapshots.sources.gossip.allow_list_cnt;
    1685           0 :     tile->snapct.sources.gossip.block_list_cnt        = config->firedancer.snapshots.sources.gossip.block_list_cnt;
    1686           0 :     tile->snapct.sources.servers_cnt                  = config->firedancer.snapshots.sources.servers_cnt;
    1687           0 :     for( ulong i=0UL; i<tile->snapct.sources.gossip.allow_list_cnt; i++ ) {
    1688           0 :       if( FD_UNLIKELY( !fd_base58_decode_32( config->firedancer.snapshots.sources.gossip.allow_list[ i ], tile->snapct.sources.gossip.allow_list[ i ].uc ) ) ) {
    1689           0 :         FD_LOG_ERR(( "[snapshots.sources.gossip.allow_list[%lu]] invalid (%s)", i, config->firedancer.snapshots.sources.gossip.allow_list[ i ] ));
    1690           0 :       }
    1691           0 :     }
    1692           0 :     for( ulong i=0UL; i<tile->snapct.sources.gossip.block_list_cnt; i++ ) {
    1693           0 :       if( FD_UNLIKELY( !fd_base58_decode_32( config->firedancer.snapshots.sources.gossip.block_list[ i ], tile->snapct.sources.gossip.block_list[ i ].uc ) ) ) {
    1694           0 :         FD_LOG_ERR(( "[snapshots.sources.gossip.block_list[%lu]] invalid (%s)", i, config->firedancer.snapshots.sources.gossip.block_list[ i ] ));
    1695           0 :       }
    1696           0 :     }
    1697             : 
    1698           0 :     for( ulong i=0UL; i<tile->snapct.sources.servers_cnt; i++ ) {
    1699           0 :       fd_cstr_ncpy( tile->snapct.sources.servers[ i ],
    1700           0 :                     config->firedancer.snapshots.sources.servers[ i ],
    1701           0 :                     sizeof(tile->snapct.sources.servers[ i ]) );
    1702           0 :     }
    1703           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "snapld" ) ) ) {
    1704             : 
    1705           0 :     fd_memcpy( tile->snapld.snapshots_path, config->paths.snapshots, PATH_MAX );
    1706           0 :     tile->snapld.incremental_snapshots             = config->firedancer.snapshots.incremental_snapshots;
    1707           0 :     tile->snapld.min_download_speed_mibs           = config->firedancer.snapshots.min_download_speed_mibs;
    1708           0 :     tile->snapld.wfs_slot                          = config->firedancer.consensus.wait_for_supermajority_at_slot;
    1709           0 :     tile->snapld.wfs_hash_is_zero                  = wfs_hash_is_zero( config );
    1710           0 :     tile->snapld.wfs_shred_version                 = config->consensus.expected_shred_version;
    1711             : 
    1712           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "snapdc" ) ) ) {
    1713             : 
    1714           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "snapin" ) ) ) {
    1715             : 
    1716           0 :     tile->snapin.wait_for_supermajority_at_slot = config->firedancer.consensus.wait_for_supermajority_at_slot;
    1717           0 :     wfs_decode_bank_hash( config, &tile->snapin.wait_for_supermajority_with_bank_hash );
    1718           0 :     tile->snapin.expected_shred_version = config->consensus.expected_shred_version;
    1719           0 :     tile->snapin.max_live_slots  = config->firedancer.runtime.max_live_slots;
    1720           0 :     tile->snapin.max_txn_per_slot = config->limits.max_txn_per_slot;
    1721           0 :     tile->snapin.accdb_obj_id = fd_pod_query_ulong( config->topo.props, "accdb", ULONG_MAX );
    1722           0 :     tile->snapin.txncache_obj_id = fd_pod_query_ulong( config->topo.props, "txncache", ULONG_MAX );
    1723           0 :     tile->snapin.banks_obj_id = fd_pod_query_ulong( config->topo.props, "banks", ULONG_MAX );
    1724           0 :     tile->snapin.shmem_obj_id = fd_pod_query_ulong( config->topo.props, "snapin_shmem", ULONG_MAX );
    1725             : 
    1726           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "repair" ) ) ) {
    1727           0 :     tile->repair.slot_max = config->firedancer.runtime.max_live_slots;
    1728           0 :     tile->repair.fec_max  = fd_pod_queryf_ulong( config->topo.props, ULONG_MAX, "obj.%lu.fec_max", fd_pod_query_ulong( config->topo.props, "store", ULONG_MAX ) ); /* as many FEC sets as Store */
    1729           0 :     tile->repair.max_shreds_per_block = config->limits.max_shreds_per_block;
    1730           0 :     tile->repair.repair_client_listen_port = config->tiles.repair.repair_client_listen_port;
    1731           0 :     tile->repair.allow_private_address = config->development.gossip.allow_private_address;
    1732           0 :     tile->repair.report_repair_requests = config->development.event.report_repair_requests;
    1733             : 
    1734           0 :     for( ulong i=0; i<tile->in_cnt; i++ ) {
    1735           0 :       if( !strcmp( config->topo.links[ tile->in_link_id[ i ] ].name, "sign_repair" ) ) {
    1736           0 :         tile->repair.repair_sign_depth = config->topo.links[ tile->in_link_id[ i ] ].depth;
    1737           0 :         break;
    1738           0 :       }
    1739           0 :     }
    1740           0 :     tile->repair.repair_sign_cnt = config->firedancer.layout.sign_tile_count - 1; /* -1 because this excludes the keyguard client */
    1741           0 :     fd_cstr_ncpy( tile->repair.identity_key_path, identity_key_path, sizeof(tile->repair.identity_key_path) );
    1742           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "rserve" ) ) ) {
    1743           0 :     tile->rserve.repair_serve_listen_port = config->tiles.rserve.repair_serve_listen_port;
    1744           0 :     tile->rserve.max_shreds_per_block = config->limits.max_shreds_per_block;
    1745           0 :     tile->rserve.ping_cache_entries = 1UL<<16; /* TODO: Configure this from some global metric? */
    1746           0 :     tile->rserve.blockdb_max = 1UL<<15; /* ~20.6 KiB each. TODO: make configurable */
    1747           0 :     fd_cstr_ncpy( tile->rserve.identity_key_path, identity_key_path, sizeof(tile->rserve.identity_key_path) );
    1748             : 
    1749           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "replay" ) )) {
    1750             : 
    1751             :     /* Please maintain same field order as fd_topo.h */
    1752             : 
    1753           0 :     tile->replay.boot_timestamp_nanos = config->boot_timestamp_nanos;
    1754             : 
    1755           0 :     tile->replay.accdb_obj_id = fd_pod_query_ulong( config->topo.props, "accdb", ULONG_MAX );
    1756           0 :     FD_TEST( tile->replay.accdb_obj_id !=ULONG_MAX );
    1757           0 :     tile->replay.txncache_obj_id = fd_pod_query_ulong( config->topo.props, "txncache", ULONG_MAX );
    1758           0 :     FD_TEST( tile->replay.txncache_obj_id !=ULONG_MAX );
    1759             : 
    1760           0 :     fd_cstr_ncpy( tile->replay.identity_key_path, identity_key_path, sizeof(tile->replay.identity_key_path) );
    1761           0 :     fd_cstr_ncpy( tile->replay.vote_account_path, config->paths.vote_account, sizeof(tile->replay.vote_account_path) );
    1762             : 
    1763           0 :     tile->replay.expected_shred_version = config->consensus.expected_shred_version;
    1764           0 :     tile->replay.wait_for_vote_to_start_leader = config->consensus.wait_for_vote_to_start_leader;
    1765             : 
    1766           0 :     tile->replay.sched_depth = config->tiles.replay.max_transaction_lookahead_buffer_size;
    1767           0 :     wfs_decode_bank_hash( config, &tile->replay.wait_for_supermajority_with_bank_hash );
    1768           0 :     tile->replay.wait_for_supermajority_at_slot = config->firedancer.consensus.wait_for_supermajority_at_slot;
    1769             : 
    1770           0 :     tile->replay.max_live_slots = config->firedancer.runtime.max_live_slots;
    1771           0 :     tile->replay.genesis_max_message_size = config->firedancer.development.genesis.max_file_size_mib << 20;
    1772           0 :     tile->replay.full_snapshot_interval_blocks        = config->firedancer.snapshots.full_snapshot_interval_blocks;
    1773           0 :     tile->replay.incremental_snapshot_interval_blocks = config->firedancer.snapshots.incremental_snapshot_interval_blocks;
    1774             : 
    1775           0 :     fd_cstr_ncpy( tile->replay.genesis_path, config->paths.genesis, sizeof(tile->replay.genesis_path) );
    1776             : 
    1777           0 :     tile->replay.max_txn_per_slot     = config->limits.max_txn_per_slot;
    1778           0 :     tile->replay.max_shreds_per_block = config->limits.max_shreds_per_block;
    1779             : 
    1780             :     /* not specified by [tiles.replay] */
    1781             : 
    1782           0 :     tile->replay.capture_start_slot = config->capture.capture_start_slot;
    1783           0 :     fd_cstr_ncpy( tile->replay.solcap_capture, config->capture.solcap_capture, sizeof(tile->replay.solcap_capture) );
    1784           0 :     fd_cstr_ncpy( tile->replay.dump_proto_dir, config->capture.dump_proto_dir, sizeof(tile->replay.dump_proto_dir) );
    1785           0 :     tile->replay.dump_block_to_pb = config->capture.dump_block_to_pb;
    1786           0 :     tile->replay.report_runtime_diffs = config->development.event.report_runtime_diffs;
    1787             : 
    1788           0 :     if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) {
    1789           0 : #define PARSE_BUNDLE_PUBKEY( _tile, f ) \
    1790           0 :       if( FD_UNLIKELY( !fd_base58_decode_32( config->tiles.bundle.f, tile->_tile.bundle.f ) ) )  \
    1791           0 :         FD_LOG_ERR(( "[tiles.bundle.enabled] set to true, but failed to parse [tiles.bundle."#f"] %s", config->tiles.bundle.f ));
    1792           0 :       tile->replay.bundle.enabled = 1;
    1793           0 :       PARSE_BUNDLE_PUBKEY( replay, tip_distribution_program_addr );
    1794           0 :       PARSE_BUNDLE_PUBKEY( replay, tip_payment_program_addr      );
    1795           0 :       fd_cstr_ncpy( tile->replay.bundle.vote_account_path, config->paths.vote_account, sizeof(tile->replay.bundle.vote_account_path) );
    1796           0 :     } else {
    1797           0 :       fd_memset( &tile->replay.bundle, '\0', sizeof(tile->replay.bundle) );
    1798           0 :     }
    1799             : 
    1800           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "execrp" ) ) ) {
    1801             : 
    1802           0 :     tile->execrp.txncache_obj_id  = fd_pod_query_ulong( config->topo.props, "txncache",  ULONG_MAX ); FD_TEST( tile->execrp.txncache_obj_id !=ULONG_MAX );
    1803           0 :     tile->execrp.progcache_obj_id = fd_pod_query_ulong( config->topo.props, "progcache", ULONG_MAX ); FD_TEST( tile->execrp.progcache_obj_id!=ULONG_MAX );
    1804           0 :     tile->execrp.accdb_obj_id     = fd_pod_query_ulong( config->topo.props, "accdb",     ULONG_MAX ); FD_TEST( tile->execrp.accdb_obj_id    !=ULONG_MAX );
    1805           0 :     tile->execrp.bpf_frames_obj_id = fd_pod_query_ulong( config->topo.props, "bpf_frames", ULONG_MAX ); FD_TEST( tile->execrp.bpf_frames_obj_id!=ULONG_MAX );
    1806             : 
    1807           0 :     tile->execrp.max_live_slots  = config->firedancer.runtime.max_live_slots;
    1808             : 
    1809           0 :     tile->execrp.capture_start_slot = config->capture.capture_start_slot;
    1810           0 :     fd_cstr_ncpy( tile->execrp.solcap_capture, config->capture.solcap_capture, sizeof(tile->execrp.solcap_capture) );
    1811           0 :     fd_cstr_ncpy( tile->execrp.dump_proto_dir, config->capture.dump_proto_dir, sizeof(tile->execrp.dump_proto_dir) );
    1812           0 :     fd_cstr_ncpy( tile->execrp.dump_syscall_name_filter, config->capture.dump_syscall_name_filter, sizeof(tile->execrp.dump_syscall_name_filter) );
    1813           0 :     fd_cstr_ncpy( tile->execrp.dump_instr_program_id_filter, config->capture.dump_instr_program_id_filter, sizeof(tile->execrp.dump_instr_program_id_filter) );
    1814           0 :     tile->execrp.dump_instr_to_pb = config->capture.dump_instr_to_pb;
    1815           0 :     tile->execrp.dump_txn_to_pb = config->capture.dump_txn_to_pb;
    1816           0 :     tile->execrp.dump_txn_as_fixture = config->capture.dump_txn_as_fixture;
    1817           0 :     tile->execrp.dump_syscall_to_pb = config->capture.dump_syscall_to_pb;
    1818           0 :     tile->execrp.report_runtime_diffs = config->development.event.report_runtime_diffs;
    1819             : 
    1820           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "votor" ) ) ) {
    1821           0 :     tile->votor.quic_client_listen_port = config->firedancer.development.votor.quic_client_listen_port;
    1822           0 :     tile->votor.quic_server_listen_port = config->firedancer.development.votor.quic_server_listen_port;
    1823           0 :     tile->votor.ip_addr                 = config->net.ip_addr;
    1824           0 :     tile->votor.max_live_slots          = config->firedancer.runtime.max_live_slots;
    1825           0 :     fd_cstr_ncpy( tile->votor.identity_key_path, identity_key_path, sizeof(tile->votor.identity_key_path) );
    1826           0 :     fd_cstr_ncpy( tile->votor.vote_history_path, config->paths.vote_history, sizeof(tile->votor.vote_history_path) );
    1827           0 :     tile->votor.target_gid = config->gid;
    1828           0 :     tile->votor.target_uid = config->uid;
    1829           0 :     tile->votor.authorized_voter_paths_cnt = config->firedancer.paths.authorized_voter_paths_cnt;
    1830           0 :     tile->votor.wait_for_supermajority_at_slot      = config->firedancer.consensus.wait_for_supermajority_at_slot;
    1831           0 :     tile->votor.wait_for_supermajority_hash_is_zero = wfs_hash_is_zero( config );
    1832           0 :     tile->votor.expected_shred_version              = config->consensus.expected_shred_version;
    1833             : 
    1834           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "accdb" ) ) ) {
    1835             : 
    1836           0 :     tile->accdb.accdb_obj_id = fd_pod_query_ulong( config->topo.props, "accdb", ULONG_MAX );
    1837           0 :     tile->accdb.max_live_slots = config->firedancer.runtime.max_live_slots;
    1838             : 
    1839           0 :     tile->accdb.rpc_epoch_obj_id = fd_pod_query_ulong( config->topo.props, "accdb_epoch.rpc", ULONG_MAX );
    1840             : 
    1841           0 :     tile->accdb.resolv_epoch_obj_cnt = config->firedancer.layout.enable_block_production ? config->firedancer.layout.resolv_tile_count : 0UL;
    1842           0 :     FD_TEST( tile->accdb.resolv_epoch_obj_cnt<=sizeof(tile->accdb.resolv_epoch_obj_ids)/sizeof(tile->accdb.resolv_epoch_obj_ids[0]) );
    1843           0 :     for( ulong i=0UL; i<tile->accdb.resolv_epoch_obj_cnt; i++ ) {
    1844           0 :       tile->accdb.resolv_epoch_obj_ids[ i ] = fd_pod_queryf_ulong( config->topo.props, ULONG_MAX, "accdb_epoch.resolv.%lu", i );
    1845           0 :       FD_TEST( tile->accdb.resolv_epoch_obj_ids[ i ]!=ULONG_MAX );
    1846           0 :     }
    1847             : 
    1848           0 :     tile->accdb.snapmk_epoch_obj_id = fd_pod_query_ulong( config->topo.props, "accdb_epoch.snapmk", ULONG_MAX );
    1849             : 
    1850           0 :     tile->accdb.snapzp_epoch_obj_cnt = config->firedancer.layout.enable_snapshot_production
    1851           0 :                                        ? config->firedancer.layout.snapzp_tile_count : 0UL;
    1852           0 :     FD_TEST( tile->accdb.snapzp_epoch_obj_cnt<=sizeof(tile->accdb.snapzp_epoch_obj_ids)/sizeof(tile->accdb.snapzp_epoch_obj_ids[0]) );
    1853           0 :     for( ulong i=0UL; i<tile->accdb.snapzp_epoch_obj_cnt; i++ ) {
    1854           0 :       tile->accdb.snapzp_epoch_obj_ids[ i ] = fd_pod_queryf_ulong( config->topo.props, ULONG_MAX, "accdb_epoch.snapzp.%lu", i );
    1855             :       /* might not exist for topos without snapshot creation */
    1856           0 :     }
    1857             : 
    1858           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "quic" ) ) ) {
    1859             : 
    1860           0 :     tile->quic.reasm_cnt                      = config->tiles.quic.txn_reassembly_count;
    1861           0 :     tile->quic.out_depth                      = config->tiles.verify.receive_buffer_size;
    1862           0 :     tile->quic.max_concurrent_connections     = config->tiles.quic.max_concurrent_connections;
    1863           0 :     tile->quic.max_concurrent_handshakes      = config->tiles.quic.max_concurrent_handshakes;
    1864           0 :     tile->quic.quic_transaction_listen_port   = config->tiles.quic.quic_transaction_listen_port;
    1865           0 :     tile->quic.idle_timeout_millis            = config->tiles.quic.idle_timeout_millis;
    1866           0 :     tile->quic.ack_delay_millis               = config->tiles.quic.ack_delay_millis;
    1867           0 :     tile->quic.retry                          = config->tiles.quic.retry;
    1868           0 :     fd_cstr_fini( fd_cstr_append_cstr_safe( fd_cstr_init( tile->quic.key_log_path ), config->tiles.quic.ssl_key_log_file, sizeof(tile->quic.key_log_path) ) );
    1869             : 
    1870           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "verify" ) ) ) {
    1871             : 
    1872           0 :     tile->verify.tcache_depth = config->tiles.verify.signature_cache_size;
    1873             : 
    1874           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "dedup" ) ) ) {
    1875             : 
    1876           0 :     tile->dedup.tcache_depth = config->tiles.dedup.signature_cache_size;
    1877             : 
    1878           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "resolv" ) ) ) {
    1879             : 
    1880           0 :     tile->resolv.max_live_slots = config->firedancer.runtime.max_live_slots;
    1881           0 :     tile->resolv.accdb_obj_id   = fd_pod_query_ulong( config->topo.props, "accdb", ULONG_MAX );
    1882           0 :     FD_TEST( tile->resolv.accdb_obj_id!=ULONG_MAX );
    1883           0 :     tile->resolv.accdb_epoch_fseq_obj_id = fd_pod_queryf_ulong( config->topo.props, ULONG_MAX, "accdb_epoch.resolv.%lu", tile->kind_id );
    1884           0 :     FD_TEST( tile->resolv.accdb_epoch_fseq_obj_id!=ULONG_MAX );
    1885             : 
    1886           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "pack" ) ) ) {
    1887             : 
    1888           0 :     tile->pack.max_pending_transactions      = config->tiles.pack.max_pending_transactions;
    1889           0 :     tile->pack.execle_tile_count             = config->firedancer.layout.execle_tile_count;
    1890           0 :     tile->pack.max_cost_per_block            = config->limits.max_cost_per_block;
    1891           0 :     tile->pack.max_shreds_per_block          = config->limits.max_shreds_per_block;
    1892           0 :     tile->pack.bench_max_shreds_per_block    = config->development.bench.max_shreds_per_block;
    1893           0 :     tile->pack.use_consumed_cus              = config->tiles.pack.use_consumed_cus;
    1894           0 :     tile->pack.schedule_strategy             = config->tiles.pack.schedule_strategy_enum;
    1895           0 :     tile->pack.acct_blocklist_cnt            = config->tiles.pack.account_blocklist_cnt;
    1896             : 
    1897           0 :     for( ulong i=0UL; i<tile->pack.acct_blocklist_cnt; i++ ) {
    1898           0 :       if( FD_UNLIKELY( NULL==fd_base58_decode_32( config->tiles.pack.account_blocklist[i], tile->pack.acct_blocklist[i].uc ) ) ) {
    1899           0 :         FD_LOG_ERR(( "could not parse account %s at index %lu in [tiles.pack.account_blocklist]", config->tiles.pack.account_blocklist[i], i ));
    1900           0 :       }
    1901           0 :     }
    1902             : 
    1903           0 :     if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) {
    1904             : 
    1905           0 :       tile->pack.bundle.enabled = 1;
    1906           0 :       PARSE_BUNDLE_PUBKEY( pack, tip_distribution_program_addr );
    1907           0 :       PARSE_BUNDLE_PUBKEY( pack, tip_payment_program_addr      );
    1908           0 :       PARSE_BUNDLE_PUBKEY( pack, tip_distribution_authority    );
    1909           0 :       tile->pack.bundle.commission_bps = config->tiles.bundle.commission_bps;
    1910           0 :       fd_cstr_ncpy( tile->pack.bundle.identity_key_path, identity_key_path, sizeof(tile->pack.bundle.identity_key_path) );
    1911           0 :       fd_cstr_ncpy( tile->pack.bundle.vote_account_path, config->paths.vote_account, sizeof(tile->pack.bundle.vote_account_path) );
    1912           0 :     } else {
    1913           0 :       fd_memset( &tile->pack.bundle, '\0', sizeof(tile->pack.bundle) );
    1914           0 :     }
    1915             : 
    1916           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "execle" ) ) ) {
    1917             : 
    1918           0 :     tile->execle.txncache_obj_id    = fd_pod_query_ulong( config->topo.props, "txncache",  ULONG_MAX ); FD_TEST( tile->execle.txncache_obj_id !=ULONG_MAX );
    1919           0 :     tile->execle.progcache_obj_id   = fd_pod_query_ulong( config->topo.props, "progcache", ULONG_MAX ); FD_TEST( tile->execle.progcache_obj_id!=ULONG_MAX );
    1920           0 :     tile->execle.accdb_obj_id       = fd_pod_query_ulong( config->topo.props, "accdb",     ULONG_MAX ); FD_TEST( tile->execle.accdb_obj_id    !=ULONG_MAX );
    1921           0 :     tile->execle.bpf_frames_obj_id  = fd_pod_query_ulong( config->topo.props, "bpf_frames", ULONG_MAX ); FD_TEST( tile->execle.bpf_frames_obj_id!=ULONG_MAX );
    1922           0 :     tile->execle.max_live_slots     = config->firedancer.runtime.max_live_slots;
    1923           0 :     tile->execle.report_runtime_diffs = config->development.event.report_runtime_diffs;
    1924             : 
    1925           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "motor" ) ) ) {
    1926           0 :     fd_cstr_ncpy( tile->motor.identity_key_path, identity_key_path, sizeof(tile->motor.identity_key_path) );
    1927             : 
    1928           0 :     tile->motor.execle_cnt = config->firedancer.layout.execle_tile_count;
    1929           0 :     tile->motor.max_txn_per_slot = config->limits.max_txn_per_slot;
    1930             : 
    1931           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "shred" ) ) ) {
    1932             : 
    1933           0 :     fd_cstr_ncpy( tile->shred.identity_key_path, identity_key_path, sizeof(tile->shred.identity_key_path) );
    1934             : 
    1935           0 :     tile->shred.fec_exposure                  = FD_SHRED_FIREDANCER_FEC_EXPOSURE;
    1936           0 :     tile->shred.fec_resolver_depth            = config->tiles.shred.max_pending_shred_sets;
    1937           0 :     tile->shred.slot_max                      = config->firedancer.runtime.max_live_slots;
    1938           0 :     tile->shred.expected_shred_version        = config->consensus.expected_shred_version;
    1939           0 :     tile->shred.shred_listen_port             = config->tiles.shred.shred_listen_port;
    1940           0 :     tile->shred.max_shreds_per_block          = config->limits.max_shreds_per_block;
    1941           0 :     tile->shred.bench_max_shreds_per_block    = config->development.bench.max_shreds_per_block;
    1942           0 :     tile->shred.adtl_dests_retransmit_cnt     = config->tiles.shred.additional_shred_destinations_retransmit_cnt;
    1943           0 :     tile->shred.adtl_dests_leader_cnt         = config->tiles.shred.additional_shred_destinations_leader_cnt;
    1944           0 :     fd_memcpy( tile->shred.adtl_dests_retransmit, config->tiles.shred.additional_shred_destinations_retransmit,
    1945           0 :                tile->shred.adtl_dests_retransmit_cnt*sizeof(tile->shred.adtl_dests_retransmit[ 0 ]) );
    1946           0 :     fd_memcpy( tile->shred.adtl_dests_leader, config->tiles.shred.additional_shred_destinations_leader,
    1947           0 :                tile->shred.adtl_dests_leader_cnt*sizeof(tile->shred.adtl_dests_leader[ 0 ]) );
    1948             : 
    1949           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "sign" ) ) ) {
    1950             : 
    1951           0 :     fd_cstr_ncpy( tile->sign.identity_key_path, identity_key_path, sizeof(tile->sign.identity_key_path) );
    1952           0 :     tile->sign.failover_junk_fd = -1;
    1953           0 :     tile->sign.failover_enabled = fd_topo_find_tile( &config->topo, "failov", 0UL )!=ULONG_MAX;
    1954             : 
    1955           0 :     tile->sign.authorized_voter_paths_cnt = config->firedancer.paths.authorized_voter_paths_cnt;
    1956           0 :     for( ulong i=0UL; i<tile->sign.authorized_voter_paths_cnt; i++ ) {
    1957           0 :       fd_cstr_ncpy( tile->sign.authorized_voter_paths[ i ], config->firedancer.paths.authorized_voter_paths[ i ], sizeof(tile->sign.authorized_voter_paths[ i ]) );
    1958           0 :     }
    1959           0 :     if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) {
    1960           0 :       PARSE_BUNDLE_PUBKEY( sign, tip_distribution_program_addr );
    1961           0 :       PARSE_BUNDLE_PUBKEY( sign, tip_payment_program_addr      );
    1962           0 :     } else {
    1963             :       /* 0xFF.. is not an invocable program */
    1964           0 :       memset( tile->sign.bundle.tip_distribution_program_addr, '\xFF', 32UL );
    1965           0 :       memset( tile->sign.bundle.tip_payment_program_addr,      '\xFF', 32UL );
    1966           0 :     }
    1967             : 
    1968           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "diag" ) ) ) {
    1969             : 
    1970           0 :     tile->diag.is_voting = strcmp( config->paths.vote_account, "" );
    1971             : 
    1972           0 :     fd_cstr_ncpy( tile->diag.shreds_path,    config->tiles.rserve.enabled                         ? config->paths.shredb    : "", sizeof(tile->diag.shreds_path)    );
    1973           0 :     fd_cstr_ncpy( tile->diag.snapshots_path, config->firedancer.layout.enable_snapshot_production ? config->paths.snapshots : "", sizeof(tile->diag.snapshots_path) );
    1974           0 :     fd_cstr_ncpy( tile->diag.accounts_path,  config->paths.accounts,  sizeof(tile->diag.accounts_path) );
    1975           0 :     fd_cstr_ncpy( tile->diag.gui_path,       config->paths.guidb,     sizeof(tile->diag.gui_path)      );
    1976           0 :     fd_cstr_ncpy( tile->diag.log_path,       config->log.path,        sizeof(tile->diag.log_path)      );
    1977             : 
    1978           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "waker" ) ) ) {
    1979             : 
    1980           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "mwaitx" ) ) ) {
    1981             : 
    1982           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "gui" ) ) ) {
    1983             : 
    1984           0 :     if( FD_UNLIKELY( !fd_cstr_to_ip4_addr( config->tiles.gui.gui_listen_address, &tile->gui.listen_addr ) ) )
    1985           0 :       FD_LOG_ERR(( "failed to parse gui listen address `%s`", config->tiles.gui.gui_listen_address ));
    1986           0 :     tile->gui.listen_port = config->tiles.gui.gui_listen_port;
    1987           0 :     tile->gui.max_txn_per_slot = config->limits.max_txn_per_slot;
    1988           0 :     tile->gui.is_voting = strcmp( config->paths.vote_account, "" );
    1989           0 :     fd_cstr_ncpy( tile->gui.cluster, config->cluster, sizeof(tile->gui.cluster) );
    1990           0 :     fd_cstr_ncpy( tile->gui.identity_key_path, identity_key_path, sizeof(tile->gui.identity_key_path) );
    1991           0 :     fd_cstr_ncpy( tile->gui.vote_key_path, config->paths.vote_account, sizeof(tile->gui.vote_key_path) );
    1992           0 :     fd_cstr_ncpy( tile->gui.accounts_database_path, config->paths.accounts, sizeof(tile->gui.accounts_database_path) );
    1993           0 :     fd_cstr_ncpy( tile->gui.gui_database_path, config->paths.guidb, sizeof(tile->gui.gui_database_path) );
    1994           0 :     tile->gui.max_http_connections      = config->tiles.gui.max_http_connections;
    1995           0 :     tile->gui.max_websocket_connections = config->tiles.gui.max_websocket_connections;
    1996           0 :     tile->gui.send_buffer_size_mb       = config->tiles.gui.send_buffer_size_mb;
    1997           0 :     tile->gui.db_size_gib               = config->tiles.gui.db_size_gib;
    1998           0 :     tile->gui.schedule_strategy         = config->tiles.pack.schedule_strategy_enum;
    1999           0 :     tile->gui.websocket_compression     = 1;
    2000           0 :     tile->gui.max_live_slots            = config->firedancer.runtime.max_live_slots;
    2001           0 :     fd_cstr_ncpy( tile->gui.wfs_bank_hash, config->firedancer.consensus.wait_for_supermajority_with_bank_hash, sizeof(tile->gui.wfs_bank_hash) );
    2002           0 :     tile->gui.wfs_slot               = config->firedancer.consensus.wait_for_supermajority_at_slot;
    2003           0 :     tile->gui.expected_shred_version = config->consensus.expected_shred_version;
    2004           0 :     tile->gui.cache_size_gib         = config->firedancer.accounts.cache_size_gib;
    2005           0 :     tile->gui.accdb_obj_id           = fd_pod_query_ulong( config->topo.props, "accdb", ULONG_MAX );
    2006           0 :     FD_TEST( tile->gui.accdb_obj_id!=ULONG_MAX );
    2007             : 
    2008           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "rpc" ) ) ) {
    2009             : 
    2010           0 :     parse_listen_addr( config->tiles.rpc.rpc_listen_address, "tiles.rpc.rpc_listen_address", &tile->rpc.listen_addr );
    2011           0 :     tile->rpc.listen_port = config->tiles.rpc.rpc_listen_port;
    2012           0 :     tile->rpc.delay_startup = config->tiles.rpc.delay_startup;
    2013           0 :     tile->rpc.max_http_connections      = config->tiles.rpc.max_http_connections;
    2014           0 :     tile->rpc.max_websocket_connections = config->tiles.rpc.max_websocket_connections;
    2015           0 :     tile->rpc.send_buffer_size_mb       = config->tiles.rpc.send_buffer_size_mb;
    2016             : 
    2017           0 :     tile->rpc.max_live_slots           = config->firedancer.runtime.max_live_slots;
    2018           0 :     tile->rpc.genesis_max_message_size = config->firedancer.development.genesis.max_file_size_mib << 20;
    2019             : 
    2020           0 :     tile->rpc.accdb_obj_id = fd_pod_query_ulong( config->topo.props, "accdb", ULONG_MAX );
    2021           0 :     FD_TEST( tile->rpc.accdb_obj_id!=ULONG_MAX );
    2022           0 :     tile->rpc.accdb_epoch_fseq_obj_id = fd_pod_query_ulong( config->topo.props, "accdb_epoch.rpc", ULONG_MAX );
    2023           0 :     FD_TEST( tile->rpc.accdb_epoch_fseq_obj_id!=ULONG_MAX );
    2024             : 
    2025           0 :     fd_cstr_ncpy( tile->rpc.identity_key_path, identity_key_path, sizeof(tile->rpc.identity_key_path) );
    2026             : 
    2027           0 :     tile->rpc.snapshot_server_enabled = fd_topo_find_tile( &config->topo, "snapsv", 0UL )!=ULONG_MAX;
    2028           0 :     if( FD_LIKELY( tile->rpc.snapshot_server_enabled ) ) {
    2029           0 :       if( config->firedancer.gossip.host[0] ) {
    2030           0 :         fd_cstr_ncpy( tile->rpc.snapshot_server_host, config->firedancer.gossip.host,
    2031           0 :                       sizeof(tile->rpc.snapshot_server_host) );
    2032           0 :       } else {
    2033           0 :         FD_TEST( fd_cstr_printf_check( tile->rpc.snapshot_server_host, sizeof(tile->rpc.snapshot_server_host), NULL,
    2034           0 :                                       FD_IP4_ADDR_FMT, FD_IP4_ADDR_FMT_ARGS( config->net.ip_addr ) ) );
    2035           0 :       }
    2036             : 
    2037           0 :       uint listen_port = config->firedancer.snapshots.server.http_listen_port;
    2038           0 :       FD_CHECK_ERR( listen_port && listen_port<=USHORT_MAX,
    2039           0 :                     "[snapshots.server.http_listen_port] must be in [1,65535]" );
    2040           0 :       tile->rpc.snapshot_server_port = (ushort)listen_port;
    2041           0 :     }
    2042             : 
    2043           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "backt" ) ) ) {
    2044             : 
    2045           0 :     tile->backtest.root_distance = config->firedancer.development.backtest.root_distance;
    2046           0 :     fd_cstr_ncpy( tile->backtest.ledger_format, config->firedancer.development.ledger_input.format, sizeof(tile->backtest.ledger_format) );
    2047           0 :     fd_cstr_ncpy( tile->backtest.ledger_path, config->firedancer.development.ledger_input.path, PATH_MAX );
    2048           0 :     tile->backtest.end_slot = config->firedancer.development.ledger_input.end_slot;
    2049           0 :     tile->backtest.boot_timestamp_nanos = config->boot_timestamp_nanos;
    2050             : 
    2051           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "bundle" ) ) ) {
    2052           0 :     fd_cstr_ncpy( tile->bundle.url, config->tiles.bundle.url, sizeof(tile->bundle.url) );
    2053           0 :     tile->bundle.url_len = strnlen( tile->bundle.url, sizeof(tile->bundle.url)-1UL );
    2054           0 :     fd_cstr_ncpy( tile->bundle.sni, config->tiles.bundle.tls_domain_name, sizeof(tile->bundle.sni) );
    2055           0 :     tile->bundle.sni_len = strnlen( tile->bundle.sni, sizeof(tile->bundle.sni)-1UL );
    2056           0 :     fd_cstr_ncpy( tile->bundle.identity_key_path, identity_key_path, sizeof(tile->bundle.identity_key_path) );
    2057           0 :     fd_cstr_ncpy( tile->bundle.key_log_path, config->development.bundle.ssl_key_log_file, sizeof(tile->bundle.key_log_path) );
    2058           0 :     tile->bundle.buf_sz = config->development.bundle.buffer_size_kib<<10;
    2059           0 :     tile->bundle.keepalive_interval_nanos = config->tiles.bundle.keepalive_interval_millis * (ulong)1e6;
    2060           0 :     tile->bundle.tls_cert_verify = !!config->tiles.bundle.tls_cert_verify;
    2061             : 
    2062           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "solcap" ) ) ) {
    2063             : 
    2064           0 :     tile->solcap.capture_start_slot = config->capture.capture_start_slot;
    2065           0 :     fd_cstr_ncpy( tile->solcap.solcap_capture, config->capture.solcap_capture, sizeof(tile->solcap.solcap_capture) );
    2066           0 :     tile->solcap.recent_only = config->capture.recent_only;
    2067           0 :     tile->solcap.recent_slots_per_file = config->capture.recent_slots_per_file;
    2068             : 
    2069           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "snapmk" ) ) ) {
    2070             : 
    2071           0 :     tile->snapmk.accdb_obj_id       = fd_pod_query_ulong( config->topo.props, "accdb",              ULONG_MAX ); FD_TEST( tile->snapmk.accdb_obj_id!=ULONG_MAX );
    2072           0 :     tile->snapmk.accdb_epoch_obj_id = fd_pod_query_ulong( config->topo.props, "accdb_epoch.snapmk", ULONG_MAX ); FD_TEST( tile->snapmk.accdb_epoch_obj_id!=ULONG_MAX );
    2073           0 :     tile->snapmk.visited_set_obj_id = fd_pod_query_ulong( config->topo.props, "backup",         ULONG_MAX ); FD_TEST( tile->snapmk.visited_set_obj_id!=ULONG_MAX );
    2074           0 :     tile->snapmk.banks_obj_id       = fd_pod_query_ulong( config->topo.props, "banks",              ULONG_MAX ); FD_TEST( tile->snapmk.banks_obj_id!=ULONG_MAX );
    2075           0 :     tile->snapmk.zp_fseq_id         = fd_pod_query_ulong( config->topo.props, "snapzp.fseq",        ULONG_MAX ); FD_TEST( tile->snapmk.zp_fseq_id!=ULONG_MAX );
    2076           0 :     tile->snapmk.txncache_obj_id    = fd_pod_query_ulong( config->topo.props, "txncache",           ULONG_MAX ); FD_TEST( tile->snapmk.txncache_obj_id!=ULONG_MAX );
    2077           0 :     tile->snapmk.max_accounts       = config->firedancer.accounts.max_accounts;
    2078           0 :     tile->snapmk.max_live_slots     = config->firedancer.runtime.max_live_slots;
    2079           0 :     tile->snapmk.max_txn_per_slot   = config->limits.max_txn_per_slot;
    2080           0 :     tile->snapmk.max_full_snapshots_to_keep        = config->firedancer.snapshots.max_full_snapshots_to_keep;
    2081           0 :     tile->snapmk.max_incremental_snapshots_to_keep = config->firedancer.snapshots.max_incremental_snapshots_to_keep;
    2082           0 :     fd_cstr_ncpy( tile->snapmk.snapshots_path, config->paths.snapshots, PATH_MAX );
    2083             : 
    2084           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "snapzp" ) ) ) {
    2085             : 
    2086           0 :     tile->snapzp.accdb_obj_id       = fd_pod_query_ulong( config->topo.props, "accdb",              ULONG_MAX ); FD_TEST( tile->snapzp.accdb_obj_id!=ULONG_MAX );
    2087           0 :     tile->snapzp.accdb_epoch_obj_id = fd_pod_queryf_ulong( config->topo.props, ULONG_MAX, "accdb_epoch.snapzp.%lu", tile->kind_id ); FD_TEST( tile->snapzp.accdb_epoch_obj_id!=ULONG_MAX );
    2088           0 :     tile->snapzp.visited_set_obj_id = fd_pod_query_ulong( config->topo.props, "backup",         ULONG_MAX ); FD_TEST( tile->snapzp.visited_set_obj_id!=ULONG_MAX );
    2089           0 :     tile->snapzp.zp_fseq_id         = fd_pod_query_ulong( config->topo.props, "snapzp.fseq",        ULONG_MAX ); FD_TEST( tile->snapzp.zp_fseq_id!=ULONG_MAX );
    2090           0 :     tile->snapzp.max_live_slots     = config->firedancer.runtime.max_live_slots;
    2091           0 :     tile->snapzp.snap_fd_cnt        = config->firedancer.snapshots.max_full_snapshots_to_keep+
    2092           0 :                                       config->firedancer.snapshots.max_incremental_snapshots_to_keep;
    2093             : 
    2094           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "snaprd" ) ) ) {
    2095             : 
    2096           0 :     tile->snaprd.accdb_obj_id = fd_pod_query_ulong( config->topo.props, "accdb", ULONG_MAX );
    2097           0 :     FD_TEST( tile->snaprd.accdb_obj_id!=ULONG_MAX );
    2098             : 
    2099           0 :   } else if( FD_UNLIKELY( !strcmp( tile->name, "snapsv" ) ) ) {
    2100             : 
    2101           0 :     tile->snapsv.snap_max      = config->firedancer.snapshots.max_full_snapshots_to_keep +
    2102           0 :                                  config->firedancer.snapshots.max_incremental_snapshots_to_keep;
    2103           0 :     tile->snapsv.conn_max      = config->firedancer.snapshots.server.max_http_connections;
    2104           0 :     tile->snapsv.io_worker_cnt = config->firedancer.layout.snapsv_io_worker_count;
    2105           0 :     tile->snapsv.idle_timeout_millis = config->firedancer.snapshots.server.idle_timeout_millis;
    2106           0 :     tile->snapsv.send_timeout_millis = config->firedancer.snapshots.server.send_timeout_millis;
    2107           0 :     tile->snapsv.send_buffer_size_kib = config->firedancer.snapshots.server.send_buffer_size_kib;
    2108             : 
    2109             :     /* An empty listen address defaults to the RPC listen address */
    2110           0 :     char const * listen_address = config->firedancer.snapshots.server.http_listen_address;
    2111           0 :     char const * listen_key     = "snapshots.server.http_listen_address";
    2112           0 :     if( FD_LIKELY( !listen_address[0] ) ) {
    2113           0 :       listen_address = config->tiles.rpc.rpc_listen_address;
    2114           0 :       listen_key     = "tiles.rpc.rpc_listen_address";
    2115           0 :     }
    2116           0 :     parse_listen_addr( listen_address, listen_key, &tile->snapsv.listen_addr );
    2117             : 
    2118           0 :     uint listen_port = config->firedancer.snapshots.server.http_listen_port;
    2119           0 :     FD_CHECK_ERR( listen_port && listen_port<=USHORT_MAX,
    2120           0 :                   "[snapshots.server.http_listen_port] must be in [1,65535]" );
    2121           0 :     tile->snapsv.listen_port = (ushort)listen_port;
    2122             : 
    2123           0 :   } else {
    2124           0 :     FD_LOG_ERR(( "unknown tile name `%s`", tile->name ));
    2125           0 :   }
    2126           0 : }

Generated by: LCOV version 1.14