diff --git a/src/app/fdctl/config.c b/src/app/fdctl/config.c index d683cae14a..2355a942bc 100644 --- a/src/app/fdctl/config.c +++ b/src/app/fdctl/config.c @@ -365,21 +365,13 @@ validate_ports( config_t * result ) { #define FD_CONFIG_CLUSTER_MAINNET_BETA (5UL) FD_FN_PURE static ulong -determine_cluster( ulong entrypoints_cnt, - char entrypoints[16][256], - char * expected_genesis_hash ) { +determine_cluster( char * expected_genesis_hash ) { char const * DEVNET_GENESIS_HASH = "EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG"; char const * TESTNET_GENESIS_HASH = "4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY"; char const * MAINNET_BETA_GENESIS_HASH = "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d"; char const * PYTHTEST_GENESIS_HASH = "EkCkB7RWVrgkcpariRpd3pjf7GwiCMZaMHKUpB5Na1Ve"; char const * PYTHNET_GENESIS_HASH = "GLKkBUr6r72nBtGrtBPJLRqtsh8wXZanX4xfnqKnWwKq"; - char const * DEVNET_ENTRYPOINT_URI = "devnet.solana.com"; - char const * TESTNET_ENTRYPOINT_URI = "testnet.solana.com"; - char const * MAINNET_BETA_ENTRYPOINT_URI = "mainnet-beta.solana.com"; - char const * PYTHTEST_ENTRYPOINT_URI = "pythtest.pyth.network"; - char const * PYTHNET_ENTRYPOINT_URI = "pythnet.pyth.network"; - ulong cluster = FD_CONFIG_CLUSTER_UNKNOWN; if( FD_LIKELY( expected_genesis_hash ) ) { if( FD_UNLIKELY( !strcmp( expected_genesis_hash, DEVNET_GENESIS_HASH ) ) ) cluster = FD_CONFIG_CLUSTER_DEVNET; @@ -389,14 +381,6 @@ determine_cluster( ulong entrypoints_cnt, else if( FD_UNLIKELY( !strcmp( expected_genesis_hash, PYTHNET_GENESIS_HASH ) ) ) cluster = FD_CONFIG_CLUSTER_PYTHNET; } - for( ulong i=0; igossip.entrypoints_cnt, - config->gossip.entrypoints, - config->consensus.expected_genesis_hash ); + ulong cluster = determine_cluster( config->consensus.expected_genesis_hash ); config->is_live_cluster = cluster != FD_CONFIG_CLUSTER_UNKNOWN; if( FD_UNLIKELY( config->development.netns.enabled ) ) { diff --git a/src/app/fddev/main1.c b/src/app/fddev/main1.c index 1e1ea49d6e..6dfc309067 100644 --- a/src/app/fddev/main1.c +++ b/src/app/fddev/main1.c @@ -169,12 +169,6 @@ fddev_main( int argc, fdctl_boot( &argc, &argv, &config, log_path ); - /* load configuration and command line parsing */ - if( FD_UNLIKELY( config.is_live_cluster ) ) - FD_LOG_ERR(( "The `fddev` command is for development and test environments but your " - "configuration targets a live cluster. Use `fdctl` if this is a " - "production environment" )); - int no_sandbox = fd_env_strip_cmdline_contains( &argc, &argv, "--no-sandbox" ); int no_clone = fd_env_strip_cmdline_contains( &argc, &argv, "--no-clone" ); config.development.no_clone = config.development.no_clone || no_clone; @@ -202,6 +196,12 @@ fddev_main( int argc, if( FD_UNLIKELY( !action ) ) FD_LOG_ERR(( "unknown subcommand `%s`", action_name )); + int is_allowed_live = !strcmp( action->name, "flame" ) || !strcmp( action->name, "dump" ); + if( FD_UNLIKELY( config.is_live_cluster && !is_allowed_live ) ) + FD_LOG_ERR(( "The `fddev` command is for development and test environments but your " + "configuration targets a live cluster. Use `fdctl` if this is a " + "production environment" )); + args_t args = {0}; if( FD_LIKELY( action->args ) ) action->args( &argc, &argv, &args ); if( FD_UNLIKELY( argc ) ) FD_LOG_ERR(( "unknown argument `%s`", argv[ 0 ] ));