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 3 : fd_configf_t * config_f ) {
8 3 : (void)config_f;
9 3 : 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 3 : 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 3 : }
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 :
27 15 : CFG_POP1 ( cstr, ledger.accounts_path, paths.accounts_path );
28 15 : CFG_POP1_ARRAY( cstr, consensus.authorized_voter_paths, paths.authorized_voter_paths );
29 :
30 15 : CFG_POP ( uint, ledger.limit_size );
31 15 : CFG_POP_ARRAY( cstr, ledger.account_indexes );
32 15 : CFG_POP_ARRAY( cstr, ledger.account_index_include_keys );
33 15 : CFG_POP_ARRAY( cstr, ledger.account_index_exclude_keys );
34 15 : CFG_POP ( cstr, ledger.accounts_index_path );
35 15 : CFG_POP ( cstr, ledger.accounts_hash_cache_path );
36 15 : CFG_POP ( bool, ledger.enable_accounts_disk_index );
37 15 : CFG_POP ( bool, ledger.require_tower );
38 15 : CFG_POP ( cstr, ledger.snapshot_archive_format );
39 :
40 15 : CFG_POP ( bool, gossip.port_check );
41 :
42 15 : CFG_POP ( bool, consensus.snapshot_fetch );
43 15 : CFG_POP ( bool, consensus.genesis_fetch );
44 15 : CFG_POP ( bool, consensus.poh_speed_test );
45 15 : CFG_POP ( uint, consensus.wait_for_supermajority_at_slot );
46 15 : CFG_POP ( cstr, consensus.expected_bank_hash );
47 15 : CFG_POP ( bool, consensus.wait_for_vote_to_start_leader );
48 15 : CFG_POP_ARRAY( uint, consensus.hard_fork_at_slots );
49 15 : CFG_POP_ARRAY( cstr, consensus.known_validators );
50 15 : CFG_POP ( bool, consensus.os_network_limits_test );
51 :
52 15 : CFG_POP ( bool, rpc.full_api );
53 15 : CFG_POP ( bool, rpc.private );
54 15 : CFG_POP ( cstr, rpc.bind_address );
55 15 : CFG_POP ( cstr, rpc.public_address );
56 15 : CFG_POP ( bool, rpc.transaction_history );
57 15 : CFG_POP ( bool, rpc.only_known );
58 15 : CFG_POP ( bool, rpc.pubsub_enable_block_subscription );
59 15 : CFG_POP ( bool, rpc.pubsub_enable_vote_subscription );
60 15 : CFG_POP ( bool, rpc.bigtable_ledger_storage );
61 :
62 15 : CFG_POP ( bool, snapshots.enabled );
63 15 : CFG_POP ( bool, snapshots.incremental_snapshots );
64 15 : CFG_POP ( uint, snapshots.full_snapshot_interval_slots );
65 15 : CFG_POP ( uint, snapshots.incremental_snapshot_interval_slots );
66 15 : CFG_POP ( uint, snapshots.minimum_snapshot_download_speed );
67 15 : CFG_POP ( uint, snapshots.maximum_snapshot_download_abort );
68 15 : CFG_POP ( uint, snapshots.maximum_full_snapshots_to_retain );
69 15 : CFG_POP ( uint, snapshots.maximum_incremental_snapshots_to_retain);
70 15 : CFG_POP ( cstr, snapshots.path );
71 15 : CFG_POP ( cstr, snapshots.incremental_path );
72 :
73 15 : return config;
74 15 : }
75 :
76 : fd_configf_t *
77 : fd_config_extract_podf( uchar * pod,
78 3 : fd_configf_t * config ) {
79 3 : CFG_POP ( cstr, gossip.host );
80 :
81 3 : CFG_POP ( uint, layout.exec_tile_count );
82 3 : CFG_POP ( uint, layout.writer_tile_count );
83 3 : CFG_POP ( uint, layout.sign_tile_count );
84 3 : CFG_POP ( uint, layout.gossvf_tile_count );
85 :
86 3 : CFG_POP ( ulong, blockstore.shred_max );
87 3 : CFG_POP ( ulong, blockstore.block_max );
88 3 : CFG_POP ( ulong, blockstore.idx_max );
89 3 : CFG_POP ( ulong, blockstore.alloc_max );
90 3 : CFG_POP ( cstr, blockstore.file );
91 3 : CFG_POP ( cstr, blockstore.checkpt );
92 3 : CFG_POP ( cstr, blockstore.restore ); /* TODO delete blockstore fields */
93 :
94 3 : CFG_POP ( ulong, funk.max_account_records );
95 3 : CFG_POP ( ulong, funk.heap_size_gib );
96 3 : CFG_POP ( ulong, funk.max_database_transactions );
97 3 : CFG_POP ( bool, funk.lock_pages );
98 :
99 3 : CFG_POP ( ulong, runtime.max_rooted_slots );
100 3 : CFG_POP ( ulong, runtime.max_live_slots );
101 3 : CFG_POP ( ulong, runtime.max_transactions_per_slot );
102 3 : CFG_POP ( ulong, runtime.snapshot_grace_period_seconds );
103 3 : CFG_POP ( ulong, runtime.max_vote_accounts );
104 3 : CFG_POP ( ulong, runtime.max_total_banks );
105 3 : CFG_POP ( ulong, runtime.max_fork_width );
106 :
107 3 : CFG_POP ( ulong, store.max_completed_shred_sets );
108 :
109 3 : CFG_POP ( bool, snapshots.incremental_snapshots );
110 3 : CFG_POP ( uint, snapshots.maximum_local_snapshot_age );
111 3 : CFG_POP ( bool, snapshots.genesis_download );
112 3 : CFG_POP ( bool, snapshots.download );
113 3 : CFG_POP_ARRAY( cstr, snapshots.known_validators );
114 3 : CFG_POP ( uint, snapshots.minimum_download_speed_mib );
115 3 : CFG_POP ( uint, snapshots.maximum_download_retry_abort );
116 3 : CFG_POP ( uint, snapshots.max_full_snapshots_to_keep );
117 3 : CFG_POP ( uint, snapshots.max_incremental_snapshots_to_keep );
118 3 : CFG_POP_TABLE( bool, snapshots.sources.http, snapshots.sources.http.peers, enabled, 0 );
119 3 : CFG_POP_TABLE( cstr, snapshots.sources.http, snapshots.sources.http.peers, url, 1 );
120 3 : CFG_POP_TABLE_FINI( snapshots.sources.http );
121 :
122 3 : return config;
123 3 : }
124 :
125 : fd_config_t *
126 : fd_config_extract_pod( uchar * pod,
127 18 : fd_config_t * config ) {
128 18 : CFG_POP ( cstr, name );
129 18 : CFG_POP ( cstr, user );
130 :
131 18 : CFG_POP ( cstr, log.path );
132 18 : CFG_POP ( cstr, log.colorize );
133 18 : CFG_POP ( cstr, log.level_logfile );
134 18 : CFG_POP ( cstr, log.level_stderr );
135 18 : CFG_POP ( cstr, log.level_flush );
136 :
137 18 : if( FD_UNLIKELY( config->is_firedancer ) ) {
138 3 : CFG_POP ( cstr, paths.base );
139 3 : CFG_POP ( cstr, paths.ledger );
140 3 : CFG_POP ( cstr, paths.identity_key );
141 3 : CFG_POP ( cstr, paths.vote_account );
142 3 : CFG_POP ( cstr, paths.snapshots );
143 3 : CFG_POP ( cstr, paths.genesis );
144 15 : } else {
145 15 : CFG_POP1 ( cstr, scratch_directory, paths.base );
146 15 : CFG_POP1 ( cstr, ledger.path, paths.ledger );
147 15 : CFG_POP1 ( cstr, consensus.identity_path, paths.identity_key );
148 15 : CFG_POP1 ( cstr, consensus.vote_account_path, paths.vote_account );
149 15 : }
150 :
151 18 : CFG_POP_ARRAY( cstr, gossip.entrypoints );
152 18 : CFG_POP ( ushort, gossip.port );
153 :
154 18 : CFG_POP ( ushort, consensus.expected_shred_version );
155 18 : CFG_POP ( cstr, consensus.expected_genesis_hash );
156 :
157 18 : CFG_POP ( ushort, rpc.port );
158 18 : CFG_POP ( bool, rpc.extended_tx_metadata_storage );
159 18 : if( FD_UNLIKELY( config->is_firedancer ) ) {
160 3 : CFG_POP ( uint, rpc.block_index_max );
161 3 : CFG_POP ( uint, rpc.txn_index_max );
162 3 : CFG_POP ( uint, rpc.acct_index_max );
163 3 : CFG_POP ( cstr, rpc.history_file );
164 3 : }
165 :
166 18 : CFG_POP ( cstr, layout.affinity );
167 18 : CFG_POP ( uint, layout.net_tile_count );
168 18 : CFG_POP ( uint, layout.quic_tile_count );
169 18 : CFG_POP ( uint, layout.resolv_tile_count );
170 18 : CFG_POP ( uint, layout.verify_tile_count );
171 18 : CFG_POP ( uint, layout.bank_tile_count );
172 18 : CFG_POP ( uint, layout.shred_tile_count );
173 :
174 18 : CFG_POP ( cstr, hugetlbfs.mount_path );
175 18 : CFG_POP ( cstr, hugetlbfs.max_page_size );
176 18 : CFG_POP ( ulong, hugetlbfs.gigantic_page_threshold_mib );
177 18 : CFG_POP ( bool, hugetlbfs.allow_hugepage_increase );
178 :
179 18 : CFG_POP ( cstr, net.interface );
180 18 : CFG_POP ( cstr, net.bind_address );
181 18 : CFG_POP ( cstr, net.provider );
182 18 : CFG_POP ( uint, net.ingress_buffer_size );
183 18 : CFG_POP ( cstr, net.xdp.xdp_mode );
184 18 : CFG_POP ( bool, net.xdp.xdp_zero_copy );
185 18 : CFG_POP ( uint, net.xdp.xdp_rx_queue_size );
186 18 : CFG_POP ( uint, net.xdp.xdp_tx_queue_size );
187 18 : CFG_POP ( uint, net.xdp.flush_timeout_micros );
188 18 : CFG_POP ( cstr, net.xdp.rss_queue_mode );
189 18 : CFG_POP ( uint, net.socket.receive_buffer_size );
190 18 : CFG_POP ( uint, net.socket.send_buffer_size );
191 :
192 18 : CFG_POP ( ulong, tiles.netlink.max_routes );
193 18 : CFG_POP ( ulong, tiles.netlink.max_peer_routes );
194 18 : CFG_POP ( ulong, tiles.netlink.max_neighbors );
195 :
196 18 : CFG_POP ( ulong, tiles.gossip.max_entries );
197 :
198 18 : CFG_POP ( ushort, tiles.quic.regular_transaction_listen_port );
199 18 : CFG_POP ( ushort, tiles.quic.quic_transaction_listen_port );
200 18 : CFG_POP ( uint, tiles.quic.txn_reassembly_count );
201 18 : CFG_POP ( uint, tiles.quic.max_concurrent_connections );
202 18 : CFG_POP ( uint, tiles.quic.max_concurrent_handshakes );
203 18 : CFG_POP ( uint, tiles.quic.idle_timeout_millis );
204 18 : CFG_POP ( uint, tiles.quic.ack_delay_millis );
205 18 : CFG_POP ( bool, tiles.quic.retry );
206 18 : CFG_POP ( cstr, tiles.quic.ssl_key_log_file );
207 :
208 18 : CFG_POP ( uint, tiles.verify.signature_cache_size );
209 18 : CFG_POP ( uint, tiles.verify.receive_buffer_size );
210 18 : CFG_POP ( uint, tiles.verify.mtu );
211 :
212 18 : CFG_POP ( uint, tiles.dedup.signature_cache_size );
213 :
214 18 : CFG_POP ( bool, tiles.bundle.enabled );
215 18 : CFG_POP ( cstr, tiles.bundle.url );
216 18 : CFG_POP ( cstr, tiles.bundle.tls_domain_name );
217 18 : CFG_POP ( cstr, tiles.bundle.tip_distribution_program_addr );
218 18 : CFG_POP ( cstr, tiles.bundle.tip_payment_program_addr );
219 18 : CFG_POP ( cstr, tiles.bundle.tip_distribution_authority );
220 18 : CFG_POP ( uint, tiles.bundle.commission_bps );
221 18 : CFG_POP ( ulong, tiles.bundle.keepalive_interval_millis );
222 18 : CFG_POP ( bool, tiles.bundle.tls_cert_verify );
223 :
224 18 : CFG_POP ( uint, tiles.pack.max_pending_transactions );
225 18 : CFG_POP ( bool, tiles.pack.use_consumed_cus );
226 18 : CFG_POP ( cstr, tiles.pack.schedule_strategy );
227 :
228 18 : CFG_POP ( bool, tiles.poh.lagged_consecutive_leader_start );
229 :
230 18 : CFG_POP ( uint, tiles.shred.max_pending_shred_sets );
231 18 : CFG_POP ( ushort, tiles.shred.shred_listen_port );
232 18 : CFG_POP_ARRAY( cstr, tiles.shred.additional_shred_destinations_retransmit );
233 18 : CFG_POP_ARRAY( cstr, tiles.shred.additional_shred_destinations_leader );
234 :
235 18 : CFG_POP ( cstr, tiles.metric.prometheus_listen_address );
236 18 : CFG_POP ( ushort, tiles.metric.prometheus_listen_port );
237 :
238 18 : CFG_POP ( bool, tiles.gui.enabled );
239 18 : CFG_POP ( cstr, tiles.gui.gui_listen_address );
240 18 : CFG_POP ( ushort, tiles.gui.gui_listen_port );
241 18 : CFG_POP ( ulong, tiles.gui.max_http_connections );
242 18 : CFG_POP ( ulong, tiles.gui.max_websocket_connections );
243 18 : CFG_POP ( ulong, tiles.gui.max_http_request_length );
244 18 : CFG_POP ( ulong, tiles.gui.send_buffer_size_mb );
245 :
246 18 : CFG_POP ( ushort, tiles.repair.repair_intake_listen_port );
247 18 : CFG_POP ( ushort, tiles.repair.repair_serve_listen_port );
248 18 : CFG_POP ( ulong, tiles.repair.slot_max );
249 :
250 18 : CFG_POP ( ulong, capture.capture_start_slot );
251 18 : CFG_POP ( cstr, capture.solcap_capture );
252 18 : CFG_POP ( cstr, capture.dump_proto_dir );
253 18 : CFG_POP ( bool, capture.dump_elf_to_pb );
254 18 : CFG_POP ( bool, capture.dump_syscall_to_pb );
255 18 : CFG_POP ( bool, capture.dump_instr_to_pb );
256 18 : CFG_POP ( bool, capture.dump_txn_to_pb );
257 18 : CFG_POP ( bool, capture.dump_block_to_pb );
258 :
259 18 : CFG_POP ( cstr, tiles.replay.funk_checkpt );
260 18 : CFG_POP ( cstr, tiles.replay.status_cache );
261 18 : CFG_POP ( cstr, tiles.replay.cluster_version );
262 18 : CFG_POP ( cstr, tiles.replay.tower_checkpt );
263 18 : CFG_POP_ARRAY( cstr, tiles.replay.enable_features );
264 18 : CFG_POP ( ulong, tiles.replay.heap_size_gib );
265 :
266 18 : CFG_POP ( cstr, tiles.store_int.slots_pending );
267 18 : CFG_POP ( cstr, tiles.store_int.shred_cap_archive );
268 18 : CFG_POP ( cstr, tiles.store_int.shred_cap_replay );
269 18 : CFG_POP ( ulong, tiles.store_int.shred_cap_end_slot );
270 :
271 18 : CFG_POP ( ushort, tiles.send.send_src_port );
272 :
273 18 : CFG_POP ( bool, tiles.archiver.enabled );
274 18 : CFG_POP ( ulong, tiles.archiver.end_slot );
275 18 : CFG_POP ( cstr, tiles.archiver.rocksdb_path );
276 18 : CFG_POP ( cstr, tiles.archiver.shredcap_path );
277 18 : CFG_POP ( cstr, tiles.archiver.bank_hash_path );
278 18 : CFG_POP ( cstr, tiles.archiver.ingest_mode );
279 :
280 18 : if( FD_UNLIKELY( config->is_firedancer ) ) {
281 3 : CFG_POP ( bool, tiles.shredcap.enabled );
282 3 : CFG_POP ( cstr, tiles.shredcap.folder_path );
283 3 : CFG_POP ( ulong, tiles.shredcap.write_buffer_size );
284 3 : }
285 :
286 18 : CFG_POP ( bool, development.sandbox );
287 18 : CFG_POP ( bool, development.no_clone );
288 18 : CFG_POP ( bool, development.core_dump );
289 18 : CFG_POP ( bool, development.no_agave );
290 18 : CFG_POP ( bool, development.bootstrap );
291 :
292 18 : CFG_POP ( bool, development.netns.enabled );
293 18 : CFG_POP ( cstr, development.netns.interface0 );
294 18 : CFG_POP ( cstr, development.netns.interface0_mac );
295 18 : CFG_POP ( cstr, development.netns.interface0_addr );
296 18 : CFG_POP ( cstr, development.netns.interface1 );
297 18 : CFG_POP ( cstr, development.netns.interface1_mac );
298 18 : CFG_POP ( cstr, development.netns.interface1_addr );
299 :
300 18 : CFG_POP ( bool, development.gossip.allow_private_address );
301 :
302 18 : CFG_POP ( ulong, development.genesis.hashes_per_tick );
303 18 : CFG_POP ( ulong, development.genesis.target_tick_duration_micros );
304 18 : CFG_POP ( ulong, development.genesis.ticks_per_slot );
305 18 : CFG_POP ( ulong, development.genesis.fund_initial_accounts );
306 18 : CFG_POP ( ulong, development.genesis.fund_initial_amount_lamports );
307 18 : CFG_POP ( ulong, development.genesis.vote_account_stake_lamports );
308 18 : CFG_POP ( bool, development.genesis.warmup_epochs );
309 :
310 18 : CFG_POP ( uint, development.bench.benchg_tile_count );
311 18 : CFG_POP ( uint, development.bench.benchs_tile_count );
312 18 : CFG_POP ( cstr, development.bench.affinity );
313 18 : CFG_POP ( bool, development.bench.larger_max_cost_per_block );
314 18 : CFG_POP ( bool, development.bench.larger_shred_limits_per_block );
315 18 : CFG_POP ( ulong, development.bench.disable_blockstore_from_slot );
316 18 : CFG_POP ( bool, development.bench.disable_status_cache );
317 :
318 18 : CFG_POP ( cstr, development.bundle.ssl_key_log_file );
319 18 : CFG_POP ( uint, development.bundle.buffer_size_kib );
320 18 : CFG_POP ( uint, development.bundle.ssl_heap_size_mib );
321 :
322 18 : CFG_POP ( cstr, development.pktgen.affinity );
323 18 : CFG_POP ( cstr, development.pktgen.fake_dst_ip );
324 :
325 18 : CFG_POP ( cstr, development.udpecho.affinity );
326 :
327 18 : CFG_POP ( bool, development.gui.websocket_compression );
328 :
329 18 : if( FD_UNLIKELY( config->is_firedancer ) ) {
330 3 : if( FD_UNLIKELY( !fd_config_extract_podf( pod, &config->firedancer ) ) ) return NULL;
331 3 : fd_config_check_configf( config, &config->firedancer );
332 15 : } else {
333 15 : if( FD_UNLIKELY( !fd_config_extract_podh( pod, &config->frankendancer ) ) ) return NULL;
334 15 : }
335 :
336 : /* Renamed config options */
337 :
338 18 : # define CFG_RENAMED( old_path, new_path ) \
339 216 : do { \
340 216 : char const * key = #old_path; \
341 216 : fd_pod_info_t info[1]; \
342 216 : if( FD_UNLIKELY( !fd_pod_query( pod, key, info ) ) ) { \
343 0 : FD_LOG_WARNING(( "Config option `%s` was renamed to `%s`. " \
344 0 : "Please update your config file.", \
345 0 : #old_path, #new_path )); \
346 0 : return NULL; \
347 0 : } \
348 216 : (void)config->new_path; /* assert new path exists */ \
349 216 : } while(0)
350 :
351 18 : CFG_RENAMED( tiles.net.interface, net.interface );
352 18 : CFG_RENAMED( tiles.net.bind_address, net.bind_address );
353 18 : CFG_RENAMED( tiles.net.provider, net.provider );
354 18 : CFG_RENAMED( tiles.net.xdp_mode, net.xdp.xdp_mode );
355 18 : CFG_RENAMED( tiles.net.xdp_zero_copy, net.xdp.xdp_zero_copy );
356 18 : CFG_RENAMED( tiles.net.xdp_rx_queue_size, net.xdp.xdp_rx_queue_size );
357 18 : CFG_RENAMED( tiles.net.xdp_tx_queue_size, net.xdp.xdp_tx_queue_size );
358 18 : CFG_RENAMED( tiles.net.flush_timeout_micros, net.xdp.flush_timeout_micros );
359 18 : CFG_RENAMED( tiles.net.send_buffer_size, net.ingress_buffer_size );
360 :
361 18 : CFG_RENAMED( development.net.provider, net.provider );
362 18 : CFG_RENAMED( development.net.sock_receive_buffer_size, net.socket.receive_buffer_size );
363 18 : CFG_RENAMED( development.net.sock_send_buffer_size, net.socket.send_buffer_size );
364 :
365 18 : # undef CFG_RENAMED
366 :
367 18 : if( FD_UNLIKELY( !fdctl_pod_find_leftover( pod ) ) ) return NULL;
368 15 : return config;
369 18 : }
370 :
371 : #undef CFG_POP
372 : #undef CFG_ARRAY
|