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