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