LCOV - code coverage report
Current view: top level - app/fdctl - config_parse.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 299 362 82.6 %
Date: 2024-11-13 11:58:15 Functions: 9 9 100.0 %

          Line data    Source code
       1             : #include "config_parse.h"
       2             : 
       3             : FD_IMPORT_BINARY( fdctl_default_config, "src/app/fdctl/config/default.toml" );
       4             : FD_IMPORT_BINARY( fdctl_default_firedancer_config, "src/app/fdctl/config/default-firedancer.toml" );
       5             : 
       6             : /* Pod query utils ****************************************************/
       7             : 
       8             : static int
       9             : fdctl_cfg_get_cstr_( char *                out,
      10             :                      ulong                 out_sz,
      11             :                      fd_pod_info_t const * info,
      12         102 :                      char const *          path ) {
      13         102 :   if( FD_UNLIKELY( info->val_type != FD_POD_VAL_TYPE_CSTR ) ) {
      14           0 :     FD_LOG_WARNING(( "invalid value for `%s`", path ));
      15           0 :     return 0;
      16           0 :   }
      17         102 :   char const * str = info->val;
      18         102 :   ulong        sz  = strlen( str ) + 1;
      19         102 :   if( FD_UNLIKELY( sz > out_sz ) ) {
      20           0 :     FD_LOG_WARNING(( "`%s`: too long (max %ld)", path, (long)out_sz-1L ));
      21           0 :     return 0;
      22           0 :   }
      23         102 :   fd_memcpy( out, str, sz );
      24         102 :   return 1;
      25         102 : }
      26             : 
      27             : #define fdctl_cfg_get_cstr( out, out_sz, info, path ) \
      28           0 :   fdctl_cfg_get_cstr_( *out, out_sz, info, path )
      29             : 
      30             : static int
      31             : fdctl_cfg_get_ulong( ulong *               out,
      32             :                      ulong                 out_sz FD_PARAM_UNUSED,
      33             :                      fd_pod_info_t const * info,
      34         135 :                      char const *          path ) {
      35             : 
      36         135 :   ulong num;
      37         135 :   switch( info->val_type ) {
      38         135 :   case FD_POD_VAL_TYPE_LONG:
      39         135 :     fd_ulong_svw_dec( (uchar const *)info->val, &num );
      40         135 :     long snum = fd_long_zz_dec( num );
      41         135 :     if( snum < 0L ) {
      42           0 :       FD_LOG_WARNING(( "`%s` cannot be negative", path ));
      43           0 :       return 0;
      44           0 :     }
      45         135 :     num = (ulong)snum;
      46         135 :     break;
      47           0 :   case FD_POD_VAL_TYPE_ULONG:
      48           0 :     fd_ulong_svw_dec( (uchar const *)info->val, &num );
      49           0 :     break;
      50           0 :   default:
      51           0 :     FD_LOG_WARNING(( "invalid value for `%s`", path ));
      52           0 :     return 0;
      53         135 :   }
      54             : 
      55         135 :   *out = num;
      56         135 :   return 1;
      57         135 : }
      58             : 
      59             : static int
      60             : fdctl_cfg_get_uint( uint *                out,
      61             :                     ulong                 out_sz FD_PARAM_UNUSED,
      62             :                     fd_pod_info_t const * info,
      63          90 :                     char const *          path ) {
      64          90 :   ulong num;
      65          90 :   if( FD_UNLIKELY( !fdctl_cfg_get_ulong( &num, sizeof(num), info, path ) ) ) return 0;
      66          90 :   if( num > UINT_MAX ) {
      67           0 :     FD_LOG_WARNING(( "`%s` is out of bounds (%lx)", path, num ));
      68           0 :     return 0;
      69           0 :   }
      70          90 :   *out = (uint)num;
      71          90 :   return 1;
      72          90 : }
      73             : 
      74             : static int
      75             : fdctl_cfg_get_ushort( ushort *              out,
      76             :                       ulong                 out_sz FD_PARAM_UNUSED,
      77             :                       fd_pod_info_t const * info,
      78          24 :                       char const *          path ) {
      79          24 :   ulong num;
      80          24 :   if( FD_UNLIKELY( !fdctl_cfg_get_ulong( &num, sizeof(num), info, path ) ) ) return 0;
      81          24 :   if( num > USHORT_MAX ) {
      82           0 :     FD_LOG_WARNING(( "`%s` is out of bounds (%lx)", path, num ));
      83           0 :     return 0;
      84           0 :   }
      85          24 :   *out = (ushort)num;
      86          24 :   return 1;
      87          24 : }
      88             : 
      89             : static int
      90             : fdctl_cfg_get_bool( int *                 out,
      91             :                     ulong                 out_sz FD_PARAM_UNUSED,
      92             :                     fd_pod_info_t const * info,
      93          87 :                     char const *          path ) {
      94          87 :   if( FD_UNLIKELY( info->val_type != FD_POD_VAL_TYPE_INT ) ) {
      95           0 :     FD_LOG_WARNING(( "invalid value for `%s`", path ));
      96           0 :     return 0;
      97           0 :   }
      98          87 :   ulong u; fd_ulong_svw_dec( (uchar const *)info->val, &u );
      99          87 :   *out = (int)u;
     100          87 :   return 1;
     101          87 : }
     102             : 
     103             : /* Find leftover ******************************************************/
     104             : 
     105             : /* fdctl_pod_find_leftover recursively searches for non-subpod keys in
     106             :    pod.  Prints to the warning log if it finds any.  Used to detect
     107             :    config keys that were not recognized by fdctl.  Returns 0 if no
     108             :    leftover key was found.  Otherwise, returns a non-zero number of
     109             :    segments of the leftover key.  The key can be reassembled by joining
     110             :    stack[0] .. stack[depth-1].
     111             : 
     112             :    Not thread safe (uses global buffer). */
     113             : 
     114           0 : # define FDCTL_CFG_MAX_DEPTH (16)
     115             : 
     116             : static ulong
     117             : fdctl_pod_find_leftover_recurse( uchar *       pod,
     118             :                                  char const ** stack,
     119          75 :                                  ulong         depth ) {
     120             : 
     121          75 :   if( FD_UNLIKELY( depth+1 >= FDCTL_CFG_MAX_DEPTH ) ) {
     122           0 :     FD_LOG_WARNING(( "configuration file has too many nested keys" ));
     123           0 :     return depth;
     124           0 :   }
     125             : 
     126         147 :   for( fd_pod_iter_t iter = fd_pod_iter_init( pod ); !fd_pod_iter_done( iter ); iter = fd_pod_iter_next( iter ) ) {
     127          72 :     fd_pod_info_t info = fd_pod_iter_info( iter );
     128          72 :     stack[ depth ] = info.key;
     129          72 :     depth++;
     130          72 :     if( FD_LIKELY( info.val_type == FD_POD_VAL_TYPE_SUBPOD ) ) {
     131          72 :       ulong sub_depth = fdctl_pod_find_leftover_recurse( (uchar *)info.val, stack, depth );
     132          72 :       if( FD_UNLIKELY( sub_depth ) ) return sub_depth;
     133          72 :     } else {
     134           0 :       return depth;
     135           0 :     }
     136          72 :     depth--;
     137          72 :   }
     138             : 
     139          75 :   return 0;
     140          75 : }
     141             : 
     142             : static int
     143           3 : fdctl_pod_find_leftover( uchar * pod ) {
     144             : 
     145           3 :   static char const * stack[ FDCTL_CFG_MAX_DEPTH ];
     146           3 :   ulong depth = fdctl_pod_find_leftover_recurse( pod, stack, 0UL );
     147           3 :   if( FD_LIKELY( !depth ) ) return 1;
     148             : 
     149           0 :   static char path[ 64*FDCTL_CFG_MAX_DEPTH + 4 ];
     150           0 :   char * c   = fd_cstr_init( path );
     151           0 :   char * end = path + 64*FDCTL_CFG_MAX_DEPTH - 1;
     152           0 :   for( ulong j=0UL; j<depth; j++ ) {
     153           0 :     char const * key     = stack[j];
     154           0 :     ulong        key_len = strlen( key );
     155           0 :     if( c+key_len+1 >= end ) {
     156           0 :       c = fd_cstr_append_text( c, "...", 3UL );
     157           0 :       break;
     158           0 :     }
     159           0 :     c = fd_cstr_append_text( c, key, key_len );
     160           0 :     c = fd_cstr_append_char( c, '.' );
     161           0 :   }
     162           0 :   c -= 1;
     163           0 :   fd_cstr_fini( c );
     164             : 
     165           0 :   FD_LOG_WARNING(( "Unrecognized key `%s`", path ));
     166           0 :   return 0;
     167           3 : }
     168             : 
     169             : /* Converter **********************************************************/
     170             : 
     171             : config_t *
     172             : fdctl_pod_to_cfg( config_t * config,
     173           3 :                   uchar *    pod ) {
     174             : 
     175           3 : # define CFG_POP( type, cfg_path )                                     \
     176         396 :   do {                                                                 \
     177         396 :     char const * key = #cfg_path;                                      \
     178         396 :     fd_pod_info_t info[1];                                             \
     179         396 :     if( fd_pod_query( pod, key, info ) ) break;                        \
     180         396 :     if( FD_UNLIKELY( !fdctl_cfg_get_##type( &config->cfg_path, sizeof(config->cfg_path), \
     181         324 :         info, key ) ) )                                                \
     182         324 :       return NULL;                                                     \
     183         324 :     fd_pod_remove( pod, key );                                         \
     184         324 :   } while(0)
     185             : 
     186           3 : # define CFG_POP_ARRAY( type, cfg_path )                               \
     187          30 :   do {                                                                 \
     188          30 :     char const * key = #cfg_path;                                      \
     189          30 :     fd_pod_info_t info[1];                                             \
     190          30 :     if( fd_pod_query( pod, key, info ) ) break;                        \
     191          30 :     if( FD_UNLIKELY( info->val_type!=FD_POD_VAL_TYPE_SUBPOD ) ) {      \
     192           0 :       FD_LOG_WARNING(( "`%s`: expected array", key ));                 \
     193           0 :       return NULL;                                                     \
     194           0 :     }                                                                  \
     195          24 :     ulong  arr_len = sizeof( config->cfg_path ) / sizeof( config->cfg_path[ 0 ] ); \
     196          24 :     ulong  j       = 0UL;                                              \
     197          24 :     for( fd_pod_iter_t iter = fd_pod_iter_init( info->val ); !fd_pod_iter_done( iter ); iter = fd_pod_iter_next( iter ) ) { \
     198           0 :       if( FD_UNLIKELY( j>=arr_len ) ) {                                \
     199           0 :         FD_LOG_WARNING(( "`%s`: too many values (max %lu)", key, arr_len )); \
     200           0 :         return NULL;                                                   \
     201           0 :       }                                                                \
     202           0 :       fd_pod_info_t sub_info = fd_pod_iter_info( iter );               \
     203           0 :       fdctl_cfg_get_##type( &config->cfg_path[j], sizeof(config->cfg_path[j]), &sub_info, key ); \
     204           0 :       j++;                                                             \
     205           0 :     }                                                                  \
     206          24 :     config->cfg_path ## _cnt = j;                                      \
     207          24 :     fd_pod_remove( pod, key );                                         \
     208          24 :   } while(0)
     209             : 
     210           3 :   CFG_POP      ( cstr,   name                                             );
     211           3 :   CFG_POP      ( cstr,   user                                             );
     212           3 :   CFG_POP      ( cstr,   scratch_directory                                );
     213           3 :   CFG_POP      ( cstr,   dynamic_port_range                               );
     214             : 
     215           3 :   CFG_POP      ( cstr,   log.path                                         );
     216           3 :   CFG_POP      ( cstr,   log.colorize                                     );
     217           3 :   CFG_POP      ( cstr,   log.level_logfile                                );
     218           3 :   CFG_POP      ( cstr,   log.level_stderr                                 );
     219           3 :   CFG_POP      ( cstr,   log.level_flush                                  );
     220             : 
     221           3 :   CFG_POP      ( cstr,   reporting.solana_metrics_config                  );
     222             : 
     223           3 :   CFG_POP      ( cstr,   ledger.path                                      );
     224           3 :   CFG_POP      ( cstr,   ledger.accounts_path                             );
     225           3 :   CFG_POP      ( uint,   ledger.limit_size                                );
     226           3 :   CFG_POP_ARRAY( cstr,   ledger.account_indexes                           );
     227           3 :   CFG_POP_ARRAY( cstr,   ledger.account_index_include_keys                );
     228           3 :   CFG_POP_ARRAY( cstr,   ledger.account_index_exclude_keys                );
     229           3 :   CFG_POP      ( bool,   ledger.require_tower                             );
     230           3 :   CFG_POP      ( cstr,   ledger.snapshot_archive_format                   );
     231             : 
     232           3 :   CFG_POP_ARRAY( cstr,   gossip.entrypoints                               );
     233           3 :   CFG_POP      ( bool,   gossip.port_check                                );
     234           3 :   CFG_POP      ( ushort, gossip.port                                      );
     235           3 :   CFG_POP      ( cstr,   gossip.host                                      );
     236             : 
     237           3 :   CFG_POP      ( cstr,   consensus.identity_path                          );
     238           3 :   CFG_POP      ( cstr,   consensus.vote_account_path                      );
     239           3 :   CFG_POP_ARRAY( cstr,   consensus.authorized_voter_paths                 );
     240           3 :   CFG_POP      ( bool,   consensus.snapshot_fetch                         );
     241           3 :   CFG_POP      ( bool,   consensus.genesis_fetch                          );
     242           3 :   CFG_POP      ( bool,   consensus.poh_speed_test                         );
     243           3 :   CFG_POP      ( cstr,   consensus.expected_genesis_hash                  );
     244           3 :   CFG_POP      ( uint,   consensus.wait_for_supermajority_at_slot         );
     245           3 :   CFG_POP      ( cstr,   consensus.expected_bank_hash                     );
     246           3 :   CFG_POP      ( ushort, consensus.expected_shred_version                 );
     247           3 :   CFG_POP      ( bool,   consensus.wait_for_vote_to_start_leader          );
     248           3 :   CFG_POP_ARRAY( uint,   consensus.hard_fork_at_slots                     );
     249           3 :   CFG_POP_ARRAY( cstr,   consensus.known_validators                       );
     250           3 :   CFG_POP      ( bool,   consensus.os_network_limits_test                 );
     251             : 
     252           3 :   CFG_POP      ( ushort, rpc.port                                         );
     253           3 :   CFG_POP      ( bool,   rpc.full_api                                     );
     254           3 :   CFG_POP      ( bool,   rpc.private                                      );
     255           3 :   CFG_POP      ( bool,   rpc.transaction_history                          );
     256           3 :   CFG_POP      ( bool,   rpc.extended_tx_metadata_storage                 );
     257           3 :   CFG_POP      ( bool,   rpc.only_known                                   );
     258           3 :   CFG_POP      ( bool,   rpc.pubsub_enable_block_subscription             );
     259           3 :   CFG_POP      ( bool,   rpc.pubsub_enable_vote_subscription              );
     260           3 :   CFG_POP      ( bool,   rpc.bigtable_ledger_storage                      );
     261             : 
     262           3 :   CFG_POP      ( bool,   snapshots.incremental_snapshots                  );
     263           3 :   CFG_POP      ( uint,   snapshots.full_snapshot_interval_slots           );
     264           3 :   CFG_POP      ( uint,   snapshots.incremental_snapshot_interval_slots    );
     265           3 :   CFG_POP      ( uint,   snapshots.minimum_snapshot_download_speed        );
     266           3 :   CFG_POP      ( uint,   snapshots.maximum_full_snapshots_to_retain       );
     267           3 :   CFG_POP      ( uint,   snapshots.maximum_incremental_snapshots_to_retain);
     268           3 :   CFG_POP      ( cstr,   snapshots.path                                   );
     269           3 :   CFG_POP      ( cstr,   snapshots.incremental_path                       );
     270             : 
     271           3 :   CFG_POP      ( cstr,   layout.affinity                                  );
     272           3 :   CFG_POP      ( cstr,   layout.agave_affinity                            );
     273           3 :   CFG_POP      ( uint,   layout.net_tile_count                            );
     274           3 :   CFG_POP      ( uint,   layout.quic_tile_count                           );
     275           3 :   CFG_POP      ( uint,   layout.resolv_tile_count                         );
     276           3 :   CFG_POP      ( uint,   layout.verify_tile_count                         );
     277           3 :   CFG_POP      ( uint,   layout.bank_tile_count                           );
     278           3 :   CFG_POP      ( uint,   layout.shred_tile_count                          );
     279             : 
     280           3 :   CFG_POP      ( cstr,   hugetlbfs.mount_path                             );
     281             : 
     282           3 :   CFG_POP      ( cstr,   tiles.net.interface                              );
     283           3 :   CFG_POP      ( cstr,   tiles.net.xdp_mode                               );
     284           3 :   CFG_POP      ( uint,   tiles.net.xdp_rx_queue_size                      );
     285           3 :   CFG_POP      ( uint,   tiles.net.xdp_tx_queue_size                      );
     286           3 :   CFG_POP      ( uint,   tiles.net.xdp_aio_depth                          );
     287           3 :   CFG_POP      ( uint,   tiles.net.send_buffer_size                       );
     288           3 :   CFG_POP_ARRAY( cstr,   tiles.net.multihome_ip_addrs                     );
     289             : 
     290           3 :   CFG_POP      ( ushort, tiles.quic.regular_transaction_listen_port       );
     291           3 :   CFG_POP      ( ushort, tiles.quic.quic_transaction_listen_port          );
     292           3 :   CFG_POP      ( uint,   tiles.quic.txn_reassembly_count                  );
     293           3 :   CFG_POP      ( uint,   tiles.quic.max_concurrent_connections            );
     294           3 :   CFG_POP      ( uint,   tiles.quic.max_concurrent_streams_per_connection );
     295           3 :   CFG_POP      ( uint,   tiles.quic.max_concurrent_handshakes             );
     296           3 :   CFG_POP      ( uint,   tiles.quic.max_inflight_quic_packets             );
     297           3 :   CFG_POP      ( uint,   tiles.quic.idle_timeout_millis                   );
     298           3 :   CFG_POP      ( uint,   tiles.quic.ack_delay_millis                      );
     299           3 :   CFG_POP      ( bool,   tiles.quic.retry                                 );
     300             : 
     301           3 :   CFG_POP      ( uint,   tiles.verify.receive_buffer_size                 );
     302           3 :   CFG_POP      ( uint,   tiles.verify.mtu                                 );
     303             : 
     304           3 :   CFG_POP      ( uint,   tiles.dedup.signature_cache_size                 );
     305             : 
     306           3 :   CFG_POP      ( uint,   tiles.pack.max_pending_transactions              );
     307           3 :   CFG_POP      ( bool,   tiles.pack.use_consumed_cus                      );
     308             : 
     309           3 :   CFG_POP      ( uint,   tiles.shred.max_pending_shred_sets               );
     310           3 :   CFG_POP      ( ushort, tiles.shred.shred_listen_port                    );
     311             : 
     312           3 :   CFG_POP      ( cstr,   tiles.metric.prometheus_listen_address           );
     313           3 :   CFG_POP      ( ushort, tiles.metric.prometheus_listen_port              );
     314             : 
     315           3 :   CFG_POP      ( bool,   tiles.gui.enabled                                );
     316           3 :   CFG_POP      ( cstr,   tiles.gui.gui_listen_address                     );
     317           3 :   CFG_POP      ( ushort, tiles.gui.gui_listen_port                        );
     318             : 
     319           3 :   CFG_POP      ( bool,   development.sandbox                              );
     320           3 :   CFG_POP      ( bool,   development.no_clone                             );
     321           3 :   CFG_POP      ( bool,   development.no_agave                             );
     322           3 :   CFG_POP      ( bool,   development.bootstrap                            );
     323             : 
     324           3 :   CFG_POP      ( bool,   development.netns.enabled                        );
     325           3 :   CFG_POP      ( cstr,   development.netns.interface0                     );
     326           3 :   CFG_POP      ( cstr,   development.netns.interface0_mac                 );
     327           3 :   CFG_POP      ( cstr,   development.netns.interface0_addr                );
     328           3 :   CFG_POP      ( cstr,   development.netns.interface1                     );
     329           3 :   CFG_POP      ( cstr,   development.netns.interface1_mac                 );
     330           3 :   CFG_POP      ( cstr,   development.netns.interface1_addr                );
     331             : 
     332           3 :   CFG_POP      ( bool,   development.gossip.allow_private_address         );
     333             : 
     334           3 :   CFG_POP      ( ulong,  development.genesis.hashes_per_tick              );
     335           3 :   CFG_POP      ( ulong,  development.genesis.target_tick_duration_micros  );
     336           3 :   CFG_POP      ( ulong,  development.genesis.ticks_per_slot               );
     337           3 :   CFG_POP      ( ulong,  development.genesis.fund_initial_accounts        );
     338           3 :   CFG_POP      ( ulong,  development.genesis.fund_initial_amount_lamports );
     339           3 :   CFG_POP      ( ulong,  development.genesis.vote_account_stake_lamports  );
     340           3 :   CFG_POP      ( bool,   development.genesis.warmup_epochs                );
     341             : 
     342           3 :   CFG_POP      ( uint,   development.bench.benchg_tile_count              );
     343           3 :   CFG_POP      ( uint,   development.bench.benchs_tile_count              );
     344           3 :   CFG_POP      ( cstr,   development.bench.affinity                       );
     345           3 :   CFG_POP      ( bool,   development.bench.larger_max_cost_per_block      );
     346           3 :   CFG_POP      ( bool,   development.bench.larger_shred_limits_per_block  );
     347           3 :   CFG_POP      ( ulong,  development.bench.disable_blockstore_from_slot   );
     348           3 :   CFG_POP      ( bool,   development.bench.disable_status_cache           );
     349             : 
     350             :   /* Firedancer-only configuration */
     351             : 
     352           3 :   CFG_POP_ARRAY( cstr,   tiles.gossip.entrypoints                         );
     353           3 :   CFG_POP      ( ushort, tiles.gossip.gossip_listen_port                  );
     354           3 :   CFG_POP_ARRAY( ushort, tiles.gossip.peer_ports                          );
     355             : 
     356           3 :   CFG_POP      ( bool,   consensus.vote                                   );
     357             : 
     358           3 :   CFG_POP      ( ushort, tiles.repair.repair_intake_listen_port           );
     359           3 :   CFG_POP      ( ushort, tiles.repair.repair_serve_listen_port            );
     360             : 
     361           3 :   CFG_POP      ( cstr,   tiles.replay.blockstore_checkpt                  );
     362           3 :   CFG_POP      ( bool,   tiles.replay.blockstore_publish                  );
     363           3 :   CFG_POP      ( cstr,   tiles.replay.capture                             );
     364           3 :   CFG_POP      ( cstr,   tiles.replay.funk_checkpt                        );
     365           3 :   CFG_POP      ( ulong,  tiles.replay.funk_rec_max                        );
     366           3 :   CFG_POP      ( ulong,  tiles.replay.funk_sz_gb                          );
     367           3 :   CFG_POP      ( ulong,  tiles.replay.funk_txn_max                        );
     368           3 :   CFG_POP      ( cstr,   tiles.replay.funk_file                           );
     369           3 :   CFG_POP      ( cstr,   tiles.replay.genesis                             );
     370           3 :   CFG_POP      ( cstr,   tiles.replay.incremental                         );
     371           3 :   CFG_POP      ( cstr,   tiles.replay.slots_replayed                      );
     372           3 :   CFG_POP      ( cstr,   tiles.replay.snapshot                            );
     373           3 :   CFG_POP      ( cstr,   tiles.replay.status_cache                        );
     374           3 :   CFG_POP      ( ulong,  tiles.replay.tpool_thread_count                  );
     375           3 :   CFG_POP      ( cstr,   tiles.replay.cluster_version                     );
     376             : 
     377           3 :   CFG_POP      ( cstr,   tiles.store_int.blockstore_restore               );
     378           3 :   CFG_POP      ( cstr,   tiles.store_int.slots_pending                    );
     379           3 :   CFG_POP      ( cstr,   tiles.store_int.shred_cap_archive                );
     380           3 :   CFG_POP      ( cstr,   tiles.store_int.shred_cap_replay                 );
     381             : 
     382           3 : # undef CFG_POP
     383           3 : # undef CFG_ARRAY
     384             : 
     385           3 :   if( FD_UNLIKELY( !fdctl_pod_find_leftover( pod ) ) ) return NULL;
     386           3 :   return config;
     387           3 : }
     388             : 
     389             : void
     390           3 : fdctl_cfg_validate( config_t * cfg ) {
     391             : 
     392          57 : # define CFG_HAS_NON_EMPTY( key ) do {             \
     393          57 :     if( !strnlen( cfg->key, sizeof(cfg->key) ) ) { \
     394           0 :       FD_LOG_ERR(( "missing `%s`", #key ));        \
     395           0 :     }                                              \
     396          57 :   } while(0)
     397             : 
     398          99 : # define CFG_HAS_NON_ZERO( key ) do {                         \
     399          99 :     if( !cfg->key ) { FD_LOG_ERR(( "missing `%s`", #key )); } \
     400          99 :   } while(0)
     401             : 
     402           6 : # define CFG_HAS_POW2( key ) do {                        \
     403           6 :     ulong value = (ulong)( cfg -> key );                 \
     404           6 :     if( !value || !fd_ulong_is_pow2( value ) ) {         \
     405           0 :       FD_LOG_ERR(( "`%s` must be a power of 2", #key )); \
     406           0 :     }                                                    \
     407           6 :   } while(0)
     408             : 
     409           3 :   CFG_HAS_NON_EMPTY( name );
     410           3 :   CFG_HAS_NON_EMPTY( scratch_directory );
     411           3 :   CFG_HAS_NON_EMPTY( dynamic_port_range );
     412             : 
     413           3 :   CFG_HAS_NON_EMPTY( log.colorize );
     414           3 :   CFG_HAS_NON_EMPTY( log.level_logfile );
     415           3 :   CFG_HAS_NON_EMPTY( log.level_stderr );
     416           3 :   CFG_HAS_NON_EMPTY( log.level_flush );
     417             : 
     418           3 :   CFG_HAS_NON_EMPTY( ledger.snapshot_archive_format );
     419             : 
     420           3 :   CFG_HAS_NON_ZERO( gossip.port );
     421             : 
     422           3 :   CFG_HAS_NON_ZERO( snapshots.full_snapshot_interval_slots );
     423           3 :   CFG_HAS_NON_ZERO( snapshots.incremental_snapshot_interval_slots );
     424           3 :   CFG_HAS_NON_ZERO( snapshots.minimum_snapshot_download_speed );
     425             : 
     426           3 :   CFG_HAS_NON_EMPTY( layout.affinity );
     427           3 :   CFG_HAS_NON_EMPTY( layout.agave_affinity );
     428           3 :   CFG_HAS_NON_ZERO ( layout.net_tile_count );
     429           3 :   CFG_HAS_NON_ZERO ( layout.quic_tile_count );
     430           3 :   CFG_HAS_NON_ZERO ( layout.resolv_tile_count );
     431           3 :   CFG_HAS_NON_ZERO ( layout.verify_tile_count );
     432           3 :   CFG_HAS_NON_ZERO ( layout.bank_tile_count );
     433           3 :   CFG_HAS_NON_ZERO ( layout.shred_tile_count );
     434             : 
     435           3 :   CFG_HAS_NON_EMPTY( hugetlbfs.mount_path );
     436             : 
     437           3 :   CFG_HAS_NON_EMPTY( tiles.net.xdp_mode );
     438           3 :   CFG_HAS_POW2     ( tiles.net.xdp_rx_queue_size );
     439           3 :   CFG_HAS_POW2     ( tiles.net.xdp_tx_queue_size );
     440           3 :   CFG_HAS_NON_ZERO ( tiles.net.xdp_aio_depth );
     441           3 :   CFG_HAS_NON_ZERO ( tiles.net.send_buffer_size );
     442             : 
     443           3 :   CFG_HAS_NON_ZERO( tiles.quic.regular_transaction_listen_port );
     444           3 :   CFG_HAS_NON_ZERO( tiles.quic.quic_transaction_listen_port );
     445           3 :   CFG_HAS_NON_ZERO( tiles.quic.max_concurrent_connections );
     446           3 :   CFG_HAS_NON_ZERO( tiles.quic.max_concurrent_streams_per_connection );
     447           3 :   CFG_HAS_NON_ZERO( tiles.quic.txn_reassembly_count );
     448           3 :   CFG_HAS_NON_ZERO( tiles.quic.max_concurrent_handshakes );
     449           3 :   CFG_HAS_NON_ZERO( tiles.quic.max_inflight_quic_packets );
     450           3 :   CFG_HAS_NON_ZERO( tiles.quic.idle_timeout_millis );
     451             : 
     452           3 :   CFG_HAS_NON_ZERO( tiles.verify.receive_buffer_size );
     453             : 
     454           3 :   CFG_HAS_NON_ZERO( tiles.dedup.signature_cache_size );
     455             : 
     456           3 :   CFG_HAS_NON_ZERO( tiles.pack.max_pending_transactions );
     457             : 
     458           3 :   CFG_HAS_NON_ZERO( tiles.shred.max_pending_shred_sets );
     459           3 :   CFG_HAS_NON_ZERO( tiles.shred.shred_listen_port );
     460             : 
     461           3 :   CFG_HAS_NON_ZERO( tiles.metric.prometheus_listen_port );
     462             : 
     463           3 :   CFG_HAS_NON_ZERO( tiles.gui.gui_listen_port );
     464             : 
     465           3 :   CFG_HAS_NON_EMPTY( development.netns.interface0 );
     466           3 :   CFG_HAS_NON_EMPTY( development.netns.interface0_mac );
     467           3 :   CFG_HAS_NON_EMPTY( development.netns.interface0_addr );
     468           3 :   CFG_HAS_NON_EMPTY( development.netns.interface1 );
     469           3 :   CFG_HAS_NON_EMPTY( development.netns.interface1_mac );
     470           3 :   CFG_HAS_NON_EMPTY( development.netns.interface1_addr );
     471             : 
     472           3 :   CFG_HAS_NON_ZERO( development.genesis.target_tick_duration_micros );
     473           3 :   CFG_HAS_NON_ZERO( development.genesis.ticks_per_slot );
     474           3 :   CFG_HAS_NON_ZERO( development.genesis.fund_initial_accounts );
     475           3 :   CFG_HAS_NON_ZERO( development.genesis.fund_initial_amount_lamports );
     476             : 
     477           3 :   CFG_HAS_NON_ZERO ( development.bench.benchg_tile_count );
     478           3 :   CFG_HAS_NON_ZERO ( development.bench.benchs_tile_count );
     479           3 :   CFG_HAS_NON_EMPTY( development.bench.affinity );
     480             : 
     481           3 : # undef CFG_HAS_NON_EMPTY
     482           3 : # undef CFG_HAS_NON_ZERO
     483           3 : # undef CFG_HAS_POW2
     484           3 : }

Generated by: LCOV version 1.14