Add net/ support for reusable identity keypairs (#6783)
This commit is contained in:
parent
e420800aeb
commit
87ba66b6d0
|
@ -262,6 +262,11 @@ trap shutdown EXIT INT
|
|||
|
||||
set -x
|
||||
|
||||
# Fetch reusable testnet keypairs
|
||||
if [[ ! -d net/keypairs ]]; then
|
||||
git clone git@github.com: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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -163,9 +163,18 @@ 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
|
||||
|
@ -173,8 +182,12 @@ $pubkey:
|
|||
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
|
||||
|
@ -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=(
|
||||
|
@ -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=(
|
||||
|
|
Loading…
Reference in New Issue