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