Skip to content

Commit

Permalink
Add net/ support for reusable identity keypairs (solana-labs#6783)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines authored Nov 7, 2019
1 parent e420800 commit 87ba66b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 9 deletions.
5 changes: 5 additions & 0 deletions ci/testnet-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ trap shutdown EXIT INT

set -x

# Fetch reusable testnet keypairs
if [[ ! -d net/keypairs ]]; then
git clone [email protected]:solana-labs/testnet-keypairs.git net/keypairs
fi

# Build a string to pass zone opts to $cloudProvider.sh: "-z zone1 -z zone2 ..."
zone_args=()
for val in "${zone[@]}"; do
Expand Down
13 changes: 11 additions & 2 deletions multinode-demo/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,18 @@ rm -rf "$SOLANA_CONFIG_DIR"/bootstrap-leader
mkdir -p "$SOLANA_CONFIG_DIR"/bootstrap-leader

# Create genesis ledger
$solana_keygen new -f -o "$SOLANA_CONFIG_DIR"/mint-keypair.json
if [[ -r $MINT_KEYPAIR ]]; then
cp -f "$MINT_KEYPAIR" "$SOLANA_CONFIG_DIR"/mint-keypair.json
else
$solana_keygen new -f -o "$SOLANA_CONFIG_DIR"/mint-keypair.json
fi

if [[ -f $BOOTSTRAP_LEADER_IDENTITY_KEYPAIR ]]; then
cp -f "$BOOTSTRAP_LEADER_IDENTITY_KEYPAIR" "$SOLANA_CONFIG_DIR"/bootstrap-leader/identity-keypair.json
else
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/bootstrap-leader/identity-keypair.json
fi

$solana_keygen new -o "$SOLANA_CONFIG_DIR"/bootstrap-leader/identity-keypair.json
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/bootstrap-leader/vote-keypair.json
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/bootstrap-leader/stake-keypair.json
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/bootstrap-leader/storage-keypair.json
Expand Down
40 changes: 33 additions & 7 deletions net/remote/remote-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,31 @@ EOF

if [[ -n $internalNodesLamports ]]; then
echo "---" >> config/validator-balances.yml
for i in $(seq 0 "$numNodes"); do
solana-keygen new -o config/validator-"$i"-identity.json
pubkey="$(solana-keygen pubkey config/validator-"$i"-identity.json)"
fi

setupValidatorKeypair() {
declare name=$1
if [[ -f net/keypairs/"$name".json ]]; then
cp net/keypairs/"$name".json config/"$name".json
else
solana-keygen new -o config/"$name".json
fi
if [[ -n $internalNodesLamports ]]; then
declare pubkey
pubkey="$(solana-keygen pubkey config/"$name".json)"
cat >> config/validator-balances.yml <<EOF
$pubkey:
balance: $internalNodesLamports
owner: 11111111111111111111111111111111
data:
executable: false
EOF
done
fi
fi
}
for i in $(seq 1 "$numNodes"); do
setupValidatorKeypair validator-identity-"$i"
done
setupValidatorKeypair blockstreamer-identity

lamports_per_signature="42"
# shellcheck disable=SC2206 # Do not want to quote $genesisOptions
Expand Down Expand Up @@ -219,6 +232,13 @@ EOF
fi
# shellcheck disable=SC2206 # Do not want to quote $genesisOptions
args+=($genesisOptions)

if [[ -f net/keypairs/mint.json ]]; then
export MINT_KEYPAIR=net/keypairs/mint.json
fi
if [[ -f net/keypairs/bootstrap-leader-identity.json ]]; then
export BOOTSTRAP_LEADER_IDENTITY_KEYPAIR=net/keypairs/bootstrap-leader-identity.json
fi
multinode-demo/setup.sh "${args[@]}"
fi
args=(
Expand Down Expand Up @@ -256,8 +276,14 @@ EOF
fi
if [[ $skipSetup != true ]]; then
clear_config_dir "$SOLANA_CONFIG_DIR"
[[ -z $internalNodesLamports ]] || net/scripts/rsync-retry.sh -vPrc \
"$entrypointIp":~/solana/config/validator-"$nodeIndex"-identity.json config/validator-identity.json

if [[ $nodeType = blockstreamer ]]; then
net/scripts/rsync-retry.sh -vPrc \
"$entrypointIp":~/solana/config/blockstreamer-identity.json config/validator-identity.json
else
net/scripts/rsync-retry.sh -vPrc \
"$entrypointIp":~/solana/config/validator-identity-"$nodeIndex".json config/validator-identity.json
fi
fi

args=(
Expand Down

0 comments on commit 87ba66b

Please sign in to comment.