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 12 : fd_configh_t * config ) {
20 12 : CFG_POP ( cstr, dynamic_port_range );
21 :
22 12 : CFG_POP ( cstr, reporting.solana_metrics_config );
23 :
24 12 : CFG_POP ( cstr, layout.agave_affinity );
25 12 : CFG_POP ( uint, layout.agave_unified_scheduler_handler_threads );
26 12 : CFG_POP ( uint, layout.resolh_tile_count );
27 12 : CFG_POP ( uint, layout.bank_tile_count );
28 :
29 12 : CFG_POP1 ( cstr, ledger.accounts_path, paths.accounts_path );
30 12 : CFG_POP1_ARRAY( cstr, consensus.authorized_voter_paths, paths.authorized_voter_paths );
31 :
32 12 : CFG_POP ( uint, ledger.limit_size );
33 12 : CFG_POP_ARRAY( cstr, ledger.account_indexes );
34 12 : CFG_POP_ARRAY( cstr, ledger.account_index_include_keys );
35 12 : CFG_POP_ARRAY( cstr, ledger.account_index_exclude_keys );
36 12 : CFG_POP ( bool, ledger.enable_accounts_disk_index );
37 12 : CFG_POP ( cstr, ledger.accounts_index_path );
38 12 : CFG_POP ( cstr, ledger.accounts_hash_cache_path );
39 12 : CFG_POP ( bool, ledger.require_tower );
40 12 : CFG_POP ( cstr, ledger.snapshot_archive_format );
41 :
42 12 : CFG_POP ( bool, gossip.port_check );
43 :
44 12 : CFG_POP ( bool, consensus.snapshot_fetch );
45 12 : CFG_POP ( bool, consensus.genesis_fetch );
46 12 : CFG_POP ( bool, consensus.poh_speed_test );
47 12 : CFG_POP ( uint, consensus.wait_for_supermajority_at_slot );
48 12 : CFG_POP ( cstr, consensus.expected_bank_hash );
49 12 : CFG_POP ( bool, consensus.wait_for_vote_to_start_leader );
50 12 : CFG_POP_ARRAY( uint, consensus.hard_fork_at_slots );
51 12 : CFG_POP_ARRAY( cstr, consensus.known_validators );
52 12 : CFG_POP ( bool, consensus.os_network_limits_test );
53 :
54 12 : CFG_POP ( ushort, rpc.port );
55 12 : CFG_POP ( bool, rpc.extended_tx_metadata_storage );
56 12 : CFG_POP ( bool, rpc.full_api );
57 12 : CFG_POP ( bool, rpc.private );
58 12 : CFG_POP ( cstr, rpc.bind_address );
59 12 : CFG_POP ( cstr, rpc.public_address );
60 12 : CFG_POP ( bool, rpc.transaction_history );
61 12 : CFG_POP ( bool, rpc.only_known );
62 12 : CFG_POP ( bool, rpc.pubsub_enable_block_subscription );
63 12 : CFG_POP ( bool, rpc.pubsub_enable_vote_subscription );
64 12 : CFG_POP ( bool, rpc.bigtable_ledger_storage );
65 :
66 12 : CFG_POP ( bool, snapshots.enabled );
67 12 : CFG_POP ( bool, snapshots.incremental_snapshots );
68 12 : CFG_POP ( uint, snapshots.full_snapshot_interval_slots );
69 12 : CFG_POP ( uint, snapshots.incremental_snapshot_interval_slots );
70 12 : CFG_POP ( uint, snapshots.minimum_snapshot_download_speed );
71 12 : CFG_POP ( uint, snapshots.maximum_snapshot_download_abort );
72 12 : CFG_POP ( uint, snapshots.maximum_full_snapshots_to_retain );
73 12 : CFG_POP ( uint, snapshots.maximum_incremental_snapshots_to_retain);
74 12 : CFG_POP ( cstr, snapshots.path );
75 12 : CFG_POP ( cstr, snapshots.incremental_path );
76 :
77 12 : return config;
78 12 : }
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 12 : fd_config_t * config ) {
139 12 : CFG_POP ( cstr, name );
140 12 : CFG_POP ( cstr, user );
141 :
142 12 : CFG_POP ( bool, telemetry );
143 :
144 12 : CFG_POP ( cstr, log.path );
145 12 : CFG_POP ( cstr, log.colorize );
146 12 : CFG_POP ( cstr, log.level_logfile );
147 12 : CFG_POP ( cstr, log.level_stderr );
148 12 : CFG_POP ( cstr, log.level_flush );
149 :
150 12 : 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 12 : } else {
159 12 : CFG_POP1 ( cstr, scratch_directory, paths.base );
160 12 : CFG_POP1 ( cstr, ledger.path, frankendancer.paths.ledger );
161 12 : CFG_POP1 ( cstr, consensus.identity_path, paths.identity_key );
162 12 : CFG_POP1 ( cstr, consensus.vote_account_path, paths.vote_account );
163 12 : }
164 :
165 12 : CFG_POP_ARRAY( cstr, gossip.entrypoints );
166 12 : CFG_POP ( ushort, gossip.port );
167 :
168 12 : CFG_POP ( ushort, consensus.expected_shred_version );
169 12 : CFG_POP ( cstr, consensus.expected_genesis_hash );
170 12 : CFG_POP ( bool, consensus.wait_for_vote_to_start_leader );
171 :
172 12 : CFG_POP ( cstr, layout.affinity );
173 12 : CFG_POP ( cstr, layout.blocklist_cores );
174 12 : CFG_POP ( uint, layout.net_tile_count );
175 12 : CFG_POP ( uint, layout.quic_tile_count );
176 12 : CFG_POP ( uint, layout.verify_tile_count );
177 12 : CFG_POP ( uint, layout.shred_tile_count );
178 :
179 12 : CFG_POP ( cstr, hugetlbfs.mount_path );
180 12 : CFG_POP ( cstr, hugetlbfs.max_page_size );
181 12 : CFG_POP ( ulong, hugetlbfs.gigantic_page_threshold_mib );
182 :
183 12 : CFG_POP ( cstr, net.interface );
184 12 : CFG_POP ( cstr, net.bind_address );
185 12 : CFG_POP ( cstr, net.provider );
186 12 : CFG_POP ( uint, net.ingress_buffer_size );
187 12 : CFG_POP ( cstr, net.xdp.xdp_mode );
188 12 : CFG_POP ( bool, net.xdp.xdp_zero_copy );
189 12 : CFG_POP ( uint, net.xdp.xdp_rx_queue_size );
190 12 : CFG_POP ( uint, net.xdp.xdp_tx_queue_size );
191 12 : CFG_POP ( uint, net.xdp.flush_timeout_micros );
192 12 : CFG_POP ( cstr, net.xdp.rss_queue_mode );
193 12 : CFG_POP ( bool, net.xdp.listen_gre );
194 12 : CFG_POP ( bool, net.xdp.native_bond );
195 12 : CFG_POP ( uint, net.socket.receive_buffer_size );
196 12 : CFG_POP ( uint, net.socket.send_buffer_size );
197 :
198 12 : CFG_POP ( ulong, tiles.netlink.max_routes );
199 12 : CFG_POP ( ulong, tiles.netlink.max_peer_routes );
200 12 : CFG_POP ( ulong, tiles.netlink.max_neighbors );
201 :
202 12 : CFG_POP ( ulong, tiles.gossip.max_entries );
203 :
204 12 : CFG_POP ( ushort, tiles.quic.regular_transaction_listen_port );
205 12 : CFG_POP ( ushort, tiles.quic.quic_transaction_listen_port );
206 12 : CFG_POP ( uint, tiles.quic.txn_reassembly_count );
207 12 : CFG_POP ( uint, tiles.quic.max_concurrent_connections );
208 12 : CFG_POP ( uint, tiles.quic.max_concurrent_handshakes );
209 12 : CFG_POP ( uint, tiles.quic.idle_timeout_millis );
210 12 : CFG_POP ( uint, tiles.quic.ack_delay_millis );
211 12 : CFG_POP ( bool, tiles.quic.retry );
212 12 : CFG_POP ( cstr, tiles.quic.ssl_key_log_file );
213 :
214 12 : CFG_POP ( uint, tiles.verify.signature_cache_size );
215 12 : CFG_POP ( uint, tiles.verify.receive_buffer_size );
216 12 : CFG_POP ( uint, tiles.verify.mtu );
217 :
218 12 : CFG_POP ( uint, tiles.dedup.signature_cache_size );
219 :
220 12 : CFG_POP ( bool, tiles.bundle.enabled );
221 12 : CFG_POP ( cstr, tiles.bundle.url );
222 12 : CFG_POP ( cstr, tiles.bundle.tls_domain_name );
223 12 : CFG_POP ( cstr, tiles.bundle.tip_distribution_program_addr );
224 12 : CFG_POP ( cstr, tiles.bundle.tip_payment_program_addr );
225 12 : CFG_POP ( cstr, tiles.bundle.tip_distribution_authority );
226 12 : CFG_POP ( uint, tiles.bundle.commission_bps );
227 12 : CFG_POP ( ulong, tiles.bundle.keepalive_interval_millis );
228 12 : CFG_POP ( bool, tiles.bundle.tls_cert_verify );
229 :
230 12 : CFG_POP ( uint, tiles.pack.max_pending_transactions );
231 12 : CFG_POP ( bool, tiles.pack.use_consumed_cus );
232 12 : CFG_POP ( cstr, tiles.pack.schedule_strategy );
233 12 : CFG_POP_ARRAY( cstr, tiles.pack.account_blocklist );
234 :
235 12 : CFG_POP ( ulong, tiles.replay.max_transaction_lookahead_buffer_size );
236 12 : CFG_POP_ARRAY( cstr, tiles.replay.enable_features );
237 :
238 12 : CFG_POP ( bool, tiles.pohh.lagged_consecutive_leader_start );
239 :
240 12 : CFG_POP ( uint, tiles.shred.max_pending_shred_sets );
241 12 : CFG_POP ( ushort, tiles.shred.shred_listen_port );
242 12 : CFG_POP_ARRAY( cstr, tiles.shred.additional_shred_destinations_retransmit );
243 12 : CFG_POP_ARRAY( cstr, tiles.shred.additional_shred_destinations_leader );
244 :
245 12 : CFG_POP ( cstr, tiles.metric.prometheus_listen_address );
246 12 : CFG_POP ( ushort, tiles.metric.prometheus_listen_port );
247 :
248 12 : CFG_POP ( cstr, tiles.event.url );
249 :
250 12 : CFG_POP ( bool, tiles.gui.enabled );
251 12 : CFG_POP ( cstr, tiles.gui.gui_listen_address );
252 12 : CFG_POP ( ushort, tiles.gui.gui_listen_port );
253 12 : CFG_POP ( ulong, tiles.gui.max_http_connections );
254 12 : CFG_POP ( ulong, tiles.gui.max_websocket_connections );
255 12 : CFG_POP ( ulong, tiles.gui.max_http_request_length );
256 12 : CFG_POP ( ulong, tiles.gui.send_buffer_size_mb );
257 :
258 12 : CFG_POP ( bool, tiles.rpc.enabled );
259 12 : CFG_POP ( cstr, tiles.rpc.rpc_listen_address );
260 12 : CFG_POP ( ushort, tiles.rpc.rpc_listen_port );
261 12 : CFG_POP ( ulong, tiles.rpc.max_http_connections );
262 12 : CFG_POP ( ulong, tiles.rpc.max_websocket_connections );
263 12 : CFG_POP ( ulong, tiles.rpc.max_http_request_length );
264 12 : CFG_POP ( ulong, tiles.rpc.send_buffer_size_mb );
265 12 : CFG_POP ( bool, tiles.rpc.delay_startup );
266 :
267 12 : CFG_POP ( ushort, tiles.repair.repair_client_listen_port );
268 12 : CFG_POP ( ulong, tiles.repair.slot_max );
269 :
270 12 : CFG_POP ( bool, tiles.rserve.enabled );
271 12 : CFG_POP ( ushort, tiles.rserve.repair_serve_listen_port );
272 12 : CFG_POP ( ulong, tiles.rserve.shred_storage_limit_gib );
273 :
274 12 : CFG_POP ( ulong, capture.capture_start_slot );
275 12 : CFG_POP ( cstr, capture.solcap_capture );
276 12 : CFG_POP ( bool, capture.recent_only );
277 12 : CFG_POP ( ulong, capture.recent_slots_per_file );
278 12 : CFG_POP ( cstr, capture.dump_proto_dir );
279 12 : CFG_POP ( cstr, capture.dump_syscall_name_filter );
280 12 : CFG_POP ( cstr, capture.dump_instr_program_id_filter );
281 12 : CFG_POP ( bool, capture.dump_syscall_to_pb );
282 12 : CFG_POP ( bool, capture.dump_instr_to_pb );
283 12 : CFG_POP ( bool, capture.dump_txn_to_pb );
284 12 : CFG_POP ( bool, capture.dump_txn_as_fixture );
285 12 : CFG_POP ( bool, capture.dump_block_to_pb );
286 :
287 12 : CFG_POP ( ushort, tiles.txsend.txsend_src_port );
288 :
289 12 : CFG_POP ( bool, development.sandbox );
290 12 : CFG_POP ( bool, development.no_clone );
291 12 : CFG_POP ( cstr, development.core_dump );
292 12 : CFG_POP ( bool, development.no_agave );
293 12 : CFG_POP ( bool, development.bootstrap );
294 :
295 12 : CFG_POP ( bool, development.gossip.allow_private_address );
296 :
297 12 : CFG_POP ( ulong, development.genesis.hashes_per_tick );
298 12 : CFG_POP ( ulong, development.genesis.target_tick_duration_micros );
299 12 : CFG_POP ( ulong, development.genesis.ticks_per_slot );
300 12 : CFG_POP ( ulong, development.genesis.fund_initial_accounts );
301 12 : CFG_POP ( ulong, development.genesis.fund_initial_amount_lamports );
302 12 : CFG_POP ( ulong, development.genesis.vote_account_stake_lamports );
303 12 : CFG_POP ( bool, development.genesis.warmup_epochs );
304 :
305 12 : CFG_POP ( uint, development.bench.benchg_tile_count );
306 12 : CFG_POP ( uint, development.bench.benchs_tile_count );
307 12 : CFG_POP ( cstr, development.bench.affinity );
308 12 : CFG_POP ( bool, development.bench.larger_max_cost_per_block );
309 12 : CFG_POP ( bool, development.bench.larger_shred_limits_per_block );
310 12 : CFG_POP ( ulong, development.bench.disable_blockstore_from_slot );
311 12 : CFG_POP ( bool, development.bench.disable_status_cache );
312 :
313 12 : CFG_POP ( cstr, development.bundle.ssl_key_log_file );
314 12 : CFG_POP ( uint, development.bundle.buffer_size_kib );
315 12 : CFG_POP ( uint, development.bundle.ssl_heap_size_mib );
316 :
317 12 : CFG_POP ( bool, development.event.report_shreds );
318 12 : CFG_POP ( bool, development.event.report_transactions );
319 :
320 12 : CFG_POP ( cstr, development.pktgen.affinity );
321 12 : CFG_POP ( cstr, development.pktgen.fake_dst_ip );
322 :
323 12 : CFG_POP ( cstr, development.udpecho.affinity );
324 :
325 12 : if( FD_UNLIKELY( !config->is_firedancer ) ) {
326 12 : CFG_POP ( bool, development.gui.websocket_compression );
327 12 : }
328 :
329 12 : CFG_POP ( ulong, development.accdb.partition_size_gib );
330 :
331 12 : CFG_POP ( bool, development.hugetlbfs.min_size );
332 :
333 12 : if( FD_UNLIKELY( config->is_firedancer ) ) {
334 0 : if( FD_UNLIKELY( !fd_config_extract_podf( pod, &config->firedancer ) ) ) return NULL;
335 0 : fd_config_check_configf( config, &config->firedancer );
336 12 : } else {
337 12 : if( FD_UNLIKELY( !fd_config_extract_podh( pod, &config->frankendancer ) ) ) return NULL;
338 12 : }
339 :
340 : /* Renamed config options */
341 :
342 12 : # define CFG_RENAMED( old_path, new_path ) \
343 156 : do { \
344 156 : char const * key = #old_path; \
345 156 : fd_pod_info_t info[1]; \
346 156 : if( FD_UNLIKELY( !fd_pod_query( pod, key, info ) ) ) { \
347 0 : FD_LOG_WARNING(( "Config option `%s` was renamed to `%s`. " \
348 0 : "Please update your config file.", \
349 0 : #old_path, #new_path )); \
350 0 : return NULL; \
351 0 : } \
352 156 : (void)config->new_path; /* assert new path exists */ \
353 156 : } while(0)
354 :
355 12 : CFG_RENAMED( tiles.net.interface, net.interface );
356 12 : CFG_RENAMED( tiles.net.bind_address, net.bind_address );
357 12 : CFG_RENAMED( tiles.net.provider, net.provider );
358 12 : CFG_RENAMED( tiles.net.xdp_mode, net.xdp.xdp_mode );
359 12 : CFG_RENAMED( tiles.net.xdp_zero_copy, net.xdp.xdp_zero_copy );
360 12 : CFG_RENAMED( tiles.net.xdp_rx_queue_size, net.xdp.xdp_rx_queue_size );
361 12 : CFG_RENAMED( tiles.net.xdp_tx_queue_size, net.xdp.xdp_tx_queue_size );
362 12 : CFG_RENAMED( tiles.net.flush_timeout_micros, net.xdp.flush_timeout_micros );
363 12 : CFG_RENAMED( tiles.net.send_buffer_size, net.ingress_buffer_size );
364 :
365 12 : CFG_RENAMED( development.net.provider, net.provider );
366 12 : CFG_RENAMED( development.net.sock_receive_buffer_size, net.socket.receive_buffer_size );
367 12 : CFG_RENAMED( development.net.sock_send_buffer_size, net.socket.send_buffer_size );
368 :
369 12 : CFG_RENAMED( tiles.repair.repair_intake_listen_port, tiles.repair.repair_client_listen_port );
370 :
371 12 : # undef CFG_RENAMED
372 :
373 12 : if( FD_UNLIKELY( !fdctl_pod_find_leftover( pod ) ) ) return NULL;
374 9 : return config;
375 12 : }
376 :
377 : #undef CFG_POP
378 : #undef CFG_ARRAY
|