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