Line data Source code
1 : #include "../platform/fd_config_extract.h"
2 : #include "../platform/fd_config_macros.c"
3 : #include "fd_config_private.h"
4 :
5 : static void
6 : fd_config_check_configf( fd_config_t * config,
7 6 : fd_configf_t * config_f ) {
8 6 : (void)config_f;
9 6 : if( FD_UNLIKELY( strlen( config->paths.snapshots )>PATH_MAX-1UL ) ) {
10 0 : FD_LOG_ERR(( "[config->paths.snapshots] is too long (max %lu)", PATH_MAX-1UL ));
11 0 : }
12 6 : if( FD_UNLIKELY( config->paths.snapshots[ 0 ]!='\0' && config->paths.snapshots[ 0 ]!='/' ) ) {
13 0 : FD_LOG_ERR(( "[config->paths.snapshots] must be an absolute path and hence start with a '/'"));
14 0 : }
15 6 : }
16 :
17 : fd_configh_t *
18 : fd_config_extract_podh( uchar * pod,
19 21 : fd_configh_t * config ) {
20 21 : CFG_POP ( cstr, dynamic_port_range );
21 :
22 21 : CFG_POP ( cstr, reporting.solana_metrics_config );
23 :
24 21 : CFG_POP ( cstr, layout.agave_affinity );
25 21 : CFG_POP ( uint, layout.agave_unified_scheduler_handler_threads );
26 21 : CFG_POP ( uint, layout.resolh_tile_count );
27 21 : CFG_POP ( uint, layout.bank_tile_count );
28 :
29 21 : CFG_POP1 ( cstr, ledger.accounts_path, paths.accounts_path );
30 21 : CFG_POP1_ARRAY( cstr, consensus.authorized_voter_paths, paths.authorized_voter_paths );
31 :
32 21 : CFG_POP ( uint, ledger.limit_size );
33 21 : CFG_POP_ARRAY( cstr, ledger.account_indexes );
34 21 : CFG_POP_ARRAY( cstr, ledger.account_index_include_keys );
35 21 : CFG_POP_ARRAY( cstr, ledger.account_index_exclude_keys );
36 21 : CFG_POP ( bool, ledger.enable_accounts_disk_index );
37 21 : CFG_POP ( cstr, ledger.accounts_index_path );
38 21 : CFG_POP ( cstr, ledger.accounts_hash_cache_path );
39 21 : CFG_POP ( bool, ledger.require_tower );
40 21 : CFG_POP ( cstr, ledger.snapshot_archive_format );
41 :
42 21 : CFG_POP ( bool, gossip.port_check );
43 :
44 21 : CFG_POP ( bool, consensus.snapshot_fetch );
45 21 : CFG_POP ( bool, consensus.genesis_fetch );
46 21 : CFG_POP ( bool, consensus.poh_speed_test );
47 21 : CFG_POP ( uint, consensus.wait_for_supermajority_at_slot );
48 21 : CFG_POP ( cstr, consensus.expected_bank_hash );
49 21 : CFG_POP ( bool, consensus.wait_for_vote_to_start_leader );
50 21 : CFG_POP_ARRAY( uint, consensus.hard_fork_at_slots );
51 21 : CFG_POP_ARRAY( cstr, consensus.known_validators );
52 21 : CFG_POP ( bool, consensus.os_network_limits_test );
53 :
54 21 : CFG_POP ( ushort, rpc.port );
55 21 : CFG_POP ( bool, rpc.extended_tx_metadata_storage );
56 21 : CFG_POP ( bool, rpc.full_api );
57 21 : CFG_POP ( bool, rpc.private );
58 21 : CFG_POP ( cstr, rpc.bind_address );
59 21 : CFG_POP ( cstr, rpc.public_address );
60 21 : CFG_POP ( bool, rpc.transaction_history );
61 21 : CFG_POP ( bool, rpc.only_known );
62 21 : CFG_POP ( bool, rpc.pubsub_enable_block_subscription );
63 21 : CFG_POP ( bool, rpc.pubsub_enable_vote_subscription );
64 21 : CFG_POP ( bool, rpc.bigtable_ledger_storage );
65 :
66 21 : CFG_POP ( bool, snapshots.enabled );
67 21 : CFG_POP ( bool, snapshots.incremental_snapshots );
68 21 : CFG_POP ( uint, snapshots.full_snapshot_interval_slots );
69 21 : CFG_POP ( uint, snapshots.incremental_snapshot_interval_slots );
70 21 : CFG_POP ( uint, snapshots.minimum_snapshot_download_speed );
71 21 : CFG_POP ( uint, snapshots.maximum_snapshot_download_abort );
72 21 : CFG_POP ( uint, snapshots.maximum_full_snapshots_to_retain );
73 21 : CFG_POP ( uint, snapshots.maximum_incremental_snapshots_to_retain);
74 21 : CFG_POP ( cstr, snapshots.path );
75 21 : CFG_POP ( cstr, snapshots.incremental_path );
76 :
77 21 : return config;
78 21 : }
79 :
80 : fd_configf_t *
81 : fd_config_extract_podf( uchar * pod,
82 6 : fd_configf_t * config ) {
83 6 : CFG_POP_ARRAY( cstr, paths.authorized_voter_paths );
84 :
85 6 : CFG_POP ( cstr, gossip.host );
86 :
87 6 : CFG_POP ( bool, layout.enable_block_production );
88 6 : CFG_POP ( bool, layout.enable_snapshot_production );
89 6 : CFG_POP ( uint, layout.execrp_tile_count );
90 6 : CFG_POP ( uint, layout.sign_tile_count );
91 6 : CFG_POP ( uint, layout.resolv_tile_count );
92 6 : CFG_POP ( uint, layout.execle_tile_count );
93 6 : CFG_POP ( uint, layout.gossvf_tile_count );
94 6 : CFG_POP ( uint, layout.snapzp_tile_count );
95 6 : CFG_POP ( uint, layout.snapsv_tile_count );
96 6 : CFG_POP ( uint, layout.snapsv_io_worker_count );
97 :
98 6 : CFG_POP ( ulong, accounts.max_accounts );
99 6 : CFG_POP ( ulong, accounts.cache_size_gib );
100 :
101 6 : CFG_POP ( ulong, runtime.max_live_slots );
102 6 : CFG_POP ( ulong, runtime.max_fork_width );
103 :
104 6 : CFG_POP ( ulong, runtime.program_cache.heap_size_mib );
105 6 : CFG_POP ( ulong, runtime.program_cache.mean_cache_entry_size );
106 :
107 6 : CFG_POP ( cstr, consensus.wait_for_supermajority_with_bank_hash );
108 :
109 6 : CFG_POP ( uint, snapshots.sources.max_local_full_effective_age );
110 6 : CFG_POP ( uint, snapshots.sources.max_local_incremental_age );
111 6 : CFG_POP ( bool, snapshots.sources.gossip.allow_any );
112 6 : CFG_POP_ARRAY( cstr, snapshots.sources.gossip.allow_list );
113 6 : CFG_POP_ARRAY( cstr, snapshots.sources.gossip.block_list );
114 6 : CFG_POP_ARRAY( cstr, snapshots.sources.servers );
115 6 : CFG_POP ( bool, snapshots.incremental_snapshots );
116 6 : CFG_POP ( bool, snapshots.genesis_download );
117 6 : CFG_POP ( uint, snapshots.max_full_snapshots_to_keep );
118 6 : CFG_POP ( uint, snapshots.max_incremental_snapshots_to_keep );
119 6 : CFG_POP ( uint, snapshots.max_retry_abort );
120 6 : CFG_POP ( uint, snapshots.min_download_speed_mibs );
121 6 : CFG_POP ( ulong, snapshots.wait_for_peers_timeout_seconds );
122 6 : CFG_POP ( ulong, snapshots.full_snapshot_interval_slots );
123 6 : CFG_POP ( ulong, snapshots.incremental_snapshot_interval_slots );
124 6 : CFG_POP ( ulong, snapshots.max_incremental_snapshot_accounts );
125 :
126 6 : CFG_POP ( bool, snapshots.server.enabled );
127 6 : CFG_POP ( cstr, snapshots.server.http_listen_address );
128 6 : CFG_POP ( uint, snapshots.server.http_listen_port );
129 6 : CFG_POP ( ulong, snapshots.server.max_http_connections );
130 6 : CFG_POP ( ulong, snapshots.server.idle_timeout_millis );
131 6 : CFG_POP ( ulong, snapshots.server.send_timeout_millis );
132 6 : CFG_POP ( ulong, snapshots.server.send_buffer_size_kib );
133 :
134 6 : CFG_POP ( bool, development.hard_fork_fatal );
135 6 : CFG_POP ( bool, development.fixed_fec_sets );
136 6 : CFG_POP ( bool, development.alpenglow );
137 :
138 6 : CFG_POP ( ushort, development.votor.quic_server_listen_port );
139 :
140 6 : CFG_POP ( bool, development.genesis.validate_genesis_hash );
141 6 : CFG_POP ( ulong, development.genesis.max_file_size_mib );
142 :
143 6 : CFG_POP ( cstr, development.ledger_input.format );
144 6 : CFG_POP ( cstr, development.ledger_input.path );
145 6 : CFG_POP ( ulong, development.ledger_input.end_slot );
146 :
147 6 : CFG_POP ( cstr, development.backtest.affinity );
148 6 : CFG_POP ( ulong, development.backtest.root_distance );
149 :
150 6 : CFG_POP ( cstr, development.forktest.affinity );
151 :
152 6 : return config;
153 6 : }
154 :
155 : fd_config_t *
156 : fd_config_extract_pod( uchar * pod,
157 30 : fd_config_t * config ) {
158 30 : CFG_POP ( cstr, name );
159 30 : CFG_POP ( cstr, user );
160 :
161 30 : CFG_POP ( bool, telemetry );
162 :
163 30 : CFG_POP ( cstr, log.path );
164 30 : CFG_POP ( cstr, log.colorize );
165 30 : CFG_POP ( cstr, log.level_logfile );
166 30 : CFG_POP ( cstr, log.level_stderr );
167 30 : CFG_POP ( cstr, log.level_flush );
168 :
169 30 : if( FD_UNLIKELY( config->is_firedancer ) ) {
170 6 : CFG_POP ( cstr, paths.base );
171 6 : CFG_POP ( cstr, paths.identity_key );
172 6 : CFG_POP ( cstr, paths.vote_account );
173 6 : CFG_POP ( cstr, paths.snapshots );
174 6 : CFG_POP ( cstr, paths.genesis );
175 6 : CFG_POP ( cstr, paths.accounts );
176 6 : CFG_POP ( cstr, paths.shredb );
177 6 : CFG_POP ( cstr, paths.guidb );
178 24 : } else {
179 24 : CFG_POP1 ( cstr, scratch_directory, paths.base );
180 24 : CFG_POP1 ( cstr, ledger.path, frankendancer.paths.ledger );
181 24 : CFG_POP1 ( cstr, consensus.identity_path, paths.identity_key );
182 24 : CFG_POP1 ( cstr, consensus.vote_account_path, paths.vote_account );
183 24 : }
184 :
185 30 : CFG_POP_ARRAY( cstr, gossip.entrypoints );
186 30 : CFG_POP ( ushort, gossip.port );
187 :
188 30 : CFG_POP ( ushort, consensus.expected_shred_version );
189 30 : CFG_POP ( cstr, consensus.expected_genesis_hash );
190 30 : CFG_POP ( bool, consensus.wait_for_vote_to_start_leader );
191 :
192 30 : CFG_POP ( cstr, layout.affinity );
193 30 : CFG_POP ( cstr, layout.blocklist_cores );
194 30 : CFG_POP ( uint, layout.net_tile_count );
195 30 : CFG_POP ( uint, layout.quic_tile_count );
196 30 : CFG_POP ( uint, layout.verify_tile_count );
197 30 : CFG_POP ( uint, layout.shred_tile_count );
198 :
199 30 : CFG_POP ( cstr, hugetlbfs.mount_path );
200 30 : CFG_POP ( cstr, hugetlbfs.max_page_size );
201 30 : CFG_POP ( ulong, hugetlbfs.gigantic_page_threshold_mib );
202 :
203 30 : CFG_POP ( cstr, net.interface );
204 30 : CFG_POP ( cstr, net.bind_address );
205 30 : CFG_POP ( cstr, net.provider );
206 30 : CFG_POP ( uint, net.ingress_buffer_size );
207 30 : CFG_POP ( cstr, net.xdp.xdp_mode );
208 30 : CFG_POP ( boolau, net.xdp.xdp_zero_copy );
209 27 : CFG_POP ( cstr, net.xdp.poll_mode );
210 27 : CFG_POP ( uint, net.xdp.xdp_rx_queue_size );
211 27 : CFG_POP ( uint, net.xdp.xdp_tx_queue_size );
212 27 : CFG_POP ( uint, net.xdp.flush_timeout_micros );
213 27 : CFG_POP ( cstr, net.xdp.rss_queue_mode );
214 27 : CFG_POP ( bool, net.xdp.listen_gre );
215 27 : CFG_POP ( boolau, net.xdp.native_bond );
216 27 : CFG_POP ( uint, net.socket.receive_buffer_size );
217 27 : CFG_POP ( uint, net.socket.send_buffer_size );
218 :
219 27 : CFG_POP ( ulong, tiles.netlink.max_routes );
220 27 : CFG_POP ( ulong, tiles.netlink.max_peer_routes );
221 27 : CFG_POP ( ulong, tiles.netlink.max_neighbors );
222 :
223 27 : CFG_POP ( ulong, tiles.gossip.max_entries );
224 :
225 27 : CFG_POP ( ushort, tiles.quic.regular_transaction_listen_port );
226 27 : CFG_POP ( ushort, tiles.quic.quic_transaction_listen_port );
227 27 : CFG_POP ( uint, tiles.quic.txn_reassembly_count );
228 27 : CFG_POP ( uint, tiles.quic.max_concurrent_connections );
229 27 : CFG_POP ( uint, tiles.quic.max_concurrent_handshakes );
230 27 : CFG_POP ( uint, tiles.quic.idle_timeout_millis );
231 27 : CFG_POP ( uint, tiles.quic.ack_delay_millis );
232 27 : CFG_POP ( bool, tiles.quic.retry );
233 27 : CFG_POP ( cstr, tiles.quic.ssl_key_log_file );
234 :
235 27 : CFG_POP ( uint, tiles.verify.signature_cache_size );
236 27 : CFG_POP ( uint, tiles.verify.receive_buffer_size );
237 27 : CFG_POP ( uint, tiles.verify.mtu );
238 :
239 27 : CFG_POP ( uint, tiles.dedup.signature_cache_size );
240 :
241 27 : CFG_POP ( bool, tiles.bundle.enabled );
242 27 : CFG_POP ( cstr, tiles.bundle.url );
243 27 : CFG_POP ( cstr, tiles.bundle.tls_domain_name );
244 27 : CFG_POP ( cstr, tiles.bundle.tip_distribution_program_addr );
245 27 : CFG_POP ( cstr, tiles.bundle.tip_payment_program_addr );
246 27 : CFG_POP ( cstr, tiles.bundle.tip_distribution_authority );
247 27 : CFG_POP ( uint, tiles.bundle.commission_bps );
248 27 : CFG_POP ( ulong, tiles.bundle.keepalive_interval_millis );
249 27 : CFG_POP ( bool, tiles.bundle.tls_cert_verify );
250 :
251 27 : CFG_POP ( uint, tiles.pack.max_pending_transactions );
252 27 : CFG_POP ( bool, tiles.pack.use_consumed_cus );
253 27 : CFG_POP ( cstr, tiles.pack.schedule_strategy );
254 27 : CFG_POP_ARRAY( cstr, tiles.pack.account_blocklist );
255 :
256 27 : CFG_POP ( ulong, tiles.replay.max_transaction_lookahead_buffer_size );
257 27 : CFG_POP_ARRAY( cstr, tiles.replay.enable_features );
258 :
259 27 : CFG_POP ( bool, tiles.pohh.lagged_consecutive_leader_start );
260 :
261 27 : CFG_POP ( uint, tiles.shred.max_pending_shred_sets );
262 27 : CFG_POP ( ushort, tiles.shred.shred_listen_port );
263 27 : CFG_POP_ARRAY( cstr, tiles.shred.additional_shred_destinations_retransmit );
264 27 : CFG_POP_ARRAY( cstr, tiles.shred.additional_shred_destinations_leader );
265 :
266 27 : CFG_POP ( cstr, tiles.metric.prometheus_listen_address );
267 27 : CFG_POP ( ushort, tiles.metric.prometheus_listen_port );
268 :
269 27 : CFG_POP ( cstr, tiles.event.url );
270 :
271 27 : CFG_POP ( bool, tiles.gui.enabled );
272 27 : CFG_POP ( cstr, tiles.gui.gui_listen_address );
273 27 : CFG_POP ( ushort, tiles.gui.gui_listen_port );
274 27 : CFG_POP ( ulong, tiles.gui.max_http_connections );
275 27 : CFG_POP ( ulong, tiles.gui.max_websocket_connections );
276 27 : CFG_POP ( ulong, tiles.gui.max_http_request_length );
277 27 : CFG_POP ( ulong, tiles.gui.send_buffer_size_mb );
278 27 : CFG_POP ( ulong, tiles.gui.db_size_gib );
279 :
280 27 : CFG_POP ( bool, tiles.rpc.enabled );
281 27 : CFG_POP ( cstr, tiles.rpc.rpc_listen_address );
282 27 : CFG_POP ( ushort, tiles.rpc.rpc_listen_port );
283 27 : CFG_POP ( ulong, tiles.rpc.max_http_connections );
284 27 : CFG_POP ( ulong, tiles.rpc.max_websocket_connections );
285 27 : CFG_POP ( ulong, tiles.rpc.max_http_request_length );
286 27 : CFG_POP ( ulong, tiles.rpc.send_buffer_size_mb );
287 27 : CFG_POP ( bool, tiles.rpc.delay_startup );
288 :
289 27 : CFG_POP ( ushort, tiles.repair.repair_client_listen_port );
290 27 : CFG_POP ( ulong, tiles.repair.slot_max );
291 :
292 27 : CFG_POP ( bool, tiles.rserve.enabled );
293 27 : CFG_POP ( ushort, tiles.rserve.repair_serve_listen_port );
294 27 : CFG_POP ( ulong, tiles.rserve.shred_storage_limit_gib );
295 :
296 27 : CFG_POP ( ulong, capture.capture_start_slot );
297 27 : CFG_POP ( cstr, capture.solcap_capture );
298 27 : CFG_POP ( bool, capture.recent_only );
299 27 : CFG_POP ( ulong, capture.recent_slots_per_file );
300 27 : CFG_POP ( cstr, capture.dump_proto_dir );
301 27 : CFG_POP ( cstr, capture.dump_syscall_name_filter );
302 27 : CFG_POP ( cstr, capture.dump_instr_program_id_filter );
303 27 : CFG_POP ( bool, capture.dump_syscall_to_pb );
304 27 : CFG_POP ( bool, capture.dump_instr_to_pb );
305 27 : CFG_POP ( bool, capture.dump_txn_to_pb );
306 27 : CFG_POP ( bool, capture.dump_txn_as_fixture );
307 27 : CFG_POP ( bool, capture.dump_block_to_pb );
308 :
309 27 : CFG_POP ( ushort, tiles.txsend.txsend_src_port );
310 :
311 27 : CFG_POP ( bool, development.sandbox );
312 27 : CFG_POP ( bool, development.no_clone );
313 27 : CFG_POP ( cstr, development.core_dump );
314 27 : CFG_POP ( bool, development.no_agave );
315 27 : CFG_POP ( bool, development.bootstrap );
316 :
317 27 : CFG_POP ( bool, development.gossip.allow_private_address );
318 :
319 27 : CFG_POP ( ulong, development.genesis.hashes_per_tick );
320 27 : CFG_POP ( ulong, development.genesis.target_tick_duration_micros );
321 27 : CFG_POP ( ulong, development.genesis.ticks_per_slot );
322 27 : CFG_POP ( ulong, development.genesis.fund_initial_accounts );
323 27 : CFG_POP ( ulong, development.genesis.fund_initial_amount_lamports );
324 27 : CFG_POP ( ulong, development.genesis.vote_account_stake_lamports );
325 27 : CFG_POP ( bool, development.genesis.warmup_epochs );
326 :
327 27 : CFG_POP ( uint, development.bench.benchg_tile_count );
328 27 : CFG_POP ( uint, development.bench.benchs_tile_count );
329 27 : CFG_POP ( cstr, development.bench.affinity );
330 27 : CFG_POP ( bool, development.bench.larger_max_cost_per_block );
331 27 : CFG_POP ( bool, development.bench.larger_shred_limits_per_block );
332 27 : CFG_POP ( ulong, development.bench.disable_blockstore_from_slot );
333 27 : CFG_POP ( bool, development.bench.disable_status_cache );
334 :
335 27 : CFG_POP ( cstr, development.bundle.ssl_key_log_file );
336 27 : CFG_POP ( uint, development.bundle.buffer_size_kib );
337 27 : CFG_POP ( uint, development.bundle.ssl_heap_size_mib );
338 :
339 27 : CFG_POP ( bool, development.event.report_shreds );
340 27 : CFG_POP ( bool, development.event.report_transactions );
341 27 : CFG_POP ( bool, development.event.report_transaction_diffs );
342 :
343 27 : CFG_POP ( cstr, development.pktgen.affinity );
344 27 : CFG_POP ( cstr, development.pktgen.fake_dst_ip );
345 :
346 27 : CFG_POP ( cstr, development.udpecho.affinity );
347 :
348 27 : if( FD_UNLIKELY( !config->is_firedancer ) ) {
349 21 : CFG_POP ( bool, development.gui.websocket_compression );
350 21 : }
351 :
352 27 : CFG_POP ( ulong, development.accdb.partition_size_gib );
353 :
354 27 : CFG_POP ( bool, development.hugetlbfs.min_size );
355 :
356 27 : if( FD_UNLIKELY( config->is_firedancer ) ) {
357 6 : if( FD_UNLIKELY( !fd_config_extract_podf( pod, &config->firedancer ) ) ) return NULL;
358 6 : fd_config_check_configf( config, &config->firedancer );
359 21 : } else {
360 21 : if( FD_UNLIKELY( !fd_config_extract_podh( pod, &config->frankendancer ) ) ) return NULL;
361 21 : }
362 :
363 : /* Renamed config options */
364 :
365 27 : # define CFG_RENAMED( old_path, new_path ) \
366 351 : do { \
367 351 : char const * key = #old_path; \
368 351 : fd_pod_info_t info[1]; \
369 351 : if( FD_UNLIKELY( !fd_pod_query( pod, key, info ) ) ) { \
370 0 : FD_LOG_WARNING(( "Config option `%s` was renamed to `%s`. " \
371 0 : "Please update your config file.", \
372 0 : #old_path, #new_path )); \
373 0 : return NULL; \
374 0 : } \
375 351 : (void)config->new_path; /* assert new path exists */ \
376 351 : } while(0)
377 :
378 27 : CFG_RENAMED( tiles.net.interface, net.interface );
379 27 : CFG_RENAMED( tiles.net.bind_address, net.bind_address );
380 27 : CFG_RENAMED( tiles.net.provider, net.provider );
381 27 : CFG_RENAMED( tiles.net.xdp_mode, net.xdp.xdp_mode );
382 27 : CFG_RENAMED( tiles.net.xdp_zero_copy, net.xdp.xdp_zero_copy );
383 27 : CFG_RENAMED( tiles.net.xdp_rx_queue_size, net.xdp.xdp_rx_queue_size );
384 27 : CFG_RENAMED( tiles.net.xdp_tx_queue_size, net.xdp.xdp_tx_queue_size );
385 27 : CFG_RENAMED( tiles.net.flush_timeout_micros, net.xdp.flush_timeout_micros );
386 27 : CFG_RENAMED( tiles.net.send_buffer_size, net.ingress_buffer_size );
387 :
388 27 : CFG_RENAMED( development.net.provider, net.provider );
389 27 : CFG_RENAMED( development.net.sock_receive_buffer_size, net.socket.receive_buffer_size );
390 27 : CFG_RENAMED( development.net.sock_send_buffer_size, net.socket.send_buffer_size );
391 :
392 27 : CFG_RENAMED( tiles.repair.repair_intake_listen_port, tiles.repair.repair_client_listen_port );
393 :
394 27 : # undef CFG_RENAMED
395 :
396 27 : if( FD_UNLIKELY( !fdctl_pod_find_leftover( pod ) ) ) return NULL;
397 21 : return config;
398 27 : }
399 :
400 : #undef CFG_POP
401 : #undef CFG_ARRAY
|