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