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