Line data Source code
1 : #include "topology.h"
2 :
3 : #include "../../ballet/lthash/fd_lthash.h"
4 : #include "../../choreo/fd_choreo_base.h"
5 : #include "../../discof/reasm/fd_reasm.h"
6 : #include "../../discof/poh/fd_poh.h"
7 : #include "../../discof/replay/fd_exec.h"
8 : #include "../../discof/gossip/fd_gossip_tile.h"
9 : #include "../../discof/tower/fd_tower_tile.h"
10 : #include "../../discof/resolv/fd_resolv_tile.h"
11 : #include "../../discof/repair/fd_repair.h"
12 : #include "../../discof/replay/fd_replay_tile.h"
13 : #include "../../disco/net/fd_net_tile.h"
14 : #include "../../discof/restore/fd_snapct_tile.h"
15 : #include "../../disco/gui/fd_gui_peers.h"
16 : #include "../../disco/quic/fd_tpu.h"
17 : #include "../../disco/pack/fd_pack_cost.h"
18 : #include "../../disco/tiles.h"
19 : #include "../../disco/topo/fd_topob.h"
20 : #include "../../disco/topo/fd_cpu_topo.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 "../../vinyl/meta/fd_vinyl_meta.h"
28 : #include "../../vinyl/io/fd_vinyl_io.h" /* FD_VINYL_IO_TYPE_* */
29 :
30 : #include <sys/random.h>
31 : #include <sys/types.h>
32 : #include <sys/socket.h>
33 : #include <stdlib.h>
34 : #include <netdb.h>
35 :
36 : extern fd_topo_obj_callbacks_t * CALLBACKS[];
37 :
38 : static void
39 0 : parse_ip_port( const char * name, const char * ip_port, fd_topo_ip_port_t *parsed_ip_port) {
40 0 : char buf[ sizeof( "255.255.255.255:65536" ) ];
41 0 : memcpy( buf, ip_port, sizeof( buf ) );
42 0 : char *ip_end = strchr( buf, ':' );
43 0 : if( FD_UNLIKELY( !ip_end ) )
44 0 : FD_LOG_ERR(( "[%s] must in the form ip:port", name ));
45 0 : *ip_end = '\0';
46 :
47 0 : if( FD_UNLIKELY( !fd_cstr_to_ip4_addr( buf, &( parsed_ip_port->ip ) ) ) ) {
48 0 : FD_LOG_ERR(( "could not parse IP %s in [%s]", buf, name ));
49 0 : }
50 :
51 0 : parsed_ip_port->port = fd_cstr_to_ushort( ip_end+1 );
52 0 : if( FD_UNLIKELY( !parsed_ip_port->port ) )
53 0 : FD_LOG_ERR(( "could not parse port %s in [%s]", ip_end+1, name ));
54 0 : }
55 :
56 : fd_topo_obj_t *
57 : setup_topo_banks( fd_topo_t * topo,
58 : char const * wksp_name,
59 : ulong max_live_slots,
60 : ulong max_fork_width,
61 0 : int larger_max_cost_per_block ) {
62 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "banks", wksp_name );
63 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_live_slots, "obj.%lu.max_live_slots", obj->id ) );
64 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_fork_width, "obj.%lu.max_fork_width", obj->id ) );
65 0 : FD_TEST( fd_pod_insertf_int( topo->props, larger_max_cost_per_block, "obj.%lu.larger_max_cost_per_block", obj->id ) );
66 0 : ulong seed;
67 0 : FD_TEST( fd_rng_secure( &seed, sizeof( ulong ) ) );
68 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, seed, "obj.%lu.seed", obj->id ) );
69 0 : return obj;
70 0 : }
71 :
72 : static fd_topo_obj_t *
73 0 : setup_topo_fec_sets( fd_topo_t * topo, char const * wksp_name, ulong sz ) {
74 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "fec_sets", wksp_name );
75 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, sz, "obj.%lu.sz", obj->id ) );
76 0 : return obj;
77 0 : }
78 :
79 : fd_topo_obj_t *
80 : setup_topo_funk( fd_topo_t * topo,
81 : char const * wksp_name,
82 : ulong max_account_records,
83 : ulong max_database_transactions,
84 0 : ulong heap_size_gib ) {
85 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "funk", wksp_name );
86 0 : FD_TEST( fd_pod_insert_ulong( topo->props, "funk", obj->id ) );
87 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_account_records, "obj.%lu.rec_max", obj->id ) );
88 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_database_transactions, "obj.%lu.txn_max", obj->id ) );
89 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, heap_size_gib*(1UL<<30), "obj.%lu.heap_max", obj->id ) );
90 0 : ulong funk_footprint = fd_funk_footprint( max_database_transactions, max_account_records );
91 0 : if( FD_UNLIKELY( !funk_footprint ) ) FD_LOG_ERR(( "Invalid [funk] parameters" ));
92 :
93 : /* Increase workspace partition count */
94 0 : ulong wksp_idx = fd_topo_find_wksp( topo, wksp_name );
95 0 : FD_TEST( wksp_idx!=ULONG_MAX );
96 0 : fd_topo_wksp_t * wksp = &topo->workspaces[ wksp_idx ];
97 0 : ulong size = funk_footprint+(heap_size_gib*(1UL<<30));
98 0 : ulong part_max = fd_wksp_part_max_est( size, 1U<<14U );
99 0 : if( FD_UNLIKELY( !part_max ) ) FD_LOG_ERR(( "fd_wksp_part_max_est(%lu,16KiB) failed", size ));
100 0 : wksp->part_max += part_max;
101 :
102 0 : return obj;
103 0 : }
104 :
105 : fd_topo_obj_t *
106 : setup_topo_progcache( fd_topo_t * topo,
107 : char const * wksp_name,
108 : ulong max_cache_entries,
109 : ulong max_database_transactions,
110 0 : ulong heap_size ) {
111 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "funk", wksp_name );
112 0 : FD_TEST( fd_pod_insert_ulong( topo->props, "progcache", obj->id ) );
113 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_cache_entries, "obj.%lu.rec_max", obj->id ) );
114 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_database_transactions, "obj.%lu.txn_max", obj->id ) );
115 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, heap_size, "obj.%lu.heap_max", obj->id ) );
116 0 : ulong funk_footprint = fd_funk_footprint( max_database_transactions, max_cache_entries );
117 0 : if( FD_UNLIKELY( !funk_footprint ) ) FD_LOG_ERR(( "Invalid [runtime.program_cache] parameters" ));
118 0 : if( FD_UNLIKELY( heap_size<(2*funk_footprint) ) ) {
119 0 : FD_LOG_ERR(( "Invalid [runtime.program_cache] parameters: heap_size_mib should be at least %lu",
120 0 : ( 2*funk_footprint )>>20 ));
121 0 : }
122 :
123 : /* Increase workspace partition count */
124 0 : ulong wksp_idx = fd_topo_find_wksp( topo, wksp_name );
125 0 : FD_TEST( wksp_idx!=ULONG_MAX );
126 0 : fd_topo_wksp_t * wksp = &topo->workspaces[ wksp_idx ];
127 0 : ulong part_max = fd_wksp_part_max_est( heap_size, 1U<<14U );
128 0 : if( FD_UNLIKELY( !part_max ) ) FD_LOG_ERR(( "fd_wksp_part_max_est(%lu,16KiB) failed", funk_footprint ));
129 0 : wksp->part_max += part_max;
130 :
131 0 : return obj;
132 0 : }
133 :
134 : fd_topo_obj_t *
135 : setup_topo_store( fd_topo_t * topo,
136 : char const * wksp_name,
137 : ulong fec_max,
138 0 : uint part_cnt ) {
139 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "store", wksp_name );
140 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, fec_max, "obj.%lu.fec_max", obj->id ) );
141 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, part_cnt, "obj.%lu.part_cnt", obj->id ) );
142 0 : return obj;
143 0 : }
144 :
145 : fd_topo_obj_t *
146 : setup_topo_txncache( fd_topo_t * topo,
147 : char const * wksp_name,
148 : ulong max_live_slots,
149 0 : ulong max_txn_per_slot ) {
150 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "txncache", wksp_name );
151 :
152 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_live_slots, "obj.%lu.max_live_slots", obj->id ) );
153 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_txn_per_slot, "obj.%lu.max_txn_per_slot", obj->id ) );
154 :
155 0 : return obj;
156 0 : }
157 :
158 : void
159 : setup_topo_vinyl_meta( fd_topo_t * topo,
160 0 : fd_configf_t * config ) {
161 0 : fd_topob_wksp( topo, "vinyl_meta" );
162 :
163 0 : fd_topo_obj_t * map_obj = fd_topob_obj( topo, "vinyl_meta", "vinyl_meta" );
164 0 : ulong const meta_max = fd_ulong_pow2_up( config->vinyl.max_account_records );
165 0 : ulong const lock_cnt = fd_vinyl_meta_lock_cnt_est ( meta_max );
166 0 : ulong const probe_max = fd_vinyl_meta_probe_max_est( meta_max );
167 0 : fd_pod_insertf_ulong( topo->props, meta_max, "obj.%lu.ele_max", map_obj->id );
168 0 : fd_pod_insertf_ulong( topo->props, lock_cnt, "obj.%lu.lock_cnt", map_obj->id );
169 0 : fd_pod_insertf_ulong( topo->props, probe_max, "obj.%lu.probe_max", map_obj->id );
170 0 : fd_pod_insertf_ulong( topo->props, (ulong)fd_tickcount(), "obj.%lu.seed", map_obj->id );
171 :
172 0 : fd_topo_obj_t * meta_pool_obj = fd_topob_obj( topo, "vinyl_meta_e", "vinyl_meta" );
173 0 : fd_pod_insertf_ulong( topo->props, meta_max, "obj.%lu.cnt", meta_pool_obj->id );
174 :
175 0 : fd_pod_insert_ulong( topo->props, "vinyl.meta_map", map_obj->id );
176 0 : fd_pod_insert_ulong( topo->props, "vinyl.meta_pool", meta_pool_obj->id );
177 0 : }
178 :
179 : fd_topo_obj_t *
180 : setup_topo_vinyl_cache( fd_topo_t * topo,
181 0 : fd_configf_t * config ) {
182 0 : fd_topob_wksp( topo, "vinyl_data" );
183 0 : fd_topo_obj_t * line_obj = fd_topob_obj( topo, "vinyl_data", "vinyl_data" );
184 0 : ulong const heap_max = config->vinyl.cache_size_gib<<30;
185 0 : fd_pod_insertf_ulong( topo->props, heap_max, "obj.%lu.data_sz", line_obj->id );
186 0 : fd_pod_insert_ulong( topo->props, "vinyl.data", line_obj->id );
187 0 : return line_obj;
188 0 : }
189 :
190 : /* Resolves a hostname to a single ip address. If multiple ip address
191 : records are returned by getaddrinfo, only the first IPV4 address is
192 : returned via ip_addr. */
193 : static int
194 : resolve_address( char const * address,
195 0 : uint * ip_addr ) {
196 0 : struct addrinfo hints = { .ai_family = AF_INET };
197 0 : struct addrinfo * res;
198 0 : int err = getaddrinfo( address, NULL, &hints, &res );
199 0 : if( FD_UNLIKELY( err ) ) {
200 0 : FD_LOG_WARNING(( "cannot resolve address \"%s\": %i-%s", address, err, gai_strerror( err ) ));
201 0 : return 0;
202 0 : }
203 :
204 0 : int resolved = 0;
205 0 : for( struct addrinfo * cur=res; cur; cur=cur->ai_next ) {
206 0 : if( FD_UNLIKELY( cur->ai_addr->sa_family!=AF_INET ) ) continue;
207 0 : struct sockaddr_in const * addr = (struct sockaddr_in const *)cur->ai_addr;
208 0 : *ip_addr = addr->sin_addr.s_addr;
209 0 : resolved = 1;
210 0 : break;
211 0 : }
212 :
213 0 : freeaddrinfo( res );
214 0 : return resolved;
215 0 : }
216 :
217 : /* Resolves a hostname to multiple ip addresses, specified by
218 : ip_addr_cnt. ip_addrs points to an array of fd_ip4_port_t objects.
219 : hints points to an optionally NULL addrinfo hints object. If hints
220 : is NULL, a default hints settings containing the IPV4 address family
221 : hint will be used. */
222 : static int
223 : resolve_addresses( char const * address,
224 : struct addrinfo const * hints,
225 : fd_ip4_port_t * ip_addrs,
226 0 : ulong ip_addr_cnt ) {
227 0 : struct addrinfo default_hints = { .ai_family = AF_INET };
228 0 : if( FD_UNLIKELY( !hints ) ) {
229 0 : hints = &default_hints;
230 0 : }
231 :
232 0 : struct addrinfo * res;
233 0 : int err = getaddrinfo( address, NULL, hints, &res );
234 0 : if( FD_UNLIKELY( err ) ) {
235 0 : FD_LOG_WARNING(( "cannot resolve address \"%s\": %i-%s", address, err, gai_strerror( err ) ));
236 0 : return 0;
237 0 : }
238 :
239 0 : int resolved = 0;
240 0 : for( struct addrinfo * cur=res; cur; cur=cur->ai_next ) {
241 0 : if( FD_UNLIKELY( (ulong)resolved>=ip_addr_cnt ) ) break;
242 0 : if( FD_UNLIKELY( cur->ai_addr->sa_family!=AF_INET ) ) continue;
243 0 : struct sockaddr_in const * addr = (struct sockaddr_in const *)cur->ai_addr;
244 0 : ip_addrs[ resolved ].addr = addr->sin_addr.s_addr;
245 0 : resolved++;
246 0 : }
247 :
248 0 : freeaddrinfo( res );
249 0 : return resolved;
250 0 : }
251 :
252 : static int
253 : resolve_peer( char const * peer,
254 : struct addrinfo const * addr_resolve_hints,
255 : char const * config_str,
256 : char hostname[ static 256UL ],
257 : fd_ip4_port_t * ip4_port,
258 : ulong ip4_port_cnt,
259 0 : int * is_https ) {
260 :
261 : /* Split host:port */
262 0 : int https = 0;
263 0 : char const * host_port = peer;
264 0 : if( FD_LIKELY( strncmp( peer, "http://", 7UL )==0 ) ) {
265 0 : if( FD_LIKELY( is_https ) ) *is_https = 0;
266 0 : host_port += 7UL;
267 0 : } else if( FD_LIKELY( strncmp( peer, "https://", 8UL )==0 ) ) {
268 0 : if( FD_LIKELY( is_https ) ) *is_https = 1;
269 0 : host_port += 8UL;
270 0 : https = 1;
271 0 : }
272 :
273 0 : char const * colon = strrchr( host_port, ':' );
274 0 : char const * host_end = colon;
275 0 : if( FD_UNLIKELY( !colon && !https ) ) {
276 0 : FD_LOG_ERR(( "invalid [%s] entry \"%s\": no port number", config_str, host_port ));
277 0 : } else if( FD_LIKELY( !colon && https ) ) {
278 0 : host_end = host_port + strlen( host_port );
279 0 : }
280 :
281 0 : ulong fqdn_len = (ulong)( host_end-host_port );
282 0 : if( FD_UNLIKELY( fqdn_len>255 ) ) {
283 0 : FD_LOG_ERR(( "invalid [%s] entry \"%s\": hostname too long", config_str, host_port ));
284 0 : }
285 0 : fd_memcpy( hostname, host_port, fqdn_len );
286 0 : hostname[ fqdn_len ] = '\0';
287 :
288 : /* Resolve hostname */
289 0 : int resolved = resolve_addresses( hostname, addr_resolve_hints, ip4_port, ip4_port_cnt );
290 :
291 : /* Parse port number */
292 :
293 0 : if( FD_LIKELY( colon ) ) {
294 0 : char const * port_str = host_end+1;
295 0 : char const * endptr = NULL;
296 0 : ulong port = strtoul( port_str, (char **)&endptr, 10 );
297 0 : if( FD_UNLIKELY( endptr==port_str || !port || port>USHORT_MAX || *endptr!='\0' ) ) {
298 0 : FD_LOG_ERR(( "invalid [%s] entry \"%s\": invalid port number", config_str, host_port ));
299 0 : }
300 0 : for( ulong i=0UL; i<(ulong)resolved; i++ ) ip4_port[ i ].port = fd_ushort_bswap( (ushort)port );
301 0 : } else if( FD_LIKELY( !colon && https ) ) {
302 : /* use default https port */
303 0 : for( ulong i=0UL; i<(ulong)resolved; i++ ) ip4_port[ i ].port = fd_ushort_bswap( 443U );
304 0 : } else {
305 0 : FD_LOG_ERR(( "invalid [%s] entry \"%s\": no port number", config_str, host_port ));
306 0 : }
307 :
308 0 : return resolved;
309 0 : }
310 :
311 : static void
312 0 : resolve_gossip_entrypoints( config_t * config ) {
313 0 : ulong entrypoint_cnt = config->gossip.entrypoints_cnt;
314 0 : for( ulong i=0UL; i<entrypoint_cnt; i++ ) {
315 0 : char hostname[ 256UL ];
316 0 : if( FD_UNLIKELY( 0==resolve_peer( config->gossip.entrypoints[ i ], NULL, "gossip.entrypoints", hostname, &config->gossip.resolved_entrypoints[ i ], 1, NULL ) ) ) {
317 0 : FD_LOG_ERR(( "failed to resolve address of [gossip.entrypoints] entry \"%s\"", config->gossip.entrypoints[ i ] ));
318 0 : }
319 0 : }
320 0 : }
321 :
322 : void
323 0 : fd_topo_initialize( config_t * config ) {
324 : /* TODO: Not here ... */
325 0 : resolve_gossip_entrypoints( config );
326 :
327 0 : ulong net_tile_cnt = config->layout.net_tile_count;
328 0 : ulong shred_tile_cnt = config->layout.shred_tile_count;
329 0 : ulong quic_tile_cnt = config->layout.quic_tile_count;
330 0 : ulong verify_tile_cnt = config->layout.verify_tile_count;
331 0 : ulong resolv_tile_cnt = config->layout.resolv_tile_count;
332 0 : ulong bank_tile_cnt = config->layout.bank_tile_count;
333 :
334 0 : ulong gossvf_tile_cnt = config->firedancer.layout.gossvf_tile_count;
335 0 : ulong exec_tile_cnt = config->firedancer.layout.exec_tile_count;
336 0 : ulong sign_tile_cnt = config->firedancer.layout.sign_tile_count;
337 0 : ulong lta_tile_cnt = config->firedancer.layout.snapla_tile_count;
338 :
339 0 : int snapshots_enabled = !!config->gossip.entrypoints_cnt;
340 0 : int vinyl_enabled = !!config->firedancer.vinyl.enabled;
341 0 : int snapshot_lthash_disabled = config->development.snapshots.disable_lthash_verification;
342 :
343 0 : fd_topo_t * topo = fd_topob_new( &config->topo, config->name );
344 :
345 0 : topo->max_page_size = fd_cstr_to_shmem_page_sz( config->hugetlbfs.max_page_size );
346 0 : topo->gigantic_page_threshold = config->hugetlbfs.gigantic_page_threshold_mib << 20;
347 :
348 0 : int solcap_enabled = strlen( config->capture.solcap_capture ) > 0;
349 :
350 : /* topo, name */
351 0 : fd_topob_wksp( topo, "metric" );
352 0 : fd_topob_wksp( topo, "genesi" );
353 0 : fd_topob_wksp( topo, "ipecho" );
354 0 : fd_topob_wksp( topo, "gossvf" );
355 0 : fd_topob_wksp( topo, "gossip" );
356 0 : fd_topob_wksp( topo, "shred" );
357 0 : fd_topob_wksp( topo, "repair" );
358 0 : fd_topob_wksp( topo, "replay" );
359 0 : fd_topob_wksp( topo, "exec" );
360 0 : fd_topob_wksp( topo, "tower" );
361 0 : fd_topob_wksp( topo, "send" );
362 :
363 0 : fd_topob_wksp( topo, "quic" );
364 0 : fd_topob_wksp( topo, "verify" );
365 0 : fd_topob_wksp( topo, "dedup" );
366 0 : fd_topob_wksp( topo, "resolv" );
367 0 : fd_topob_wksp( topo, "pack" );
368 0 : fd_topob_wksp( topo, "bank" );
369 0 : fd_topob_wksp( topo, "poh" );
370 0 : fd_topob_wksp( topo, "sign" );
371 :
372 0 : fd_topob_wksp( topo, "metric_in" );
373 :
374 0 : fd_topob_wksp( topo, "net_gossip" );
375 0 : fd_topob_wksp( topo, "net_shred" );
376 0 : fd_topob_wksp( topo, "net_repair" );
377 0 : fd_topob_wksp( topo, "net_send" );
378 0 : fd_topob_wksp( topo, "net_quic" );
379 :
380 0 : fd_topob_wksp( topo, "genesi_out" );
381 0 : fd_topob_wksp( topo, "ipecho_out" );
382 0 : fd_topob_wksp( topo, "gossvf_gossi" );
383 0 : fd_topob_wksp( topo, "gossip_gossv" );
384 0 : fd_topob_wksp( topo, "gossip_out" );
385 :
386 0 : fd_topob_wksp( topo, "shred_out" );
387 0 : fd_topob_wksp( topo, "replay_stake" );
388 0 : fd_topob_wksp( topo, "replay_exec" );
389 0 : fd_topob_wksp( topo, "replay_out" );
390 0 : fd_topob_wksp( topo, "tower_out" );
391 0 : fd_topob_wksp( topo, "send_out" );
392 :
393 0 : fd_topob_wksp( topo, "quic_verify" );
394 0 : fd_topob_wksp( topo, "verify_dedup" );
395 0 : fd_topob_wksp( topo, "dedup_resolv" );
396 0 : fd_topob_wksp( topo, "resolv_pack" );
397 0 : fd_topob_wksp( topo, "pack_poh" );
398 0 : fd_topob_wksp( topo, "pack_bank" );
399 0 : fd_topob_wksp( topo, "resolv_repla" );
400 0 : if( FD_LIKELY( config->tiles.pack.use_consumed_cus ) ) {
401 0 : fd_topob_wksp( topo, "bank_pack" );
402 0 : }
403 0 : fd_topob_wksp( topo, "bank_poh" );
404 0 : fd_topob_wksp( topo, "bank_busy" );
405 0 : fd_topob_wksp( topo, "poh_shred" );
406 0 : fd_topob_wksp( topo, "poh_replay" );
407 :
408 0 : fd_topob_wksp( topo, "funk" );
409 0 : fd_topob_wksp( topo, "progcache" );
410 0 : fd_topob_wksp( topo, "fec_sets" );
411 0 : fd_topob_wksp( topo, "txncache" );
412 0 : fd_topob_wksp( topo, "banks" );
413 0 : fd_topob_wksp( topo, "store" );
414 0 : fd_topob_wksp( topo, "executed_txn" );
415 :
416 0 : fd_topob_wksp( topo, "gossip_sign" );
417 0 : fd_topob_wksp( topo, "sign_gossip" );
418 :
419 0 : fd_topob_wksp( topo, "shred_sign" );
420 0 : fd_topob_wksp( topo, "sign_shred" );
421 :
422 0 : fd_topob_wksp( topo, "repair_sign" );
423 0 : fd_topob_wksp( topo, "sign_repair" );
424 :
425 0 : fd_topob_wksp( topo, "send_sign" );
426 0 : fd_topob_wksp( topo, "sign_send" );
427 :
428 0 : fd_topob_wksp( topo, "exec_sig" );
429 :
430 0 : fd_topob_wksp( topo, "cswtch" );
431 :
432 0 : fd_topob_wksp( topo, "exec_replay" );
433 :
434 0 : if( FD_LIKELY( snapshots_enabled ) ) {
435 0 : fd_topob_wksp( topo, "snapct" );
436 0 : fd_topob_wksp( topo, "snapld" );
437 0 : fd_topob_wksp( topo, "snapdc" );
438 0 : fd_topob_wksp( topo, "snapin" );
439 0 : if( vinyl_enabled ) {
440 0 : fd_topob_wksp( topo, "snapwh" );
441 0 : fd_topob_wksp( topo, "snapwr" );
442 0 : }
443 :
444 0 : fd_topob_wksp( topo, "snapct_ld" );
445 0 : fd_topob_wksp( topo, "snapld_dc" );
446 0 : fd_topob_wksp( topo, "snapdc_in" );
447 0 : if( vinyl_enabled ) fd_topob_wksp( topo, "snapin_wr" );
448 :
449 0 : if( FD_UNLIKELY( snapshot_lthash_disabled ) ) {
450 0 : fd_topob_wksp( topo, "snapin_ct" );
451 0 : } else {
452 0 : fd_topob_wksp( topo, "snapls_ct" );
453 0 : }
454 :
455 0 : if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "snapct_gui" );
456 0 : if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "snapin_gui" );
457 0 : fd_topob_wksp( topo, "snapin_manif" );
458 0 : fd_topob_wksp( topo, "snapct_repr" );
459 :
460 0 : if( FD_LIKELY( !snapshot_lthash_disabled ) ) {
461 0 : fd_topob_wksp( topo, "snapla" );
462 0 : fd_topob_wksp( topo, "snapls" );
463 0 : fd_topob_wksp( topo, "snapla_ls" );
464 0 : fd_topob_wksp( topo, "snapin_ls" );
465 0 : }
466 0 : }
467 :
468 0 : #define FOR(cnt) for( ulong i=0UL; i<cnt; i++ )
469 :
470 0 : ulong shred_depth = 65536UL; /* from fdctl/topology.c shred_store link. MAKE SURE TO KEEP IN SYNC. */
471 :
472 : /* topo, link_name, wksp_name, depth, mtu, burst */
473 0 : /**/ fd_topob_link( topo, "gossip_net", "net_gossip", 32768UL, FD_NET_MTU, 1UL );
474 0 : FOR(shred_tile_cnt) fd_topob_link( topo, "shred_net", "net_shred", 32768UL, FD_NET_MTU, 1UL );
475 0 : /**/ fd_topob_link( topo, "repair_net", "net_repair", config->net.ingress_buffer_size, FD_NET_MTU, 1UL );
476 0 : /**/ fd_topob_link( topo, "send_net", "net_send", config->net.ingress_buffer_size, FD_NET_MTU, 1UL );
477 0 : FOR(quic_tile_cnt) fd_topob_link( topo, "quic_net", "net_quic", config->net.ingress_buffer_size, FD_NET_MTU, 1UL );
478 :
479 0 : if( FD_LIKELY( snapshots_enabled ) ) {
480 : /* TODO: Revisit the depths of all the snapshot links */
481 0 : /**/ fd_topob_link( topo, "snapct_ld", "snapct_ld", 128UL, sizeof(fd_ssctrl_init_t), 1UL );
482 0 : /**/ fd_topob_link( topo, "snapld_dc", "snapld_dc", 16384UL, USHORT_MAX, 1UL );
483 0 : /**/ fd_topob_link( topo, "snapdc_in", "snapdc_in", 16384UL, USHORT_MAX, 1UL );
484 0 : if( FD_UNLIKELY( snapshot_lthash_disabled ) ) {
485 0 : fd_topob_link( topo, "snapin_ct", "snapin_ct", 128UL, 0UL, 1UL );
486 0 : } else {
487 0 : fd_topob_link( topo, "snapls_ct", "snapls_ct", 128UL, 0UL, 1UL );
488 0 : }
489 0 : /**/ fd_topob_link( topo, "snapin_manif", "snapin_manif", 4UL, sizeof(fd_snapshot_manifest_t),1UL );
490 0 : /**/ fd_topob_link( topo, "snapct_repr", "snapct_repr", 128UL, 0UL, 1UL )->permit_no_consumers = 1; /* TODO: wire in repair later */
491 0 : if( FD_LIKELY( config->tiles.gui.enabled ) ) {
492 0 : /**/ fd_topob_link( topo, "snapct_gui", "snapct_gui", 128UL, sizeof(fd_snapct_update_t), 1UL );
493 0 : /**/ fd_topob_link( topo, "snapin_gui", "snapin_gui", 128UL, FD_GUI_CONFIG_PARSE_MAX_VALID_ACCT_SZ_WITH_NULL, 1UL );
494 0 : }
495 0 : if( vinyl_enabled ) {
496 0 : fd_topo_link_t * snapin_wh =
497 0 : /**/ fd_topob_link( topo, "snapin_wh", "snapin_wr", 4UL, 16UL<<20, 1UL );
498 0 : /**/ fd_topob_link( topo, "snapwh_wr", "snapin_wr", 4UL, 0UL, 1UL );
499 0 : fd_pod_insertf_ulong( topo->props, 8UL, "obj.%lu.app_sz", snapin_wh->dcache_obj_id );
500 0 : }
501 0 : if( FD_LIKELY( !snapshot_lthash_disabled ) ) {
502 0 : FOR(lta_tile_cnt) fd_topob_link( topo, "snapla_ls", "snapla_ls", 128UL, sizeof(fd_lthash_value_t), 1UL );
503 0 : /**/ fd_topob_link( topo, "snapin_ls", "snapin_ls", 256UL, sizeof(fd_snapshot_full_account_t), 1UL );
504 0 : }
505 0 : }
506 :
507 : /**/ fd_topob_link( topo, "genesi_out", "genesi_out", 2UL, 10UL*1024UL*1024UL+32UL+sizeof(fd_lthash_value_t), 1UL );
508 0 : /**/ fd_topob_link( topo, "ipecho_out", "ipecho_out", 2UL, 0UL, 1UL );
509 0 : FOR(gossvf_tile_cnt) fd_topob_link( topo, "gossvf_gossi", "gossvf_gossi", config->net.ingress_buffer_size, sizeof(fd_gossip_view_t)+FD_NET_MTU, 1UL );
510 0 : /**/ fd_topob_link( topo, "gossip_gossv", "gossip_gossv", 65536UL*4UL, sizeof(fd_gossip_ping_update_t), 1UL ); /* TODO: Unclear where this depth comes from ... fix */
511 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 */
512 :
513 0 : FOR(quic_tile_cnt) fd_topob_link( topo, "quic_verify", "quic_verify", config->tiles.verify.receive_buffer_size, FD_TPU_REASM_MTU, config->tiles.quic.txn_reassembly_count );
514 0 : FOR(verify_tile_cnt) fd_topob_link( topo, "verify_dedup", "verify_dedup", config->tiles.verify.receive_buffer_size, FD_TPU_PARSED_MTU, 1UL );
515 0 : /**/ fd_topob_link( topo, "dedup_resolv", "dedup_resolv", 65536UL, FD_TPU_PARSED_MTU, 1UL );
516 0 : FOR(resolv_tile_cnt) fd_topob_link( topo, "resolv_pack", "resolv_pack", 65536UL, FD_TPU_RESOLVED_MTU, 1UL );
517 0 : /**/ fd_topob_link( topo, "replay_stake", "replay_stake", 128UL, FD_STAKE_OUT_MTU, 1UL ); /* TODO: This should be 2 but requires fixing STEM_BURST */
518 0 : /**/ fd_topob_link( topo, "replay_out", "replay_out", 8192UL, sizeof(fd_replay_message_t), 1UL );
519 0 : /**/ fd_topob_link( topo, "pack_poh", "pack_poh", 4096UL, sizeof(fd_done_packing_t), 1UL );
520 : /* pack_bank is shared across all banks, so if one bank stalls due to complex transactions, the buffer needs to be large so that
521 : other banks can keep proceeding. */
522 0 : /**/ fd_topob_link( topo, "pack_bank", "pack_bank", 65536UL, USHORT_MAX, 1UL );
523 0 : FOR(bank_tile_cnt) fd_topob_link( topo, "bank_poh", "bank_poh", 16384UL, USHORT_MAX, 1UL );
524 0 : if( FD_LIKELY( config->tiles.pack.use_consumed_cus ) ) {
525 0 : FOR(bank_tile_cnt) fd_topob_link( topo, "bank_pack", "bank_pack", 16384UL, USHORT_MAX, 1UL );
526 0 : }
527 0 : /**/ fd_topob_link( topo, "poh_shred", "poh_shred", 16384UL, USHORT_MAX, 1UL );
528 0 : /**/ fd_topob_link( topo, "poh_replay", "poh_replay", 4096UL, sizeof(fd_poh_leader_slot_ended_t), 1UL );
529 0 : FOR(resolv_tile_cnt) fd_topob_link( topo, "resolv_repla", "resolv_repla", 4096UL, sizeof(fd_resolv_slot_exchanged_t), 1UL );
530 0 : /**/ fd_topob_link( topo, "executed_txn", "executed_txn", 16384UL, 64UL, 1UL ); /* TODO: Rename this ... */
531 :
532 0 : FOR(shred_tile_cnt) fd_topob_link( topo, "shred_sign", "shred_sign", 128UL, 32UL, 1UL );
533 0 : FOR(shred_tile_cnt) fd_topob_link( topo, "sign_shred", "sign_shred", 128UL, sizeof(fd_ed25519_sig_t), 1UL );
534 :
535 : /**/ 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 */
536 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 */
537 :
538 0 : FOR(sign_tile_cnt-1) fd_topob_link( topo, "repair_sign", "repair_sign", 128UL, FD_REPAIR_MAX_PREIMAGE_SZ, 1UL );
539 0 : FOR(sign_tile_cnt-1) fd_topob_link( topo, "sign_repair", "sign_repair", 128UL, sizeof(fd_ed25519_sig_t), 1UL );
540 :
541 0 : /**/ fd_topob_link( topo, "send_sign", "send_sign", 128UL, FD_TXN_MTU, 1UL ); /* TODO: Depth probably doesn't need to be 128 */
542 0 : /**/ fd_topob_link( topo, "sign_send", "sign_send", 128UL, sizeof(fd_ed25519_sig_t), 1UL ); /* TODO: Depth probably doesn't need to be 128 */
543 :
544 0 : FOR(shred_tile_cnt) fd_topob_link( topo, "shred_out", "shred_out", shred_depth, FD_SHRED_OUT_MTU, 3UL ); /* TODO: Pretty sure burst of 3 is incorrect here */
545 0 : FOR(shred_tile_cnt) fd_topob_link( topo, "repair_shred", "shred_out", shred_depth, sizeof(fd_ed25519_sig_t), 1UL );
546 0 : /**/ fd_topob_link( topo, "tower_out", "tower_out", 128UL, sizeof(fd_tower_msg_t), 3UL ); /* dup conf + cluster conf + slot_done */
547 0 : /**/ fd_topob_link( topo, "send_out", "send_out", 128UL, FD_TPU_RAW_MTU, 1UL );
548 :
549 0 : fd_topob_link( topo, "replay_exec", "replay_exec", 16384UL, sizeof(fd_exec_task_msg_t), 1UL );
550 :
551 0 : FOR(exec_tile_cnt) fd_topob_link( topo, "exec_sig", "exec_sig", 16384UL, 64UL, 1UL );
552 0 : FOR(exec_tile_cnt) fd_topob_link( topo, "exec_replay", "exec_replay", 16384UL, sizeof(fd_exec_task_done_msg_t), 1UL );
553 :
554 0 : ushort parsed_tile_to_cpu[ FD_TILE_MAX ];
555 : /* Unassigned tiles will be floating, unless auto topology is enabled. */
556 0 : for( ulong i=0UL; i<FD_TILE_MAX; i++ ) parsed_tile_to_cpu[ i ] = USHORT_MAX;
557 :
558 0 : int is_auto_affinity = !strcmp( config->layout.affinity, "auto" );
559 :
560 0 : fd_topo_cpus_t cpus[1];
561 0 : fd_topo_cpus_init( cpus );
562 :
563 0 : ulong affinity_tile_cnt = 0UL;
564 0 : if( FD_LIKELY( !is_auto_affinity ) ) affinity_tile_cnt = fd_tile_private_cpus_parse( config->layout.affinity, parsed_tile_to_cpu );
565 :
566 0 : ulong tile_to_cpu[ FD_TILE_MAX ] = {0};
567 0 : for( ulong i=0UL; i<affinity_tile_cnt; i++ ) {
568 0 : if( FD_UNLIKELY( parsed_tile_to_cpu[ i ]!=USHORT_MAX && parsed_tile_to_cpu[ i ]>=cpus->cpu_cnt ) )
569 0 : FD_LOG_ERR(( "The CPU affinity string in the configuration file under [layout.affinity] specifies a CPU index of %hu, but the system "
570 0 : "only has %lu CPUs. You should either change the CPU allocations in the affinity string, or increase the number of CPUs "
571 0 : "in the system.",
572 0 : parsed_tile_to_cpu[ i ], cpus->cpu_cnt ));
573 0 : tile_to_cpu[ i ] = fd_ulong_if( parsed_tile_to_cpu[ i ]==USHORT_MAX, ULONG_MAX, (ulong)parsed_tile_to_cpu[ i ] );
574 0 : }
575 :
576 0 : fd_topos_net_tiles( topo, net_tile_cnt, &config->net, config->tiles.netlink.max_routes, config->tiles.netlink.max_peer_routes, config->tiles.netlink.max_neighbors, tile_to_cpu );
577 :
578 0 : FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_gossvf", i, config->net.ingress_buffer_size );
579 0 : FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_shred", i, config->net.ingress_buffer_size );
580 0 : FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_repair", i, config->net.ingress_buffer_size );
581 0 : FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_send", i, config->net.ingress_buffer_size );
582 0 : FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_quic", i, config->net.ingress_buffer_size );
583 :
584 : /* topo, tile_name, tile_wksp, metrics_wksp, cpu_idx, is_agave, uses_keyswitch */
585 : /**/ fd_topob_tile( topo, "metric", "metric", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
586 0 : /**/ fd_topob_tile( topo, "cswtch", "cswtch", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
587 :
588 0 : if( FD_LIKELY( snapshots_enabled ) ) {
589 0 : /**/ fd_topob_tile( topo, "snapct", "snapct", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
590 0 : /**/ fd_topob_tile( topo, "snapld", "snapld", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
591 0 : /**/ fd_topob_tile( topo, "snapdc", "snapdc", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
592 0 : /**/ fd_topob_tile( topo, "snapin", "snapin", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
593 0 : if(vinyl_enabled) fd_topob_tile( topo, "snapwh", "snapwh", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
594 0 : if(vinyl_enabled) fd_topob_tile( topo, "snapwr", "snapwr", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
595 :
596 0 : if( FD_LIKELY( !snapshot_lthash_disabled ) ) {
597 0 : FOR(lta_tile_cnt) fd_topob_tile( topo, "snapla", "snapla", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
598 0 : /**/ fd_topob_tile( topo, "snapls", "snapls", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
599 0 : }
600 0 : }
601 :
602 : /**/ fd_topob_tile( topo, "genesi", "genesi", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
603 0 : /**/ fd_topob_tile( topo, "ipecho", "ipecho", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
604 0 : FOR(gossvf_tile_cnt) fd_topob_tile( topo, "gossvf", "gossvf", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
605 0 : /**/ fd_topob_tile( topo, "gossip", "gossip", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
606 :
607 0 : FOR(shred_tile_cnt) fd_topob_tile( topo, "shred", "shred", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
608 0 : /**/ fd_topob_tile( topo, "repair", "repair", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 ); /* TODO: Wrong? Needs to use keyswitch as signs */
609 0 : /**/ fd_topob_tile( topo, "replay", "replay", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
610 0 : FOR(exec_tile_cnt) fd_topob_tile( topo, "exec", "exec", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
611 0 : /**/ fd_topob_tile( topo, "tower", "tower", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
612 0 : /**/ fd_topob_tile( topo, "send", "send", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
613 :
614 0 : FOR(quic_tile_cnt) fd_topob_tile( topo, "quic", "quic", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
615 0 : FOR(verify_tile_cnt) fd_topob_tile( topo, "verify", "verify", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
616 0 : /**/ fd_topob_tile( topo, "dedup", "dedup", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
617 0 : FOR(resolv_tile_cnt) fd_topob_tile( topo, "resolv", "resolv", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
618 0 : FOR(resolv_tile_cnt) strncpy( topo->tiles[ topo->tile_cnt-1UL-i ].metrics_name, "resolf", 8UL );
619 0 : /**/ fd_topob_tile( topo, "pack", "pack", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, config->tiles.bundle.enabled );
620 0 : FOR(bank_tile_cnt) fd_topob_tile( topo, "bank", "bank", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
621 0 : FOR(bank_tile_cnt) strncpy( topo->tiles[ topo->tile_cnt-1UL-i ].metrics_name, "bankf", 6UL );
622 0 : /**/ fd_topob_tile( topo, "poh", "poh", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
623 0 : FOR(sign_tile_cnt) fd_topob_tile( topo, "sign", "sign", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
624 :
625 0 : if( FD_UNLIKELY( solcap_enabled ) ) {
626 0 : fd_topob_wksp( topo, "solcap" );
627 0 : fd_topob_tile( topo, "solcap", "solcap", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
628 0 : }
629 :
630 : /* topo, tile_name, tile_kind_id, fseq_wksp, link_name, link_kind_id, reliable, polled */
631 0 : FOR(gossvf_tile_cnt) for( ulong j=0UL; j<net_tile_cnt; j++ )
632 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 */
633 0 : FOR(shred_tile_cnt) for( ulong j=0UL; j<net_tile_cnt; j++ )
634 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 */
635 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 */
636 0 : /**/ fd_topob_tile_out( topo, "repair", 0UL, "repair_net", 0UL );
637 0 : FOR(net_tile_cnt) fd_topob_tile_in ( topo, "send", 0UL, "metric_in", "net_send", i, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
638 0 : FOR(quic_tile_cnt) for( ulong j=0UL; j<net_tile_cnt; j++ )
639 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 */
640 :
641 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 */
642 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 */
643 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 */
644 0 : /**/ fd_topos_tile_in_net( topo, "metric_in", "send_net", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
645 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 */
646 :
647 0 : /**/ fd_topob_tile_out( topo, "genesi", 0UL, "genesi_out", 0UL );
648 0 : /**/ fd_topob_tile_in ( topo, "ipecho", 0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
649 0 : /**/ fd_topob_tile_out( topo, "ipecho", 0UL, "ipecho_out", 0UL );
650 :
651 0 : FOR(gossvf_tile_cnt) fd_topob_tile_out( topo, "gossvf", i, "gossvf_gossi", i );
652 0 : FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossvf", i, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
653 0 : FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossvf", i, "metric_in", "gossip_gossv", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
654 0 : FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossvf", i, "metric_in", "ipecho_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
655 0 : FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossvf", i, "metric_in", "replay_stake", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
656 0 : /**/ fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "replay_stake", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
657 0 : /**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_out", 0UL );
658 0 : /**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_net", 0UL );
659 0 : /**/ fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "ipecho_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
660 0 : FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "gossvf_gossi", i, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
661 0 : /**/ fd_topob_tile_in( topo, "gossip", 0UL, "metric_in", "send_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
662 0 : /**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_gossv", 0UL );
663 :
664 0 : int snapshots_gossip_enabled = config->firedancer.snapshots.sources.gossip.allow_any || config->firedancer.snapshots.sources.gossip.allow_list_cnt>0UL;
665 0 : if( FD_LIKELY( snapshots_enabled ) ) {
666 0 : if( FD_LIKELY( snapshots_gossip_enabled ) ) {
667 0 : /**/ fd_topob_tile_in ( topo, "snapct", 0UL, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
668 0 : }
669 :
670 0 : if( FD_UNLIKELY( snapshot_lthash_disabled ) ) {
671 0 : fd_topob_tile_in ( topo, "snapct", 0UL, "metric_in", "snapin_ct", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
672 0 : } else {
673 0 : fd_topob_tile_in ( topo, "snapct", 0UL, "metric_in", "snapls_ct", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
674 0 : }
675 0 : fd_topob_tile_in ( topo, "snapct", 0UL, "metric_in", "snapld_dc", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
676 0 : fd_topob_tile_out( topo, "snapct", 0UL, "snapct_ld", 0UL );
677 0 : fd_topob_tile_out( topo, "snapct", 0UL, "snapct_repr", 0UL );
678 0 : if( FD_LIKELY( config->tiles.gui.enabled ) ) {
679 0 : /**/ fd_topob_tile_out( topo, "snapct", 0UL, "snapct_gui", 0UL );
680 0 : }
681 0 : if( vinyl_enabled ) {
682 0 : /**/ fd_topob_tile_out( topo, "snapin", 0UL, "snapin_wh", 0UL );
683 0 : /**/ fd_topob_tile_in ( topo, "snapwh", 0UL, "metric_in", "snapin_wh", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
684 0 : /**/ fd_topob_tile_out( topo, "snapwh", 0UL, "snapwh_wr", 0UL );
685 0 : /**/ fd_topob_tile_in ( topo, "snapwr", 0UL, "metric_in", "snapwh_wr", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
686 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapwr", 0UL ) ], &topo->objs[ topo->links[ fd_topo_find_link( topo, "snapin_wh", 0UL ) ].dcache_obj_id ], FD_SHMEM_JOIN_MODE_READ_ONLY );
687 0 : }
688 :
689 0 : /**/ fd_topob_tile_in ( topo, "snapld", 0UL, "metric_in", "snapct_ld", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
690 0 : /**/ fd_topob_tile_out( topo, "snapld", 0UL, "snapld_dc", 0UL );
691 :
692 0 : /**/ fd_topob_tile_in ( topo, "snapdc", 0UL, "metric_in", "snapld_dc", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
693 0 : /**/ fd_topob_tile_out( topo, "snapdc", 0UL, "snapdc_in", 0UL );
694 :
695 0 : fd_topob_tile_in ( topo, "snapin", 0UL, "metric_in", "snapdc_in", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
696 0 : if( FD_LIKELY( config->tiles.gui.enabled ) ) {
697 0 : /**/ fd_topob_tile_out( topo, "snapin", 0UL, "snapin_gui", 0UL );
698 0 : }
699 0 : if( FD_UNLIKELY( snapshot_lthash_disabled ) ) {
700 0 : fd_topob_tile_out( topo, "snapin", 0UL, "snapin_ct", 0UL );
701 0 : } else {
702 0 : fd_topob_tile_out( topo, "snapin", 0UL, "snapin_ls", 0UL );
703 0 : }
704 0 : fd_topob_tile_out( topo, "snapin", 0UL, "snapin_manif", 0UL );
705 0 : if( FD_LIKELY( !snapshot_lthash_disabled ) ) {
706 0 : FOR(lta_tile_cnt) fd_topob_tile_in( topo, "snapla", i, "metric_in", "snapdc_in", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
707 0 : FOR(lta_tile_cnt) fd_topob_tile_out( topo, "snapla", i, "snapla_ls", i );
708 0 : /**/ fd_topob_tile_in( topo, "snapls", 0UL, "metric_in", "snapin_ls", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
709 0 : FOR(lta_tile_cnt) fd_topob_tile_in( topo, "snapls", 0UL, "metric_in", "snapla_ls", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
710 0 : /**/ fd_topob_tile_out( topo, "snapls", 0UL, "snapls_ct", 0UL );
711 0 : }
712 0 : }
713 :
714 0 : /**/ fd_topob_tile_in( topo, "repair", 0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
715 0 : /**/ fd_topob_tile_in( topo, "repair", 0UL, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
716 0 : /**/ fd_topob_tile_in( topo, "repair", 0UL, "metric_in", "tower_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
717 0 : /**/ fd_topob_tile_in( topo, "repair", 0UL, "metric_in", "replay_stake", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
718 0 : if( snapshots_enabled ) {
719 0 : fd_topob_tile_in( topo, "repair", 0UL, "metric_in", "snapin_manif", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
720 0 : }
721 0 : FOR(shred_tile_cnt) fd_topob_tile_in( topo, "repair", 0UL, "metric_in", "shred_out", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
722 0 : FOR(shred_tile_cnt) fd_topob_tile_in( topo, "replay", 0UL, "metric_in", "shred_out", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
723 0 : FOR(shred_tile_cnt) fd_topob_tile_out( topo, "repair", 0UL, "repair_shred", i );
724 0 : /**/ fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
725 0 : /**/ fd_topob_tile_out( topo, "replay", 0UL, "replay_out", 0UL );
726 0 : /**/ fd_topob_tile_out( topo, "replay", 0UL, "replay_stake", 0UL );
727 0 : /**/ fd_topob_tile_out( topo, "replay", 0UL, "executed_txn", 0UL );
728 0 : /**/ fd_topob_tile_out( topo, "replay", 0UL, "replay_exec", 0UL );
729 0 : /**/ fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "tower_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
730 0 : /**/ fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "send_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
731 0 : FOR(resolv_tile_cnt) fd_topob_tile_in( topo, "replay", 0UL, "metric_in", "resolv_repla", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
732 0 : if( FD_LIKELY( snapshots_enabled ) ) {
733 0 : fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "snapin_manif", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
734 0 : }
735 :
736 0 : /**/ fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "poh_replay", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
737 0 : FOR(exec_tile_cnt) fd_topob_tile_in ( topo, "exec", i, "metric_in", "replay_exec", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
738 :
739 0 : /**/ fd_topob_tile_in ( topo, "tower", 0UL, "metric_in", "dedup_resolv", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
740 0 : /**/ fd_topob_tile_in ( topo, "tower", 0UL, "metric_in", "replay_exec", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
741 0 : /**/ fd_topob_tile_in ( topo, "tower", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
742 0 : /**/ fd_topob_tile_out( topo, "tower", 0UL, "tower_out", 0UL );
743 :
744 0 : /**/ fd_topob_tile_in ( topo, "send", 0UL, "metric_in", "replay_stake", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
745 0 : /**/ fd_topob_tile_in ( topo, "send", 0UL, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
746 0 : /**/ fd_topob_tile_in ( topo, "send", 0UL, "metric_in", "tower_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
747 0 : /**/ fd_topob_tile_out( topo, "send", 0UL, "send_net", 0UL );
748 0 : /**/ fd_topob_tile_out( topo, "send", 0UL, "send_out", 0UL );
749 :
750 0 : FOR(quic_tile_cnt) fd_topob_tile_out( topo, "quic", i, "quic_verify", i );
751 0 : FOR(quic_tile_cnt) fd_topob_tile_out( topo, "quic", i, "quic_net", i );
752 : /* All verify tiles read from all QUIC tiles, packets are round robin. */
753 0 : FOR(verify_tile_cnt) for( ulong j=0UL; j<quic_tile_cnt; j++ )
754 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 */
755 0 : FOR(verify_tile_cnt) fd_topob_tile_in( topo, "verify", i, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
756 0 : /**/ fd_topob_tile_in( topo, "verify", 0UL, "metric_in", "send_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
757 0 : FOR(verify_tile_cnt) fd_topob_tile_out( topo, "verify", i, "verify_dedup", i );
758 0 : FOR(verify_tile_cnt) fd_topob_tile_in( topo, "dedup", 0UL, "metric_in", "verify_dedup", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
759 0 : /**/ fd_topob_tile_in( topo, "dedup", 0UL, "metric_in", "executed_txn", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
760 0 : /**/ fd_topob_tile_out( topo, "dedup", 0UL, "dedup_resolv", 0UL );
761 0 : FOR(resolv_tile_cnt) fd_topob_tile_in( topo, "resolv", i, "metric_in", "dedup_resolv", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
762 0 : FOR(resolv_tile_cnt) fd_topob_tile_in( topo, "resolv", i, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
763 0 : FOR(resolv_tile_cnt) fd_topob_tile_out( topo, "resolv", i, "resolv_pack", i );
764 0 : FOR(resolv_tile_cnt) fd_topob_tile_out( topo, "resolv", i, "resolv_repla", i );
765 0 : /**/ fd_topob_tile_in( topo, "pack", 0UL, "metric_in", "resolv_pack", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
766 0 : /**/ fd_topob_tile_in( topo, "pack", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
767 0 : /**/ fd_topob_tile_in( topo, "pack", 0UL, "metric_in", "executed_txn", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
768 0 : fd_topob_tile_out( topo, "pack", 0UL, "pack_bank", 0UL );
769 0 : fd_topob_tile_out( topo, "pack", 0UL, "pack_poh" , 0UL );
770 0 : if( FD_LIKELY( config->tiles.pack.use_consumed_cus ) ) {
771 0 : FOR(bank_tile_cnt) fd_topob_tile_in( topo, "pack", 0UL, "metric_in", "bank_pack", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
772 0 : }
773 0 : FOR(bank_tile_cnt) fd_topob_tile_in( topo, "bank", i, "metric_in", "pack_bank", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
774 0 : FOR(bank_tile_cnt) fd_topob_tile_out( topo, "bank", i, "bank_poh", i );
775 0 : if( FD_LIKELY( config->tiles.pack.use_consumed_cus ) ) {
776 0 : FOR(bank_tile_cnt) fd_topob_tile_out( topo, "bank", i, "bank_pack", i );
777 0 : }
778 0 : FOR(bank_tile_cnt) fd_topob_tile_in( topo, "poh", 0UL, "metric_in", "bank_poh", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
779 0 : /**/ fd_topob_tile_in( topo, "poh", 0UL, "metric_in", "pack_poh", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
780 0 : /**/ fd_topob_tile_in( topo, "poh", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
781 0 : /**/ fd_topob_tile_out( topo, "poh", 0UL, "poh_shred", 0UL );
782 0 : /**/ fd_topob_tile_out( topo, "poh", 0UL, "poh_replay", 0UL );
783 0 : FOR(shred_tile_cnt) fd_topob_tile_in ( topo, "shred", i, "metric_in", "replay_stake", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
784 0 : FOR(shred_tile_cnt) fd_topob_tile_in ( topo, "shred", i, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
785 0 : FOR(shred_tile_cnt) fd_topob_tile_out( topo, "shred", i, "shred_out", i );
786 0 : FOR(shred_tile_cnt) fd_topob_tile_in ( topo, "shred", i, "metric_in", "repair_shred", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
787 0 : FOR(shred_tile_cnt) fd_topob_tile_in ( topo, "shred", i, "metric_in", "ipecho_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
788 0 : FOR(shred_tile_cnt) fd_topob_tile_in ( topo, "shred", i, "metric_in", "poh_shred", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
789 0 : FOR(shred_tile_cnt) fd_topob_tile_out( topo, "shred", i, "shred_net", i );
790 :
791 0 : FOR(exec_tile_cnt) fd_topob_tile_in ( topo, "dedup", 0UL, "metric_in", "exec_sig", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
792 0 : FOR(exec_tile_cnt) fd_topob_tile_in ( topo, "pack", 0UL, "metric_in", "exec_sig", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
793 0 : FOR(exec_tile_cnt) fd_topob_tile_out( topo, "exec", i, "exec_sig", i );
794 0 : FOR(exec_tile_cnt) fd_topob_tile_out( topo, "exec", i, "exec_replay", i );
795 0 : FOR(exec_tile_cnt) fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "exec_replay", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
796 :
797 :
798 0 : if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) {
799 0 : fd_topob_wksp( topo, "bundle_verif" );
800 0 : fd_topob_wksp( topo, "bundle_sign" );
801 0 : fd_topob_wksp( topo, "sign_bundle" );
802 0 : fd_topob_wksp( topo, "pack_sign" );
803 0 : fd_topob_wksp( topo, "sign_pack" );
804 0 : fd_topob_wksp( topo, "bundle" );
805 :
806 0 : /**/ fd_topob_link( topo, "bundle_verif", "bundle_verif", config->tiles.verify.receive_buffer_size, FD_TPU_PARSED_MTU, 1UL );
807 0 : /**/ fd_topob_link( topo, "bundle_sign", "bundle_sign", 65536UL, 9UL, 1UL );
808 0 : /**/ fd_topob_link( topo, "sign_bundle", "sign_bundle", 128UL, 64UL, 1UL );
809 0 : /**/ fd_topob_link( topo, "pack_sign", "pack_sign", 65536UL, 1232UL, 1UL );
810 0 : /**/ fd_topob_link( topo, "sign_pack", "sign_pack", 128UL, 64UL, 1UL );
811 :
812 : /**/ fd_topob_tile( topo, "bundle", "bundle", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
813 :
814 : /**/ fd_topob_tile_out( topo, "bundle", 0UL, "bundle_verif", 0UL );
815 0 : FOR(verify_tile_cnt) fd_topob_tile_in( topo, "verify", i, "metric_in", "bundle_verif", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
816 :
817 0 : /**/ fd_topob_tile_in( topo, "sign", 0UL, "metric_in", "bundle_sign", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
818 0 : /**/ fd_topob_tile_out( topo, "bundle", 0UL, "bundle_sign", 0UL );
819 0 : /**/ fd_topob_tile_in( topo, "bundle", 0UL, "metric_in", "sign_bundle", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
820 0 : /**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_bundle", 0UL );
821 :
822 0 : /**/ fd_topob_tile_in( topo, "sign", 0UL, "metric_in", "pack_sign", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
823 0 : /**/ fd_topob_tile_out( topo, "pack", 0UL, "pack_sign", 0UL );
824 0 : /**/ fd_topob_tile_in( topo, "pack", 0UL, "metric_in", "sign_pack", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
825 0 : /**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_pack", 0UL );
826 :
827 : /* TODO: bundle gui support needs to be integrated here */
828 0 : }
829 :
830 : /* Sign links don't need to be reliable because they are synchronous,
831 : so there's at most one fragment in flight at a time anyway. The
832 : sign links are also not polled by fd_stem, instead the tiles will
833 : read the sign responses out of band in a dedicated spin loop.
834 :
835 : TODO: This can probably be fixed now to be relible ... ? */
836 : /* topo, tile_name, tile_kind_id, fseq_wksp, link_name, link_kind_id, reliable, polled */
837 0 : /**/ fd_topob_tile_in ( topo, "sign", 0UL, "metric_in", "gossip_sign", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
838 0 : /**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_sign", 0UL );
839 0 : /**/ fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "sign_gossip", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
840 0 : /**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_gossip", 0UL );
841 :
842 0 : for( ulong i=0UL; i<shred_tile_cnt; i++ ) {
843 0 : /**/ fd_topob_tile_in ( topo, "sign", 0UL, "metric_in", "shred_sign", i, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
844 0 : /**/ fd_topob_tile_out( topo, "shred", i, "shred_sign", i );
845 0 : /**/ fd_topob_tile_in ( topo, "shred", i, "metric_in", "sign_shred", i, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
846 0 : /**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_shred", i );
847 0 : }
848 :
849 0 : FOR(sign_tile_cnt-1UL) fd_topob_tile_out( topo, "repair", 0UL, "repair_sign", i );
850 0 : FOR(sign_tile_cnt-1UL) fd_topob_tile_in ( topo, "sign", i+1UL, "metric_in", "repair_sign", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
851 0 : FOR(sign_tile_cnt-1UL) fd_topob_tile_out( topo, "sign", i+1UL, "sign_repair", i );
852 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 */
853 :
854 0 : /**/ fd_topob_tile_in ( topo, "sign", 0UL, "metric_in", "send_sign", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
855 0 : /**/ fd_topob_tile_out( topo, "send", 0UL, "send_sign", 0UL );
856 0 : /**/ fd_topob_tile_in ( topo, "send", 0UL, "metric_in", "sign_send", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
857 0 : /**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_send", 0UL );
858 :
859 0 : if( FD_UNLIKELY( config->tiles.archiver.enabled ) ) {
860 0 : fd_topob_wksp( topo, "arch_f" );
861 0 : fd_topob_wksp( topo, "arch_w" );
862 0 : fd_topob_wksp( topo, "feeder" );
863 0 : fd_topob_wksp( topo, "arch_f2w" );
864 :
865 0 : fd_topob_link( topo, "feeder", "feeder", 65536UL, 4UL*FD_SHRED_STORE_MTU, 4UL+config->tiles.shred.max_pending_shred_sets );
866 0 : fd_topob_link( topo, "arch_f2w", "arch_f2w", 128UL, 4UL*FD_SHRED_STORE_MTU, 1UL );
867 :
868 0 : fd_topob_tile( topo, "arch_f", "arch_f", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
869 0 : fd_topob_tile( topo, "arch_w", "arch_w", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
870 :
871 0 : fd_topob_tile_out( topo, "replay", 0UL, "feeder", 0UL );
872 0 : fd_topob_tile_in( topo, "arch_f", 0UL, "metric_in", "feeder", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
873 :
874 0 : fd_topob_tile_out( topo, "arch_f", 0UL, "arch_f2w", 0UL );
875 0 : fd_topob_tile_in( topo, "arch_w", 0UL, "metric_in", "arch_f2w", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
876 0 : }
877 :
878 0 : if( FD_UNLIKELY( config->tiles.shredcap.enabled ) ) {
879 0 : fd_topob_wksp( topo, "scap" );
880 :
881 0 : fd_topob_tile( topo, "scap", "scap", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
882 :
883 0 : fd_topob_tile_in( topo, "scap", 0UL, "metric_in", "repair_net", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
884 0 : for( ulong j=0UL; j<net_tile_cnt; j++ ) {
885 0 : fd_topob_tile_in( topo, "scap", 0UL, "metric_in", "net_shred", j, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
886 0 : }
887 0 : for( ulong j=0UL; j<shred_tile_cnt; j++ ) {
888 0 : fd_topob_tile_in( topo, "scap", 0UL, "metric_in", "shred_out", j, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
889 0 : }
890 0 : fd_topob_tile_in( topo, "scap", 0UL, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
891 :
892 0 : fd_topob_tile_in( topo, "scap", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
893 :
894 : /* No default fd_topob_tile_in connection to stake_out */
895 0 : }
896 :
897 0 : int rpc_enabled = config->tiles.rpc.enabled;
898 0 : if( FD_UNLIKELY( rpc_enabled ) ) {
899 0 : fd_topob_wksp( topo, "rpc" );
900 0 : fd_topob_wksp( topo, "rpc_replay" );
901 0 : fd_topob_link( topo, "rpc_replay", "rpc_replay", 4UL, 0UL, 1UL );
902 0 : fd_topob_tile( topo, "rpc", "rpc", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
903 0 : fd_topob_tile_out( topo, "rpc", 0UL, "rpc_replay", 0UL );
904 0 : fd_topob_tile_in( topo, "rpc", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
905 0 : fd_topob_tile_in( topo, "rpc", 0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
906 0 : fd_topob_tile_in( topo, "replay", 0UL, "metric_in", "rpc_replay", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
907 0 : }
908 :
909 0 : if( FD_UNLIKELY( solcap_enabled ) ) {
910 0 : fd_topob_link( topo, "cap_repl", "solcap", 32UL, SOLCAP_WRITE_ACCOUNT_DATA_MTU, 1UL );
911 0 : fd_topob_tile_out( topo, "replay", 0UL, "cap_repl", 0UL );
912 0 : fd_topob_tile_in( topo, "solcap", 0UL, "metric_in", "cap_repl", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
913 0 : FOR(exec_tile_cnt) fd_topob_link( topo, "cap_exec", "solcap", 32UL, SOLCAP_WRITE_ACCOUNT_DATA_MTU, 1UL );
914 0 : FOR(exec_tile_cnt) fd_topob_tile_out( topo, "exec", i, "cap_exec", i );
915 0 : FOR(exec_tile_cnt) fd_topob_tile_in( topo, "solcap", 0UL, "metric_in", "cap_exec", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
916 0 : }
917 :
918 0 : if( FD_LIKELY( !is_auto_affinity ) ) {
919 0 : if( FD_UNLIKELY( affinity_tile_cnt<topo->tile_cnt ) )
920 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. "
921 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 "
922 0 : "the total tile count. You can reduce the tile count by decreasing individual tile counts in the [layout] section of the configuration file.",
923 0 : topo->tile_cnt, affinity_tile_cnt ));
924 0 : if( FD_UNLIKELY( affinity_tile_cnt>topo->tile_cnt ) )
925 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. "
926 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 "
927 0 : "individual tile counts in the [layout] section of the configuration file.",
928 0 : topo->tile_cnt, affinity_tile_cnt ));
929 0 : }
930 :
931 :
932 0 : if( FD_UNLIKELY( is_auto_affinity ) ) fd_topob_auto_layout( topo, 0 );
933 :
934 : /* There is a special fseq that sits between the pack, bank, and poh
935 : tiles to indicate when the bank/poh tiles are done processing a
936 : microblock. Pack uses this to determine when to "unlock" accounts
937 : that it marked as locked because they were being used. */
938 :
939 0 : for( ulong i=0UL; i<bank_tile_cnt; i++ ) {
940 0 : fd_topo_obj_t * busy_obj = fd_topob_obj( topo, "fseq", "bank_busy" );
941 :
942 0 : fd_topo_tile_t * pack_tile = &topo->tiles[ fd_topo_find_tile( topo, "pack", 0UL ) ];
943 0 : fd_topo_tile_t * bank_tile = &topo->tiles[ fd_topo_find_tile( topo, "bank", i ) ];
944 0 : fd_topob_tile_uses( topo, pack_tile, busy_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
945 0 : fd_topob_tile_uses( topo, bank_tile, busy_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
946 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, busy_obj->id, "bank_busy.%lu", i ) );
947 0 : }
948 :
949 0 : fd_topo_obj_t * funk_obj = setup_topo_funk( topo, "funk",
950 0 : config->firedancer.funk.max_account_records,
951 0 : config->firedancer.funk.max_database_transactions,
952 0 : config->firedancer.funk.heap_size_gib );
953 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], funk_obj, FD_SHMEM_JOIN_MODE_READ_WRITE ); /* TODO: Should be readonly? */
954 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "tower", 0UL ) ], funk_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
955 0 : FOR(exec_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "exec", i ) ], funk_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
956 0 : FOR(bank_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "bank", i ) ], funk_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
957 0 : FOR(resolv_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "resolv", i ) ], funk_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
958 :
959 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 );
960 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE ); /* TODO: Should be readonly? */
961 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "tower", 0UL ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
962 0 : FOR(exec_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "exec", i ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE ); /* TODO: Should be readonly? */
963 0 : FOR(bank_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "bank", i ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
964 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 );
965 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, banks_obj->id, "banks" ) );
966 :
967 0 : fd_topo_obj_t * progcache_obj = setup_topo_progcache( topo, "progcache",
968 0 : fd_progcache_est_rec_max( config->firedancer.runtime.program_cache.heap_size_mib<<20,
969 0 : config->firedancer.runtime.program_cache.mean_cache_entry_size ),
970 0 : config->firedancer.funk.max_database_transactions,
971 0 : config->firedancer.runtime.program_cache.heap_size_mib<<20 );
972 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], progcache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
973 0 : FOR(exec_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "exec", i ) ], progcache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
974 0 : FOR(bank_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "bank", i ) ], progcache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
975 :
976 0 : if( FD_LIKELY( config->tiles.gui.enabled ) ) {
977 0 : fd_topob_wksp( topo, "gui" );
978 :
979 : /**/ fd_topob_tile( topo, "gui", "gui", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
980 :
981 : /* Read banks */
982 : /* TODO: SECURITY CRITICAL. GUI SHOULD NOT HAVE WRITE ACCESS TO BANKS, JUST HACKED IN FOR NOW SO RWLOCK WORKS */
983 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "gui", 0UL ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
984 :
985 : /* release ownership of banks */
986 : /**/ fd_topob_link( topo, "gui_replay", "gui", 128, 0UL,2UL ); /* burst==2 since a bank and its parent may be sent in one burst */
987 :
988 0 : /**/ fd_topob_tile_out( topo, "gui", 0UL, "gui_replay", 0UL );
989 0 : /**/ fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "gui_replay", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
990 :
991 : /* topo, tile_name, tile_kind_id, fseq_wksp, link_name, link_kind_id, reliable, polled */
992 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 */
993 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "repair_net", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
994 0 : FOR(shred_tile_cnt) fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "shred_out", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
995 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "gossip_net", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
996 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
997 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "tower_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
998 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
999 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "replay_stake", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1000 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1001 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "pack_poh", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1002 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "pack_bank", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1003 0 : FOR(bank_tile_cnt) fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "bank_poh", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1004 0 : FOR(exec_tile_cnt) fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "exec_replay", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1005 :
1006 0 : if( FD_LIKELY( snapshots_enabled ) ) {
1007 0 : /**/ fd_topob_tile_in ( topo, "gui", 0UL, "metric_in", "snapct_gui", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1008 0 : /**/ fd_topob_tile_in ( topo, "gui", 0UL, "metric_in", "snapin_gui", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1009 0 : }
1010 0 : }
1011 :
1012 0 : ulong fec_set_cnt = shred_depth + config->tiles.shred.max_pending_shred_sets + 4UL;
1013 0 : ulong fec_sets_sz = fec_set_cnt*sizeof(fd_shred34_t)*4; /* mirrors # of dcache entires in frankendancer */
1014 0 : fd_topo_obj_t * fec_sets_obj = setup_topo_fec_sets( topo, "fec_sets", shred_tile_cnt*fec_sets_sz );
1015 0 : for( ulong i=0UL; i<shred_tile_cnt; i++ ) {
1016 0 : fd_topo_tile_t * shred_tile = &topo->tiles[ fd_topo_find_tile( topo, "shred", i ) ];
1017 0 : fd_topob_tile_uses( topo, shred_tile, fec_sets_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1018 0 : }
1019 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "repair", 0UL ) ], fec_sets_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
1020 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, fec_sets_obj->id, "fec_sets" ) );
1021 :
1022 0 : fd_topo_obj_t * store_obj = setup_topo_store( topo, "store", config->firedancer.store.max_completed_shred_sets, (uint)shred_tile_cnt );
1023 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 );
1024 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], store_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1025 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, store_obj->id, "store" ) );
1026 :
1027 0 : fd_topo_obj_t * txncache_obj = setup_topo_txncache( topo, "txncache",
1028 0 : config->firedancer.runtime.max_live_slots,
1029 0 : fd_ulong_pow2_up( FD_PACK_MAX_TXNCACHE_TXN_PER_SLOT ) );
1030 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], txncache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1031 0 : if( FD_LIKELY( snapshots_enabled ) ) {
1032 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapin", 0UL ) ], txncache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1033 0 : }
1034 0 : FOR(bank_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "bank", i ) ], txncache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1035 0 : FOR(exec_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "exec", i ) ], txncache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1036 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, txncache_obj->id, "txncache" ) );
1037 :
1038 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "genesi", 0UL ) ], funk_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1039 0 : if( FD_LIKELY( snapshots_enabled ) ) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapin", 0UL ) ], funk_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1040 :
1041 0 : if( FD_UNLIKELY( rpc_enabled ) ) {
1042 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "rpcsrv", 0UL ) ], funk_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1043 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "rpcsrv", 0UL ) ], store_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1044 0 : }
1045 :
1046 0 : fd_pod_insert_int( topo->props, "sandbox", config->development.sandbox ? 1 : 0 );
1047 :
1048 0 : for( ulong i=0UL; i<topo->tile_cnt; i++ ) fd_topo_configure_tile( &topo->tiles[ i ], config );
1049 :
1050 0 : FOR(net_tile_cnt) fd_topos_net_tile_finish( topo, i );
1051 0 : fd_topob_finish( topo, CALLBACKS );
1052 0 : config->topo = *topo;
1053 0 : }
1054 :
1055 : void
1056 : fd_topo_configure_tile( fd_topo_tile_t * tile,
1057 0 : fd_config_t * config ) {
1058 0 : if( FD_UNLIKELY( !strcmp( tile->name, "metric" ) ) ) {
1059 :
1060 0 : if( FD_UNLIKELY( !fd_cstr_to_ip4_addr( config->tiles.metric.prometheus_listen_address, &tile->metric.prometheus_listen_addr ) ) )
1061 0 : FD_LOG_ERR(( "failed to parse prometheus listen address `%s`", config->tiles.metric.prometheus_listen_address ));
1062 0 : tile->metric.prometheus_listen_port = config->tiles.metric.prometheus_listen_port;
1063 :
1064 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "net" ) || !strcmp( tile->name, "sock" ) ) ) {
1065 :
1066 0 : tile->net.shred_listen_port = config->tiles.shred.shred_listen_port;
1067 0 : tile->net.quic_transaction_listen_port = config->tiles.quic.quic_transaction_listen_port;
1068 0 : tile->net.legacy_transaction_listen_port = config->tiles.quic.regular_transaction_listen_port;
1069 0 : tile->net.gossip_listen_port = config->gossip.port;
1070 0 : tile->net.repair_intake_listen_port = config->tiles.repair.repair_intake_listen_port;
1071 0 : tile->net.repair_serve_listen_port = config->tiles.repair.repair_serve_listen_port;
1072 0 : tile->net.send_src_port = config->tiles.send.send_src_port;
1073 :
1074 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "netlnk" ) ) ) {
1075 :
1076 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "ipecho") ) ) {
1077 :
1078 0 : tile->ipecho.expected_shred_version = config->consensus.expected_shred_version;
1079 0 : tile->ipecho.bind_address = config->net.ip_addr;
1080 0 : tile->ipecho.bind_port = config->gossip.port;
1081 0 : tile->ipecho.entrypoints_cnt = config->gossip.entrypoints_cnt;
1082 0 : fd_memcpy( tile->ipecho.entrypoints, config->gossip.resolved_entrypoints, tile->ipecho.entrypoints_cnt * sizeof(fd_ip4_port_t) );
1083 :
1084 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "genesi" ) ) ) {
1085 :
1086 0 : tile->genesi.funk_obj_id = fd_pod_query_ulong( config->topo.props, "funk", ULONG_MAX );
1087 :
1088 0 : tile->genesi.allow_download = config->firedancer.snapshots.genesis_download;
1089 0 : strncpy( tile->genesi.genesis_path, config->paths.genesis, sizeof(tile->genesi.genesis_path) );
1090 0 : tile->genesi.expected_shred_version = config->consensus.expected_shred_version;
1091 0 : tile->genesi.entrypoints_cnt = config->gossip.entrypoints_cnt;
1092 0 : fd_memcpy( tile->genesi.entrypoints, config->gossip.resolved_entrypoints, tile->genesi.entrypoints_cnt * sizeof(fd_ip4_port_t) );
1093 :
1094 0 : tile->genesi.has_expected_genesis_hash = !!strcmp( config->consensus.expected_genesis_hash, "" );
1095 :
1096 0 : if( FD_UNLIKELY( strcmp( config->consensus.expected_genesis_hash, "" ) && !fd_base58_decode_32( config->consensus.expected_genesis_hash, tile->genesi.expected_genesis_hash ) ) ) {
1097 0 : FD_LOG_ERR(( "failed to decode [consensus.expected_genesis_hash] \"%s\" as base58", config->consensus.expected_genesis_hash ));
1098 0 : }
1099 :
1100 0 : tile->genesi.target_gid = config->gid;
1101 0 : tile->genesi.target_uid = config->uid;
1102 :
1103 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "gossvf") ) ) {
1104 :
1105 0 : strncpy( tile->gossvf.identity_key_path, config->paths.identity_key, sizeof(tile->gossvf.identity_key_path) );
1106 0 : tile->gossvf.tcache_depth = 1<<22UL; /* TODO: user defined option */
1107 0 : tile->gossvf.shred_version = 0U;
1108 0 : tile->gossvf.allow_private_address = config->development.gossip.allow_private_address;
1109 0 : tile->gossvf.boot_timestamp_nanos = config->boot_timestamp_nanos;
1110 :
1111 0 : tile->gossvf.entrypoints_cnt = config->gossip.entrypoints_cnt;
1112 0 : fd_memcpy( tile->gossvf.entrypoints, config->gossip.resolved_entrypoints, tile->gossvf.entrypoints_cnt * sizeof(fd_ip4_port_t) );
1113 :
1114 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "gossip" ) ) ) {
1115 :
1116 0 : if( FD_UNLIKELY( strcmp( config->firedancer.gossip.host, "" ) ) ) {
1117 0 : if( !resolve_address( config->firedancer.gossip.host, &tile->gossip.ip_addr ) )
1118 0 : FD_LOG_ERR(( "could not resolve [gossip.host] %s", config->firedancer.gossip.host ));
1119 0 : } else {
1120 0 : tile->gossip.ip_addr = config->net.ip_addr;
1121 0 : }
1122 0 : strncpy( tile->gossip.identity_key_path, config->paths.identity_key, sizeof(tile->gossip.identity_key_path) );
1123 0 : tile->gossip.shred_version = config->consensus.expected_shred_version;
1124 0 : tile->gossip.max_entries = config->tiles.gossip.max_entries;
1125 0 : tile->gossip.boot_timestamp_nanos = config->boot_timestamp_nanos;
1126 :
1127 0 : tile->gossip.ports.gossip = config->gossip.port;
1128 0 : tile->gossip.ports.tvu = config->tiles.shred.shred_listen_port;
1129 0 : tile->gossip.ports.tpu = config->tiles.quic.regular_transaction_listen_port;
1130 0 : tile->gossip.ports.tpu_quic = config->tiles.quic.quic_transaction_listen_port;
1131 0 : tile->gossip.ports.repair = config->tiles.repair.repair_intake_listen_port;
1132 :
1133 0 : tile->gossip.entrypoints_cnt = config->gossip.entrypoints_cnt;
1134 0 : fd_memcpy( tile->gossip.entrypoints, config->gossip.resolved_entrypoints, tile->gossip.entrypoints_cnt * sizeof(fd_ip4_port_t) );
1135 :
1136 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapct" ) ) ) {
1137 :
1138 0 : fd_memcpy( tile->snapct.snapshots_path, config->paths.snapshots, PATH_MAX );
1139 0 : tile->snapct.sources.max_local_full_effective_age = config->firedancer.snapshots.sources.max_local_full_effective_age;
1140 0 : tile->snapct.sources.max_local_incremental_age = config->firedancer.snapshots.sources.max_local_incremental_age;
1141 0 : tile->snapct.incremental_snapshots = config->firedancer.snapshots.incremental_snapshots;
1142 0 : tile->snapct.max_full_snapshots_to_keep = config->firedancer.snapshots.max_full_snapshots_to_keep;
1143 0 : tile->snapct.max_incremental_snapshots_to_keep = config->firedancer.snapshots.max_incremental_snapshots_to_keep;
1144 0 : tile->snapct.full_effective_age_cancel_threshold = config->firedancer.snapshots.full_effective_age_cancel_threshold;
1145 0 : tile->snapct.sources.gossip.allow_any = config->firedancer.snapshots.sources.gossip.allow_any;
1146 0 : tile->snapct.sources.gossip.allow_list_cnt = config->firedancer.snapshots.sources.gossip.allow_list_cnt;
1147 0 : tile->snapct.sources.gossip.block_list_cnt = config->firedancer.snapshots.sources.gossip.block_list_cnt;
1148 0 : tile->snapct.sources.servers_cnt = config->firedancer.snapshots.sources.servers_cnt;
1149 0 : for( ulong i=0UL; i<tile->snapct.sources.gossip.allow_list_cnt; i++ ) {
1150 0 : if( FD_UNLIKELY( !fd_base58_decode_32( config->firedancer.snapshots.sources.gossip.allow_list[ i ], tile->snapct.sources.gossip.allow_list[ i ].uc ) ) ) {
1151 0 : FD_LOG_ERR(( "[snapshots.sources.gossip.allow_list[%lu]] invalid (%s)", i, config->firedancer.snapshots.sources.gossip.allow_list[ i ] ));
1152 0 : }
1153 0 : }
1154 0 : for( ulong i=0UL; i<tile->snapct.sources.gossip.block_list_cnt; i++ ) {
1155 0 : if( FD_UNLIKELY( !fd_base58_decode_32( config->firedancer.snapshots.sources.gossip.block_list[ i ], tile->snapct.sources.gossip.block_list[ i ].uc ) ) ) {
1156 0 : FD_LOG_ERR(( "[snapshots.sources.gossip.block_list[%lu]] invalid (%s)", i, config->firedancer.snapshots.sources.gossip.block_list[ i ] ));
1157 0 : }
1158 0 : }
1159 :
1160 0 : ulong resolved_peers_cnt = 0UL;
1161 0 : for( ulong i=0UL; i<tile->snapct.sources.servers_cnt; i++ ) {
1162 0 : fd_ip4_port_t resolved_addrs[ FD_TOPO_MAX_RESOLVED_ADDRS ];
1163 0 : struct addrinfo hints = { .ai_family = AF_INET, .ai_socktype = SOCK_STREAM };
1164 0 : int num_resolved = resolve_peer( config->firedancer.snapshots.sources.servers[ i ],
1165 0 : &hints,
1166 0 : "snapshots.sources.servers",
1167 0 : tile->snapct.sources.servers[ resolved_peers_cnt ].hostname,
1168 0 : resolved_addrs,
1169 0 : FD_TOPO_MAX_RESOLVED_ADDRS,
1170 0 : &tile->snapct.sources.servers[ resolved_peers_cnt ].is_https );
1171 0 : if( FD_UNLIKELY( 0==num_resolved ) ) {
1172 0 : FD_LOG_ERR(( "[snapshots.sources.servers[%lu]] invalid (%s)", i, config->firedancer.snapshots.sources.servers[ i ] ));
1173 0 : } else {
1174 0 : for( ulong i=0UL; i<(ulong)num_resolved; i++ ) tile->snapct.sources.servers[ resolved_peers_cnt+i ].addr = resolved_addrs[ i ];
1175 0 : for( ulong i=1UL; i<(ulong)num_resolved; i++ ) {
1176 0 : tile->snapct.sources.servers[ resolved_peers_cnt+i ].is_https = tile->snapct.sources.servers[ resolved_peers_cnt ].is_https;
1177 0 : fd_memcpy( tile->snapct.sources.servers[ resolved_peers_cnt+i ].hostname,
1178 0 : tile->snapct.sources.servers[ resolved_peers_cnt ].hostname,
1179 0 : sizeof(tile->snapct.sources.servers[ resolved_peers_cnt ].hostname) );
1180 0 : }
1181 0 : resolved_peers_cnt += (ulong)num_resolved;
1182 0 : }
1183 0 : }
1184 0 : tile->snapct.sources.servers_cnt = resolved_peers_cnt;
1185 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapld" ) ) ) {
1186 :
1187 0 : fd_memcpy( tile->snapld.snapshots_path, config->paths.snapshots, PATH_MAX );
1188 :
1189 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapdc" ) ) ) {
1190 :
1191 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapin" ) ) ) {
1192 :
1193 0 : tile->snapin.max_live_slots = config->firedancer.runtime.max_live_slots;
1194 0 : tile->snapin.funk_obj_id = fd_pod_query_ulong( config->topo.props, "funk", ULONG_MAX );
1195 0 : tile->snapin.txncache_obj_id = fd_pod_query_ulong( config->topo.props, "txncache", ULONG_MAX );
1196 :
1197 0 : tile->snapin.use_vinyl = !!config->firedancer.vinyl.enabled;
1198 0 : tile->snapin.lthash_disabled = !!config->development.snapshots.disable_lthash_verification;
1199 0 : if( tile->snapin.use_vinyl ) {
1200 0 : strcpy( tile->snapin.vinyl_path, config->paths.accounts );
1201 0 : tile->snapin.vinyl_meta_map_obj_id = fd_pod_query_ulong( config->topo.props, "vinyl.meta_map", ULONG_MAX );
1202 0 : tile->snapin.vinyl_meta_pool_obj_id = fd_pod_query_ulong( config->topo.props, "vinyl.meta_pool", ULONG_MAX );
1203 :
1204 0 : ulong in_wr_link_id = fd_topo_find_link( &config->topo, "snapin_wh", 0UL );
1205 0 : FD_TEST( in_wr_link_id!=ULONG_MAX );
1206 0 : fd_topo_link_t * in_wr_link = &config->topo.links[ in_wr_link_id ];
1207 0 : tile->snapin.snapwr_depth = in_wr_link->depth;
1208 0 : }
1209 :
1210 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapwh" ) ) ) {
1211 :
1212 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapwr" ) ) ) {
1213 :
1214 0 : strcpy( tile->snapwr.vinyl_path, config->paths.accounts );
1215 0 : ulong in_wr_link_id = fd_topo_find_link( &config->topo, "snapin_wh", 0UL );
1216 0 : FD_TEST( in_wr_link_id!=ULONG_MAX );
1217 0 : fd_topo_link_t * in_wr_link = &config->topo.links[ in_wr_link_id ];
1218 0 : tile->snapwr.dcache_obj_id = in_wr_link->dcache_obj_id;
1219 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapla" ) ) ) {
1220 :
1221 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapls" ) ) ) {
1222 :
1223 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "repair" ) ) ) {
1224 0 : tile->repair.max_pending_shred_sets = config->tiles.shred.max_pending_shred_sets;
1225 0 : tile->repair.repair_intake_listen_port = config->tiles.repair.repair_intake_listen_port;
1226 0 : tile->repair.repair_serve_listen_port = config->tiles.repair.repair_serve_listen_port;
1227 0 : tile->repair.slot_max = config->tiles.repair.slot_max;
1228 0 : tile->repair.repair_sign_cnt = config->firedancer.layout.sign_tile_count - 1; /* -1 because this excludes the keyguard client */
1229 0 : tile->repair.end_slot = 0;
1230 :
1231 0 : for( ulong i=0; i<tile->in_cnt; i++ ) {
1232 0 : if( !strcmp( config->topo.links[ tile->in_link_id[ i ] ].name, "sign_repair" ) ) {
1233 0 : tile->repair.repair_sign_depth = config->topo.links[ tile->in_link_id[ i ] ].depth;
1234 0 : break;
1235 0 : }
1236 0 : }
1237 0 : strncpy( tile->repair.identity_key_path, config->paths.identity_key, sizeof(tile->repair.identity_key_path) );
1238 :
1239 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "replay" ) )) {
1240 :
1241 0 : if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) {
1242 0 : #define PARSE_PUBKEY( _tile, f ) \
1243 0 : if( FD_UNLIKELY( !fd_base58_decode_32( config->tiles.bundle.f, tile->_tile.bundle.f ) ) ) \
1244 0 : FD_LOG_ERR(( "[tiles.bundle.enabled] set to true, but failed to parse [tiles.bundle."#f"] %s", config->tiles.bundle.f ));
1245 0 : tile->replay.bundle.enabled = 1;
1246 0 : PARSE_PUBKEY( replay, tip_distribution_program_addr );
1247 0 : PARSE_PUBKEY( replay, tip_payment_program_addr );
1248 0 : strncpy( tile->replay.bundle.vote_account_path, config->paths.vote_account, sizeof(tile->replay.bundle.vote_account_path) );
1249 0 : } else {
1250 0 : fd_memset( &tile->replay.bundle, '\0', sizeof(tile->replay.bundle) );
1251 0 : }
1252 :
1253 0 : tile->replay.max_live_slots = config->firedancer.runtime.max_live_slots;
1254 0 : tile->replay.fec_max = config->tiles.shred.max_pending_shred_sets;
1255 0 : tile->replay.max_vote_accounts = config->firedancer.runtime.max_vote_accounts;
1256 :
1257 0 : tile->replay.txncache_obj_id = fd_pod_query_ulong( config->topo.props, "txncache", ULONG_MAX ); FD_TEST( tile->replay.txncache_obj_id !=ULONG_MAX );
1258 0 : tile->replay.funk_obj_id = fd_pod_query_ulong( config->topo.props, "funk", ULONG_MAX ); FD_TEST( tile->replay.funk_obj_id !=ULONG_MAX );
1259 0 : tile->replay.progcache_obj_id = fd_pod_query_ulong( config->topo.props, "progcache", ULONG_MAX ); FD_TEST( tile->replay.progcache_obj_id!=ULONG_MAX );
1260 :
1261 0 : tile->replay.max_live_slots = config->firedancer.runtime.max_live_slots;
1262 :
1263 0 : tile->replay.expected_shred_version = config->consensus.expected_shred_version;
1264 :
1265 0 : tile->replay.larger_max_cost_per_block = config->development.bench.larger_max_cost_per_block;
1266 :
1267 0 : strncpy( tile->replay.genesis_path, config->paths.genesis, sizeof(tile->replay.genesis_path) );
1268 :
1269 : /* not specified by [tiles.replay] */
1270 :
1271 0 : strncpy( tile->replay.identity_key_path, config->paths.identity_key, sizeof(tile->replay.identity_key_path) );
1272 0 : tile->replay.ip_addr = config->net.ip_addr;
1273 0 : strncpy( tile->replay.vote_account_path, config->paths.vote_account, sizeof(tile->replay.vote_account_path) );
1274 :
1275 0 : tile->replay.capture_start_slot = config->capture.capture_start_slot;
1276 0 : strncpy( tile->replay.solcap_capture, config->capture.solcap_capture, sizeof(tile->replay.solcap_capture) );
1277 0 : strncpy( tile->replay.dump_proto_dir, config->capture.dump_proto_dir, sizeof(tile->replay.dump_proto_dir) );
1278 0 : tile->replay.dump_block_to_pb = config->capture.dump_block_to_pb;
1279 :
1280 0 : FD_TEST( tile->replay.funk_obj_id == fd_pod_query_ulong( config->topo.props, "funk", ULONG_MAX ) );
1281 :
1282 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "exec" ) ) ) {
1283 :
1284 0 : tile->exec.funk_obj_id = fd_pod_query_ulong( config->topo.props, "funk", ULONG_MAX ); FD_TEST( tile->exec.funk_obj_id !=ULONG_MAX );
1285 0 : tile->exec.txncache_obj_id = fd_pod_query_ulong( config->topo.props, "txncache", ULONG_MAX ); FD_TEST( tile->exec.txncache_obj_id !=ULONG_MAX );
1286 0 : tile->exec.progcache_obj_id = fd_pod_query_ulong( config->topo.props, "progcache", ULONG_MAX ); FD_TEST( tile->exec.progcache_obj_id!=ULONG_MAX );
1287 :
1288 0 : tile->exec.max_live_slots = config->firedancer.runtime.max_live_slots;
1289 :
1290 0 : tile->exec.capture_start_slot = config->capture.capture_start_slot;
1291 0 : strncpy( tile->exec.solcap_capture, config->capture.solcap_capture, sizeof(tile->exec.solcap_capture) );
1292 0 : strncpy( tile->exec.dump_proto_dir, config->capture.dump_proto_dir, sizeof(tile->exec.dump_proto_dir) );
1293 0 : tile->exec.dump_instr_to_pb = config->capture.dump_instr_to_pb;
1294 0 : tile->exec.dump_txn_to_pb = config->capture.dump_txn_to_pb;
1295 0 : tile->exec.dump_syscall_to_pb = config->capture.dump_syscall_to_pb;
1296 0 : tile->exec.dump_elf_to_pb = config->capture.dump_elf_to_pb;
1297 :
1298 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "tower" ) ) ) {
1299 :
1300 0 : tile->tower.hard_fork_fatal = config->firedancer.development.hard_fork_fatal;
1301 0 : tile->tower.max_live_slots = config->firedancer.runtime.max_live_slots;
1302 0 : tile->tower.max_vote_lookahead = config->tiles.tower.max_vote_lookahead;
1303 0 : strncpy( tile->tower.identity_key, config->paths.identity_key, sizeof(tile->tower.identity_key) );
1304 0 : strncpy( tile->tower.vote_account, config->paths.vote_account, sizeof(tile->tower.vote_account) );
1305 0 : strncpy( tile->tower.base_path, config->paths.base, sizeof(tile->tower.base_path) );
1306 :
1307 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "send" ) ) ) {
1308 :
1309 0 : tile->send.send_src_port = config->tiles.send.send_src_port;
1310 0 : tile->send.ip_addr = config->net.ip_addr;
1311 0 : strncpy( tile->send.identity_key_path, config->paths.identity_key, sizeof(tile->send.identity_key_path) );
1312 :
1313 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "quic" ) ) ) {
1314 :
1315 0 : tile->quic.reasm_cnt = config->tiles.quic.txn_reassembly_count;
1316 0 : tile->quic.out_depth = config->tiles.verify.receive_buffer_size;
1317 0 : tile->quic.max_concurrent_connections = config->tiles.quic.max_concurrent_connections;
1318 0 : tile->quic.max_concurrent_handshakes = config->tiles.quic.max_concurrent_handshakes;
1319 0 : tile->quic.quic_transaction_listen_port = config->tiles.quic.quic_transaction_listen_port;
1320 0 : tile->quic.idle_timeout_millis = config->tiles.quic.idle_timeout_millis;
1321 0 : tile->quic.ack_delay_millis = config->tiles.quic.ack_delay_millis;
1322 0 : tile->quic.retry = config->tiles.quic.retry;
1323 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) ) );
1324 :
1325 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "verify" ) ) ) {
1326 :
1327 0 : tile->verify.tcache_depth = config->tiles.verify.signature_cache_size;
1328 :
1329 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "dedup" ) ) ) {
1330 :
1331 0 : tile->dedup.tcache_depth = config->tiles.dedup.signature_cache_size;
1332 :
1333 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "resolv" ) ) ) {
1334 :
1335 0 : tile->resolv.funk_obj_id = fd_pod_query_ulong( config->topo.props, "funk", ULONG_MAX );
1336 :
1337 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "pack" ) ) ) {
1338 :
1339 0 : tile->pack.max_pending_transactions = config->tiles.pack.max_pending_transactions;
1340 0 : tile->pack.bank_tile_count = config->layout.bank_tile_count;
1341 0 : tile->pack.larger_max_cost_per_block = config->development.bench.larger_max_cost_per_block;
1342 0 : tile->pack.larger_shred_limits_per_block = config->development.bench.larger_shred_limits_per_block;
1343 0 : tile->pack.use_consumed_cus = config->tiles.pack.use_consumed_cus;
1344 0 : tile->pack.schedule_strategy = config->tiles.pack.schedule_strategy_enum;
1345 :
1346 0 : if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) {
1347 :
1348 0 : tile->pack.bundle.enabled = 1;
1349 0 : PARSE_PUBKEY( pack, tip_distribution_program_addr );
1350 0 : PARSE_PUBKEY( pack, tip_payment_program_addr );
1351 0 : PARSE_PUBKEY( pack, tip_distribution_authority );
1352 0 : tile->pack.bundle.commission_bps = config->tiles.bundle.commission_bps;
1353 0 : strncpy( tile->pack.bundle.identity_key_path, config->paths.identity_key, sizeof(tile->pack.bundle.identity_key_path) );
1354 0 : strncpy( tile->pack.bundle.vote_account_path, config->paths.vote_account, sizeof(tile->pack.bundle.vote_account_path) );
1355 0 : } else {
1356 0 : fd_memset( &tile->pack.bundle, '\0', sizeof(tile->pack.bundle) );
1357 0 : }
1358 :
1359 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "bank" ) ) ) {
1360 0 : tile->bank.txncache_obj_id = fd_pod_query_ulong( config->topo.props, "txncache", ULONG_MAX );
1361 0 : tile->bank.funk_obj_id = fd_pod_query_ulong( config->topo.props, "funk", ULONG_MAX );
1362 0 : tile->bank.progcache_obj_id = fd_pod_query_ulong( config->topo.props, "progcache", ULONG_MAX );
1363 :
1364 0 : tile->bank.max_live_slots = config->firedancer.runtime.max_live_slots;
1365 :
1366 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "poh" ) ) ) {
1367 0 : strncpy( tile->poh.identity_key_path, config->paths.identity_key, sizeof(tile->poh.identity_key_path) );
1368 :
1369 0 : tile->poh.plugins_enabled = 0;
1370 0 : tile->poh.bank_cnt = config->layout.bank_tile_count;
1371 0 : tile->poh.lagged_consecutive_leader_start = config->tiles.poh.lagged_consecutive_leader_start;
1372 :
1373 0 : if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) {
1374 0 : tile->poh.bundle.enabled = 1;
1375 0 : PARSE_PUBKEY( poh, tip_distribution_program_addr );
1376 0 : PARSE_PUBKEY( poh, tip_payment_program_addr );
1377 0 : strncpy( tile->poh.bundle.vote_account_path, config->paths.vote_account, sizeof(tile->poh.bundle.vote_account_path) );
1378 0 : #undef PARSE_PUBKEY
1379 0 : } else {
1380 0 : fd_memset( &tile->poh.bundle, '\0', sizeof(tile->poh.bundle) );
1381 0 : }
1382 :
1383 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "shred" ) ) ) {
1384 :
1385 0 : strncpy( tile->shred.identity_key_path, config->paths.identity_key, sizeof(tile->shred.identity_key_path) );
1386 :
1387 0 : tile->shred.depth = config->topo.links[ tile->out_link_id[ 0 ] ].depth;
1388 0 : tile->shred.fec_resolver_depth = config->tiles.shred.max_pending_shred_sets;
1389 0 : tile->shred.expected_shred_version = config->consensus.expected_shred_version;
1390 0 : tile->shred.shred_listen_port = config->tiles.shred.shred_listen_port;
1391 0 : tile->shred.larger_shred_limits_per_block = config->development.bench.larger_shred_limits_per_block;
1392 0 : for( ulong i=0UL; i<config->tiles.shred.additional_shred_destinations_retransmit_cnt; i++ ) {
1393 0 : parse_ip_port( "tiles.shred.additional_shred_destinations_retransmit",
1394 0 : config->tiles.shred.additional_shred_destinations_retransmit[ i ],
1395 0 : &tile->shred.adtl_dests_retransmit[ i ] );
1396 0 : }
1397 0 : tile->shred.adtl_dests_retransmit_cnt = config->tiles.shred.additional_shred_destinations_retransmit_cnt;
1398 0 : for( ulong i=0UL; i<config->tiles.shred.additional_shred_destinations_leader_cnt; i++ ) {
1399 0 : parse_ip_port( "tiles.shred.additional_shred_destinations_leader",
1400 0 : config->tiles.shred.additional_shred_destinations_leader[ i ],
1401 0 : &tile->shred.adtl_dests_leader[ i ] );
1402 0 : }
1403 0 : tile->shred.adtl_dests_leader_cnt = config->tiles.shred.additional_shred_destinations_leader_cnt;
1404 :
1405 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "sign" ) ) ) {
1406 :
1407 0 : strncpy( tile->sign.identity_key_path, config->paths.identity_key, sizeof(tile->sign.identity_key_path) );
1408 :
1409 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "plugin" ) ) ) {
1410 :
1411 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "cswtch" ) ) ) {
1412 :
1413 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "gui" ) ) ) {
1414 :
1415 0 : if( FD_UNLIKELY( !fd_cstr_to_ip4_addr( config->tiles.gui.gui_listen_address, &tile->gui.listen_addr ) ) )
1416 0 : FD_LOG_ERR(( "failed to parse gui listen address `%s`", config->tiles.gui.gui_listen_address ));
1417 0 : tile->gui.listen_port = config->tiles.gui.gui_listen_port;
1418 0 : tile->gui.is_voting = strcmp( config->paths.vote_account, "" );
1419 0 : strncpy( tile->gui.cluster, config->cluster, sizeof(tile->gui.cluster) );
1420 0 : strncpy( tile->gui.identity_key_path, config->paths.identity_key, sizeof(tile->gui.identity_key_path) );
1421 0 : strncpy( tile->gui.vote_key_path, config->paths.vote_account, sizeof(tile->gui.vote_key_path) );
1422 0 : tile->gui.max_http_connections = config->tiles.gui.max_http_connections;
1423 0 : tile->gui.max_websocket_connections = config->tiles.gui.max_websocket_connections;
1424 0 : tile->gui.max_http_request_length = config->tiles.gui.max_http_request_length;
1425 0 : tile->gui.send_buffer_size_mb = config->tiles.gui.send_buffer_size_mb;
1426 0 : tile->gui.schedule_strategy = config->tiles.pack.schedule_strategy_enum;
1427 0 : tile->gui.websocket_compression = 1;
1428 0 : tile->gui.frontend_release_channel = config->development.gui.frontend_release_channel_enum;
1429 :
1430 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "rpc" ) ) ) {
1431 :
1432 0 : if( FD_UNLIKELY( !fd_cstr_to_ip4_addr( config->tiles.rpc.rpc_listen_address, &tile->rpc.listen_addr ) ) )
1433 0 : FD_LOG_ERR(( "failed to parse rpc listen address `%s`", config->tiles.rpc.rpc_listen_address ));
1434 0 : tile->rpc.listen_port = config->tiles.rpc.rpc_listen_port;
1435 0 : tile->rpc.max_http_connections = config->tiles.rpc.max_http_connections;
1436 0 : tile->rpc.max_http_request_length = config->tiles.rpc.max_http_request_length;
1437 0 : tile->rpc.send_buffer_size_mb = config->tiles.rpc.send_buffer_size_mb;
1438 :
1439 0 : tile->rpc.max_live_slots = config->firedancer.runtime.max_live_slots;
1440 :
1441 0 : strncpy( tile->rpc.identity_key_path, config->paths.identity_key, sizeof(tile->rpc.identity_key_path) );
1442 :
1443 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "arch_f" ) ||
1444 0 : !strcmp( tile->name, "arch_w" ) ) ) {
1445 :
1446 0 : strncpy( tile->archiver.rocksdb_path, config->tiles.archiver.rocksdb_path, sizeof(tile->archiver.rocksdb_path) );
1447 :
1448 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "backt" ) ) ) {
1449 :
1450 0 : tile->backtest.end_slot = config->tiles.archiver.end_slot;
1451 :
1452 : /* Validate arguments based on the ingest mode */
1453 0 : if( !strcmp( config->tiles.archiver.ingest_mode, "rocksdb" ) ) {
1454 0 : strncpy( tile->backtest.rocksdb_path, config->tiles.archiver.rocksdb_path, PATH_MAX );
1455 0 : if( FD_UNLIKELY( 0==strlen( tile->backtest.rocksdb_path ) ) ) {
1456 0 : FD_LOG_ERR(( "`archiver.rocksdb_path` not specified in toml" ));
1457 0 : }
1458 0 : } else if( !strcmp( config->tiles.archiver.ingest_mode, "shredcap" ) ) {
1459 0 : strncpy( tile->backtest.shredcap_path, config->tiles.archiver.shredcap_path, PATH_MAX );
1460 0 : if( FD_UNLIKELY( 0==strlen( tile->backtest.shredcap_path ) ) ) {
1461 0 : FD_LOG_ERR(( "`archiver.shredcap_path` not specified in toml" ));
1462 0 : }
1463 0 : } else {
1464 0 : FD_LOG_ERR(( "Invalid ingest mode: %s", config->tiles.archiver.ingest_mode ));
1465 0 : }
1466 :
1467 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "scap" ) ) ) {
1468 :
1469 0 : tile->shredcap.repair_intake_listen_port = config->tiles.repair.repair_intake_listen_port;
1470 0 : strncpy( tile->shredcap.folder_path, config->tiles.shredcap.folder_path, sizeof(tile->shredcap.folder_path) );
1471 0 : tile->shredcap.write_buffer_size = config->tiles.shredcap.write_buffer_size;
1472 0 : tile->shredcap.enable_publish_stake_weights = 0; /* this is not part of the config */
1473 0 : strncpy( tile->shredcap.manifest_path, "", PATH_MAX ); /* this is not part of the config */
1474 :
1475 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "bundle" ) ) ) {
1476 0 : strncpy( tile->bundle.url, config->tiles.bundle.url, sizeof(tile->bundle.url) );
1477 0 : tile->bundle.url_len = strnlen( tile->bundle.url, 255 );
1478 0 : strncpy( tile->bundle.sni, config->tiles.bundle.tls_domain_name, 256 );
1479 0 : tile->bundle.sni_len = strnlen( tile->bundle.sni, 255 );
1480 0 : strncpy( tile->bundle.identity_key_path, config->paths.identity_key, sizeof(tile->bundle.identity_key_path) );
1481 0 : strncpy( tile->bundle.key_log_path, config->development.bundle.ssl_key_log_file, sizeof(tile->bundle.key_log_path) );
1482 0 : tile->bundle.buf_sz = config->development.bundle.buffer_size_kib<<10;
1483 0 : tile->bundle.ssl_heap_sz = config->development.bundle.ssl_heap_size_mib<<20;
1484 0 : tile->bundle.keepalive_interval_nanos = config->tiles.bundle.keepalive_interval_millis * (ulong)1e6;
1485 0 : tile->bundle.tls_cert_verify = !!config->tiles.bundle.tls_cert_verify;
1486 :
1487 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "vinyl" ) ) ) {
1488 :
1489 0 : tile->vinyl.vinyl_meta_map_obj_id = fd_pod_query_ulong( config->topo.props, "vinyl.meta_map", ULONG_MAX );
1490 0 : tile->vinyl.vinyl_meta_pool_obj_id = fd_pod_query_ulong( config->topo.props, "vinyl.meta_pool", ULONG_MAX );
1491 0 : tile->vinyl.vinyl_line_max = config->firedancer.vinyl.max_cache_entries;
1492 0 : tile->vinyl.vinyl_cnc_obj_id = fd_pod_query_ulong( config->topo.props, "vinyl.cnc", ULONG_MAX );
1493 0 : tile->vinyl.vinyl_data_obj_id = fd_pod_query_ulong( config->topo.props, "vinyl.data", ULONG_MAX );
1494 0 : fd_cstr_ncpy( tile->vinyl.vinyl_bstream_path, config->paths.accounts, sizeof(tile->vinyl.vinyl_bstream_path) );
1495 :
1496 0 : tile->vinyl.io_type = config->firedancer.vinyl.io_uring.enabled ?
1497 0 : FD_VINYL_IO_TYPE_UR : FD_VINYL_IO_TYPE_BD;
1498 0 : tile->vinyl.uring_depth = config->firedancer.vinyl.io_uring.queue_depth;
1499 :
1500 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "solcap" ) ) ) {
1501 :
1502 0 : tile->solcap.capture_start_slot = config->capture.capture_start_slot;
1503 0 : strncpy( tile->solcap.solcap_capture, config->capture.solcap_capture, sizeof(tile->solcap.solcap_capture) );
1504 0 : tile->solcap.recent_only = config->capture.recent_only;
1505 0 : tile->solcap.recent_slots_per_file = config->capture.recent_slots_per_file;
1506 :
1507 0 : } else {
1508 0 : FD_LOG_ERR(( "unknown tile name `%s`", tile->name ));
1509 0 : }
1510 0 : }
|