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