From 3e6148db2a42e2002173c2351d9dc8e8d1c959bb Mon Sep 17 00:00:00 2001 From: Anway De Date: Fri, 8 Dec 2023 03:25:33 +0000 Subject: [PATCH] fdctl: add ability to run a bootstrap validator --- src/app/fdctl/config.c | 1 + src/app/fdctl/config.h | 1 + src/app/fdctl/config/default.toml | 15 +++++++++++++++ src/app/fdctl/run/run.c | 5 +++-- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/app/fdctl/config.c b/src/app/fdctl/config.c index 14b0db8025..7d26a676d5 100644 --- a/src/app/fdctl/config.c +++ b/src/app/fdctl/config.c @@ -239,6 +239,7 @@ static int parse_key_value( config_t * config, ENTRY_BOOL ( ., development, sandbox ); ENTRY_BOOL ( ., development, no_solana_labs ); + ENTRY_BOOL ( ., development, bootstrap ); ENTRY_BOOL ( ., development.netns, enabled ); ENTRY_STR ( ., development.netns, interface0 ); diff --git a/src/app/fdctl/config.h b/src/app/fdctl/config.h index 42a3ced858..e2745b1a4a 100644 --- a/src/app/fdctl/config.h +++ b/src/app/fdctl/config.h @@ -131,6 +131,7 @@ typedef struct { struct { int sandbox; int no_solana_labs; + int bootstrap; uint debug_tile; struct { int enabled; diff --git a/src/app/fdctl/config/default.toml b/src/app/fdctl/config/default.toml index 94a7467d29..689dd8cbe9 100644 --- a/src/app/fdctl/config/default.toml +++ b/src/app/fdctl/config/default.toml @@ -843,6 +843,21 @@ dynamic_port_range = "8900-9000" # the `--no-solana-labs` argument to `fddev`. no_solana_labs = false + # Sometimes, it may be useful to run a bootstrap firedancer validator, + # either for development or for testing purposes. The `fddev` tool is + # provided for this purpose, which creates the bootstrap keys and does + # the cluster genesis using some parameters that are typically useful + # for development. + # + # Enabling this allows de-coupling the genesis and key creation from + # the validator startup. The bootstrap validator can then be started + # up with `fdctl`. It will expect the genesis to already exist at + # [ledger.path]. The keys used during genesis should be the same as + # the ones supplied in the [consensus.identity_path] and + # [consensus.vote_account_path]. This option will not be effective if + # [gossip.entrypoints] is non-empty. + bootstrap = false + # It can be convenient during development to use a network namespace # for running Firedancer. This allows us to send packets at a local # Firedancer instance and have them go through more of the kernel diff --git a/src/app/fdctl/run/run.c b/src/app/fdctl/run/run.c index 3fbb713051..66b909256c 100644 --- a/src/app/fdctl/run/run.c +++ b/src/app/fdctl/run/run.c @@ -456,11 +456,12 @@ run_cmd_fn( args_t * args, config_t * const config ) { (void)args; - if( FD_UNLIKELY( !config->gossip.entrypoints_cnt ) ) + if( FD_UNLIKELY( !config->gossip.entrypoints_cnt && !config->development.bootstrap ) ) FD_LOG_ERR(( "No entrypoints specified in configuration file under [gossip.entrypoints], but " "at least one is needed to determine how to connect to the Solana cluster. If " "you want to start a new cluster in a development environment, use `fddev` instead " - "of `fdctl`." )); + "of `fdctl`. If you want to use an existing genesis, set [development.bootstrap] " + "to \"true\" in the configuration file." )); for( ulong i=0; igossip.entrypoints_cnt; i++ ) { if( FD_UNLIKELY( !strcmp( config->gossip.entrypoints[ i ], "" ) ) )