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 390 : fd_configf_t * config_f ) {
8 390 : (void)config_f;
9 390 : 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 390 : 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 390 : if( FD_UNLIKELY( config->paths.vote_history[ 0 ]!='\0' && config->paths.vote_history[ 0 ]!='/' ) ) {
16 3 : FD_LOG_ERR(( "[config->paths.vote_history] must be an absolute path and hence start with a '/'"));
17 3 : }
18 390 : }
19 :
20 : fd_configf_t *
21 : fd_config_extract_podf( uchar * pod,
22 390 : fd_configf_t * config ) {
23 390 : CFG_POP_ARRAY( cstr, paths.authorized_voter_paths );
24 :
25 390 : CFG_POP ( cstr, gossip.host );
26 :
27 390 : CFG_POP ( bool, layout.enable_block_production );
28 390 : CFG_POP ( bool, layout.enable_snapshot_production );
29 390 : CFG_POP ( uint, layout.execrp_tile_count );
30 390 : CFG_POP ( uint, layout.sign_tile_count );
31 390 : CFG_POP ( uint, layout.resolv_tile_count );
32 390 : CFG_POP ( uint, layout.execle_tile_count );
33 390 : CFG_POP ( uint, layout.gossvf_tile_count );
34 390 : CFG_POP ( uint, layout.snapdc_tile_count );
35 390 : CFG_POP ( uint, layout.snapin_tile_count );
36 390 : CFG_POP ( uint, layout.snapzp_tile_count );
37 390 : CFG_POP ( uint, layout.snapsv_tile_count );
38 390 : CFG_POP ( uint, layout.snapsv_io_worker_count );
39 :
40 390 : CFG_POP ( cstr, layout.mode );
41 :
42 390 : CFG_POP ( ulong, accounts.max_accounts );
43 390 : CFG_POP ( ulong, accounts.cache_size_gib );
44 :
45 390 : CFG_POP ( ulong, runtime.max_live_slots );
46 390 : CFG_POP ( ulong, runtime.stake_delegation_cache_cnt );
47 :
48 390 : CFG_POP ( ulong, runtime.program_cache_size_mib );
49 390 : CFG_POP ( ulong, runtime.transaction_cache_size_mib );
50 :
51 390 : CFG_POP ( ulong, runtime.bank_cache_cnt );
52 :
53 390 : CFG_POP ( ulong, consensus.wait_for_supermajority_at_slot );
54 390 : CFG_POP ( cstr, consensus.wait_for_supermajority_with_bank_hash );
55 :
56 390 : CFG_POP ( uint, snapshots.sources.max_local_full_effective_age );
57 390 : CFG_POP ( uint, snapshots.sources.max_local_incremental_age );
58 390 : CFG_POP ( bool, snapshots.sources.gossip.allow_any );
59 390 : CFG_POP_ARRAY( cstr, snapshots.sources.gossip.allow_list );
60 390 : CFG_POP_ARRAY( cstr, snapshots.sources.gossip.block_list );
61 390 : CFG_POP_ARRAY( cstr, snapshots.sources.servers );
62 390 : CFG_POP ( bool, snapshots.incremental_snapshots );
63 390 : CFG_POP ( bool, snapshots.genesis_download );
64 390 : CFG_POP ( uint, snapshots.max_full_snapshots_to_keep );
65 390 : CFG_POP ( uint, snapshots.max_incremental_snapshots_to_keep );
66 390 : CFG_POP ( uint, snapshots.max_retry_abort );
67 390 : CFG_POP ( uint, snapshots.min_download_speed_mibs );
68 390 : CFG_POP ( ulong, snapshots.wait_for_peers_timeout_seconds );
69 390 : CFG_POP ( ulong, snapshots.full_snapshot_interval_blocks );
70 390 : CFG_POP ( ulong, snapshots.incremental_snapshot_interval_blocks );
71 390 : CFG_POP ( ulong, snapshots.max_incremental_snapshot_accounts );
72 :
73 390 : CFG_POP ( bool, snapshots.server.enabled );
74 390 : CFG_POP ( cstr, snapshots.server.http_listen_address );
75 390 : CFG_POP ( uint, snapshots.server.http_listen_port );
76 390 : CFG_POP ( ulong, snapshots.server.max_http_connections );
77 390 : CFG_POP ( ulong, snapshots.server.idle_timeout_millis );
78 390 : CFG_POP ( ulong, snapshots.server.send_timeout_millis );
79 390 : CFG_POP ( ulong, snapshots.server.send_buffer_size_kib );
80 :
81 390 : CFG_POP ( bool, failover.enabled );
82 390 : CFG_POP ( bool, failover.boot_to_standby );
83 390 : CFG_POP ( cstr, failover.listen_address );
84 390 : CFG_POP ( ushort, failover.listen_port );
85 :
86 390 : CFG_POP ( bool, development.hard_fork_fatal );
87 390 : CFG_POP ( bool, development.fixed_fec_sets );
88 :
89 390 : CFG_POP ( ushort, development.votor.quic_client_listen_port );
90 390 : CFG_POP ( ushort, development.votor.quic_server_listen_port );
91 :
92 390 : CFG_POP ( bool, development.genesis.validate_genesis_hash );
93 390 : CFG_POP ( ulong, development.genesis.max_file_size_mib );
94 :
95 390 : CFG_POP ( cstr, development.ledger_input.format );
96 390 : CFG_POP ( cstr, development.ledger_input.path );
97 390 : CFG_POP ( ulong, development.ledger_input.end_slot );
98 :
99 390 : CFG_POP ( cstr, development.backtest.affinity );
100 390 : CFG_POP ( ulong, development.backtest.root_distance );
101 :
102 :
103 390 : return config;
104 390 : }
105 :
106 : fd_config_t *
107 : fd_config_extract_pod( uchar * pod,
108 414 : fd_config_t * config ) {
109 414 : CFG_POP ( cstr, name );
110 414 : CFG_POP ( cstr, user );
111 :
112 414 : CFG_POP ( bool, telemetry );
113 :
114 414 : CFG_POP ( cstr, log.path );
115 414 : CFG_POP ( cstr, log.colorize );
116 414 : CFG_POP ( cstr, log.level_logfile );
117 414 : CFG_POP ( cstr, log.level_stderr );
118 414 : CFG_POP ( cstr, log.level_flush );
119 :
120 414 : CFG_POP ( cstr, paths.base );
121 414 : CFG_POP ( cstr, paths.identity_key );
122 414 : CFG_POP ( cstr, paths.vote_account );
123 414 : CFG_POP ( cstr, paths.snapshots );
124 414 : CFG_POP ( cstr, paths.genesis );
125 414 : CFG_POP ( cstr, paths.accounts );
126 414 : CFG_POP ( cstr, paths.stake_delegations );
127 414 : CFG_POP ( cstr, paths.epoch_credits );
128 414 : CFG_POP ( cstr, paths.cost_tracker );
129 414 : CFG_POP ( cstr, paths.vote_stakes );
130 414 : CFG_POP ( cstr, paths.txncache );
131 414 : CFG_POP ( cstr, paths.shredb );
132 414 : CFG_POP ( cstr, paths.guidb );
133 414 : CFG_POP ( cstr, paths.vote_history );
134 :
135 414 : CFG_POP_ARRAY( cstr, gossip.entrypoints );
136 414 : CFG_POP ( ushort, gossip.port );
137 :
138 414 : CFG_POP ( ushort, consensus.expected_shred_version );
139 414 : CFG_POP ( cstr, consensus.expected_genesis_hash );
140 414 : CFG_POP ( boolau, consensus.wait_for_vote_to_start_leader );
141 :
142 414 : CFG_POP ( cstr, layout.affinity );
143 414 : CFG_POP ( cstr, layout.blocklist_cores );
144 414 : CFG_POP ( uint, layout.net_tile_count );
145 414 : CFG_POP ( uint, layout.quic_tile_count );
146 414 : CFG_POP ( uint, layout.verify_tile_count );
147 414 : CFG_POP ( uint, layout.shred_tile_count );
148 :
149 414 : CFG_POP ( cstr, hugetlbfs.mount_path );
150 414 : CFG_POP ( cstr, hugetlbfs.max_page_size );
151 414 : CFG_POP ( ulong, hugetlbfs.gigantic_page_threshold_mib );
152 :
153 414 : CFG_POP ( cstr, net.interface );
154 414 : CFG_POP ( cstr, net.bind_address );
155 414 : CFG_POP ( cstr, net.provider );
156 414 : CFG_POP ( uint, net.ingress_buffer_size );
157 414 : CFG_POP ( cstr, net.xdp.xdp_mode );
158 414 : CFG_POP ( boolau, net.xdp.xdp_zero_copy );
159 390 : CFG_POP ( cstr, net.xdp.poll_mode );
160 390 : CFG_POP ( uint, net.xdp.xdp_rx_queue_size );
161 390 : CFG_POP ( uint, net.xdp.xdp_tx_queue_size );
162 390 : CFG_POP ( uint, net.xdp.flush_timeout_micros );
163 390 : CFG_POP ( cstr, net.xdp.rss_queue_mode );
164 390 : CFG_POP ( boolau, net.xdp.listen_gre );
165 390 : CFG_POP ( boolau, net.xdp.native_bond );
166 390 : CFG_POP ( uint, net.mlx5.rx_queue_size );
167 390 : CFG_POP ( uint, net.mlx5.tx_queue_size );
168 390 : CFG_POP ( uint, net.iavf.rx_queue_size );
169 390 : CFG_POP ( uint, net.iavf.tx_queue_size );
170 390 : CFG_POP ( uint, net.socket.receive_buffer_size );
171 390 : CFG_POP ( uint, net.socket.send_buffer_size );
172 :
173 390 : CFG_POP ( ulong, tiles.netlink.max_routes );
174 390 : CFG_POP ( ulong, tiles.netlink.max_peer_routes );
175 390 : CFG_POP ( ulong, tiles.netlink.max_neighbors );
176 :
177 390 : CFG_POP ( ulong, tiles.gossip.max_entries );
178 :
179 390 : CFG_POP ( ushort, tiles.quic.regular_transaction_listen_port );
180 390 : CFG_POP ( ushort, tiles.quic.quic_transaction_listen_port );
181 390 : CFG_POP ( uint, tiles.quic.txn_reassembly_count );
182 390 : CFG_POP ( uint, tiles.quic.max_concurrent_connections );
183 390 : CFG_POP ( uint, tiles.quic.max_concurrent_handshakes );
184 390 : CFG_POP ( uint, tiles.quic.idle_timeout_millis );
185 390 : CFG_POP ( uint, tiles.quic.ack_delay_millis );
186 390 : CFG_POP ( bool, tiles.quic.retry );
187 390 : CFG_POP ( cstr, tiles.quic.ssl_key_log_file );
188 :
189 390 : CFG_POP ( uint, tiles.verify.signature_cache_size );
190 390 : CFG_POP ( uint, tiles.verify.receive_buffer_size );
191 390 : CFG_POP ( uint, tiles.verify.mtu );
192 :
193 390 : CFG_POP ( uint, tiles.dedup.signature_cache_size );
194 :
195 390 : CFG_POP ( bool, tiles.bundle.enabled );
196 390 : CFG_POP ( cstr, tiles.bundle.url );
197 390 : CFG_POP ( cstr, tiles.bundle.tls_domain_name );
198 390 : CFG_POP ( cstr, tiles.bundle.tip_distribution_program_addr );
199 390 : CFG_POP ( cstr, tiles.bundle.tip_payment_program_addr );
200 390 : CFG_POP ( cstr, tiles.bundle.tip_distribution_authority );
201 390 : CFG_POP ( uint, tiles.bundle.commission_bps );
202 390 : CFG_POP ( ulong, tiles.bundle.keepalive_interval_millis );
203 390 : CFG_POP ( bool, tiles.bundle.tls_cert_verify );
204 :
205 390 : CFG_POP ( uint, tiles.pack.max_pending_transactions );
206 390 : CFG_POP ( bool, tiles.pack.use_consumed_cus );
207 390 : CFG_POP ( cstr, tiles.pack.schedule_strategy );
208 390 : CFG_POP_ARRAY( cstr, tiles.pack.account_blocklist );
209 :
210 390 : CFG_POP ( ulong, tiles.replay.max_transaction_lookahead_buffer_size );
211 390 : CFG_POP_ARRAY( cstr, tiles.replay.enable_features );
212 :
213 390 : CFG_POP ( uint, tiles.shred.max_pending_shred_sets );
214 390 : CFG_POP ( ushort, tiles.shred.shred_listen_port );
215 390 : CFG_POP_ARRAY( cstr, tiles.shred.additional_shred_destinations_retransmit );
216 390 : CFG_POP_ARRAY( cstr, tiles.shred.additional_shred_destinations_leader );
217 390 : CFG_POP ( ulong, tiles.shred.shred_cache_size_mib );
218 :
219 390 : CFG_POP ( cstr, tiles.metric.prometheus_listen_address );
220 390 : CFG_POP ( ushort, tiles.metric.prometheus_listen_port );
221 :
222 390 : CFG_POP ( cstr, tiles.event.url );
223 :
224 390 : CFG_POP ( bool, tiles.gui.enabled );
225 390 : CFG_POP ( cstr, tiles.gui.gui_listen_address );
226 390 : CFG_POP ( ushort, tiles.gui.gui_listen_port );
227 390 : CFG_POP ( ulong, tiles.gui.max_http_connections );
228 390 : CFG_POP ( ulong, tiles.gui.max_websocket_connections );
229 390 : CFG_POP ( ulong, tiles.gui.send_buffer_size_mb );
230 390 : CFG_POP ( ulong, tiles.gui.db_size_gib );
231 :
232 390 : CFG_POP ( bool, tiles.rpc.enabled );
233 390 : CFG_POP ( cstr, tiles.rpc.rpc_listen_address );
234 390 : CFG_POP ( ushort, tiles.rpc.rpc_listen_port );
235 390 : CFG_POP ( ulong, tiles.rpc.max_http_connections );
236 390 : CFG_POP ( ulong, tiles.rpc.max_websocket_connections );
237 390 : CFG_POP ( ulong, tiles.rpc.send_buffer_size_mb );
238 390 : CFG_POP ( bool, tiles.rpc.delay_startup );
239 :
240 390 : CFG_POP ( ushort, tiles.repair.repair_client_listen_port );
241 390 : CFG_POP ( ulong, tiles.repair.slot_max );
242 :
243 390 : CFG_POP ( bool, tiles.rserve.enabled );
244 390 : CFG_POP ( ushort, tiles.rserve.repair_serve_listen_port );
245 390 : CFG_POP ( ulong, tiles.rserve.shred_storage_limit_gib );
246 :
247 390 : CFG_POP ( ulong, capture.capture_start_slot );
248 390 : CFG_POP ( cstr, capture.solcap_capture );
249 390 : CFG_POP ( bool, capture.recent_only );
250 390 : CFG_POP ( ulong, capture.recent_slots_per_file );
251 390 : CFG_POP ( cstr, capture.dump_proto_dir );
252 390 : CFG_POP ( cstr, capture.dump_syscall_name_filter );
253 390 : CFG_POP ( cstr, capture.dump_instr_program_id_filter );
254 390 : CFG_POP ( bool, capture.dump_syscall_to_pb );
255 390 : CFG_POP ( bool, capture.dump_instr_to_pb );
256 390 : CFG_POP ( bool, capture.dump_txn_to_pb );
257 390 : CFG_POP ( bool, capture.dump_txn_as_fixture );
258 390 : CFG_POP ( bool, capture.dump_block_to_pb );
259 :
260 390 : CFG_POP ( bool, development.sandbox );
261 390 : CFG_POP ( bool, development.no_clone );
262 390 : CFG_POP ( cstr, development.core_dump );
263 390 : CFG_POP ( bool, development.bootstrap );
264 :
265 390 : CFG_POP ( bool, development.gossip.allow_private_address );
266 :
267 390 : CFG_POP ( ulong, development.genesis.hashes_per_tick );
268 390 : CFG_POP ( ulong, development.genesis.target_tick_duration_micros );
269 390 : CFG_POP ( ulong, development.genesis.ticks_per_slot );
270 390 : CFG_POP ( ulong, development.genesis.fund_initial_accounts );
271 390 : CFG_POP ( ulong, development.genesis.fund_initial_amount_lamports );
272 390 : CFG_POP ( ulong, development.genesis.vote_account_stake_lamports );
273 390 : CFG_POP ( bool, development.genesis.warmup_epochs );
274 :
275 390 : CFG_POP ( uint, development.bench.benchg_tile_count );
276 390 : CFG_POP ( uint, development.bench.benchs_tile_count );
277 390 : CFG_POP ( cstr, development.bench.affinity );
278 390 : CFG_POP ( cstr, development.bench.transaction_mode );
279 390 : CFG_POP ( ulong, development.bench.max_cost_per_block );
280 390 : CFG_POP ( ulong, development.bench.max_shreds_per_block );
281 390 : CFG_POP ( ulong, development.bench.disable_blockstore_from_slot );
282 390 : CFG_POP ( bool, development.bench.disable_status_cache );
283 :
284 390 : CFG_POP ( cstr, development.bundle.ssl_key_log_file );
285 390 : CFG_POP ( uint, development.bundle.buffer_size_kib );
286 :
287 390 : CFG_POP ( bool, development.event.report_shreds );
288 390 : CFG_POP ( bool, development.event.report_transactions );
289 390 : CFG_POP ( bool, development.event.report_runtime_diffs );
290 390 : CFG_POP ( bool, development.event.report_repair_requests );
291 390 : CFG_POP ( ulong, development.event.max_upload_rate_mbps );
292 :
293 390 : CFG_POP ( cstr, development.pktgen.affinity );
294 390 : CFG_POP ( cstr, development.pktgen.fake_dst_ip );
295 :
296 390 : CFG_POP ( cstr, development.udpecho.affinity );
297 :
298 390 : CFG_POP ( ulong, development.accdb.partition_size_gib );
299 :
300 390 : CFG_POP ( bool, development.hugetlbfs.min_size );
301 :
302 390 : if( FD_UNLIKELY( !fd_config_extract_podf( pod, &config->firedancer ) ) ) return NULL;
303 390 : fd_config_check_configf( config, &config->firedancer );
304 :
305 : /* Renamed config options */
306 :
307 390 : # define CFG_RENAMED( old_path, new_path ) \
308 5070 : do { \
309 5070 : char const * key = #old_path; \
310 5070 : fd_pod_info_t info[1]; \
311 5070 : if( FD_UNLIKELY( !fd_pod_query( pod, key, info ) ) ) { \
312 0 : FD_LOG_WARNING(( "Config option `%s` was renamed to `%s`. " \
313 0 : "Please update your config file.", \
314 0 : #old_path, #new_path )); \
315 0 : return NULL; \
316 0 : } \
317 5070 : (void)config->new_path; /* assert new path exists */ \
318 5070 : } while(0)
319 :
320 390 : CFG_RENAMED( tiles.net.interface, net.interface );
321 390 : CFG_RENAMED( tiles.net.bind_address, net.bind_address );
322 390 : CFG_RENAMED( tiles.net.provider, net.provider );
323 390 : CFG_RENAMED( tiles.net.xdp_mode, net.xdp.xdp_mode );
324 390 : CFG_RENAMED( tiles.net.xdp_zero_copy, net.xdp.xdp_zero_copy );
325 390 : CFG_RENAMED( tiles.net.xdp_rx_queue_size, net.xdp.xdp_rx_queue_size );
326 390 : CFG_RENAMED( tiles.net.xdp_tx_queue_size, net.xdp.xdp_tx_queue_size );
327 390 : CFG_RENAMED( tiles.net.flush_timeout_micros, net.xdp.flush_timeout_micros );
328 390 : CFG_RENAMED( tiles.net.send_buffer_size, net.ingress_buffer_size );
329 :
330 390 : CFG_RENAMED( development.net.provider, net.provider );
331 390 : CFG_RENAMED( development.net.sock_receive_buffer_size, net.socket.receive_buffer_size );
332 390 : CFG_RENAMED( development.net.sock_send_buffer_size, net.socket.send_buffer_size );
333 :
334 390 : CFG_RENAMED( tiles.repair.repair_intake_listen_port, tiles.repair.repair_client_listen_port );
335 :
336 390 : # undef CFG_RENAMED
337 :
338 390 : # define CFG_DEPRECATED( path ) \
339 1560 : do { \
340 1560 : char const * key = #path; \
341 1560 : if( FD_UNLIKELY( !fd_pod_query( pod, key, NULL ) ) ) { \
342 0 : FD_LOG_WARNING(( "ignoring deprecated config option `%s`", key ));\
343 0 : if( FD_UNLIKELY( fd_pod_remove( pod, key ) ) ) \
344 0 : FD_LOG_ERR(( "failed to remove deprecated key `%s`", key )); \
345 0 : } \
346 1560 : } while(0)
347 :
348 390 : CFG_DEPRECATED( development.bundle.ssl_heap_size_mib );
349 390 : CFG_DEPRECATED( tiles.tower.write_vote_history_file );
350 390 : CFG_DEPRECATED( tiles.txsend.txsend_src_port );
351 390 : CFG_DEPRECATED( consensus.alpenglow );
352 :
353 390 : # undef CFG_DEPRECATED
354 :
355 390 : if( FD_UNLIKELY( !fdctl_pod_find_leftover( pod ) ) ) return NULL;
356 273 : return config;
357 390 : }
358 :
359 : #undef CFG_POP
360 : #undef CFG_ARRAY
|