From 1c765124e7c739326d77f44b09d6c5977374c35e Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Thu, 6 Jun 2019 14:51:48 -0700 Subject: [PATCH] Clean up .configured flag handling to work with an external identity keypair (#4579) automerge --- book/src/testnet-participation.md | 11 ++++++----- multinode-demo/fullnode.sh | 14 ++++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/book/src/testnet-participation.md b/book/src/testnet-participation.md index 043526c8b2..8d41875ca0 100644 --- a/book/src/testnet-participation.md +++ b/book/src/testnet-participation.md @@ -119,7 +119,8 @@ $ solana-gossip --entrypoint testnet.solana.com:8001 spy Now configure a key pair for your validator by running: ```bash -$ solana-keygen -o validator-keypair.json +$ solana-keygen -o ~/validator-keypair.json +$ solana-keygen pubkey ~/validator-keypair.json ``` Then use one of the following commands, depending on your installation @@ -128,20 +129,20 @@ choice, to start the node: If this is a `solana-install`-installation: ```bash $ clear-config.sh -$ validator.sh --identity validator-keypair.json --poll-for-new-genesis-block testnet.solana.com +$ validator.sh --identity ~/validator-keypair.json --poll-for-new-genesis-block testnet.solana.com ``` Alternatively, the `solana-install run` command can be used to run the validator node while periodically checking for and applying software updates: ```bash $ clear-config.sh -$ solana-install run validator.sh -- --identity validator-keypair.json --poll-for-new-genesis-block testnet.solana.com +$ solana-install run validator.sh -- --identity ~/validator-keypair.json --poll-for-new-genesis-block testnet.solana.com ``` If you built from source: ```bash $ USE_INSTALL=1 ./multinode-demo/clear-config.sh -$ USE_INSTALL=1 ./multinode-demo/validator.sh --identity validator-keypair.json --poll-for-new-genesis-block testnet.solana.com +$ USE_INSTALL=1 ./multinode-demo/validator.sh --identity ~/validator-keypair.json --poll-for-new-genesis-block testnet.solana.com ``` #### Controlling local network port allocation @@ -164,7 +165,7 @@ accounts: ... The **identity pubkey** for your validator can also be found by running: ```bash -$ solana-keygen pubkey validator-keypair.json +$ solana-keygen pubkey ~/validator-keypair.json ``` From another console, confirm the IP address and **identity pubkey** of your validator is visible in the diff --git a/multinode-demo/fullnode.sh b/multinode-demo/fullnode.sh index 8f4701dd4a..a59c3ae8f8 100755 --- a/multinode-demo/fullnode.sh +++ b/multinode-demo/fullnode.sh @@ -94,7 +94,7 @@ setup_validator_accounts() { declare storage_pubkey storage_pubkey=$($solana_keygen pubkey "$storage_keypair_path") - if [[ -f "$node_keypair_path".configured ]]; then + if [[ -f $configured_flag ]]; then echo "Vote and stake accounts have already been configured" else # Fund the node with enough tokens to fund its Vote, Staking, and Storage accounts @@ -118,7 +118,7 @@ setup_validator_accounts() { $solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \ create-validator-storage-account "$node_pubkey" "$storage_pubkey" || return $? - touch "$node_keypair_path".configured + touch "$configured_flag" fi $solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \ @@ -146,7 +146,7 @@ setup_replicator_account() { declare storage_pubkey storage_pubkey=$($solana_keygen pubkey "$storage_keypair_path") - if [[ -f "$node_keypair_path".configured ]]; then + if [[ -f $configured_flag ]]; then echo "Replicator account has already been configured" else $solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" airdrop "$node_lamports" || return $? @@ -155,7 +155,7 @@ setup_replicator_account() { $solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \ create-replicator-storage-account "$node_pubkey" "$storage_pubkey" || return $? - touch "$node_keypair_path".configured + touch "$configured_flag" fi $solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \ @@ -257,6 +257,7 @@ if [[ $node_type = replicator ]]; then : "${identity_keypair_path:=$SOLANA_CONFIG_DIR/replicator-keypair$label.json}" storage_keypair_path="$SOLANA_CONFIG_DIR"/replicator-storage-keypair$label.json ledger_config_dir=$SOLANA_CONFIG_DIR/replicator-ledger$label + configured_flag=$SOLANA_CONFIG_DIR/replicator$label.configured mkdir -p "$SOLANA_CONFIG_DIR" [[ -r "$identity_keypair_path" ]] || $solana_keygen -o "$identity_keypair_path" @@ -294,6 +295,7 @@ elif [[ $node_type = bootstrap_leader ]]; then ledger_config_dir="$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger accounts_config_dir="$SOLANA_CONFIG_DIR"/bootstrap-leader-accounts storage_keypair_path=$SOLANA_CONFIG_DIR/bootstrap-leader-storage-keypair.json + configured_flag=$SOLANA_CONFIG_DIR/bootstrap-leader.configured default_arg --rpc-port 8899 default_arg --rpc-drone-address 127.0.0.1:9900 @@ -313,6 +315,7 @@ elif [[ $node_type = validator ]]; then storage_keypair_path=$SOLANA_CONFIG_DIR/validator-storage-keypair$label.json ledger_config_dir=$SOLANA_CONFIG_DIR/validator-ledger$label accounts_config_dir=$SOLANA_CONFIG_DIR/validator-accounts$label + configured_flag=$SOLANA_CONFIG_DIR/validator$label.configured mkdir -p "$SOLANA_CONFIG_DIR" [[ -r "$identity_keypair_path" ]] || $solana_keygen -o "$identity_keypair_path" @@ -383,8 +386,7 @@ while true; do # keypair for the node and start all over again ( set -x - rm -rf "$ledger_config_dir" "$accounts_config_dir" \ - "$vote_keypair_path".configured "$storage_keypair_path".configured + rm -rf "$ledger_config_dir" "$accounts_config_dir" "$configured_flag" ) fi