forked from jito-foundation/jito-solana
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f277df0
commit 92a3e00
Showing
6 changed files
with
363 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
BANK_HASH=$(cargo run --release --bin solana-ledger-tool -- -l /mnt/ledger bank-hash) | ||
|
||
# increase max file handle limit | ||
ulimit -Hn 1000000 | ||
|
||
# if above fails, run: | ||
# sudo bash -c 'echo "* hard nofile 1000000" >> /etc/security/limits.conf' | ||
|
||
# NOTE: make sure tip-payment and tip-distribution program are deployed using the correct pubkeys | ||
# --relayer-url http://127.0.0.1:11226 \ | ||
RUST_LOG=INFO,solana_core::bundle_stage=DEBUG \ | ||
NDEBUG=1 ./multinode-demo/bootstrap-validator-mainnet.sh \ | ||
--wait-for-supermajority 0 \ | ||
--expected-bank-hash "$BANK_HASH" \ | ||
--rpc-pubsub-enable-block-subscription \ | ||
--enable-rpc-transaction-history \ | ||
--accounts /mnt/accounts \ | ||
--tip-payment-program-pubkey VKoeHPtSwCjT7BTiDPthiSUuz5LgpG2eUVp9apFH8Yy \ | ||
--tip-distribution-program-pubkey FD9k3t7HhDbpuhz6TKprwBW7S68zufyg8TnWhGVqwonk \ | ||
--commission-bps 0 \ | ||
--trust-relayer-packets \ | ||
--trust-block-engine-packets \ | ||
--limit-ledger-size 100000000 \ | ||
--enable-extended-tx-metadata-storage \ | ||
--log solana-validator.log \ | ||
--geyser-plugin-config geyser-config.json \ | ||
--expected-shred-version 28599 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,238 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Start the bootstrap validator node | ||
# | ||
set -e | ||
|
||
here=$(dirname "$0") | ||
# shellcheck source=multinode-demo/common.sh | ||
source "$here"/common.sh | ||
|
||
SOLANA_CONFIG_DIR=/mnt/ledger | ||
IDENTITY_DIR=/home/ubuntu/mantis/solana/config | ||
|
||
if [[ "$SOLANA_GPU_MISSING" -eq 1 ]]; then | ||
echo "Testnet requires GPUs, but none were found! Aborting..." | ||
exit 1 | ||
fi | ||
|
||
if [[ -n $SOLANA_CUDA ]]; then | ||
program=$solana_validator_cuda | ||
else | ||
program=$solana_validator | ||
fi | ||
|
||
no_restart=0 | ||
maybeRequireTower=true | ||
|
||
args=() | ||
while [[ -n $1 ]]; do | ||
if [[ ${1:0:1} = - ]]; then | ||
if [[ $1 = --init-complete-file ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 = --gossip-host ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 = --gossip-port ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 = --dev-halt-at-slot ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 = --dynamic-port-range ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 = --limit-ledger-size ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 = --no-rocksdb-compaction ]]; then | ||
args+=("$1") | ||
shift | ||
elif [[ $1 = --enable-rpc-transaction-history ]]; then | ||
args+=("$1") | ||
shift | ||
elif [[ $1 = --rpc-pubsub-enable-block-subscription ]]; then | ||
args+=("$1") | ||
shift | ||
elif [[ $1 = --enable-cpi-and-log-storage ]]; then | ||
args+=("$1") | ||
shift | ||
elif [[ $1 = --enable-extended-tx-metadata-storage ]]; then | ||
args+=("$1") | ||
shift | ||
elif [[ $1 = --enable-rpc-bigtable-ledger-storage ]]; then | ||
args+=("$1") | ||
shift | ||
elif [[ $1 = --tpu-disable-quic ]]; then | ||
args+=("$1") | ||
shift | ||
elif [[ $1 = --tpu-enable-udp ]]; then | ||
args+=("$1") | ||
shift | ||
elif [[ $1 = --rpc-send-batch-ms ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 = --rpc-send-batch-size ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 = --skip-poh-verify ]]; then | ||
args+=("$1") | ||
shift | ||
elif [[ $1 = --log ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 = --no-restart ]]; then | ||
no_restart=1 | ||
shift | ||
elif [[ $1 == --wait-for-supermajority ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 == --expected-bank-hash ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 == --accounts ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 == --maximum-snapshots-to-retain ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 == --no-snapshot-fetch ]]; then | ||
args+=("$1") | ||
shift | ||
elif [[ $1 == --accounts-db-skip-shrink ]]; then | ||
args+=("$1") | ||
shift | ||
elif [[ $1 == --skip-require-tower ]]; then | ||
maybeRequireTower=false | ||
shift | ||
elif [[ $1 == --relayer-url ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 == --block-engine-url ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 == --tip-payment-program-pubkey ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 == --tip-distribution-program-pubkey ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 == --commission-bps ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 == --shred-receiver-address ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 = --log-messages-bytes-limit ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 == --block-production-method ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 == --geyser-plugin-config ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 == --trust-relayer-packets ]]; then | ||
args+=("$1") | ||
shift | ||
elif [[ $1 == --rpc-threads ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
elif [[ $1 == --trust-block-engine-packets ]]; then | ||
args+=("$1") | ||
shift | ||
elif [[ $1 == --expected-shred-version ]]; then | ||
args+=("$1" "$2") | ||
shift 2 | ||
else | ||
echo "Unknown argument: $1" | ||
$program --help | ||
exit 1 | ||
fi | ||
else | ||
echo "Unknown argument: $1" | ||
$program --help | ||
exit 1 | ||
fi | ||
done | ||
|
||
# These keypairs are created by ./setup.sh and included in the genesis config | ||
identity="$IDENTITY_DIR"/identity.json | ||
vote_account="$IDENTITY_DIR"/vote-account.json | ||
|
||
ledger_dir="$SOLANA_CONFIG_DIR"/bootstrap-validator | ||
|
||
[[ -d "$ledger_dir" ]] || { | ||
echo "$ledger_dir does not exist" | ||
echo | ||
echo "Please run: $here/setup-mainnet.sh" | ||
exit 1 | ||
} | ||
|
||
if [[ $maybeRequireTower = true ]]; then | ||
args+=(--require-tower) | ||
fi | ||
|
||
args+=( | ||
--ledger "$ledger_dir" | ||
--rpc-port 8899 | ||
--snapshot-interval-slots 200 | ||
--no-incremental-snapshots | ||
--identity "$identity" | ||
--vote-account "$vote_account" | ||
--merkle-root-upload-authority "$identity" | ||
--rpc-faucet-address 127.0.0.1:9900 | ||
--no-poh-speed-test | ||
--no-os-network-limits-test | ||
--no-wait-for-vote-to-start-leader | ||
--full-rpc-api | ||
--allow-private-addr | ||
) | ||
default_arg --gossip-port 8001 | ||
default_arg --log - | ||
#default_arg --tip-payment-program-pubkey "DThZmRNNXh7kvTQW9hXeGoWGPKktK8pgVAyoTLjH7UrT" | ||
#default_arg --tip-distribution-program-pubkey "FjrdANjvo76aCYQ4kf9FM1R8aESUcEE6F8V7qyoVUQcM" | ||
default_arg --commission-bps 0 | ||
|
||
pid= | ||
kill_node() { | ||
# Note: do not echo anything from this function to ensure $pid is actually | ||
# killed when stdout/stderr are redirected | ||
set +ex | ||
if [[ -n $pid ]]; then | ||
declare _pid=$pid | ||
pid= | ||
kill "$_pid" || true | ||
wait "$_pid" || true | ||
fi | ||
} | ||
|
||
kill_node_and_exit() { | ||
kill_node | ||
exit | ||
} | ||
|
||
trap 'kill_node_and_exit' INT TERM ERR | ||
|
||
while true; do | ||
echo "$program ${args[*]}" | ||
$program "${args[@]}" & | ||
pid=$! | ||
echo "pid: $pid" | ||
|
||
if ((no_restart)); then | ||
wait "$pid" | ||
exit $? | ||
fi | ||
|
||
while true; do | ||
if [[ -z $pid ]] || ! kill -0 "$pid"; then | ||
echo "############## validator exited, restarting ##############" | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
|
||
kill_node | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Starts an instance of solana-faucet | ||
# | ||
here=$(dirname "$0") | ||
|
||
# shellcheck source=multinode-demo/common.sh | ||
source "$here"/common.sh | ||
SOLANA_CONFIG_DIR=/mnt/ledger | ||
|
||
[[ -f "$SOLANA_CONFIG_DIR"/faucet.json ]] || { | ||
echo "$SOLANA_CONFIG_DIR/faucet.json not found, create it by running:" | ||
echo | ||
echo " ${here}/setup.sh" | ||
exit 1 | ||
} | ||
|
||
set -x | ||
# shellcheck disable=SC2086 # Don't want to double quote $solana_faucet | ||
exec $solana_faucet --keypair "$SOLANA_CONFIG_DIR"/faucet.json "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env bash | ||
|
||
here=$(dirname "$0") | ||
# shellcheck source=multinode-demo/common.sh | ||
source "$here"/common.sh | ||
|
||
set -e | ||
|
||
rm -rf "$SOLANA_CONFIG_DIR"/bootstrap-validator | ||
mkdir -p "$SOLANA_CONFIG_DIR"/bootstrap-validator | ||
|
||
# Create genesis ledger | ||
if [[ -r $FAUCET_KEYPAIR ]]; then | ||
cp -f "$FAUCET_KEYPAIR" "$SOLANA_CONFIG_DIR"/faucet.json | ||
else | ||
$solana_keygen new --no-passphrase -fso "$SOLANA_CONFIG_DIR"/faucet.json | ||
fi | ||
|
||
if [[ -f $BOOTSTRAP_VALIDATOR_IDENTITY_KEYPAIR ]]; then | ||
cp -f "$BOOTSTRAP_VALIDATOR_IDENTITY_KEYPAIR" "$SOLANA_CONFIG_DIR"/bootstrap-validator/identity.json | ||
else | ||
$solana_keygen new --no-passphrase -so "$SOLANA_CONFIG_DIR"/bootstrap-validator/identity.json | ||
fi | ||
if [[ -f $BOOTSTRAP_VALIDATOR_STAKE_KEYPAIR ]]; then | ||
cp -f "$BOOTSTRAP_VALIDATOR_STAKE_KEYPAIR" "$SOLANA_CONFIG_DIR"/bootstrap-validator/stake-account.json | ||
else | ||
$solana_keygen new --no-passphrase -so "$SOLANA_CONFIG_DIR"/bootstrap-validator/stake-account.json | ||
fi | ||
if [[ -f $BOOTSTRAP_VALIDATOR_VOTE_KEYPAIR ]]; then | ||
cp -f "$BOOTSTRAP_VALIDATOR_VOTE_KEYPAIR" "$SOLANA_CONFIG_DIR"/bootstrap-validator/vote-account.json | ||
else | ||
$solana_keygen new --no-passphrase -so "$SOLANA_CONFIG_DIR"/bootstrap-validator/vote-account.json | ||
fi | ||
|
||
args=( | ||
"$@" | ||
--max-genesis-archive-unpacked-size 1073741824 | ||
--enable-warmup-epochs | ||
--bootstrap-validator "$SOLANA_CONFIG_DIR"/bootstrap-validator/identity.json | ||
"$SOLANA_CONFIG_DIR"/bootstrap-validator/vote-account.json | ||
"$SOLANA_CONFIG_DIR"/bootstrap-validator/stake-account.json | ||
) | ||
|
||
"$SOLANA_ROOT"/fetch-spl.sh | ||
if [[ -r spl-genesis-args.sh ]]; then | ||
SPL_GENESIS_ARGS=$(cat "$SOLANA_ROOT"/spl-genesis-args.sh) | ||
#shellcheck disable=SC2207 | ||
#shellcheck disable=SC2206 | ||
args+=($SPL_GENESIS_ARGS) | ||
fi | ||
|
||
"$SOLANA_ROOT"/fetch-metaplex.sh | ||
if [[ -r metaplex-genesis-args.sh ]]; then | ||
METAPLEX_GENESIS_ARGS=$(cat "$SOLANA_ROOT"/metaplex-genesis-args.sh) | ||
#shellcheck disable=SC2207 | ||
#shellcheck disable=SC2206 | ||
args+=($METAPLEX_GENESIS_ARGS) | ||
fi | ||
|
||
default_arg --ledger "$SOLANA_CONFIG_DIR"/bootstrap-validator | ||
default_arg --faucet-pubkey "$SOLANA_CONFIG_DIR"/faucet.json | ||
default_arg --faucet-lamports 500000000000000000 | ||
default_arg --hashes-per-tick auto | ||
default_arg --cluster-type development | ||
|
||
$solana_genesis "${args[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
SOLANA_CONFIG_DIR=/mnt/ledger | ||
|
||
mkdir -p $SOLANA_CONFIG_DIR | ||
NDEBUG=1 ./multinode-demo/setup-mainnet.sh | ||
cargo run --release --bin solana-ledger-tool -- -l /mnt/ledger/config/bootstrap-validator/ create-snapshot 0 |