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