Skip to content

Commit

Permalink
support authorized voter keypairs
Browse files Browse the repository at this point in the history
  • Loading branch information
anwayde committed Aug 5, 2024
1 parent 00a4ef0 commit 9b8f5b6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/app/fdctl/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ fdctl_cfg_from_env( int * pargc,
replace( config->consensus.vote_account_path, "{user}", config->user );
replace( config->consensus.vote_account_path, "{name}", config->name );

for( ulong i=0UL; i<config->consensus.authorized_voter_paths_cnt; i++ ) {
replace( config->consensus.authorized_voter_paths[ i ], "{user}", config->user );
replace( config->consensus.authorized_voter_paths[ i ], "{name}", config->name );
}

if( FD_UNLIKELY( config->is_live_cluster && cluster!=FD_CONFIG_CLUSTER_TESTNET ) )
FD_LOG_ERR(( "Attempted to start against live cluster `%s`. Firedancer is not "
"ready for production deployment, has not been tested, and is "
Expand Down
2 changes: 2 additions & 0 deletions src/app/fdctl/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ typedef struct {
int vote;
char identity_path[ PATH_MAX ];
char vote_account_path[ PATH_MAX ];
ulong authorized_voter_paths_cnt;
char authorized_voter_paths[ 16 ][ PATH_MAX ];
int snapshot_fetch;
int genesis_fetch;
int poh_speed_test;
Expand Down
14 changes: 14 additions & 0 deletions src/app/fdctl/config/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,20 @@ dynamic_port_range = "8900-9000"
# `--vote-account` argument.
vote_account_path = ""

# List of absolute paths to authorized-voter keypairs for the vote
# account. This is not needed if no vote account is specified.
# If a vote account is specified and this is empty, the identity
# account will be used as the authorized-voter account.
#
# Two substitutions will be performed on each string in this list.
# If "{user}" is present it will be replaced with the user running
# Firedancer, as above, and "{name}" will be replaced with the
# name of the Firedancer instance.
#
# These options are passed to the Agave client with the
# `--authorized-voter` argument.
authorized_voter_paths = []

# If false, do not attempt to fetch a snapshot from the cluster,
# instead start from a local snapshot if one is present. A snapshot
# is required to run the validator, so either one must be present,
Expand Down
1 change: 1 addition & 0 deletions src/app/fdctl/config_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ fdctl_pod_to_cfg( config_t * config,

CFG_POP ( cstr, consensus.identity_path );
CFG_POP ( cstr, consensus.vote_account_path );
CFG_POP_ARRAY( cstr, consensus.authorized_voter_paths );
CFG_POP ( bool, consensus.snapshot_fetch );
CFG_POP ( bool, consensus.genesis_fetch );
CFG_POP ( bool, consensus.poh_speed_test );
Expand Down
8 changes: 5 additions & 3 deletions src/app/fdctl/run/run_agave.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ agave_boot( config_t * config ) {
ADD( "--identity", config->consensus.identity_path );
if( strcmp( config->consensus.vote_account_path, "" ) )
ADD( "--vote-account", config->consensus.vote_account_path );
for( ulong i=0UL; i<config->consensus.authorized_voter_paths_cnt; i++ )
ADD( "--authorized-voter", config->consensus.authorized_voter_paths[ i ] );
if( !config->consensus.snapshot_fetch ) ADD1( "--no-snapshot-fetch" );
if( !config->consensus.genesis_fetch ) ADD1( "--no-genesis-fetch" );
if( !config->consensus.poh_speed_test ) ADD1( "--no-poh-speed-test" );
Expand Down Expand Up @@ -95,13 +97,13 @@ agave_boot( config_t * config ) {
ADD( "--ledger", config->ledger.path );
if( strcmp( "", config->ledger.accounts_path ) ) ADD( "--accounts", config->ledger.accounts_path );
ADDU( "--limit-ledger-size", config->ledger.limit_size );
for( ulong i=0; i<config->ledger.account_indexes_cnt; i++ )
for( ulong i=0UL; i<config->ledger.account_indexes_cnt; i++ )
ADD( "--account-index", config->ledger.account_indexes[ i ] );
for( ulong i=0; i<config->ledger.account_index_exclude_keys_cnt; i++ )
for( ulong i=0UL; i<config->ledger.account_index_exclude_keys_cnt; i++ )
ADD( "--account-index-exclude-key", config->ledger.account_index_exclude_keys[ i ] );

/* gossip */
for( ulong i=0; i<config->gossip.entrypoints_cnt; i++ ) ADD( "--entrypoint", config->gossip.entrypoints[ i ] );
for( ulong i=0UL; i<config->gossip.entrypoints_cnt; i++ ) ADD( "--entrypoint", config->gossip.entrypoints[ i ] );
if( !config->gossip.port_check ) ADD1( "--no-port-check" );
ADDH( "--gossip-port", config->gossip.port );
char ip_addr[16]; /* ADD stored the address for later use, so ip_addr must be in scope */
Expand Down

0 comments on commit 9b8f5b6

Please sign in to comment.