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