Line data Source code
1 : #include "topology.h"
2 :
3 : #include "../../ballet/lthash/fd_lthash.h"
4 : #include "../../discof/poh/fd_poh.h"
5 : #include "../../discof/replay/fd_execrp.h"
6 : #include "../../discof/gossip/fd_gossip_tile.h"
7 : #include "../../discof/tower/fd_tower_tile.h"
8 : #include "../../discof/resolv/fd_resolv_tile.h"
9 : #include "../../discof/repair/fd_repair.h"
10 : #include "../../discof/replay/fd_replay_tile.h"
11 : #include "../../disco/net/fd_net_tile.h"
12 : #include "../../discof/restore/fd_snapct_tile.h"
13 : #include "../../disco/gui/fd_gui_config_parse.h"
14 : #include "../../disco/quic/fd_tpu.h"
15 : #include "../../disco/pack/fd_pack_cost.h"
16 : #include "../../disco/tiles.h"
17 : #include "../../disco/topo/fd_topob.h"
18 : #include "../../disco/topo/fd_topob_vinyl.h"
19 : #include "../../disco/topo/fd_cpu_topo.h"
20 : #include "../../util/pod/fd_pod_format.h"
21 : #include "../../util/tile/fd_tile_private.h"
22 : #include "../../discof/restore/fd_snapin_tile_private.h"
23 : #include "../../discof/restore/fd_snaplv_tile_private.h"
24 : #include "../../discof/restore/fd_snapwm_tile_private.h"
25 : #include "../../discof/restore/utils/fd_slot_delta_parser.h"
26 : #include "../../discof/restore/utils/fd_ssctrl.h"
27 : #include "../../discof/restore/utils/fd_ssmsg.h"
28 : #include "../../flamenco/capture/fd_solcap_writer.h"
29 : #include "../../flamenco/progcache/fd_progcache_admin.h"
30 : #include "../../flamenco/runtime/fd_acc_pool.h"
31 : #include "../../vinyl/meta/fd_vinyl_meta.h"
32 : #include "../../vinyl/io/fd_vinyl_io.h" /* FD_VINYL_IO_TYPE_* */
33 :
34 : #include <sys/random.h>
35 : #include <sys/types.h>
36 : #include <sys/socket.h>
37 : #include <stdlib.h>
38 : #include <netdb.h>
39 :
40 : extern fd_topo_obj_callbacks_t * CALLBACKS[];
41 :
42 : static void
43 0 : parse_ip_port( const char * name, const char * ip_port, fd_topo_ip_port_t *parsed_ip_port) {
44 0 : char buf[ sizeof( "255.255.255.255:65536" ) ];
45 0 : memcpy( buf, ip_port, sizeof( buf ) );
46 0 : char *ip_end = strchr( buf, ':' );
47 0 : if( FD_UNLIKELY( !ip_end ) )
48 0 : FD_LOG_ERR(( "[%s] must in the form ip:port", name ));
49 0 : *ip_end = '\0';
50 :
51 0 : if( FD_UNLIKELY( !fd_cstr_to_ip4_addr( buf, &( parsed_ip_port->ip ) ) ) ) {
52 0 : FD_LOG_ERR(( "could not parse IP %s in [%s]", buf, name ));
53 0 : }
54 :
55 0 : parsed_ip_port->port = fd_cstr_to_ushort( ip_end+1 );
56 0 : if( FD_UNLIKELY( !parsed_ip_port->port ) )
57 0 : FD_LOG_ERR(( "could not parse port %s in [%s]", ip_end+1, name ));
58 0 : }
59 :
60 : fd_topo_obj_t *
61 : setup_topo_banks( fd_topo_t * topo,
62 : char const * wksp_name,
63 : ulong max_live_slots,
64 : ulong max_fork_width,
65 0 : int larger_max_cost_per_block ) {
66 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "banks", wksp_name );
67 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_live_slots, "obj.%lu.max_live_slots", obj->id ) );
68 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_fork_width, "obj.%lu.max_fork_width", obj->id ) );
69 0 : FD_TEST( fd_pod_insertf_int( topo->props, larger_max_cost_per_block, "obj.%lu.larger_max_cost_per_block", obj->id ) );
70 0 : ulong seed;
71 0 : FD_TEST( fd_rng_secure( &seed, sizeof( ulong ) ) );
72 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, seed, "obj.%lu.seed", obj->id ) );
73 0 : return obj;
74 0 : }
75 :
76 : fd_topo_obj_t *
77 : setup_topo_banks_locks( fd_topo_t * topo,
78 0 : char const * wksp_name ) {
79 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "banks_locks", wksp_name );
80 0 : return obj;
81 0 : }
82 :
83 : static fd_topo_obj_t *
84 0 : setup_topo_fec_sets( fd_topo_t * topo, char const * wksp_name, ulong sz ) {
85 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "fec_sets", wksp_name );
86 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, sz, "obj.%lu.sz", obj->id ) );
87 0 : return obj;
88 0 : }
89 :
90 : fd_topo_obj_t *
91 : setup_topo_funk( fd_topo_t * topo,
92 : char const * wksp_name,
93 : ulong max_account_records,
94 : ulong max_database_transactions,
95 0 : ulong heap_size_gib ) {
96 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "funk", wksp_name );
97 0 : FD_TEST( fd_pod_insert_ulong( topo->props, "funk", obj->id ) );
98 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_account_records, "obj.%lu.rec_max", obj->id ) );
99 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_database_transactions, "obj.%lu.txn_max", obj->id ) );
100 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, heap_size_gib*(1UL<<30), "obj.%lu.heap_max", obj->id ) );
101 0 : ulong funk_footprint = fd_funk_footprint( max_database_transactions, max_account_records );
102 0 : if( FD_UNLIKELY( !funk_footprint ) ) FD_LOG_ERR(( "Invalid [funk] parameters" ));
103 :
104 : /* Increase workspace partition count */
105 0 : ulong wksp_idx = fd_topo_find_wksp( topo, wksp_name );
106 0 : FD_TEST( wksp_idx!=ULONG_MAX );
107 0 : fd_topo_wksp_t * wksp = &topo->workspaces[ wksp_idx ];
108 0 : ulong size = funk_footprint+(heap_size_gib*(1UL<<30));
109 0 : ulong part_max = fd_wksp_part_max_est( size, 1U<<14U );
110 0 : if( FD_UNLIKELY( !part_max ) ) FD_LOG_ERR(( "fd_wksp_part_max_est(%lu,16KiB) failed", size ));
111 0 : wksp->part_max += part_max;
112 :
113 0 : return obj;
114 0 : }
115 :
116 : fd_topo_obj_t *
117 : setup_topo_progcache( fd_topo_t * topo,
118 : char const * wksp_name,
119 : ulong max_cache_entries,
120 : ulong max_database_transactions,
121 0 : ulong heap_size ) {
122 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "funk", wksp_name );
123 0 : FD_TEST( fd_pod_insert_ulong( topo->props, "progcache", obj->id ) );
124 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_cache_entries, "obj.%lu.rec_max", obj->id ) );
125 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_database_transactions, "obj.%lu.txn_max", obj->id ) );
126 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, heap_size, "obj.%lu.heap_max", obj->id ) );
127 0 : ulong funk_footprint = fd_funk_footprint( max_database_transactions, max_cache_entries );
128 0 : if( FD_UNLIKELY( !funk_footprint ) ) FD_LOG_ERR(( "Invalid [runtime.program_cache] parameters" ));
129 0 : if( FD_UNLIKELY( heap_size<(2*funk_footprint) ) ) {
130 0 : FD_LOG_ERR(( "Invalid [runtime.program_cache] parameters: heap_size_mib should be at least %lu",
131 0 : ( 2*funk_footprint )>>20 ));
132 0 : }
133 :
134 : /* Increase workspace partition count */
135 0 : ulong wksp_idx = fd_topo_find_wksp( topo, wksp_name );
136 0 : FD_TEST( wksp_idx!=ULONG_MAX );
137 0 : fd_topo_wksp_t * wksp = &topo->workspaces[ wksp_idx ];
138 0 : ulong part_max = fd_wksp_part_max_est( heap_size, 1U<<14U );
139 0 : if( FD_UNLIKELY( !part_max ) ) FD_LOG_ERR(( "fd_wksp_part_max_est(%lu,16KiB) failed", funk_footprint ));
140 0 : wksp->part_max += part_max;
141 :
142 0 : return obj;
143 0 : }
144 :
145 : fd_topo_obj_t *
146 : setup_topo_store( fd_topo_t * topo,
147 : char const * wksp_name,
148 : ulong fec_max,
149 0 : uint part_cnt ) {
150 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "store", wksp_name );
151 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, fec_max, "obj.%lu.fec_max", obj->id ) );
152 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, part_cnt, "obj.%lu.part_cnt", obj->id ) );
153 0 : return obj;
154 0 : }
155 :
156 : fd_topo_obj_t *
157 : setup_topo_txncache( fd_topo_t * topo,
158 : char const * wksp_name,
159 : ulong max_live_slots,
160 0 : ulong max_txn_per_slot ) {
161 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "txncache", wksp_name );
162 :
163 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_live_slots, "obj.%lu.max_live_slots", obj->id ) );
164 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, max_txn_per_slot, "obj.%lu.max_txn_per_slot", obj->id ) );
165 :
166 0 : return obj;
167 0 : }
168 :
169 : fd_topo_obj_t *
170 : setup_topo_acc_pool( fd_topo_t * topo,
171 0 : ulong max_account_cnt ) {
172 0 : fd_topob_wksp( topo, "acc_pool" );
173 0 : fd_topo_obj_t * acc_pool_obj = fd_topob_obj( topo, "acc_pool", "acc_pool" );
174 0 : fd_pod_insertf_ulong( topo->props, max_account_cnt, "obj.%lu.max_account_cnt", acc_pool_obj->id );
175 0 : FD_TEST( acc_pool_obj );
176 0 : FD_TEST( acc_pool_obj->id != ULONG_MAX );
177 0 : return acc_pool_obj;
178 0 : }
179 :
180 : void
181 : setup_topo_accdb_meta( fd_topo_t * topo,
182 0 : fd_configf_t * config ) {
183 0 : fd_topob_wksp( topo, "accdb_meta" );
184 :
185 0 : fd_topo_obj_t * map_obj = fd_topob_obj( topo, "vinyl_meta", "accdb_meta" );
186 0 : ulong const meta_max = fd_ulong_pow2_up( config->vinyl.max_account_records );
187 0 : ulong const lock_cnt = fd_vinyl_meta_lock_cnt_est ( meta_max );
188 0 : ulong const probe_max = fd_vinyl_meta_probe_max_est( meta_max );
189 0 : fd_pod_insertf_ulong( topo->props, meta_max, "obj.%lu.ele_max", map_obj->id );
190 0 : fd_pod_insertf_ulong( topo->props, lock_cnt, "obj.%lu.lock_cnt", map_obj->id );
191 0 : fd_pod_insertf_ulong( topo->props, probe_max, "obj.%lu.probe_max", map_obj->id );
192 0 : fd_pod_insertf_ulong( topo->props, (ulong)fd_tickcount(), "obj.%lu.seed", map_obj->id );
193 :
194 0 : fd_topo_obj_t * meta_pool_obj = fd_topob_obj( topo, "vinyl_meta_e", "accdb_meta" );
195 0 : fd_pod_insertf_ulong( topo->props, meta_max, "obj.%lu.cnt", meta_pool_obj->id );
196 :
197 0 : fd_pod_insert_ulong( topo->props, "accdb.meta_map", map_obj->id );
198 0 : fd_pod_insert_ulong( topo->props, "accdb.meta_pool", meta_pool_obj->id );
199 0 : }
200 :
201 : fd_topo_obj_t *
202 : setup_topo_accdb_cache( fd_topo_t * topo,
203 0 : fd_configf_t * config ) {
204 0 : fd_topob_wksp( topo, "accdb_data" );
205 0 : fd_topo_obj_t * line_obj = fd_topob_obj( topo, "vinyl_data", "accdb_data" );
206 0 : ulong const heap_max = config->vinyl.cache_size_gib<<30;
207 0 : fd_pod_insertf_ulong( topo->props, heap_max, "obj.%lu.data_sz", line_obj->id );
208 0 : fd_pod_insert_ulong( topo->props, "accdb.data", line_obj->id );
209 0 : return line_obj;
210 0 : }
211 :
212 : fd_topo_obj_t *
213 : setup_topo_vinyl_admin( fd_topo_t * topo,
214 0 : char const * wksp_name ) {
215 0 : fd_topo_obj_t * obj = fd_topob_obj( topo, "vinyl_admin", wksp_name );
216 0 : return obj;
217 0 : }
218 :
219 : /* Resolves a hostname to a single ip address. If multiple ip address
220 : records are returned by getaddrinfo, only the first IPV4 address is
221 : returned via ip_addr. */
222 : static int
223 : resolve_address( char const * address,
224 0 : uint * ip_addr ) {
225 0 : struct addrinfo hints = { .ai_family = AF_INET };
226 0 : struct addrinfo * res;
227 0 : int err = getaddrinfo( address, NULL, &hints, &res );
228 0 : if( FD_UNLIKELY( err ) ) {
229 0 : FD_LOG_WARNING(( "cannot resolve address \"%s\": %i-%s", address, err, gai_strerror( err ) ));
230 0 : return 0;
231 0 : }
232 :
233 0 : int resolved = 0;
234 0 : for( struct addrinfo * cur=res; cur; cur=cur->ai_next ) {
235 0 : if( FD_UNLIKELY( cur->ai_addr->sa_family!=AF_INET ) ) continue;
236 0 : struct sockaddr_in const * addr = (struct sockaddr_in const *)cur->ai_addr;
237 0 : *ip_addr = addr->sin_addr.s_addr;
238 0 : resolved = 1;
239 0 : break;
240 0 : }
241 :
242 0 : freeaddrinfo( res );
243 0 : return resolved;
244 0 : }
245 :
246 : /* Resolves a hostname to multiple ip addresses, specified by
247 : ip_addr_cnt. ip_addrs points to an array of fd_ip4_port_t objects.
248 : hints points to an optionally NULL addrinfo hints object. If hints
249 : is NULL, a default hints settings containing the IPV4 address family
250 : hint will be used. */
251 : static int
252 : resolve_addresses( char const * address,
253 : struct addrinfo const * hints,
254 : fd_ip4_port_t * ip_addrs,
255 0 : ulong ip_addr_cnt ) {
256 0 : struct addrinfo default_hints = { .ai_family = AF_INET };
257 0 : if( FD_UNLIKELY( !hints ) ) {
258 0 : hints = &default_hints;
259 0 : }
260 :
261 0 : struct addrinfo * res;
262 0 : int err = getaddrinfo( address, NULL, hints, &res );
263 0 : if( FD_UNLIKELY( err ) ) {
264 0 : FD_LOG_WARNING(( "cannot resolve address \"%s\": %i-%s", address, err, gai_strerror( err ) ));
265 0 : return 0;
266 0 : }
267 :
268 0 : int resolved = 0;
269 0 : for( struct addrinfo * cur=res; cur; cur=cur->ai_next ) {
270 0 : if( FD_UNLIKELY( (ulong)resolved>=ip_addr_cnt ) ) break;
271 0 : if( FD_UNLIKELY( cur->ai_addr->sa_family!=AF_INET ) ) continue;
272 0 : struct sockaddr_in const * addr = (struct sockaddr_in const *)cur->ai_addr;
273 0 : ip_addrs[ resolved ].addr = addr->sin_addr.s_addr;
274 0 : resolved++;
275 0 : }
276 :
277 0 : freeaddrinfo( res );
278 0 : return resolved;
279 0 : }
280 :
281 : static int
282 : resolve_peer( char const * peer,
283 : struct addrinfo const * addr_resolve_hints,
284 : char const * config_str,
285 : char hostname[ static 256UL ],
286 : fd_ip4_port_t * ip4_port,
287 : ulong ip4_port_cnt,
288 0 : int * is_https ) {
289 :
290 : /* Split host:port */
291 0 : int https = 0;
292 0 : char const * host_port = peer;
293 0 : if( FD_LIKELY( strncmp( peer, "http://", 7UL )==0 ) ) {
294 0 : if( FD_LIKELY( is_https ) ) *is_https = 0;
295 0 : host_port += 7UL;
296 0 : } else if( FD_LIKELY( strncmp( peer, "https://", 8UL )==0 ) ) {
297 0 : if( FD_LIKELY( is_https ) ) *is_https = 1;
298 0 : host_port += 8UL;
299 0 : https = 1;
300 0 : }
301 :
302 0 : char const * colon = strrchr( host_port, ':' );
303 0 : char const * host_end = colon;
304 0 : if( FD_UNLIKELY( !colon && !https ) ) {
305 0 : FD_LOG_ERR(( "invalid [%s] entry \"%s\": no port number", config_str, host_port ));
306 0 : } else if( FD_LIKELY( !colon && https ) ) {
307 0 : host_end = host_port + strlen( host_port );
308 0 : }
309 :
310 0 : ulong fqdn_len = (ulong)( host_end-host_port );
311 0 : if( FD_UNLIKELY( fqdn_len>255 ) ) {
312 0 : FD_LOG_ERR(( "invalid [%s] entry \"%s\": hostname too long", config_str, host_port ));
313 0 : }
314 0 : fd_memcpy( hostname, host_port, fqdn_len );
315 0 : hostname[ fqdn_len ] = '\0';
316 :
317 : /* Resolve hostname */
318 0 : int resolved = resolve_addresses( hostname, addr_resolve_hints, ip4_port, ip4_port_cnt );
319 :
320 : /* Parse port number */
321 :
322 0 : if( FD_LIKELY( colon ) ) {
323 0 : char const * port_str = host_end+1;
324 0 : char const * endptr = NULL;
325 0 : ulong port = strtoul( port_str, (char **)&endptr, 10 );
326 0 : if( FD_UNLIKELY( endptr==port_str || !port || port>USHORT_MAX || *endptr!='\0' ) ) {
327 0 : FD_LOG_ERR(( "invalid [%s] entry \"%s\": invalid port number", config_str, host_port ));
328 0 : }
329 0 : for( ulong i=0UL; i<(ulong)resolved; i++ ) ip4_port[ i ].port = fd_ushort_bswap( (ushort)port );
330 0 : } else if( FD_LIKELY( !colon && https ) ) {
331 : /* use default https port */
332 0 : for( ulong i=0UL; i<(ulong)resolved; i++ ) ip4_port[ i ].port = fd_ushort_bswap( 443U );
333 0 : } else {
334 0 : FD_LOG_ERR(( "invalid [%s] entry \"%s\": no port number", config_str, host_port ));
335 0 : }
336 :
337 0 : return resolved;
338 0 : }
339 :
340 : static void
341 0 : resolve_gossip_entrypoints( config_t * config ) {
342 0 : ulong entrypoint_cnt = config->gossip.entrypoints_cnt;
343 0 : for( ulong i=0UL; i<entrypoint_cnt; i++ ) {
344 0 : char hostname[ 256UL ];
345 0 : if( FD_UNLIKELY( 0==resolve_peer( config->gossip.entrypoints[ i ], NULL, "gossip.entrypoints", hostname, &config->gossip.resolved_entrypoints[ i ], 1, NULL ) ) ) {
346 0 : FD_LOG_ERR(( "failed to resolve address of [gossip.entrypoints] entry \"%s\"", config->gossip.entrypoints[ i ] ));
347 0 : }
348 0 : }
349 0 : }
350 :
351 : void
352 0 : fd_topo_initialize( config_t * config ) {
353 : /* TODO: Not here ... */
354 0 : resolve_gossip_entrypoints( config );
355 :
356 0 : ulong net_tile_cnt = config->layout.net_tile_count;
357 0 : ulong shred_tile_cnt = config->layout.shred_tile_count;
358 0 : ulong quic_tile_cnt = config->layout.quic_tile_count;
359 0 : ulong verify_tile_cnt = config->layout.verify_tile_count;
360 0 : ulong resolv_tile_cnt = config->firedancer.layout.resolv_tile_count;
361 0 : ulong execle_tile_cnt = config->firedancer.layout.execle_tile_count;
362 :
363 0 : ulong gossvf_tile_cnt = config->firedancer.layout.gossvf_tile_count;
364 0 : ulong execrp_tile_cnt = config->firedancer.layout.execrp_tile_count;
365 0 : ulong sign_tile_cnt = config->firedancer.layout.sign_tile_count;
366 0 : ulong lta_tile_cnt = config->firedancer.layout.snapshot_hash_tile_count;
367 0 : ulong snapwr_tile_cnt = config->firedancer.layout.snapwr_tile_count;
368 0 : ulong snaplh_tile_cnt = config->firedancer.layout.snapshot_hash_tile_count;
369 :
370 0 : int snapshots_enabled = !!config->gossip.entrypoints_cnt;
371 0 : int vinyl_enabled = !!config->firedancer.vinyl.enabled;
372 0 : int snapshot_lthash_disabled = config->development.snapshots.disable_lthash_verification;
373 0 : int rpc_enabled = config->tiles.rpc.enabled;
374 0 : int telemetry_enabled = config->telemetry && strcmp( config->tiles.event.url, "" );
375 :
376 0 : fd_topo_t * topo = fd_topob_new( &config->topo, config->name );
377 :
378 0 : topo->max_page_size = fd_cstr_to_shmem_page_sz( config->hugetlbfs.max_page_size );
379 0 : topo->gigantic_page_threshold = config->hugetlbfs.gigantic_page_threshold_mib << 20;
380 :
381 0 : int solcap_enabled = strlen( config->capture.solcap_capture ) > 0;
382 :
383 : /* topo, name */
384 0 : fd_topob_wksp( topo, "metric" );
385 0 : fd_topob_wksp( topo, "diag" );
386 0 : fd_topob_wksp( topo, "genesi" );
387 0 : fd_topob_wksp( topo, "ipecho" );
388 0 : fd_topob_wksp( topo, "gossvf" );
389 0 : fd_topob_wksp( topo, "gossip" );
390 0 : fd_topob_wksp( topo, "shred" );
391 0 : fd_topob_wksp( topo, "repair" );
392 0 : fd_topob_wksp( topo, "replay" );
393 0 : fd_topob_wksp( topo, "execrp" );
394 0 : fd_topob_wksp( topo, "tower" );
395 0 : fd_topob_wksp( topo, "txsend" );
396 :
397 0 : fd_topob_wksp( topo, "quic" );
398 0 : fd_topob_wksp( topo, "verify" );
399 0 : fd_topob_wksp( topo, "dedup" );
400 0 : fd_topob_wksp( topo, "resolv" );
401 0 : fd_topob_wksp( topo, "pack" );
402 0 : fd_topob_wksp( topo, "execle" );
403 0 : fd_topob_wksp( topo, "poh" );
404 0 : fd_topob_wksp( topo, "sign" )->core_dump_level = FD_TOPO_CORE_DUMP_LEVEL_NEVER;
405 :
406 0 : fd_topob_wksp( topo, "metric_in" );
407 :
408 0 : fd_topob_wksp( topo, "net_gossip" );
409 0 : fd_topob_wksp( topo, "net_shred" );
410 0 : fd_topob_wksp( topo, "net_repair" );
411 0 : fd_topob_wksp( topo, "net_txsend" );
412 0 : fd_topob_wksp( topo, "net_quic" );
413 :
414 0 : fd_topob_wksp( topo, "genesi_out" );
415 0 : fd_topob_wksp( topo, "ipecho_out" );
416 0 : fd_topob_wksp( topo, "gossvf_gossip" );
417 0 : fd_topob_wksp( topo, "gossip_gossvf" );
418 0 : fd_topob_wksp( topo, "gossip_out" );
419 :
420 0 : fd_topob_wksp( topo, "shred_out" );
421 0 : fd_topob_wksp( topo, "repair_shred" );
422 0 : fd_topob_wksp( topo, "replay_epoch" );
423 0 : fd_topob_wksp( topo, "replay_execrp" );
424 0 : fd_topob_wksp( topo, "replay_out" );
425 0 : fd_topob_wksp( topo, "tower_out" );
426 0 : fd_topob_wksp( topo, "txsend_out" );
427 :
428 0 : fd_topob_wksp( topo, "quic_verify" );
429 0 : fd_topob_wksp( topo, "verify_dedup" );
430 0 : fd_topob_wksp( topo, "dedup_resolv" );
431 0 : fd_topob_wksp( topo, "resolv_pack" );
432 0 : fd_topob_wksp( topo, "pack_poh" );
433 0 : fd_topob_wksp( topo, "pack_execle" );
434 0 : fd_topob_wksp( topo, "resolv_replay" );
435 0 : if( FD_LIKELY( config->tiles.pack.use_consumed_cus ) ) {
436 0 : fd_topob_wksp( topo, "execle_pack" );
437 0 : }
438 0 : fd_topob_wksp( topo, "execle_poh" );
439 0 : fd_topob_wksp( topo, "execle_busy" );
440 0 : fd_topob_wksp( topo, "poh_shred" );
441 0 : fd_topob_wksp( topo, "poh_replay" );
442 :
443 0 : fd_topob_wksp( topo, "funk" )->core_dump_level = FD_TOPO_CORE_DUMP_LEVEL_FULL;
444 0 : fd_topob_wksp( topo, "progcache" );
445 0 : fd_topob_wksp( topo, "fec_sets" );
446 0 : fd_topob_wksp( topo, "txncache" );
447 0 : fd_topob_wksp( topo, "banks" );
448 0 : fd_topob_wksp( topo, "banks_locks" );
449 0 : fd_topob_wksp( topo, "store" )->core_dump_level = FD_TOPO_CORE_DUMP_LEVEL_FULL;
450 0 : fd_topob_wksp( topo, "executed_txn" );
451 :
452 0 : fd_topob_wksp( topo, "gossip_sign" );
453 0 : fd_topob_wksp( topo, "sign_gossip" );
454 :
455 0 : fd_topob_wksp( topo, "shred_sign" );
456 0 : fd_topob_wksp( topo, "sign_shred" );
457 :
458 0 : fd_topob_wksp( topo, "repair_sign" );
459 0 : fd_topob_wksp( topo, "sign_repair" );
460 :
461 0 : fd_topob_wksp( topo, "txsend_sign" );
462 0 : fd_topob_wksp( topo, "sign_txsend" );
463 :
464 0 : fd_topob_wksp( topo, "execrp_sig" );
465 :
466 0 : fd_topob_wksp( topo, "execrp_replay" );
467 :
468 0 : if( FD_LIKELY( snapshots_enabled ) ) {
469 0 : fd_topob_wksp( topo, "snapct" );
470 0 : fd_topob_wksp( topo, "snapld" );
471 0 : fd_topob_wksp( topo, "snapdc" );
472 0 : fd_topob_wksp( topo, "snapin" );
473 0 : if( vinyl_enabled ) {
474 0 : fd_topob_wksp( topo, "snapwm" );
475 0 : fd_topob_wksp( topo, "snapwh" );
476 0 : fd_topob_wksp( topo, "snapwr" );
477 0 : }
478 0 : fd_topob_wksp( topo, "snapct_ld" );
479 0 : fd_topob_wksp( topo, "snapld_dc" );
480 0 : fd_topob_wksp( topo, "snapdc_in" );
481 0 : if( vinyl_enabled ) {
482 0 : fd_topob_wksp( topo, "snapin_txn");
483 0 : fd_topob_wksp( topo, "snapin_wm" );
484 0 : fd_topob_wksp( topo, "snapwm_wr" );
485 0 : }
486 0 : if( snapshot_lthash_disabled ) {
487 0 : if( vinyl_enabled ) {
488 0 : fd_topob_wksp( topo, "snapwm_ct" );
489 0 : } else {
490 0 : fd_topob_wksp( topo, "snapin_ct" );
491 0 : }
492 0 : } else {
493 0 : if( vinyl_enabled ) {
494 0 : fd_topob_wksp( topo, "snaplh" );
495 0 : fd_topob_wksp( topo, "snaplv" );
496 0 : fd_topob_wksp( topo, "vinyl_admin" );
497 0 : fd_topob_wksp( topo, "snaplv_lh" );
498 0 : fd_topob_wksp( topo, "snaplh_lv" );
499 0 : fd_topob_wksp( topo, "snapwm_lv" );
500 0 : fd_topob_wksp( topo, "snaplv_ct" );
501 0 : } else {
502 0 : fd_topob_wksp( topo, "snapla" );
503 0 : fd_topob_wksp( topo, "snapls" );
504 0 : fd_topob_wksp( topo, "snapla_ls" );
505 0 : fd_topob_wksp( topo, "snapin_ls" );
506 0 : fd_topob_wksp( topo, "snapls_ct" );
507 0 : }
508 0 : }
509 :
510 0 : if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "snapct_gui" );
511 0 : if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "snapin_gui" );
512 0 : fd_topob_wksp( topo, "snapin_manif" );
513 0 : fd_topob_wksp( topo, "snapct_repr" );
514 0 : }
515 :
516 0 : #define FOR(cnt) for( ulong i=0UL; i<cnt; i++ )
517 :
518 0 : ulong shred_depth = 65536UL; /* from fdctl/topology.c shred_store link. MAKE SURE TO KEEP IN SYNC. */
519 :
520 : /* topo, link_name, wksp_name, depth, mtu, burst */
521 0 : /**/ fd_topob_link( topo, "gossip_net", "net_gossip", 32768UL, FD_NET_MTU, 1UL );
522 0 : FOR(shred_tile_cnt) fd_topob_link( topo, "shred_net", "net_shred", 32768UL, FD_NET_MTU, 1UL );
523 0 : /**/ fd_topob_link( topo, "repair_net", "net_repair", config->net.ingress_buffer_size, FD_NET_MTU, 1UL );
524 0 : /**/ fd_topob_link( topo, "txsend_net", "net_txsend", config->net.ingress_buffer_size, FD_NET_MTU, 1UL );
525 0 : FOR(quic_tile_cnt) fd_topob_link( topo, "quic_net", "net_quic", config->net.ingress_buffer_size, FD_NET_MTU, 1UL );
526 :
527 0 : if( FD_LIKELY( snapshots_enabled ) ) {
528 : /* TODO: Revisit the depths of all the snapshot links */
529 0 : /**/ fd_topob_link( topo, "snapct_ld", "snapct_ld", 128UL, sizeof(fd_ssctrl_init_t), 1UL );
530 0 : /**/ fd_topob_link( topo, "snapld_dc", "snapld_dc", 16384UL, USHORT_MAX, 1UL );
531 0 : /**/ fd_topob_link( topo, "snapdc_in", "snapdc_in", 16384UL, USHORT_MAX, 1UL );
532 :
533 : /**/ fd_topob_link( topo, "snapin_manif", "snapin_manif", 4UL, sizeof(fd_snapshot_manifest_t),1UL );
534 0 : /**/ fd_topob_link( topo, "snapct_repr", "snapct_repr", 128UL, 0UL, 1UL )->permit_no_consumers = 1; /* TODO: wire in repair later */
535 0 : if( FD_LIKELY( config->tiles.gui.enabled ) ) {
536 0 : /**/ fd_topob_link( topo, "snapct_gui", "snapct_gui", 128UL, sizeof(fd_snapct_update_t), 1UL );
537 0 : /**/ fd_topob_link( topo, "snapin_gui", "snapin_gui", 128UL, FD_GUI_CONFIG_PARSE_MAX_VALID_ACCT_SZ, 1UL );
538 0 : }
539 :
540 0 : if( vinyl_enabled ) {
541 : /* snapwm needs all txn_cache data in order to verify the slot
542 : deltas with the slot history. To make this possible, snapin
543 : uses the dcache of the snapin_txn link as the scratch memory.
544 : The depth of the link should match that of snapin_wm, just to
545 : guarantee enough mcache credits. The mtu needs to be adjusted
546 : so that the total dcache size matches what snapin requires.
547 : Round up the mtu (ulong) size using: (...+(depth-1))/depth. */
548 0 : /**/ fd_topob_link( topo, "snapin_txn", "snapin_txn", 16UL, (sizeof(fd_sstxncache_entry_t)*FD_SNAPIN_TXNCACHE_MAX_ENTRIES+15UL/*depth-1*/)/16UL/*depth*/, 1UL );
549 0 : /**/ fd_topob_link( topo, "snapin_wm", "snapin_wm", 16UL, FD_SNAPWM_PAIR_BATCH_SZ_MAX, 1UL );
550 : /* snapwh and snapwr both use snapwm_wh's dcache. snapwh sends
551 : control messages to snapwr, using snapwh_wr link, instructing
552 : which chunks in the dcache are ready to be consumed by snapwr. */
553 0 : fd_topo_link_t * snapwm_wh =
554 0 : /**/ fd_topob_link( topo, "snapwm_wh", "snapwm_wr", 64UL, FD_SNAPWM_WR_MTU, 1UL );
555 0 : /**/ fd_topob_link( topo, "snapwh_wr", "snapwm_wr", 64UL, 0UL, 1UL );
556 0 : fd_pod_insertf_ulong( topo->props, 8UL, "obj.%lu.app_sz", snapwm_wh->dcache_obj_id );
557 0 : }
558 0 : if( snapshot_lthash_disabled ) {
559 0 : if( vinyl_enabled ) {
560 0 : /**/ fd_topob_link( topo, "snapwm_ct", "snapwm_ct", 128UL, 0UL, 1UL );
561 0 : } else {
562 0 : /**/ fd_topob_link( topo, "snapin_ct", "snapin_ct", 128UL, 0UL, 1UL );
563 0 : }
564 0 : } else {
565 0 : if( vinyl_enabled ) {
566 0 : FOR(snaplh_tile_cnt) fd_topob_link( topo, "snaplh_lv", "snaplh_lv", 128UL, sizeof(fd_lthash_value_t), 1UL );
567 0 : /**/ fd_topob_link( topo, "snapwm_lv", "snapwm_lv", 32768UL, FD_SNAPWM_DUP_META_BATCH_SZ, 1UL );
568 0 : /**/ fd_topob_link( topo, "snaplv_lh", "snaplv_lh", 262144UL, FD_SNAPLV_DUP_META_SZ, FD_SNAPLV_STEM_BURST ); /* FD_SNAPWM_DUP_META_BATCH_CNT_MAX times the depth of snapwm_lv */
569 0 : /**/ fd_topob_link( topo, "snaplv_ct", "snaplv_ct", 128UL, 0UL, 1UL );
570 0 : } else {
571 0 : FOR(lta_tile_cnt) fd_topob_link( topo, "snapla_ls", "snapla_ls", 128UL, sizeof(fd_lthash_value_t), 1UL );
572 0 : /**/ fd_topob_link( topo, "snapin_ls", "snapin_ls", 256UL, sizeof(fd_snapshot_full_account_t), 1UL );
573 0 : /**/ fd_topob_link( topo, "snapls_ct", "snapls_ct", 128UL, 0UL, 1UL );
574 0 : }
575 0 : }
576 0 : }
577 :
578 : /**/ fd_topob_link( topo, "genesi_out", "genesi_out", 2UL, 10UL*1024UL*1024UL+32UL+sizeof(fd_lthash_value_t), 1UL );
579 0 : /**/ fd_topob_link( topo, "ipecho_out", "ipecho_out", 2UL, 0UL, 1UL );
580 0 : FOR(gossvf_tile_cnt) fd_topob_link( topo, "gossvf_gossip", "gossvf_gossip", config->net.ingress_buffer_size, sizeof(fd_gossip_view_t)+FD_NET_MTU, 1UL );
581 0 : /**/ fd_topob_link( topo, "gossip_gossvf", "gossip_gossvf", 65536UL*4UL, sizeof(fd_gossip_ping_update_t), 1UL ); /* TODO: Unclear where this depth comes from ... fix */
582 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 */
583 :
584 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 );
585 0 : FOR(verify_tile_cnt) fd_topob_link( topo, "verify_dedup", "verify_dedup", config->tiles.verify.receive_buffer_size, FD_TPU_PARSED_MTU, 1UL );
586 0 : /**/ fd_topob_link( topo, "dedup_resolv", "dedup_resolv", 65536UL, FD_TPU_PARSED_MTU, 1UL );
587 0 : FOR(resolv_tile_cnt) fd_topob_link( topo, "resolv_pack", "resolv_pack", 65536UL, FD_TPU_RESOLVED_MTU, 1UL );
588 0 : /**/ fd_topob_link( topo, "replay_epoch", "replay_epoch", 128UL, FD_EPOCH_OUT_MTU, 1UL ); /* TODO: This should be 2 but requires fixing STEM_BURST */
589 0 : /**/ fd_topob_link( topo, "replay_out", "replay_out", 8192UL, sizeof(fd_replay_message_t), 1UL );
590 0 : /**/ fd_topob_link( topo, "pack_poh", "pack_poh", 4096UL, sizeof(fd_done_packing_t), 1UL );
591 : /* pack_execle is shared across all execle, so if one executor stalls
592 : due to complex transactions, the buffer needs to be large so that
593 : other executors can keep proceeding. */
594 0 : /**/ fd_topob_link( topo, "pack_execle", "pack_execle", 65536UL, USHORT_MAX, 1UL );
595 0 : FOR(execle_tile_cnt) fd_topob_link( topo, "execle_poh", "execle_poh", 16384UL, USHORT_MAX, 1UL );
596 0 : if( FD_LIKELY( config->tiles.pack.use_consumed_cus ) ) {
597 0 : FOR(execle_tile_cnt) fd_topob_link( topo, "execle_pack", "execle_pack", 16384UL, USHORT_MAX, 1UL );
598 0 : }
599 0 : /**/ fd_topob_link( topo, "poh_shred", "poh_shred", 16384UL, USHORT_MAX, 1UL );
600 0 : /**/ fd_topob_link( topo, "poh_replay", "poh_replay", 4096UL, sizeof(fd_poh_leader_slot_ended_t), 1UL );
601 0 : FOR(resolv_tile_cnt) fd_topob_link( topo, "resolv_replay", "resolv_replay", 4096UL, sizeof(fd_resolv_slot_exchanged_t), 1UL );
602 0 : /**/ fd_topob_link( topo, "executed_txn", "executed_txn", 16384UL, 64UL, 1UL ); /* TODO: Rename this ... */
603 :
604 0 : FOR(shred_tile_cnt) fd_topob_link( topo, "shred_sign", "shred_sign", 128UL, 32UL, 1UL );
605 0 : FOR(shred_tile_cnt) fd_topob_link( topo, "sign_shred", "sign_shred", 128UL, sizeof(fd_ed25519_sig_t), 1UL );
606 :
607 : /**/ 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 */
608 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 */
609 :
610 0 : FOR(sign_tile_cnt-1) fd_topob_link( topo, "repair_sign", "repair_sign", 256UL, FD_REPAIR_MAX_PREIMAGE_SZ, 1UL ); /* See repair_tile.c for explanation */
611 0 : FOR(sign_tile_cnt-1) fd_topob_link( topo, "sign_repair", "sign_repair", 128UL, sizeof(fd_ed25519_sig_t), 1UL );
612 :
613 0 : /**/ fd_topob_link( topo, "txsend_sign", "txsend_sign", 128UL, FD_TXN_MTU, 1UL ); /* TODO: Depth probably doesn't need to be 128 */
614 0 : /**/ fd_topob_link( topo, "sign_txsend", "sign_txsend", 128UL, sizeof(fd_ed25519_sig_t)*2UL, 1UL ); /* TODO: Depth probably doesn't need to be 128 */
615 :
616 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 */
617 0 : FOR(shred_tile_cnt) fd_topob_link( topo, "repair_shred", "repair_shred", shred_depth, sizeof(fd_ed25519_sig_t), 1UL );
618 0 : /**/ fd_topob_link( topo, "tower_out", "tower_out", 16384UL, sizeof(fd_tower_msg_t), 2UL ); /* conf + slot_done. see explanation in fd_tower_tile.h for link_depth */
619 0 : /**/ fd_topob_link( topo, "txsend_out", "txsend_out", 128UL, FD_TPU_RAW_MTU, 1UL );
620 :
621 0 : fd_topob_link( topo, "replay_execrp", "replay_execrp", 16384UL, sizeof(fd_execrp_task_msg_t), 1UL );
622 :
623 0 : FOR(execrp_tile_cnt) fd_topob_link( topo, "execrp_sig", "execrp_sig", 16384UL, 64UL, 1UL );
624 0 : FOR(execrp_tile_cnt) fd_topob_link( topo, "execrp_replay", "execrp_replay", 16384UL, sizeof(fd_execrp_task_done_msg_t), 1UL );
625 :
626 0 : ushort parsed_tile_to_cpu[ FD_TILE_MAX ];
627 : /* Unassigned tiles will be floating, unless auto topology is enabled. */
628 0 : for( ulong i=0UL; i<FD_TILE_MAX; i++ ) parsed_tile_to_cpu[ i ] = USHORT_MAX;
629 :
630 0 : int is_auto_affinity = !strcmp( config->layout.affinity, "auto" );
631 :
632 0 : fd_topo_cpus_t cpus[1];
633 0 : fd_topo_cpus_init( cpus );
634 :
635 0 : ulong affinity_tile_cnt = 0UL;
636 0 : if( FD_LIKELY( !is_auto_affinity ) ) affinity_tile_cnt = fd_tile_private_cpus_parse( config->layout.affinity, parsed_tile_to_cpu );
637 :
638 0 : ulong tile_to_cpu[ FD_TILE_MAX ] = {0};
639 0 : for( ulong i=0UL; i<affinity_tile_cnt; i++ ) {
640 0 : if( FD_UNLIKELY( parsed_tile_to_cpu[ i ]!=USHORT_MAX && parsed_tile_to_cpu[ i ]>=cpus->cpu_cnt ) )
641 0 : FD_LOG_ERR(( "The CPU affinity string in the configuration file under [layout.affinity] specifies a CPU index of %hu, but the system "
642 0 : "only has %lu CPUs. You should either change the CPU allocations in the affinity string, or increase the number of CPUs "
643 0 : "in the system.",
644 0 : parsed_tile_to_cpu[ i ], cpus->cpu_cnt ));
645 0 : tile_to_cpu[ i ] = fd_ulong_if( parsed_tile_to_cpu[ i ]==USHORT_MAX, ULONG_MAX, (ulong)parsed_tile_to_cpu[ i ] );
646 0 : }
647 :
648 0 : int xsk_core_dump = config->development.core_dump_level >= FD_TOPO_CORE_DUMP_LEVEL_REGULAR ? 1 : 0;
649 0 : fd_topos_net_tiles( topo, net_tile_cnt, &config->net, config->tiles.netlink.max_routes, config->tiles.netlink.max_peer_routes, config->tiles.netlink.max_neighbors, xsk_core_dump, tile_to_cpu );
650 :
651 0 : FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_gossvf", i, config->net.ingress_buffer_size );
652 0 : FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_shred", i, config->net.ingress_buffer_size );
653 0 : FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_repair", i, config->net.ingress_buffer_size );
654 0 : FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_txsend", i, config->net.ingress_buffer_size );
655 0 : FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_quic", i, config->net.ingress_buffer_size );
656 :
657 : /* topo, tile_name, tile_wksp, metrics_wksp, cpu_idx, is_agave, uses_keyswitch */
658 : /**/ fd_topob_tile( topo, "metric", "metric", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
659 0 : /**/ fd_topob_tile( topo, "diag", "diag", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
660 :
661 0 : if( FD_LIKELY( snapshots_enabled ) ) {
662 0 : /**/ fd_topob_tile( topo, "snapct", "snapct", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
663 0 : /**/ fd_topob_tile( topo, "snapld", "snapld", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
664 0 : /**/ fd_topob_tile( topo, "snapdc", "snapdc", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
665 0 : /**/ fd_topob_tile( topo, "snapin", "snapin", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
666 0 : if(vinyl_enabled) fd_topob_tile( topo, "snapwm", "snapwm", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
667 0 : if(vinyl_enabled) fd_topob_tile( topo, "snapwh", "snapwh", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
668 0 : if(vinyl_enabled) FOR(snapwr_tile_cnt)
669 0 : fd_topob_tile( topo, "snapwr", "snapwr", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
670 :
671 0 : if( snapshot_lthash_disabled ) {
672 : /* nothing to do here */
673 0 : } else {
674 0 : if( vinyl_enabled ) {
675 0 : FOR(snaplh_tile_cnt) fd_topob_tile( topo, "snaplh", "snaplh", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
676 0 : /**/ fd_topob_tile( topo, "snaplv", "snaplv", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
677 0 : } else {
678 0 : FOR(lta_tile_cnt) fd_topob_tile( topo, "snapla", "snapla", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
679 0 : /**/ fd_topob_tile( topo, "snapls", "snapls", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
680 0 : }
681 0 : }
682 0 : }
683 :
684 : /**/ fd_topob_tile( topo, "genesi", "genesi", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 )->allow_shutdown = 1;
685 0 : /**/ fd_topob_tile( topo, "ipecho", "ipecho", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
686 0 : FOR(gossvf_tile_cnt) fd_topob_tile( topo, "gossvf", "gossvf", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
687 0 : /**/ fd_topob_tile( topo, "gossip", "gossip", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
688 :
689 0 : FOR(shred_tile_cnt) fd_topob_tile( topo, "shred", "shred", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
690 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 */
691 0 : /**/ fd_topob_tile( topo, "replay", "replay", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
692 0 : FOR(execrp_tile_cnt) fd_topob_tile( topo, "execrp", "execrp", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
693 0 : /**/ fd_topob_tile( topo, "tower", "tower", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
694 0 : /**/ fd_topob_tile( topo, "txsend", "txsend", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
695 :
696 0 : FOR(quic_tile_cnt) fd_topob_tile( topo, "quic", "quic", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
697 0 : FOR(verify_tile_cnt) fd_topob_tile( topo, "verify", "verify", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
698 0 : /**/ fd_topob_tile( topo, "dedup", "dedup", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
699 0 : FOR(resolv_tile_cnt) fd_topob_tile( topo, "resolv", "resolv", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
700 0 : /**/ fd_topob_tile( topo, "pack", "pack", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, config->tiles.bundle.enabled );
701 0 : FOR(execle_tile_cnt) fd_topob_tile( topo, "execle", "execle", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
702 0 : /**/ fd_topob_tile( topo, "poh", "poh", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
703 0 : FOR(sign_tile_cnt) fd_topob_tile( topo, "sign", "sign", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
704 :
705 0 : if( FD_UNLIKELY( rpc_enabled ) ) {
706 0 : fd_topob_wksp( topo, "rpc" );
707 0 : fd_topob_wksp( topo, "rpc_replay" );
708 0 : fd_topob_tile( topo, "rpc", "rpc", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
709 0 : }
710 :
711 0 : if( vinyl_enabled ) {
712 0 : setup_topo_accdb_meta( topo, &config->firedancer );
713 :
714 0 : fd_topo_obj_t * accdb_data = setup_topo_accdb_cache( topo, &config->firedancer );
715 :
716 0 : ulong vinyl_map_obj_id = fd_pod_query_ulong( topo->props, "accdb.meta_map", ULONG_MAX ); FD_TEST( vinyl_map_obj_id !=ULONG_MAX );
717 0 : ulong vinyl_pool_obj_id = fd_pod_query_ulong( topo->props, "accdb.meta_pool", ULONG_MAX ); FD_TEST( vinyl_pool_obj_id!=ULONG_MAX );
718 :
719 0 : fd_topo_obj_t * accdb_map_obj = &topo->objs[ vinyl_map_obj_id ];
720 0 : fd_topo_obj_t * accdb_pool_obj = &topo->objs[ vinyl_pool_obj_id ];
721 :
722 0 : fd_topob_wksp( topo, "accdb" );
723 0 : fd_topo_tile_t * accdb_tile = fd_topob_tile( topo, "accdb", "accdb", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
724 0 : fd_topob_tile_uses( topo, accdb_tile, accdb_data, FD_SHMEM_JOIN_MODE_READ_WRITE );
725 0 : fd_topob_tile_uses( topo, accdb_tile, accdb_map_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
726 0 : fd_topob_tile_uses( topo, accdb_tile, accdb_pool_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
727 :
728 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], accdb_data, FD_SHMEM_JOIN_MODE_READ_WRITE );
729 0 : for( ulong i=0UL; i<execrp_tile_cnt; i++ ) {
730 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i ) ], accdb_data, FD_SHMEM_JOIN_MODE_READ_WRITE );
731 0 : }
732 0 : for( ulong i=0UL; i<execle_tile_cnt; i++ ) {
733 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execle", i ) ], accdb_data, FD_SHMEM_JOIN_MODE_READ_WRITE );
734 0 : }
735 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "tower", 0UL ) ], accdb_data, FD_SHMEM_JOIN_MODE_READ_ONLY );
736 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "resolv", 0UL ) ], accdb_data, FD_SHMEM_JOIN_MODE_READ_ONLY );
737 0 : if( rpc_enabled ) {
738 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "rpc", 0UL ) ], accdb_data, FD_SHMEM_JOIN_MODE_READ_ONLY );
739 0 : }
740 :
741 0 : fd_topob_wksp( topo, "accdb_replay" );
742 0 : fd_topob_wksp( topo, "accdb_execrp" );
743 0 : fd_topob_wksp( topo, "accdb_execle" );
744 0 : fd_topob_wksp( topo, "accdb_tower" );
745 0 : fd_topob_wksp( topo, "accdb_resolv" );
746 0 : if( config->tiles.rpc.enabled ) fd_topob_wksp( topo, "accdb_rpc" );
747 0 : }
748 :
749 0 : if( FD_UNLIKELY( solcap_enabled ) ) {
750 0 : fd_topob_wksp( topo, "solcap" );
751 0 : fd_topob_tile( topo, "solcap", "solcap", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
752 0 : }
753 :
754 0 : if( FD_LIKELY( snapshots_enabled ) ) {
755 0 : if( vinyl_enabled ) {
756 0 : ulong vinyl_map_obj_id = fd_pod_query_ulong( topo->props, "accdb.meta_map", ULONG_MAX ); FD_TEST( vinyl_map_obj_id !=ULONG_MAX );
757 0 : ulong vinyl_pool_obj_id = fd_pod_query_ulong( topo->props, "accdb.meta_pool", ULONG_MAX ); FD_TEST( vinyl_pool_obj_id!=ULONG_MAX );
758 :
759 0 : fd_topo_obj_t * vinyl_map_obj = &topo->objs[ vinyl_map_obj_id ];
760 0 : fd_topo_obj_t * vinyl_pool_obj = &topo->objs[ vinyl_pool_obj_id ];
761 :
762 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapwm", 0UL ) ], vinyl_map_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
763 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapwm", 0UL ) ], vinyl_pool_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
764 0 : }
765 0 : }
766 :
767 : /* topo, tile_name, tile_kind_id, fseq_wksp, link_name, link_kind_id, reliable, polled */
768 0 : FOR(gossvf_tile_cnt) for( ulong j=0UL; j<net_tile_cnt; j++ )
769 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 */
770 0 : FOR(shred_tile_cnt) for( ulong j=0UL; j<net_tile_cnt; j++ )
771 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 */
772 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 */
773 0 : /**/ fd_topob_tile_out( topo, "repair", 0UL, "repair_net", 0UL );
774 0 : FOR(net_tile_cnt) fd_topob_tile_in ( topo, "txsend", 0UL, "metric_in", "net_txsend", i, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
775 0 : FOR(quic_tile_cnt) for( ulong j=0UL; j<net_tile_cnt; j++ )
776 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 */
777 :
778 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 */
779 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 */
780 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 */
781 0 : /**/ fd_topos_tile_in_net( topo, "metric_in", "txsend_net", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
782 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 */
783 :
784 0 : /**/ fd_topob_tile_out( topo, "genesi", 0UL, "genesi_out", 0UL );
785 0 : /**/ fd_topob_tile_in ( topo, "ipecho", 0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
786 0 : /**/ fd_topob_tile_out( topo, "ipecho", 0UL, "ipecho_out", 0UL );
787 :
788 0 : FOR(gossvf_tile_cnt) fd_topob_tile_out( topo, "gossvf", i, "gossvf_gossip", i );
789 0 : FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossvf", i, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
790 0 : FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossvf", i, "metric_in", "gossip_gossvf", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
791 0 : FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossvf", i, "metric_in", "ipecho_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
792 0 : FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossvf", i, "metric_in", "replay_epoch", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
793 0 : /**/ fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "replay_epoch", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
794 0 : /**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_out", 0UL );
795 0 : /**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_net", 0UL );
796 0 : /**/ fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "ipecho_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
797 0 : FOR(gossvf_tile_cnt) fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "gossvf_gossip", i, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
798 0 : /**/ fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "txsend_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
799 0 : /**/ fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "tower_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
800 0 : /**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_gossvf", 0UL );
801 :
802 0 : int snapshots_gossip_enabled = config->firedancer.snapshots.sources.gossip.allow_any || config->firedancer.snapshots.sources.gossip.allow_list_cnt>0UL;
803 0 : if( FD_LIKELY( snapshots_enabled ) ) {
804 0 : if( FD_LIKELY( snapshots_gossip_enabled ) ) {
805 0 : /**/ fd_topob_tile_in ( topo, "snapct", 0UL, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
806 0 : }
807 :
808 0 : fd_topob_tile_in ( topo, "snapct", 0UL, "metric_in", "snapld_dc", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
809 0 : fd_topob_tile_out( topo, "snapct", 0UL, "snapct_ld", 0UL );
810 0 : fd_topob_tile_out( topo, "snapct", 0UL, "snapct_repr", 0UL );
811 0 : if( FD_LIKELY( config->tiles.gui.enabled ) ) {
812 0 : /**/ fd_topob_tile_out( topo, "snapct", 0UL, "snapct_gui", 0UL );
813 0 : }
814 :
815 0 : if( vinyl_enabled ) {
816 0 : /**/ fd_topob_tile_out( topo, "snapin", 0UL, "snapin_wm", 0UL );
817 0 : /**/ fd_topob_tile_in ( topo, "snapwm", 0UL, "metric_in", "snapin_wm", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
818 0 : /**/ fd_topob_tile_out( topo, "snapin", 0UL, "snapin_txn", 0UL );
819 0 : /**/ fd_topob_tile_in ( topo, "snapwm", 0UL, "metric_in", "snapin_txn", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
820 0 : /**/ fd_topob_tile_out( topo, "snapwm", 0UL, "snapwm_wh", 0UL );
821 0 : /**/ fd_topob_tile_in ( topo, "snapwh", 0UL, "metric_in", "snapwm_wh", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
822 0 : /**/ fd_topob_tile_out( topo, "snapwh", 0UL, "snapwh_wr", 0UL );
823 : /* snapwh and snapwr both access snapwm_wh's dcache, avoiding a
824 : memcpy for every account (vinyl pair) that is being processed
825 : (loaded) from the snapshot. */
826 0 : FOR(snapwr_tile_cnt) fd_topob_tile_in(topo, "snapwr", i, "metric_in", "snapwh_wr", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
827 0 : FOR(snapwr_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapwr", i ) ], &topo->objs[ topo->links[ fd_topo_find_link( topo, "snapwm_wh", 0UL ) ].dcache_obj_id ], FD_SHMEM_JOIN_MODE_READ_ONLY );
828 0 : }
829 0 : if( snapshot_lthash_disabled ) {
830 0 : if( vinyl_enabled ) {
831 0 : /**/ fd_topob_tile_out( topo, "snapwm", 0UL, "snapwm_ct", 0UL );
832 0 : fd_topob_tile_in ( topo, "snapct", 0UL, "metric_in", "snapwm_ct", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
833 0 : } else {
834 0 : fd_topob_tile_out( topo, "snapin", 0UL, "snapin_ct", 0UL );
835 0 : fd_topob_tile_in ( topo, "snapct", 0UL, "metric_in", "snapin_ct", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
836 0 : }
837 0 : } else {
838 0 : if( vinyl_enabled ) {
839 0 : FOR(snaplh_tile_cnt) fd_topob_tile_in ( topo, "snaplh", i, "metric_in", "snapwh_wr", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
840 0 : FOR(snaplh_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snaplh", i ) ], &topo->objs[ topo->links[ fd_topo_find_link( topo, "snapwm_wh", 0UL ) ].dcache_obj_id ], FD_SHMEM_JOIN_MODE_READ_ONLY );
841 0 : FOR(snaplh_tile_cnt) fd_topob_tile_in ( topo, "snaplh", i, "metric_in", "snaplv_lh", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
842 0 : /**/ fd_topob_tile_out( topo, "snaplv", 0UL, "snaplv_lh", 0UL );
843 0 : FOR(snaplh_tile_cnt) fd_topob_tile_out( topo, "snaplh", i, "snaplh_lv", i );
844 0 : /**/ fd_topob_tile_in ( topo, "snaplv", 0UL, "metric_in", "snapwm_lv", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
845 0 : FOR(snaplh_tile_cnt) fd_topob_tile_in ( topo, "snaplv", 0UL, "metric_in", "snaplh_lv", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
846 0 : /**/ fd_topob_tile_out( topo, "snaplv", 0UL, "snaplv_ct", 0UL );
847 0 : /**/ fd_topob_tile_out( topo, "snapwm", 0UL, "snapwm_lv", 0UL );
848 0 : /**/ fd_topob_tile_in ( topo, "snapct", 0UL, "metric_in", "snaplv_ct", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
849 :
850 0 : fd_topo_obj_t * vinyl_admin_obj = setup_topo_vinyl_admin( topo, "vinyl_admin" );
851 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapwm", 0UL ) ], vinyl_admin_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
852 0 : FOR(snapwr_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapwr", i ) ], vinyl_admin_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
853 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snaplv", 0UL ) ], vinyl_admin_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
854 0 : FOR(snaplh_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snaplh", i ) ], vinyl_admin_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
855 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, vinyl_admin_obj->id, "vinyl_admin" ) );
856 0 : } else {
857 0 : fd_topob_tile_out( topo, "snapin", 0UL, "snapin_ls", 0UL );
858 0 : FOR(lta_tile_cnt) fd_topob_tile_in( topo, "snapla", i, "metric_in", "snapdc_in", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
859 0 : FOR(lta_tile_cnt) fd_topob_tile_out( topo, "snapla", i, "snapla_ls", i );
860 0 : /**/ fd_topob_tile_in( topo, "snapls", 0UL, "metric_in", "snapin_ls", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
861 0 : FOR(lta_tile_cnt) fd_topob_tile_in( topo, "snapls", 0UL, "metric_in", "snapla_ls", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
862 0 : /**/ fd_topob_tile_out( topo, "snapls", 0UL, "snapls_ct", 0UL );
863 0 : /**/ fd_topob_tile_in ( topo, "snapct", 0UL, "metric_in", "snapls_ct", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
864 0 : }
865 0 : }
866 :
867 0 : /**/ fd_topob_tile_in ( topo, "snapld", 0UL, "metric_in", "snapct_ld", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
868 0 : /**/ fd_topob_tile_out( topo, "snapld", 0UL, "snapld_dc", 0UL );
869 :
870 0 : /**/ fd_topob_tile_in ( topo, "snapdc", 0UL, "metric_in", "snapld_dc", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
871 0 : /**/ fd_topob_tile_out( topo, "snapdc", 0UL, "snapdc_in", 0UL );
872 :
873 0 : fd_topob_tile_in ( topo, "snapin", 0UL, "metric_in", "snapdc_in", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
874 0 : if( FD_LIKELY( config->tiles.gui.enabled ) ) {
875 0 : /**/ fd_topob_tile_out( topo, "snapin", 0UL, "snapin_gui", 0UL );
876 0 : }
877 0 : fd_topob_tile_out( topo, "snapin", 0UL, "snapin_manif", 0UL );
878 0 : }
879 :
880 0 : /**/ fd_topob_tile_in( topo, "repair", 0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
881 0 : /**/ fd_topob_tile_in( topo, "repair", 0UL, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
882 0 : /**/ fd_topob_tile_in( topo, "repair", 0UL, "metric_in", "replay_epoch", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
883 0 : FOR(shred_tile_cnt) fd_topob_tile_in( topo, "repair", 0UL, "metric_in", "shred_out", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
884 0 : if( snapshots_enabled ) {
885 0 : fd_topob_tile_in( topo, "repair", 0UL, "metric_in", "snapin_manif", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
886 0 : }
887 0 : /**/ fd_topob_tile_in( topo, "repair", 0UL, "metric_in", "tower_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
888 0 : FOR(shred_tile_cnt) fd_topob_tile_out( topo, "repair", 0UL, "repair_shred", i );
889 :
890 0 : FOR(shred_tile_cnt) fd_topob_tile_in( topo, "replay", 0UL, "metric_in", "shred_out", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
891 0 : /**/ fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
892 0 : /**/ fd_topob_tile_out( topo, "replay", 0UL, "replay_out", 0UL );
893 0 : /**/ fd_topob_tile_out( topo, "replay", 0UL, "replay_epoch", 0UL );
894 0 : /**/ fd_topob_tile_out( topo, "replay", 0UL, "executed_txn", 0UL );
895 0 : /**/ fd_topob_tile_out( topo, "replay", 0UL, "replay_execrp", 0UL );
896 0 : /**/ fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "tower_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
897 0 : /**/ fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "txsend_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
898 0 : FOR(resolv_tile_cnt) fd_topob_tile_in( topo, "replay", 0UL, "metric_in", "resolv_replay", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
899 0 : if( FD_LIKELY( snapshots_enabled ) ) {
900 0 : fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "snapin_manif", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
901 0 : }
902 :
903 0 : /**/ fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "poh_replay", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
904 0 : FOR(execrp_tile_cnt) fd_topob_tile_in ( topo, "execrp", i, "metric_in", "replay_execrp", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
905 :
906 0 : /**/ fd_topob_tile_in ( topo, "tower", 0UL, "metric_in", "dedup_resolv", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
907 0 : /**/ fd_topob_tile_in ( topo, "tower", 0UL, "metric_in", "replay_epoch", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
908 0 : /**/ fd_topob_tile_in ( topo, "tower", 0UL, "metric_in", "replay_execrp", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
909 0 : /**/ fd_topob_tile_in ( topo, "tower", 0UL, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
910 0 : /**/ fd_topob_tile_in ( topo, "tower", 0UL, "metric_in", "ipecho_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
911 0 : /**/ fd_topob_tile_in ( topo, "tower", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
912 0 : FOR(shred_tile_cnt) fd_topob_tile_in( topo, "tower", 0UL, "metric_in", "shred_out", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
913 0 : /**/ fd_topob_tile_out( topo, "tower", 0UL, "tower_out", 0UL );
914 :
915 0 : /**/ fd_topob_tile_in ( topo, "txsend", 0UL, "metric_in", "replay_epoch", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
916 0 : /**/ fd_topob_tile_in ( topo, "txsend", 0UL, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
917 0 : /**/ fd_topob_tile_in ( topo, "txsend", 0UL, "metric_in", "tower_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
918 0 : /**/ fd_topob_tile_out( topo, "txsend", 0UL, "txsend_net", 0UL );
919 0 : /**/ fd_topob_tile_out( topo, "txsend", 0UL, "txsend_out", 0UL );
920 :
921 0 : FOR(quic_tile_cnt) fd_topob_tile_out( topo, "quic", i, "quic_verify", i );
922 0 : FOR(quic_tile_cnt) fd_topob_tile_out( topo, "quic", i, "quic_net", i );
923 : /* All verify tiles read from all QUIC tiles, packets are round robin. */
924 0 : FOR(verify_tile_cnt) for( ulong j=0UL; j<quic_tile_cnt; j++ )
925 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 */
926 0 : FOR(verify_tile_cnt) fd_topob_tile_in( topo, "verify", i, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
927 0 : /**/ fd_topob_tile_in( topo, "verify", 0UL, "metric_in", "txsend_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
928 0 : FOR(verify_tile_cnt) fd_topob_tile_out( topo, "verify", i, "verify_dedup", i );
929 0 : FOR(verify_tile_cnt) fd_topob_tile_in( topo, "dedup", 0UL, "metric_in", "verify_dedup", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
930 0 : /**/ fd_topob_tile_in( topo, "dedup", 0UL, "metric_in", "executed_txn", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
931 0 : /**/ fd_topob_tile_out( topo, "dedup", 0UL, "dedup_resolv", 0UL );
932 0 : FOR(resolv_tile_cnt) fd_topob_tile_in( topo, "resolv", i, "metric_in", "dedup_resolv", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
933 0 : FOR(resolv_tile_cnt) fd_topob_tile_in( topo, "resolv", i, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
934 0 : FOR(resolv_tile_cnt) fd_topob_tile_out( topo, "resolv", i, "resolv_pack", i );
935 0 : FOR(resolv_tile_cnt) fd_topob_tile_out( topo, "resolv", i, "resolv_replay", i );
936 0 : /**/ fd_topob_tile_in( topo, "pack", 0UL, "metric_in", "resolv_pack", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
937 0 : /**/ fd_topob_tile_in( topo, "pack", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
938 0 : /**/ fd_topob_tile_in( topo, "pack", 0UL, "metric_in", "executed_txn", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
939 0 : fd_topob_tile_out( topo, "pack", 0UL, "pack_execle", 0UL );
940 0 : fd_topob_tile_out( topo, "pack", 0UL, "pack_poh" , 0UL );
941 0 : if( FD_LIKELY( config->tiles.pack.use_consumed_cus ) ) {
942 0 : FOR(execle_tile_cnt) fd_topob_tile_in( topo, "pack", 0UL, "metric_in", "execle_pack", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
943 0 : }
944 0 : FOR(execle_tile_cnt) fd_topob_tile_in( topo, "execle", i, "metric_in", "pack_execle", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
945 0 : FOR(execle_tile_cnt) fd_topob_tile_out( topo, "execle", i, "execle_poh", i );
946 0 : if( FD_LIKELY( config->tiles.pack.use_consumed_cus ) ) {
947 0 : FOR(execle_tile_cnt) fd_topob_tile_out( topo, "execle", i, "execle_pack", i );
948 0 : }
949 0 : FOR(execle_tile_cnt) fd_topob_tile_in( topo, "poh", 0UL, "metric_in", "execle_poh", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
950 0 : /**/ fd_topob_tile_in( topo, "poh", 0UL, "metric_in", "pack_poh", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
951 0 : /**/ fd_topob_tile_in( topo, "poh", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
952 0 : /**/ fd_topob_tile_out( topo, "poh", 0UL, "poh_shred", 0UL );
953 0 : /**/ fd_topob_tile_out( topo, "poh", 0UL, "poh_replay", 0UL );
954 0 : FOR(shred_tile_cnt) fd_topob_tile_in ( topo, "shred", i, "metric_in", "replay_epoch", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
955 0 : FOR(shred_tile_cnt) fd_topob_tile_in ( topo, "shred", i, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
956 0 : FOR(shred_tile_cnt) fd_topob_tile_out( topo, "shred", i, "shred_out", i );
957 0 : FOR(shred_tile_cnt) fd_topob_tile_in ( topo, "shred", i, "metric_in", "repair_shred", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
958 0 : FOR(shred_tile_cnt) fd_topob_tile_in ( topo, "shred", i, "metric_in", "ipecho_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
959 0 : FOR(shred_tile_cnt) fd_topob_tile_in ( topo, "shred", i, "metric_in", "poh_shred", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
960 0 : FOR(shred_tile_cnt) fd_topob_tile_out( topo, "shred", i, "shred_net", i );
961 :
962 0 : FOR(execrp_tile_cnt) fd_topob_tile_in ( topo, "dedup", 0UL, "metric_in", "execrp_sig", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
963 0 : FOR(execrp_tile_cnt) fd_topob_tile_in ( topo, "pack", 0UL, "metric_in", "execrp_sig", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
964 0 : FOR(execrp_tile_cnt) fd_topob_tile_out( topo, "execrp", i, "execrp_sig", i );
965 0 : FOR(execrp_tile_cnt) fd_topob_tile_out( topo, "execrp", i, "execrp_replay", i );
966 0 : FOR(execrp_tile_cnt) fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "execrp_replay", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
967 :
968 0 : if( FD_LIKELY( telemetry_enabled ) ) {
969 0 : fd_topob_wksp( topo, "event" );
970 0 : fd_topob_wksp( topo, "event_sign" );
971 0 : fd_topob_wksp( topo, "sign_event" );
972 0 : fd_topob_link( topo, "event_sign", "event_sign", 128UL, 32UL, 1UL );
973 0 : fd_topob_link( topo, "sign_event", "sign_event", 128UL, 64UL, 1UL );
974 0 : fd_topob_tile( topo, "event", "event", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
975 0 : fd_topob_tile_in( topo, "event", 0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
976 0 : fd_topob_tile_in( topo, "event", 0UL, "metric_in", "ipecho_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
977 :
978 0 : if( FD_UNLIKELY( config->development.event.report_shreds ) ) {
979 : /* TODO: This needs to be reliable, else we could miss shreds that
980 : are required to replay the chain, but we can't change it yet as
981 : the XDP tile does not support reliable consumers. */
982 0 : FOR(shred_tile_cnt) fd_topob_tile_in( topo, "event", 0UL, "metric_in", "net_shred", i, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
983 0 : }
984 :
985 0 : if( FD_UNLIKELY( config->development.event.report_transactions ) ) {
986 0 : fd_topob_tile_in( topo, "event", 0UL, "metric_in", "dedup_resolv", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
987 0 : }
988 :
989 0 : fd_topob_tile_in( topo, "sign", 0UL, "metric_in", "event_sign", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
990 0 : fd_topob_tile_out( topo, "event", 0UL, "event_sign", 0UL );
991 0 : fd_topob_tile_in( topo, "event", 0UL, "metric_in", "sign_event", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
992 0 : fd_topob_tile_out( topo, "sign", 0UL, "sign_event", 0UL );
993 0 : }
994 :
995 0 : if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) {
996 0 : fd_topob_wksp( topo, "bundle_verif" );
997 0 : fd_topob_wksp( topo, "bundle_sign" );
998 0 : fd_topob_wksp( topo, "sign_bundle" );
999 0 : fd_topob_wksp( topo, "pack_sign" );
1000 0 : fd_topob_wksp( topo, "sign_pack" );
1001 0 : fd_topob_wksp( topo, "bundle" );
1002 :
1003 0 : /**/ fd_topob_link( topo, "bundle_verif", "bundle_verif", config->tiles.verify.receive_buffer_size, FD_TPU_PARSED_MTU, 1UL );
1004 0 : /**/ fd_topob_link( topo, "bundle_sign", "bundle_sign", 65536UL, 9UL, 1UL );
1005 0 : /**/ fd_topob_link( topo, "sign_bundle", "sign_bundle", 128UL, 64UL, 1UL );
1006 0 : /**/ fd_topob_link( topo, "pack_sign", "pack_sign", 65536UL, 1232UL, 1UL );
1007 0 : /**/ fd_topob_link( topo, "sign_pack", "sign_pack", 128UL, 64UL, 1UL );
1008 :
1009 : /**/ fd_topob_tile( topo, "bundle", "bundle", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
1010 :
1011 : /**/ fd_topob_tile_out( topo, "bundle", 0UL, "bundle_verif", 0UL );
1012 0 : FOR(verify_tile_cnt) fd_topob_tile_in( topo, "verify", i, "metric_in", "bundle_verif", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1013 :
1014 0 : /**/ fd_topob_tile_in( topo, "sign", 0UL, "metric_in", "bundle_sign", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
1015 0 : /**/ fd_topob_tile_out( topo, "bundle", 0UL, "bundle_sign", 0UL );
1016 0 : /**/ fd_topob_tile_in( topo, "bundle", 0UL, "metric_in", "sign_bundle", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
1017 0 : /**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_bundle", 0UL );
1018 :
1019 0 : /**/ fd_topob_tile_in( topo, "sign", 0UL, "metric_in", "pack_sign", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
1020 0 : /**/ fd_topob_tile_out( topo, "pack", 0UL, "pack_sign", 0UL );
1021 0 : /**/ fd_topob_tile_in( topo, "pack", 0UL, "metric_in", "sign_pack", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
1022 0 : /**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_pack", 0UL );
1023 :
1024 : /* TODO: bundle gui support needs to be integrated here */
1025 0 : }
1026 :
1027 : /* Sign links don't need to be reliable because they are synchronous,
1028 : so there's at most one fragment in flight at a time anyway. The
1029 : sign links are also not polled by fd_stem, instead the tiles will
1030 : read the sign responses out of band in a dedicated spin loop.
1031 :
1032 : TODO: This can probably be fixed now to be relible ... ? */
1033 : /* topo, tile_name, tile_kind_id, fseq_wksp, link_name, link_kind_id, reliable, polled */
1034 0 : /**/ fd_topob_tile_in ( topo, "sign", 0UL, "metric_in", "gossip_sign", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
1035 0 : /**/ fd_topob_tile_out( topo, "gossip", 0UL, "gossip_sign", 0UL );
1036 0 : /**/ fd_topob_tile_in ( topo, "gossip", 0UL, "metric_in", "sign_gossip", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
1037 0 : /**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_gossip", 0UL );
1038 :
1039 0 : for( ulong i=0UL; i<shred_tile_cnt; i++ ) {
1040 0 : /**/ fd_topob_tile_in ( topo, "sign", 0UL, "metric_in", "shred_sign", i, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
1041 0 : /**/ fd_topob_tile_out( topo, "shred", i, "shred_sign", i );
1042 0 : /**/ fd_topob_tile_in ( topo, "shred", i, "metric_in", "sign_shred", i, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
1043 0 : /**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_shred", i );
1044 0 : }
1045 :
1046 0 : FOR(sign_tile_cnt-1UL) fd_topob_tile_out( topo, "repair", 0UL, "repair_sign", i );
1047 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 );
1048 0 : FOR(sign_tile_cnt-1UL) fd_topob_tile_out( topo, "sign", i+1UL, "sign_repair", i );
1049 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 */
1050 :
1051 0 : /**/ fd_topob_tile_in ( topo, "sign", 0UL, "metric_in", "txsend_sign", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1052 0 : /**/ fd_topob_tile_out( topo, "txsend", 0UL, "txsend_sign", 0UL );
1053 0 : /**/ fd_topob_tile_in ( topo, "txsend", 0UL, "metric_in", "sign_txsend", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
1054 0 : /**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_txsend", 0UL );
1055 :
1056 0 : if( FD_UNLIKELY( config->tiles.archiver.enabled ) ) {
1057 0 : fd_topob_wksp( topo, "arch_f" );
1058 0 : fd_topob_wksp( topo, "arch_w" );
1059 0 : fd_topob_wksp( topo, "feeder" );
1060 0 : fd_topob_wksp( topo, "arch_f2w" );
1061 :
1062 0 : fd_topob_link( topo, "feeder", "feeder", 65536UL, 4UL*FD_SHRED_STORE_MTU, 4UL+config->tiles.shred.max_pending_shred_sets );
1063 0 : fd_topob_link( topo, "arch_f2w", "arch_f2w", 128UL, 4UL*FD_SHRED_STORE_MTU, 1UL );
1064 :
1065 0 : fd_topob_tile( topo, "arch_f", "arch_f", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
1066 0 : fd_topob_tile( topo, "arch_w", "arch_w", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
1067 :
1068 0 : fd_topob_tile_out( topo, "replay", 0UL, "feeder", 0UL );
1069 0 : fd_topob_tile_in( topo, "arch_f", 0UL, "metric_in", "feeder", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1070 :
1071 0 : fd_topob_tile_out( topo, "arch_f", 0UL, "arch_f2w", 0UL );
1072 0 : fd_topob_tile_in( topo, "arch_w", 0UL, "metric_in", "arch_f2w", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1073 0 : }
1074 :
1075 0 : if( FD_UNLIKELY( config->tiles.shredcap.enabled ) ) {
1076 0 : fd_topob_wksp( topo, "scap" );
1077 :
1078 0 : fd_topob_tile( topo, "scap", "scap", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
1079 :
1080 0 : fd_topob_tile_in( topo, "scap", 0UL, "metric_in", "repair_net", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
1081 0 : for( ulong j=0UL; j<net_tile_cnt; j++ ) {
1082 0 : fd_topob_tile_in( topo, "scap", 0UL, "metric_in", "net_shred", j, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
1083 0 : }
1084 0 : for( ulong j=0UL; j<shred_tile_cnt; j++ ) {
1085 0 : fd_topob_tile_in( topo, "scap", 0UL, "metric_in", "shred_out", j, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
1086 0 : }
1087 0 : fd_topob_tile_in( topo, "scap", 0UL, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1088 :
1089 0 : fd_topob_tile_in( topo, "scap", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1090 :
1091 : /* No default fd_topob_tile_in connection to stake_out */
1092 0 : }
1093 :
1094 0 : if( FD_UNLIKELY( rpc_enabled ) ) {
1095 0 : fd_topob_link( topo, "rpc_replay", "rpc_replay", 8UL, 0UL, 1UL );
1096 0 : fd_topob_tile_out( topo, "rpc", 0UL, "rpc_replay", 0UL );
1097 :
1098 0 : fd_topob_tile_in( topo, "rpc", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1099 0 : fd_topob_tile_in( topo, "rpc", 0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1100 0 : fd_topob_tile_in( topo, "replay", 0UL, "metric_in", "rpc_replay", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1101 0 : }
1102 :
1103 0 : if( FD_UNLIKELY( solcap_enabled ) ) {
1104 0 : fd_topob_link( topo, "cap_repl", "solcap", 32UL, SOLCAP_WRITE_ACCOUNT_DATA_MTU, 1UL );
1105 0 : fd_topob_tile_out( topo, "replay", 0UL, "cap_repl", 0UL );
1106 0 : fd_topob_tile_in( topo, "solcap", 0UL, "metric_in", "cap_repl", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1107 0 : FOR(execrp_tile_cnt) fd_topob_link( topo, "cap_execrp", "solcap", 32UL, SOLCAP_WRITE_ACCOUNT_DATA_MTU, 1UL );
1108 0 : FOR(execrp_tile_cnt) fd_topob_tile_out( topo, "execrp", i, "cap_execrp", i );
1109 0 : FOR(execrp_tile_cnt) fd_topob_tile_in( topo, "solcap", 0UL, "metric_in", "cap_execrp", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1110 0 : }
1111 :
1112 0 : if( FD_LIKELY( !is_auto_affinity ) ) {
1113 0 : if( FD_UNLIKELY( affinity_tile_cnt<topo->tile_cnt ) )
1114 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. "
1115 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 "
1116 0 : "the total tile count. You can reduce the tile count by decreasing individual tile counts in the [layout] section of the configuration file.",
1117 0 : topo->tile_cnt, affinity_tile_cnt ));
1118 0 : if( FD_UNLIKELY( affinity_tile_cnt>topo->tile_cnt ) )
1119 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. "
1120 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 "
1121 0 : "individual tile counts in the [layout] section of the configuration file.",
1122 0 : topo->tile_cnt, affinity_tile_cnt ));
1123 0 : } else {
1124 0 : ushort blocklist_cores[ FD_TILE_MAX ];
1125 0 : topo->blocklist_cores_cnt = fd_tile_private_cpus_parse( config->layout.blocklist_cores, blocklist_cores );
1126 0 : if( FD_UNLIKELY( topo->blocklist_cores_cnt>FD_TILE_MAX ) ) {
1127 0 : FD_LOG_ERR(( "The CPU string in the configuration file under [layout.blocklist_cores] specifies more CPUs than Firedancer can use. "
1128 0 : "You should reduce the number of CPUs in the excluded cores string." ));
1129 0 : }
1130 :
1131 0 : for( ulong i=0UL; i<topo->blocklist_cores_cnt; i++ ) {
1132 : /* Since we use fd_tile_private_cpus_parse() like for affinity, the user
1133 : may input a string containing `f`. That's parsed correctly, but it's
1134 : meaningless for blocklisted cores, so we reject it here. */
1135 0 : if( FD_UNLIKELY( blocklist_cores[ i ]==USHORT_MAX ) ) {
1136 0 : FD_LOG_ERR(( "The CPU string in the configuration file under [layout.blocklist_cores] contains invalid values: `f`. "
1137 0 : "You should fix the excluded cores string." ));
1138 0 : }
1139 0 : topo->blocklist_cores_cpu_idx[ i ] = blocklist_cores[ i ];
1140 0 : }
1141 0 : }
1142 :
1143 0 : if( FD_UNLIKELY( is_auto_affinity ) ) fd_topob_auto_layout( topo, 0 );
1144 :
1145 : /* There is a special fseq that sits between the pack, execle, and poh
1146 : tiles to indicate when the execle/poh tiles are done processing a
1147 : microblock. Pack uses this to determine when to "unlock" accounts
1148 : that it marked as locked because they were being used. */
1149 :
1150 0 : for( ulong i=0UL; i<execle_tile_cnt; i++ ) {
1151 0 : fd_topo_obj_t * busy_obj = fd_topob_obj( topo, "fseq", "execle_busy" );
1152 :
1153 0 : fd_topo_tile_t * pack_tile = &topo->tiles[ fd_topo_find_tile( topo, "pack", 0UL ) ];
1154 0 : fd_topo_tile_t * execle_tile = &topo->tiles[ fd_topo_find_tile( topo, "execle", i ) ];
1155 0 : fd_topob_tile_uses( topo, pack_tile, busy_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
1156 0 : fd_topob_tile_uses( topo, execle_tile, busy_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1157 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, busy_obj->id, "execle_busy.%lu", i ) );
1158 0 : }
1159 :
1160 0 : fd_topo_obj_t * funk_obj = setup_topo_funk( topo, "funk",
1161 0 : config->firedancer.funk.max_account_records,
1162 0 : config->firedancer.runtime.max_live_slots + config->firedancer.vinyl.write_delay_slots,
1163 0 : config->firedancer.funk.heap_size_gib );
1164 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? */
1165 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "tower", 0UL ) ], funk_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1166 0 : FOR(execrp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i ) ], funk_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1167 0 : FOR(execle_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execle", i ) ], funk_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1168 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_WRITE );
1169 :
1170 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 );
1171 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1172 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "tower", 0UL ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
1173 0 : FOR(execrp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1174 0 : FOR(execle_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execle", i ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1175 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 );
1176 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, banks_obj->id, "banks" ) );
1177 :
1178 0 : fd_topo_obj_t * banks_locks_obj = setup_topo_banks_locks( topo, "banks_locks" );
1179 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], banks_locks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1180 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "tower", 0UL ) ], banks_locks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1181 0 : FOR(execrp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i ) ], banks_locks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1182 0 : FOR(execle_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execle", i ) ], banks_locks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1183 0 : FOR(resolv_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "resolv", i ) ], banks_locks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1184 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, banks_locks_obj->id, "banks_locks" ) );
1185 :
1186 0 : if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) {
1187 0 : if( FD_UNLIKELY( config->firedancer.runtime.max_account_cnt<FD_ACC_POOL_MIN_ACCOUNT_CNT_PER_BUNDLE ) ) {
1188 0 : FD_LOG_ERR(( "max_account_cnt is less than the minimum required for bundle execution: %lu < %lu", config->firedancer.runtime.max_account_cnt, FD_ACC_POOL_MIN_ACCOUNT_CNT_PER_BUNDLE ));
1189 0 : }
1190 0 : }
1191 0 : if( FD_UNLIKELY( config->firedancer.runtime.max_account_cnt<FD_ACC_POOL_MIN_ACCOUNT_CNT_PER_TX ) ) {
1192 0 : FD_LOG_ERR(( "max_account_cnt is less than the minimum required for transaction execution: %lu < %lu", config->firedancer.runtime.max_account_cnt, FD_ACC_POOL_MIN_ACCOUNT_CNT_PER_TX ));
1193 0 : }
1194 0 : if( FD_UNLIKELY( config->firedancer.runtime.max_live_slots<32UL ) ) {
1195 0 : FD_LOG_ERR(( "max_live_slots must be >= 32 in order to support tower rooting" ));
1196 0 : }
1197 :
1198 0 : fd_topo_obj_t * acc_pool_obj = setup_topo_acc_pool( topo, config->firedancer.runtime.max_account_cnt );
1199 0 : FOR(execrp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i ) ], acc_pool_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1200 0 : FOR(execle_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execle", i ) ], acc_pool_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1201 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, acc_pool_obj->id, "acc_pool" ) );
1202 :
1203 0 : fd_topo_obj_t * progcache_obj = setup_topo_progcache( topo, "progcache",
1204 0 : fd_progcache_est_rec_max( config->firedancer.runtime.program_cache.heap_size_mib<<20,
1205 0 : config->firedancer.runtime.program_cache.mean_cache_entry_size ),
1206 0 : config->firedancer.runtime.max_live_slots,
1207 0 : config->firedancer.runtime.program_cache.heap_size_mib<<20 );
1208 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], progcache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1209 0 : FOR(execrp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i ) ], progcache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1210 0 : FOR(execle_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execle", i ) ], progcache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1211 :
1212 0 : if( FD_LIKELY( config->tiles.gui.enabled ) ) {
1213 0 : fd_topob_wksp( topo, "gui" );
1214 0 : fd_topob_wksp( topo, "gui_replay" );
1215 :
1216 : /**/ fd_topob_tile( topo, "gui", "gui", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
1217 :
1218 : /* Read banks */
1219 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "gui", 0UL ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
1220 0 : /**/ fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "gui", 0UL ) ], banks_locks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1221 :
1222 : /* release ownership of banks */
1223 : /**/ fd_topob_link( topo, "gui_replay", "gui_replay", 128, 0UL,2UL ); /* burst==2 since a bank and its parent may be sent in one burst */
1224 :
1225 0 : /**/ fd_topob_tile_out( topo, "gui", 0UL, "gui_replay", 0UL );
1226 0 : /**/ fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "gui_replay", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1227 :
1228 : /* topo, tile_name, tile_kind_id, fseq_wksp, link_name, link_kind_id, reliable, polled */
1229 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 */
1230 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "repair_net", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
1231 0 : FOR(shred_tile_cnt) fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "shred_out", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1232 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "gossip_net", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
1233 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1234 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "tower_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1235 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1236 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "replay_epoch", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1237 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1238 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "pack_poh", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1239 0 : /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "pack_execle", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1240 0 : FOR(execle_tile_cnt) fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "execle_poh", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1241 0 : FOR(execrp_tile_cnt) fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "execrp_replay", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1242 :
1243 0 : if( FD_LIKELY( snapshots_enabled ) ) {
1244 0 : /**/ fd_topob_tile_in ( topo, "gui", 0UL, "metric_in", "snapct_gui", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1245 0 : /**/ fd_topob_tile_in ( topo, "gui", 0UL, "metric_in", "snapin_gui", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
1246 0 : }
1247 0 : }
1248 :
1249 0 : ulong fec_set_cnt = shred_depth + config->tiles.shred.max_pending_shred_sets + 4UL;
1250 0 : ulong fec_sets_sz = fec_set_cnt*sizeof(fd_shred34_t)*4; /* mirrors # of dcache entires in frankendancer */
1251 0 : fd_topo_obj_t * fec_sets_obj = setup_topo_fec_sets( topo, "fec_sets", shred_tile_cnt*fec_sets_sz );
1252 0 : for( ulong i=0UL; i<shred_tile_cnt; i++ ) {
1253 0 : fd_topo_tile_t * shred_tile = &topo->tiles[ fd_topo_find_tile( topo, "shred", i ) ];
1254 0 : fd_topob_tile_uses( topo, shred_tile, fec_sets_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1255 0 : }
1256 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "repair", 0UL ) ], fec_sets_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
1257 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, fec_sets_obj->id, "fec_sets" ) );
1258 :
1259 : /* The Store fec_max parameter is the max number of FEC sets that can
1260 : be retained before the Tower consensus algorithm indicates a new
1261 : "root", which allows pruning FECs.
1262 :
1263 : The default value is from multiplying max_live_slots by the
1264 : maximum number of FEC sets in a block (currently 32768 but can be
1265 : reduced to 1024 once FECs are restricted to always be size 32,
1266 : given the current consensus limit of 32768 shreds per block). */
1267 :
1268 0 : if( FD_UNLIKELY( !fd_ulong_is_pow2( config->firedancer.runtime.max_live_slots ) ) ) FD_LOG_ERR(( "max_live_slots must be a power of 2 for store" ));
1269 0 : fd_topo_obj_t * store_obj = setup_topo_store( topo, "store", config->firedancer.runtime.max_live_slots * 1024UL /* FIXME temporary hack to run on 512 gb boxes */, (uint)shred_tile_cnt );
1270 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 );
1271 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], store_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1272 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, store_obj->id, "store" ) );
1273 :
1274 0 : fd_topo_obj_t * txncache_obj = setup_topo_txncache( topo, "txncache", config->firedancer.runtime.max_live_slots, fd_ulong_pow2_up( FD_PACK_MAX_TXNCACHE_TXN_PER_SLOT ) );
1275 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "replay", 0UL ) ], txncache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1276 0 : if( FD_LIKELY( snapshots_enabled ) ) {
1277 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "snapin", 0UL ) ], txncache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1278 0 : }
1279 0 : FOR(execle_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execle", i ) ], txncache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1280 0 : FOR(execrp_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "execrp", i ) ], txncache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1281 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, txncache_obj->id, "txncache" ) );
1282 :
1283 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "genesi", 0UL ) ], funk_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1284 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 );
1285 :
1286 0 : if( FD_UNLIKELY( rpc_enabled ) ) {
1287 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "rpc", 0UL ) ], funk_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1288 0 : fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "rpc", 0UL ) ], store_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
1289 0 : }
1290 :
1291 0 : fd_pod_insert_int( topo->props, "sandbox", config->development.sandbox ? 1 : 0 );
1292 :
1293 0 : if( vinyl_enabled ) {
1294 0 : fd_topob_vinyl_rq( topo, "replay", 0UL, "accdb_replay", "replay", 4UL, 1024UL, 1024UL );
1295 0 : for( ulong i=0UL; i<execrp_tile_cnt; i++ ) {
1296 0 : fd_topob_vinyl_rq( topo, "execrp", i, "accdb_execrp", "execrp", 4UL, 1024UL, 1024UL );
1297 0 : }
1298 0 : for( ulong i=0UL; i<execle_tile_cnt; i++ ) {
1299 0 : fd_topob_vinyl_rq( topo, "execle", i, "accdb_execle", "execle", 4UL, 1024UL, 1024UL );
1300 0 : }
1301 0 : fd_topob_vinyl_rq( topo, "tower", 0UL, "accdb_tower", "tower", 4UL, 128UL, 128UL );
1302 0 : fd_topob_vinyl_rq( topo, "resolv", 0UL, "accdb_resolv", "resolv", 4UL, 1UL, 1UL );
1303 0 : if( rpc_enabled ) {
1304 0 : fd_topob_vinyl_rq( topo, "rpc", 0UL, "accdb_rpc", "rpc", 4UL, 1UL, 1UL );
1305 0 : }
1306 0 : }
1307 :
1308 0 : for( ulong i=0UL; i<topo->tile_cnt; i++ ) fd_topo_configure_tile( &topo->tiles[ i ], config );
1309 :
1310 0 : FOR(net_tile_cnt) fd_topos_net_tile_finish( topo, i );
1311 0 : fd_topob_finish( topo, CALLBACKS );
1312 0 : config->topo = *topo;
1313 0 : }
1314 :
1315 : void
1316 : fd_topo_configure_tile( fd_topo_tile_t * tile,
1317 0 : fd_config_t * config ) {
1318 0 : if( FD_UNLIKELY( !strcmp( tile->name, "metric" ) ) ) {
1319 :
1320 0 : if( FD_UNLIKELY( !fd_cstr_to_ip4_addr( config->tiles.metric.prometheus_listen_address, &tile->metric.prometheus_listen_addr ) ) )
1321 0 : FD_LOG_ERR(( "failed to parse prometheus listen address `%s`", config->tiles.metric.prometheus_listen_address ));
1322 0 : tile->metric.prometheus_listen_port = config->tiles.metric.prometheus_listen_port;
1323 :
1324 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "event" ) ) ) {
1325 :
1326 0 : strncpy( tile->event.identity_key_path, config->paths.identity_key, sizeof(tile->event.identity_key_path) );
1327 0 : strncpy( tile->event.url, config->tiles.event.url, sizeof(tile->event.url) );
1328 :
1329 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "net" ) || !strcmp( tile->name, "sock" ) ) ) {
1330 :
1331 0 : tile->net.shred_listen_port = config->tiles.shred.shred_listen_port;
1332 0 : tile->net.quic_transaction_listen_port = config->tiles.quic.quic_transaction_listen_port;
1333 0 : tile->net.legacy_transaction_listen_port = config->tiles.quic.regular_transaction_listen_port;
1334 0 : tile->net.gossip_listen_port = config->gossip.port;
1335 0 : tile->net.repair_intake_listen_port = config->tiles.repair.repair_intake_listen_port;
1336 0 : tile->net.repair_serve_listen_port = config->tiles.repair.repair_serve_listen_port;
1337 0 : tile->net.txsend_src_port = config->tiles.txsend.txsend_src_port;
1338 :
1339 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "netlnk" ) ) ) {
1340 :
1341 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "ipecho") ) ) {
1342 :
1343 0 : tile->ipecho.expected_shred_version = config->consensus.expected_shred_version;
1344 0 : tile->ipecho.bind_address = config->net.ip_addr;
1345 0 : tile->ipecho.bind_port = config->gossip.port;
1346 0 : tile->ipecho.entrypoints_cnt = config->gossip.entrypoints_cnt;
1347 0 : fd_memcpy( tile->ipecho.entrypoints, config->gossip.resolved_entrypoints, tile->ipecho.entrypoints_cnt * sizeof(fd_ip4_port_t) );
1348 :
1349 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "genesi" ) ) ) {
1350 :
1351 0 : tile->genesi.allow_download = config->firedancer.snapshots.genesis_download;
1352 0 : strncpy( tile->genesi.genesis_path, config->paths.genesis, sizeof(tile->genesi.genesis_path) );
1353 0 : tile->genesi.expected_shred_version = config->consensus.expected_shred_version;
1354 0 : tile->genesi.entrypoints_cnt = config->gossip.entrypoints_cnt;
1355 0 : fd_memcpy( tile->genesi.entrypoints, config->gossip.resolved_entrypoints, tile->genesi.entrypoints_cnt * sizeof(fd_ip4_port_t) );
1356 :
1357 0 : tile->genesi.has_expected_genesis_hash = !!strcmp( config->consensus.expected_genesis_hash, "" );
1358 :
1359 0 : if( FD_UNLIKELY( strcmp( config->consensus.expected_genesis_hash, "" ) && !fd_base58_decode_32( config->consensus.expected_genesis_hash, tile->genesi.expected_genesis_hash ) ) ) {
1360 0 : FD_LOG_ERR(( "failed to decode [consensus.expected_genesis_hash] \"%s\" as base58", config->consensus.expected_genesis_hash ));
1361 0 : }
1362 :
1363 0 : tile->genesi.target_gid = config->gid;
1364 0 : tile->genesi.target_uid = config->uid;
1365 :
1366 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "gossvf") ) ) {
1367 :
1368 0 : strncpy( tile->gossvf.identity_key_path, config->paths.identity_key, sizeof(tile->gossvf.identity_key_path) );
1369 0 : tile->gossvf.tcache_depth = 1<<22UL; /* TODO: user defined option */
1370 0 : tile->gossvf.shred_version = 0U;
1371 0 : tile->gossvf.allow_private_address = config->development.gossip.allow_private_address;
1372 0 : tile->gossvf.boot_timestamp_nanos = config->boot_timestamp_nanos;
1373 :
1374 0 : tile->gossvf.entrypoints_cnt = config->gossip.entrypoints_cnt;
1375 0 : fd_memcpy( tile->gossvf.entrypoints, config->gossip.resolved_entrypoints, tile->gossvf.entrypoints_cnt * sizeof(fd_ip4_port_t) );
1376 :
1377 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "gossip" ) ) ) {
1378 :
1379 0 : if( FD_UNLIKELY( strcmp( config->firedancer.gossip.host, "" ) ) ) {
1380 0 : if( !resolve_address( config->firedancer.gossip.host, &tile->gossip.ip_addr ) )
1381 0 : FD_LOG_ERR(( "could not resolve [gossip.host] %s", config->firedancer.gossip.host ));
1382 0 : } else {
1383 0 : tile->gossip.ip_addr = config->net.ip_addr;
1384 0 : }
1385 0 : strncpy( tile->gossip.identity_key_path, config->paths.identity_key, sizeof(tile->gossip.identity_key_path) );
1386 0 : tile->gossip.shred_version = config->consensus.expected_shred_version;
1387 0 : tile->gossip.max_entries = config->tiles.gossip.max_entries;
1388 0 : tile->gossip.boot_timestamp_nanos = config->boot_timestamp_nanos;
1389 :
1390 0 : tile->gossip.ports.gossip = config->gossip.port;
1391 0 : tile->gossip.ports.tvu = config->tiles.shred.shred_listen_port;
1392 0 : tile->gossip.ports.tpu = config->tiles.quic.regular_transaction_listen_port;
1393 0 : tile->gossip.ports.tpu_quic = config->tiles.quic.quic_transaction_listen_port;
1394 0 : tile->gossip.ports.repair = config->tiles.repair.repair_intake_listen_port;
1395 :
1396 0 : tile->gossip.entrypoints_cnt = config->gossip.entrypoints_cnt;
1397 0 : fd_memcpy( tile->gossip.entrypoints, config->gossip.resolved_entrypoints, tile->gossip.entrypoints_cnt * sizeof(fd_ip4_port_t) );
1398 :
1399 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapct" ) ) ) {
1400 :
1401 0 : fd_memcpy( tile->snapct.snapshots_path, config->paths.snapshots, PATH_MAX );
1402 0 : tile->snapct.sources.max_local_full_effective_age = config->firedancer.snapshots.sources.max_local_full_effective_age;
1403 0 : tile->snapct.sources.max_local_incremental_age = config->firedancer.snapshots.sources.max_local_incremental_age;
1404 0 : tile->snapct.incremental_snapshots = config->firedancer.snapshots.incremental_snapshots;
1405 0 : tile->snapct.max_full_snapshots_to_keep = config->firedancer.snapshots.max_full_snapshots_to_keep;
1406 0 : tile->snapct.max_incremental_snapshots_to_keep = config->firedancer.snapshots.max_incremental_snapshots_to_keep;
1407 0 : tile->snapct.full_effective_age_cancel_threshold = config->firedancer.snapshots.full_effective_age_cancel_threshold;
1408 0 : tile->snapct.max_retry_abort = config->firedancer.snapshots.max_retry_abort;
1409 0 : tile->snapct.sources.gossip.allow_any = config->firedancer.snapshots.sources.gossip.allow_any;
1410 0 : tile->snapct.sources.gossip.allow_list_cnt = config->firedancer.snapshots.sources.gossip.allow_list_cnt;
1411 0 : tile->snapct.sources.gossip.block_list_cnt = config->firedancer.snapshots.sources.gossip.block_list_cnt;
1412 0 : tile->snapct.sources.servers_cnt = config->firedancer.snapshots.sources.servers_cnt;
1413 0 : for( ulong i=0UL; i<tile->snapct.sources.gossip.allow_list_cnt; i++ ) {
1414 0 : if( FD_UNLIKELY( !fd_base58_decode_32( config->firedancer.snapshots.sources.gossip.allow_list[ i ], tile->snapct.sources.gossip.allow_list[ i ].uc ) ) ) {
1415 0 : FD_LOG_ERR(( "[snapshots.sources.gossip.allow_list[%lu]] invalid (%s)", i, config->firedancer.snapshots.sources.gossip.allow_list[ i ] ));
1416 0 : }
1417 0 : }
1418 0 : for( ulong i=0UL; i<tile->snapct.sources.gossip.block_list_cnt; i++ ) {
1419 0 : if( FD_UNLIKELY( !fd_base58_decode_32( config->firedancer.snapshots.sources.gossip.block_list[ i ], tile->snapct.sources.gossip.block_list[ i ].uc ) ) ) {
1420 0 : FD_LOG_ERR(( "[snapshots.sources.gossip.block_list[%lu]] invalid (%s)", i, config->firedancer.snapshots.sources.gossip.block_list[ i ] ));
1421 0 : }
1422 0 : }
1423 :
1424 0 : ulong resolved_peers_cnt = 0UL;
1425 0 : for( ulong i=0UL; i<tile->snapct.sources.servers_cnt; i++ ) {
1426 0 : fd_ip4_port_t resolved_addrs[ FD_TOPO_MAX_RESOLVED_ADDRS ];
1427 0 : struct addrinfo hints = { .ai_family = AF_INET, .ai_socktype = SOCK_STREAM };
1428 0 : int num_resolved = resolve_peer( config->firedancer.snapshots.sources.servers[ i ],
1429 0 : &hints,
1430 0 : "snapshots.sources.servers",
1431 0 : tile->snapct.sources.servers[ resolved_peers_cnt ].hostname,
1432 0 : resolved_addrs,
1433 0 : FD_TOPO_MAX_RESOLVED_ADDRS,
1434 0 : &tile->snapct.sources.servers[ resolved_peers_cnt ].is_https );
1435 0 : if( FD_UNLIKELY( 0==num_resolved ) ) {
1436 0 : FD_LOG_ERR(( "[snapshots.sources.servers[%lu]] invalid (%s)", i, config->firedancer.snapshots.sources.servers[ i ] ));
1437 0 : } else {
1438 0 : for( ulong i=0UL; i<(ulong)num_resolved; i++ ) tile->snapct.sources.servers[ resolved_peers_cnt+i ].addr = resolved_addrs[ i ];
1439 0 : for( ulong i=1UL; i<(ulong)num_resolved; i++ ) {
1440 0 : tile->snapct.sources.servers[ resolved_peers_cnt+i ].is_https = tile->snapct.sources.servers[ resolved_peers_cnt ].is_https;
1441 0 : fd_memcpy( tile->snapct.sources.servers[ resolved_peers_cnt+i ].hostname,
1442 0 : tile->snapct.sources.servers[ resolved_peers_cnt ].hostname,
1443 0 : sizeof(tile->snapct.sources.servers[ resolved_peers_cnt ].hostname) );
1444 0 : }
1445 0 : resolved_peers_cnt += (ulong)num_resolved;
1446 0 : }
1447 0 : }
1448 0 : tile->snapct.sources.servers_cnt = resolved_peers_cnt;
1449 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapld" ) ) ) {
1450 :
1451 0 : fd_memcpy( tile->snapld.snapshots_path, config->paths.snapshots, PATH_MAX );
1452 0 : tile->snapld.min_download_speed_mibs = config->firedancer.snapshots.min_download_speed_mibs;
1453 :
1454 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapdc" ) ) ) {
1455 :
1456 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapin" ) ) ) {
1457 :
1458 0 : tile->snapin.max_live_slots = config->firedancer.runtime.max_live_slots;
1459 0 : tile->snapin.funk_obj_id = fd_pod_query_ulong( config->topo.props, "funk", ULONG_MAX );
1460 0 : tile->snapin.txncache_obj_id = fd_pod_query_ulong( config->topo.props, "txncache", ULONG_MAX );
1461 :
1462 0 : tile->snapin.use_vinyl = !!config->firedancer.vinyl.enabled;
1463 0 : tile->snapin.lthash_disabled = !!config->development.snapshots.disable_lthash_verification;
1464 :
1465 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapwm" ) ) ) {
1466 :
1467 0 : strcpy( tile->snapwm.vinyl_path, config->paths.accounts );
1468 0 : tile->snapwm.vinyl_meta_map_obj_id = fd_pod_query_ulong( config->topo.props, "accdb.meta_map", ULONG_MAX );
1469 0 : tile->snapwm.vinyl_meta_pool_obj_id = fd_pod_query_ulong( config->topo.props, "accdb.meta_pool", ULONG_MAX );
1470 :
1471 0 : ulong wm_wr_link_id = fd_topo_find_link( &config->topo, "snapwm_wh", 0UL );
1472 0 : FD_TEST( wm_wr_link_id!=ULONG_MAX );
1473 0 : fd_topo_link_t * wm_wr_link = &config->topo.links[ wm_wr_link_id ];
1474 0 : tile->snapwm.snapwr_depth = wm_wr_link->depth;
1475 :
1476 0 : tile->snapwm.lthash_disabled = !!config->development.snapshots.disable_lthash_verification;
1477 :
1478 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapwh" ) ) ) {
1479 :
1480 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapwr" ) ) ) {
1481 :
1482 0 : strcpy( tile->snapwr.vinyl_path, config->paths.accounts );
1483 0 : ulong wm_wr_link_id = fd_topo_find_link( &config->topo, "snapwm_wh", 0UL );
1484 0 : FD_TEST( wm_wr_link_id!=ULONG_MAX );
1485 0 : fd_topo_link_t * wm_wr_link = &config->topo.links[ wm_wr_link_id ];
1486 0 : tile->snapwr.dcache_obj_id = wm_wr_link->dcache_obj_id;
1487 :
1488 0 : tile->snapwr.lthash_disabled = !!config->development.snapshots.disable_lthash_verification;
1489 :
1490 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapla" ) ) ) {
1491 :
1492 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snapls" ) ) ) {
1493 :
1494 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snaplh" ) ) ) {
1495 :
1496 0 : strcpy( tile->snaplh.vinyl_path, config->paths.accounts );
1497 0 : ulong wm_wr_link_id = fd_topo_find_link( &config->topo, "snapwm_wh", 0UL );
1498 0 : FD_TEST( wm_wr_link_id!=ULONG_MAX );
1499 0 : fd_topo_link_t * wm_wr_link = &config->topo.links[ wm_wr_link_id ];
1500 0 : tile->snaplh.dcache_obj_id = wm_wr_link->dcache_obj_id;
1501 0 : tile->snaplh.io_uring_enabled = !!config->firedancer.vinyl.io_uring.enabled;
1502 :
1503 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "snaplv" ) ) ) {
1504 :
1505 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "repair" ) ) ) {
1506 0 : tile->repair.max_pending_shred_sets = config->tiles.shred.max_pending_shred_sets;
1507 0 : tile->repair.repair_intake_listen_port = config->tiles.repair.repair_intake_listen_port;
1508 0 : tile->repair.repair_serve_listen_port = config->tiles.repair.repair_serve_listen_port;
1509 0 : tile->repair.slot_max = config->tiles.repair.slot_max;
1510 0 : tile->repair.repair_sign_cnt = config->firedancer.layout.sign_tile_count - 1; /* -1 because this excludes the keyguard client */
1511 0 : tile->repair.end_slot = 0;
1512 :
1513 0 : for( ulong i=0; i<tile->in_cnt; i++ ) {
1514 0 : if( !strcmp( config->topo.links[ tile->in_link_id[ i ] ].name, "sign_repair" ) ) {
1515 0 : tile->repair.repair_sign_depth = config->topo.links[ tile->in_link_id[ i ] ].depth;
1516 0 : break;
1517 0 : }
1518 0 : }
1519 0 : strncpy( tile->repair.identity_key_path, config->paths.identity_key, sizeof(tile->repair.identity_key_path) );
1520 :
1521 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "replay" ) )) {
1522 :
1523 : /* Please maintain same field order as fd_topo.h */
1524 :
1525 0 : tile->replay.fec_max = config->firedancer.runtime.max_live_slots * 1024UL; /* FIXME temporary hack to run on 512 gb boxes */
1526 :
1527 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 );
1528 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 );
1529 :
1530 0 : strncpy( tile->replay.identity_key_path, config->paths.identity_key, sizeof(tile->replay.identity_key_path) );
1531 0 : tile->replay.ip_addr = config->net.ip_addr;
1532 0 : strncpy( tile->replay.vote_account_path, config->paths.vote_account, sizeof(tile->replay.vote_account_path) );
1533 :
1534 0 : tile->replay.expected_shred_version = config->consensus.expected_shred_version;
1535 0 : tile->replay.wait_for_vote_to_start_leader = config->consensus.wait_for_vote_to_start_leader;
1536 :
1537 0 : tile->replay.sched_depth = config->firedancer.development.replay.scheduler_depth;
1538 0 : tile->replay.max_live_slots = config->firedancer.runtime.max_live_slots;
1539 0 : tile->replay.write_delay_slots = config->firedancer.vinyl.write_delay_slots;
1540 :
1541 0 : strncpy( tile->replay.genesis_path, config->paths.genesis, sizeof(tile->replay.genesis_path) );
1542 :
1543 0 : tile->replay.larger_max_cost_per_block = config->development.bench.larger_max_cost_per_block;
1544 :
1545 : /* not specified by [tiles.replay] */
1546 :
1547 0 : tile->replay.capture_start_slot = config->capture.capture_start_slot;
1548 0 : strncpy( tile->replay.solcap_capture, config->capture.solcap_capture, sizeof(tile->replay.solcap_capture) );
1549 0 : strncpy( tile->replay.dump_proto_dir, config->capture.dump_proto_dir, sizeof(tile->replay.dump_proto_dir) );
1550 0 : tile->replay.dump_block_to_pb = config->capture.dump_block_to_pb;
1551 :
1552 0 : if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) {
1553 0 : #define PARSE_PUBKEY( _tile, f ) \
1554 0 : if( FD_UNLIKELY( !fd_base58_decode_32( config->tiles.bundle.f, tile->_tile.bundle.f ) ) ) \
1555 0 : FD_LOG_ERR(( "[tiles.bundle.enabled] set to true, but failed to parse [tiles.bundle."#f"] %s", config->tiles.bundle.f ));
1556 0 : tile->replay.bundle.enabled = 1;
1557 0 : PARSE_PUBKEY( replay, tip_distribution_program_addr );
1558 0 : PARSE_PUBKEY( replay, tip_payment_program_addr );
1559 0 : strncpy( tile->replay.bundle.vote_account_path, config->paths.vote_account, sizeof(tile->replay.bundle.vote_account_path) );
1560 0 : } else {
1561 0 : fd_memset( &tile->replay.bundle, '\0', sizeof(tile->replay.bundle) );
1562 0 : }
1563 :
1564 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "execrp" ) ) ) {
1565 :
1566 0 : tile->execrp.txncache_obj_id = fd_pod_query_ulong( config->topo.props, "txncache", ULONG_MAX ); FD_TEST( tile->execrp.txncache_obj_id !=ULONG_MAX );
1567 0 : tile->execrp.progcache_obj_id = fd_pod_query_ulong( config->topo.props, "progcache", ULONG_MAX ); FD_TEST( tile->execrp.progcache_obj_id!=ULONG_MAX );
1568 0 : tile->execrp.acc_pool_obj_id = fd_pod_query_ulong( config->topo.props, "acc_pool", ULONG_MAX ); FD_TEST( tile->execrp.acc_pool_obj_id !=ULONG_MAX );
1569 :
1570 0 : tile->execrp.max_live_slots = config->firedancer.runtime.max_live_slots;
1571 :
1572 0 : tile->execrp.capture_start_slot = config->capture.capture_start_slot;
1573 0 : strncpy( tile->execrp.solcap_capture, config->capture.solcap_capture, sizeof(tile->execrp.solcap_capture) );
1574 0 : strncpy( tile->execrp.dump_proto_dir, config->capture.dump_proto_dir, sizeof(tile->execrp.dump_proto_dir) );
1575 0 : strncpy( tile->execrp.dump_syscall_name_filter, config->capture.dump_syscall_name_filter, sizeof(tile->execrp.dump_syscall_name_filter) );
1576 0 : strncpy( tile->execrp.dump_instr_program_id_filter, config->capture.dump_instr_program_id_filter, sizeof(tile->execrp.dump_instr_program_id_filter) );
1577 0 : tile->execrp.dump_instr_to_pb = config->capture.dump_instr_to_pb;
1578 0 : tile->execrp.dump_txn_to_pb = config->capture.dump_txn_to_pb;
1579 0 : tile->execrp.dump_syscall_to_pb = config->capture.dump_syscall_to_pb;
1580 0 : tile->execrp.dump_elf_to_pb = config->capture.dump_elf_to_pb;
1581 :
1582 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "tower" ) ) ) {
1583 0 : tile->tower.authorized_voter_paths_cnt = config->firedancer.paths.authorized_voter_paths_cnt;
1584 0 : for( ulong i=0UL; i<tile->tower.authorized_voter_paths_cnt; i++ ) {
1585 0 : strncpy( tile->tower.authorized_voter_paths[ i ], config->firedancer.paths.authorized_voter_paths[ i ], sizeof(tile->tower.authorized_voter_paths[ i ]) );
1586 0 : }
1587 :
1588 0 : tile->tower.hard_fork_fatal = config->firedancer.development.hard_fork_fatal;
1589 0 : tile->tower.max_live_slots = config->firedancer.runtime.max_live_slots;
1590 0 : tile->tower.max_vote_lookahead = config->tiles.tower.max_vote_lookahead;
1591 0 : tile->tower.debug_logging = config->tiles.tower.debug_logging;
1592 0 : strncpy( tile->tower.identity_key, config->paths.identity_key, sizeof(tile->tower.identity_key) );
1593 0 : strncpy( tile->tower.vote_account, config->paths.vote_account, sizeof(tile->tower.vote_account) );
1594 0 : strncpy( tile->tower.base_path, config->paths.base, sizeof(tile->tower.base_path) );
1595 :
1596 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "txsend" ) ) ) {
1597 :
1598 0 : tile->txsend.txsend_src_port = config->tiles.txsend.txsend_src_port;
1599 0 : tile->txsend.ip_addr = config->net.ip_addr;
1600 0 : strncpy( tile->txsend.identity_key_path, config->paths.identity_key, sizeof(tile->txsend.identity_key_path) );
1601 :
1602 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "quic" ) ) ) {
1603 :
1604 0 : tile->quic.reasm_cnt = config->tiles.quic.txn_reassembly_count;
1605 0 : tile->quic.out_depth = config->tiles.verify.receive_buffer_size;
1606 0 : tile->quic.max_concurrent_connections = config->tiles.quic.max_concurrent_connections;
1607 0 : tile->quic.max_concurrent_handshakes = config->tiles.quic.max_concurrent_handshakes;
1608 0 : tile->quic.quic_transaction_listen_port = config->tiles.quic.quic_transaction_listen_port;
1609 0 : tile->quic.idle_timeout_millis = config->tiles.quic.idle_timeout_millis;
1610 0 : tile->quic.ack_delay_millis = config->tiles.quic.ack_delay_millis;
1611 0 : tile->quic.retry = config->tiles.quic.retry;
1612 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) ) );
1613 :
1614 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "verify" ) ) ) {
1615 :
1616 0 : tile->verify.tcache_depth = config->tiles.verify.signature_cache_size;
1617 :
1618 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "dedup" ) ) ) {
1619 :
1620 0 : tile->dedup.tcache_depth = config->tiles.dedup.signature_cache_size;
1621 :
1622 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "resolv" ) ) ) {
1623 :
1624 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "pack" ) ) ) {
1625 :
1626 0 : tile->pack.max_pending_transactions = config->tiles.pack.max_pending_transactions;
1627 0 : tile->pack.execle_tile_count = config->firedancer.layout.execle_tile_count;
1628 0 : tile->pack.larger_max_cost_per_block = config->development.bench.larger_max_cost_per_block;
1629 0 : tile->pack.larger_shred_limits_per_block = config->development.bench.larger_shred_limits_per_block;
1630 0 : tile->pack.use_consumed_cus = config->tiles.pack.use_consumed_cus;
1631 0 : tile->pack.schedule_strategy = config->tiles.pack.schedule_strategy_enum;
1632 :
1633 0 : if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) {
1634 :
1635 0 : tile->pack.bundle.enabled = 1;
1636 0 : PARSE_PUBKEY( pack, tip_distribution_program_addr );
1637 0 : PARSE_PUBKEY( pack, tip_payment_program_addr );
1638 0 : PARSE_PUBKEY( pack, tip_distribution_authority );
1639 0 : tile->pack.bundle.commission_bps = config->tiles.bundle.commission_bps;
1640 0 : strncpy( tile->pack.bundle.identity_key_path, config->paths.identity_key, sizeof(tile->pack.bundle.identity_key_path) );
1641 0 : strncpy( tile->pack.bundle.vote_account_path, config->paths.vote_account, sizeof(tile->pack.bundle.vote_account_path) );
1642 0 : } else {
1643 0 : fd_memset( &tile->pack.bundle, '\0', sizeof(tile->pack.bundle) );
1644 0 : }
1645 :
1646 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "execle" ) ) ) {
1647 0 : tile->execle.txncache_obj_id = fd_pod_query_ulong( config->topo.props, "txncache", ULONG_MAX );
1648 0 : tile->execle.progcache_obj_id = fd_pod_query_ulong( config->topo.props, "progcache", ULONG_MAX );
1649 0 : tile->execle.acc_pool_obj_id = fd_pod_query_ulong( config->topo.props, "acc_pool", ULONG_MAX );
1650 :
1651 0 : tile->execle.max_live_slots = config->firedancer.runtime.max_live_slots;
1652 :
1653 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "poh" ) ) ) {
1654 0 : strncpy( tile->poh.identity_key_path, config->paths.identity_key, sizeof(tile->poh.identity_key_path) );
1655 :
1656 0 : tile->poh.execle_cnt = config->firedancer.layout.execle_tile_count;
1657 :
1658 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "shred" ) ) ) {
1659 :
1660 0 : strncpy( tile->shred.identity_key_path, config->paths.identity_key, sizeof(tile->shred.identity_key_path) );
1661 :
1662 0 : tile->shred.depth = config->topo.links[ tile->out_link_id[ 0 ] ].depth;
1663 0 : tile->shred.fec_resolver_depth = config->tiles.shred.max_pending_shred_sets;
1664 0 : tile->shred.expected_shred_version = config->consensus.expected_shred_version;
1665 0 : tile->shred.shred_listen_port = config->tiles.shred.shred_listen_port;
1666 0 : tile->shred.larger_shred_limits_per_block = config->development.bench.larger_shred_limits_per_block;
1667 0 : for( ulong i=0UL; i<config->tiles.shred.additional_shred_destinations_retransmit_cnt; i++ ) {
1668 0 : parse_ip_port( "tiles.shred.additional_shred_destinations_retransmit",
1669 0 : config->tiles.shred.additional_shred_destinations_retransmit[ i ],
1670 0 : &tile->shred.adtl_dests_retransmit[ i ] );
1671 0 : }
1672 0 : tile->shred.adtl_dests_retransmit_cnt = config->tiles.shred.additional_shred_destinations_retransmit_cnt;
1673 0 : for( ulong i=0UL; i<config->tiles.shred.additional_shred_destinations_leader_cnt; i++ ) {
1674 0 : parse_ip_port( "tiles.shred.additional_shred_destinations_leader",
1675 0 : config->tiles.shred.additional_shred_destinations_leader[ i ],
1676 0 : &tile->shred.adtl_dests_leader[ i ] );
1677 0 : }
1678 0 : tile->shred.adtl_dests_leader_cnt = config->tiles.shred.additional_shred_destinations_leader_cnt;
1679 :
1680 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "sign" ) ) ) {
1681 :
1682 0 : strncpy( tile->sign.identity_key_path, config->paths.identity_key, sizeof(tile->sign.identity_key_path) );
1683 :
1684 0 : tile->sign.authorized_voter_paths_cnt = config->firedancer.paths.authorized_voter_paths_cnt;
1685 0 : for( ulong i=0UL; i<tile->sign.authorized_voter_paths_cnt; i++ ) {
1686 0 : strncpy( tile->sign.authorized_voter_paths[ i ], config->firedancer.paths.authorized_voter_paths[ i ], sizeof(tile->sign.authorized_voter_paths[ i ]) );
1687 0 : }
1688 :
1689 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "plugin" ) ) ) {
1690 :
1691 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "diag" ) ) ) {
1692 :
1693 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "gui" ) ) ) {
1694 :
1695 0 : if( FD_UNLIKELY( !fd_cstr_to_ip4_addr( config->tiles.gui.gui_listen_address, &tile->gui.listen_addr ) ) )
1696 0 : FD_LOG_ERR(( "failed to parse gui listen address `%s`", config->tiles.gui.gui_listen_address ));
1697 0 : tile->gui.listen_port = config->tiles.gui.gui_listen_port;
1698 0 : tile->gui.is_voting = strcmp( config->paths.vote_account, "" );
1699 0 : strncpy( tile->gui.cluster, config->cluster, sizeof(tile->gui.cluster) );
1700 0 : strncpy( tile->gui.identity_key_path, config->paths.identity_key, sizeof(tile->gui.identity_key_path) );
1701 0 : strncpy( tile->gui.vote_key_path, config->paths.vote_account, sizeof(tile->gui.vote_key_path) );
1702 0 : tile->gui.max_http_connections = config->tiles.gui.max_http_connections;
1703 0 : tile->gui.max_websocket_connections = config->tiles.gui.max_websocket_connections;
1704 0 : tile->gui.max_http_request_length = config->tiles.gui.max_http_request_length;
1705 0 : tile->gui.send_buffer_size_mb = config->tiles.gui.send_buffer_size_mb;
1706 0 : tile->gui.schedule_strategy = config->tiles.pack.schedule_strategy_enum;
1707 0 : tile->gui.websocket_compression = 1;
1708 0 : tile->gui.frontend_release_channel = config->development.gui.frontend_release_channel_enum;
1709 :
1710 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "rpc" ) ) ) {
1711 :
1712 0 : if( FD_UNLIKELY( !fd_cstr_to_ip4_addr( config->tiles.rpc.rpc_listen_address, &tile->rpc.listen_addr ) ) )
1713 0 : FD_LOG_ERR(( "failed to parse rpc listen address `%s`", config->tiles.rpc.rpc_listen_address ));
1714 0 : tile->rpc.listen_port = config->tiles.rpc.rpc_listen_port;
1715 0 : tile->rpc.max_http_connections = config->tiles.rpc.max_http_connections;
1716 0 : tile->rpc.max_http_request_length = config->tiles.rpc.max_http_request_length;
1717 0 : tile->rpc.send_buffer_size_mb = config->tiles.rpc.send_buffer_size_mb;
1718 :
1719 0 : tile->rpc.max_live_slots = config->firedancer.runtime.max_live_slots;
1720 :
1721 0 : strncpy( tile->rpc.identity_key_path, config->paths.identity_key, sizeof(tile->rpc.identity_key_path) );
1722 :
1723 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "arch_f" ) ||
1724 0 : !strcmp( tile->name, "arch_w" ) ) ) {
1725 :
1726 0 : strncpy( tile->archiver.rocksdb_path, config->tiles.archiver.rocksdb_path, sizeof(tile->archiver.rocksdb_path) );
1727 :
1728 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "backt" ) ) ) {
1729 :
1730 0 : tile->backtest.end_slot = config->tiles.archiver.end_slot;
1731 0 : tile->backtest.ingest_dead_slots = config->tiles.archiver.ingest_dead_slots;
1732 0 : tile->backtest.root_distance = config->tiles.archiver.root_distance;
1733 :
1734 : /* Validate arguments based on the ingest mode */
1735 0 : if( !strcmp( config->tiles.archiver.ingest_mode, "rocksdb" ) ) {
1736 0 : strncpy( tile->backtest.rocksdb_path, config->tiles.archiver.rocksdb_path, PATH_MAX );
1737 0 : if( FD_UNLIKELY( 0==strlen( tile->backtest.rocksdb_path ) ) ) {
1738 0 : FD_LOG_ERR(( "`archiver.rocksdb_path` not specified in toml" ));
1739 0 : }
1740 0 : } else if( !strcmp( config->tiles.archiver.ingest_mode, "shredcap" ) ) {
1741 0 : strncpy( tile->backtest.shredcap_path, config->tiles.archiver.shredcap_path, PATH_MAX );
1742 0 : if( FD_UNLIKELY( 0==strlen( tile->backtest.shredcap_path ) ) ) {
1743 0 : FD_LOG_ERR(( "`archiver.shredcap_path` not specified in toml" ));
1744 0 : }
1745 0 : } else {
1746 0 : FD_LOG_ERR(( "Invalid ingest mode: %s", config->tiles.archiver.ingest_mode ));
1747 0 : }
1748 :
1749 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "scap" ) ) ) {
1750 :
1751 0 : tile->shredcap.repair_intake_listen_port = config->tiles.repair.repair_intake_listen_port;
1752 0 : strncpy( tile->shredcap.folder_path, config->tiles.shredcap.folder_path, sizeof(tile->shredcap.folder_path) );
1753 0 : tile->shredcap.write_buffer_size = config->tiles.shredcap.write_buffer_size;
1754 0 : tile->shredcap.enable_publish_stake_weights = 0; /* this is not part of the config */
1755 0 : strncpy( tile->shredcap.manifest_path, "", PATH_MAX ); /* this is not part of the config */
1756 :
1757 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "bundle" ) ) ) {
1758 0 : strncpy( tile->bundle.url, config->tiles.bundle.url, sizeof(tile->bundle.url) );
1759 0 : tile->bundle.url_len = strnlen( tile->bundle.url, 255 );
1760 0 : strncpy( tile->bundle.sni, config->tiles.bundle.tls_domain_name, 256 );
1761 0 : tile->bundle.sni_len = strnlen( tile->bundle.sni, 255 );
1762 0 : strncpy( tile->bundle.identity_key_path, config->paths.identity_key, sizeof(tile->bundle.identity_key_path) );
1763 0 : strncpy( tile->bundle.key_log_path, config->development.bundle.ssl_key_log_file, sizeof(tile->bundle.key_log_path) );
1764 0 : tile->bundle.buf_sz = config->development.bundle.buffer_size_kib<<10;
1765 0 : tile->bundle.ssl_heap_sz = config->development.bundle.ssl_heap_size_mib<<20;
1766 0 : tile->bundle.keepalive_interval_nanos = config->tiles.bundle.keepalive_interval_millis * (ulong)1e6;
1767 0 : tile->bundle.tls_cert_verify = !!config->tiles.bundle.tls_cert_verify;
1768 :
1769 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "accdb" ) ) ) {
1770 :
1771 0 : tile->accdb.meta_map_obj_id = fd_pod_query_ulong( config->topo.props, "accdb.meta_map", ULONG_MAX );
1772 0 : tile->accdb.meta_pool_obj_id = fd_pod_query_ulong( config->topo.props, "accdb.meta_pool", ULONG_MAX );
1773 0 : tile->accdb.line_max = config->firedancer.vinyl.max_cache_entries;
1774 0 : tile->accdb.data_obj_id = fd_pod_query_ulong( config->topo.props, "accdb.data", ULONG_MAX );
1775 0 : fd_cstr_ncpy( tile->accdb.bstream_path, config->paths.accounts, sizeof(tile->accdb.bstream_path) );
1776 0 : tile->accdb.io_type = config->firedancer.vinyl.io_uring.enabled ?
1777 0 : FD_VINYL_IO_TYPE_UR : FD_VINYL_IO_TYPE_BD;
1778 0 : tile->accdb.uring_depth = config->firedancer.vinyl.io_uring.queue_depth;
1779 :
1780 : /* Minimum bound for cache entry count */
1781 0 : ulong required_cache_entries = 0UL;
1782 0 : for( ulong i=0UL; i<(tile->uses_obj_cnt); i++ ) {
1783 0 : ulong rq_obj_id = tile->uses_obj_id[ i ];
1784 0 : fd_topo_obj_t const * rq_obj = &config->topo.objs[ rq_obj_id ];
1785 0 : if( strcmp( rq_obj->name, "vinyl_rq" ) ) continue;
1786 :
1787 0 : ulong quota_max;
1788 0 : FD_TEST( (quota_max = fd_pod_queryf_ulong( config->topo.props, ULONG_MAX, "obj.%lu.quota_max", rq_obj_id ))!=ULONG_MAX );
1789 0 : required_cache_entries += quota_max;
1790 0 : }
1791 0 : if( FD_UNLIKELY( required_cache_entries > tile->accdb.line_max ) ) {
1792 0 : FD_LOG_WARNING(( "insufficient [accdb.max_cache_entries] (%lu) for config, increasing cache entry limit to %lu and continuing",
1793 0 : tile->accdb.line_max, required_cache_entries ));
1794 0 : tile->accdb.line_max = required_cache_entries;
1795 0 : }
1796 :
1797 0 : } else if( FD_UNLIKELY( !strcmp( tile->name, "solcap" ) ) ) {
1798 :
1799 0 : tile->solcap.capture_start_slot = config->capture.capture_start_slot;
1800 0 : strncpy( tile->solcap.solcap_capture, config->capture.solcap_capture, sizeof(tile->solcap.solcap_capture) );
1801 0 : tile->solcap.recent_only = config->capture.recent_only;
1802 0 : tile->solcap.recent_slots_per_file = config->capture.recent_slots_per_file;
1803 :
1804 0 : } else {
1805 0 : FD_LOG_ERR(( "unknown tile name `%s`", tile->name ));
1806 0 : }
1807 0 : }
|