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