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