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