This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
Copy pathremote-sanity.sh
executable file
·139 lines (118 loc) · 2.76 KB
/
remote-sanity.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/usr/bin/env bash
set -e
#
# This script is to be run on the bootstrap validator
#
cd "$(dirname "$0")"/../..
sanityTargetIp="$1"
shift
deployMethod=
entrypointIp=
numNodes=
failOnValidatorBootupFailure=
airdropsEnabled=true
[[ -r deployConfig ]] || {
echo deployConfig missing
exit 1
}
# shellcheck source=/dev/null # deployConfig is written by remote-node.sh
source deployConfig
missing() {
echo "Error: $1 not specified"
exit 1
}
[[ -n $sanityTargetIp ]] || missing sanityTargetIp
[[ -n $deployMethod ]] || missing deployMethod
[[ -n $entrypointIp ]] || missing entrypointIp
[[ -n $numNodes ]] || missing numNodes
[[ -n $failOnValidatorBootupFailure ]] || missing failOnValidatorBootupFailure
installCheck=true
rejectExtraNodes=false
while [[ $1 = -o ]]; do
opt="$2"
shift 2
case $opt in
noInstallCheck)
installCheck=false
;;
rejectExtraNodes)
rejectExtraNodes=true
;;
*)
echo "Error: unknown option: $opt"
exit 1
;;
esac
done
if [[ -n $1 ]]; then
export RUST_LOG="$1"
fi
source net/common.sh
loadConfigFile
case $deployMethod in
local|tar|skip)
PATH="$HOME"/.cargo/bin:"$PATH"
export USE_INSTALL=1
solana_cli=solana
solana_gossip=solana-gossip
solana_install=solana-install
;;
*)
echo "Unknown deployment method: $deployMethod"
exit 1
esac
if $failOnValidatorBootupFailure; then
numSanityNodes="$numNodes"
else
numSanityNodes=1
if $rejectExtraNodes; then
echo "rejectExtraNodes cannot be used with failOnValidatorBootupFailure"
exit 1
fi
fi
echo "+++ $sanityTargetIp: validators"
(
set -x
$solana_cli --url http://"$sanityTargetIp":8899 show-validators
)
echo "+++ $sanityTargetIp: node count ($numSanityNodes expected)"
(
set -x
nodeArg="num-nodes"
if $rejectExtraNodes; then
nodeArg="num-nodes-exactly"
fi
$solana_gossip spy --entrypoint "$sanityTargetIp:8001" \
--$nodeArg "$numSanityNodes" --timeout 60 \
)
echo "--- $sanityTargetIp: RPC API: getTransactionCount"
(
set -x
curl --retry 5 --retry-delay 2 --retry-connrefused \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' \
http://"$sanityTargetIp":8899
)
if [[ "$airdropsEnabled" = true ]]; then
echo "--- $sanityTargetIp: wallet sanity"
(
set -x
scripts/wallet-sanity.sh --url http://"$sanityTargetIp":8899
)
else
echo "^^^ +++"
echo "Note: wallet sanity is disabled as airdrops are disabled"
fi
if $installCheck && [[ -r update_manifest_keypair.json ]]; then
echo "--- $sanityTargetIp: solana-install test"
(
set -x
rm -rf install-data-dir
$solana_install init \
--no-modify-path \
--data-dir install-data-dir \
--url http://"$sanityTargetIp":8899 \
$solana_install info
)
fi
echo --- Pass