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