2018-11-11 08:19:04 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#!/usr/bin/env bash
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set -e
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-03 18:15:55 -10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-04 09:21:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								cd "$(dirname "$0")"/../..
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-05 16:40:08 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								set -x
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-03 18:15:55 -10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								deployMethod="$1"
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-04 16:42:04 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								nodeType="$2"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								entrypointIp="$3"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								numNodes="$4"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								if [[ -n $5 ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  export RUST_LOG="$5"
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-31 10:13:30 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-04 16:42:04 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								skipSetup="$6"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								failOnValidatorBootupFailure="$7"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								externalPrimordialAccountsFile="$8"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								maybeDisableAirdrops="$9"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								internalNodesStakeLamports="${10}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								internalNodesLamports="${11}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								nodeIndex="${12}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								numBenchTpsClients="${13}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								benchTpsExtraArgs="${14}"
							 | 
						
					
						
							
								
									
										
										
										
											2021-07-12 21:59:11 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								genesisOptions="${15}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								extraNodeArgs="${16}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								gpuMode="${17:-auto}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								maybeWarpSlot="${18}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								waitForNodeInit="${19}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								extraPrimordialStakes="${20:=0}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								tmpfsAccounts="${21:false}"
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-05 16:40:08 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								set +x
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-04 09:21:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-07 08:46:20 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								missing() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  echo "Error: $1 not specified"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  exit 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[[ -n $deployMethod ]]  || missing deployMethod
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[[ -n $nodeType ]]      || missing nodeType
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[[ -n $entrypointIp ]]  || missing entrypointIp
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[[ -n $numNodes ]]      || missing numNodes
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-09 17:28:18 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								[[ -n $skipSetup ]]     || missing skipSetup
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-29 21:38:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								[[ -n $failOnValidatorBootupFailure ]] || missing failOnValidatorBootupFailure
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-04 22:21:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-17 18:15:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								airdropsEnabled=true
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-19 12:51:38 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if [[ -n $maybeDisableAirdrops ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-17 18:15:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  airdropsEnabled=false
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-04 09:21:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								cat > deployConfig <<EOF
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								deployMethod="$deployMethod"
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-04 22:21:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								entrypointIp="$entrypointIp"
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-04 09:21:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								numNodes="$numNodes"
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-29 21:38:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								failOnValidatorBootupFailure=$failOnValidatorBootupFailure
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-18 14:01:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								genesisOptions="$genesisOptions"
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-17 18:15:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								airdropsEnabled=$airdropsEnabled
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-04 09:21:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								EOF
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-03 18:15:55 -10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								source net/common.sh
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-17 15:44:45 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								source multinode-demo/common.sh
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-03 18:15:55 -10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								loadConfigFile
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-13 19:37:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								initCompleteFile=init-complete-node.log
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 12:30:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								cat > ~/solana/on-reboot <<EOF
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#!/usr/bin/env bash
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								cd ~/solana
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								source scripts/oom-score-adj.sh
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-04 07:58:33 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								now=\$(date -u +"%Y-%m-%dT%H:%M:%SZ")
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 21:21:21 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								ln -sfT validator.log.\$now validator.log
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 12:30:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								EOF
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								chmod +x ~/solana/on-reboot
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-14 10:33:32 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								GPU_CUDA_OK=false
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								GPU_FAIL_IF_NONE=false
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								case "$gpuMode" in
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  on) # GPU *required*, any vendor
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    GPU_CUDA_OK=true
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    GPU_FAIL_IF_NONE=true
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  off) # CPU-only
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  auto) # Use GPU if installed, any vendor
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    GPU_CUDA_OK=true
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  cuda) # GPU *required*, CUDA-only
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    GPU_CUDA_OK=true
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    GPU_FAIL_IF_NONE=true
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  *)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    echo "Unexpected gpuMode: \"$gpuMode\""
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    exit 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								esac
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-03 18:15:55 -10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								case $deployMethod in
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-22 21:38:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								local|tar|skip)
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-03 18:15:55 -10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  PATH="$HOME"/.cargo/bin:"$PATH"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  export USE_INSTALL=1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  ./fetch-perf-libs.sh
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 12:30:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								cat >> ~/solana/on-reboot <<EOF
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  PATH="$HOME"/.cargo/bin:"$PATH"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  export USE_INSTALL=1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-04 11:39:26 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  sudo RUST_LOG=info ~solana/.cargo/bin/solana-sys-tuner --user $(whoami) > sys-tuner.log 2>&1 &
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-02 16:46:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  echo \$! > sys-tuner.pid
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-23 22:12:58 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  (
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-10 20:11:55 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    sudo SOLANA_METRICS_CONFIG="$SOLANA_METRICS_CONFIG" scripts/oom-monitor.sh
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-23 22:12:58 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ) > oom-monitor.log 2>&1 &
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-19 08:31:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  echo \$! > oom-monitor.pid
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-26 15:17:19 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  scripts/fd-monitor.sh > fd-monitor.log 2>&1 &
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-19 08:31:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  echo \$! > fd-monitor.pid
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-10 15:52:08 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  scripts/net-stats.sh  > net-stats.log 2>&1 &
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-19 08:31:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  echo \$! > net-stats.pid
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-26 00:06:46 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  scripts/iftop.sh  > iftop.log 2>&1 &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  echo \$! > iftop.pid
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-14 20:36:34 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  scripts/system-stats.sh  > system-stats.log 2>&1 &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  echo \$! > system-stats.pid
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-03 18:15:55 -10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-14 10:33:32 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if ${GPU_CUDA_OK} && [[ -e /dev/nvidia0 ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 12:30:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    echo Selecting solana-validator-cuda
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    export SOLANA_CUDA=1
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-14 10:33:32 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  elif ${GPU_FAIL_IF_NONE} ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    echo "Expected GPU, found none!"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    export SOLANA_GPU_MISSING=1
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 12:30:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								EOF
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-03 18:15:55 -10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  case $nodeType in
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-22 09:22:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  bootstrap-validator)
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 10:50:43 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    set -x
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-22 21:38:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [[ $skipSetup != true ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-17 15:44:45 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      clear_config_dir "$SOLANA_CONFIG_DIR"
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-19 08:31:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-22 21:38:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ -n $internalNodesLamports ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 21:21:21 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        echo "---" >> config/validator-balances.yml
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-06 21:14:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      setupValidatorKeypair() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        declare name=$1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if [[ -f net/keypairs/"$name".json ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          cp net/keypairs/"$name".json config/"$name".json
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-03 18:50:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          if [[ "$name" =~ ^validator-identity- ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            name="${name//-identity-/-vote-}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            cp net/keypairs/"$name".json config/"$name".json
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            name="${name//-vote-/-stake-}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            cp net/keypairs/"$name".json config/"$name".json
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-06 21:14:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        else
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-25 23:33:15 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          solana-keygen new --no-passphrase -so config/"$name".json
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-03 18:50:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          if [[ "$name" =~ ^validator-identity- ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            name="${name//-identity-/-vote-}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            solana-keygen new --no-passphrase -so config/"$name".json
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            name="${name//-vote-/-stake-}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            solana-keygen new --no-passphrase -so config/"$name".json
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-06 21:14:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if [[ -n $internalNodesLamports ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          declare pubkey
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          pubkey="$(solana-keygen pubkey config/"$name".json)"
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 21:21:21 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          cat >> config/validator-balances.yml <<EOF
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 04:47:10 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								$pubkey:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  balance: $internalNodesLamports
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  owner: 11111111111111111111111111111111
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  data:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  executable: false
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								EOF
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-06 21:14:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      for i in $(seq 1 "$numNodes"); do
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        setupValidatorKeypair validator-identity-"$i"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      done
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      setupValidatorKeypair blockstreamer-identity
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-22 21:38:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      lamports_per_signature="42"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      # shellcheck disable=SC2206 # Do not want to quote $genesisOptions
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      genesis_args=($genesisOptions)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      for i in "${!genesis_args[@]}"; do
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if [[ "${genesis_args[$i]}" = --target-lamports-per-signature ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          lamports_per_signature="${genesis_args[$((i+1))]}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          break
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-10 19:42:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      done
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-18 14:44:53 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-22 21:38:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      for i in $(seq 0 $((numBenchTpsClients-1))); do
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # shellcheck disable=SC2086 # Do not want to quote $benchTpsExtraArgs
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-19 08:31:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        solana-bench-tps --write-client-keys config/bench-tps"$i".yml \
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-22 21:38:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          --target-lamports-per-signature "$lamports_per_signature" $benchTpsExtraArgs
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # Skip first line, as it contains header
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-19 08:31:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        tail -n +2 -q config/bench-tps"$i".yml >> config/client-accounts.yml
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        echo "" >> config/client-accounts.yml
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-22 21:38:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      done
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-19 08:31:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ -f $externalPrimordialAccountsFile ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 21:21:21 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        cat "$externalPrimordialAccountsFile" >> config/validator-balances.yml
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-19 08:31:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 21:21:21 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ -f config/validator-balances.yml ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        genesisOptions+=" --primordial-accounts-file config/validator-balances.yml"
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-18 14:44:53 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-19 08:31:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ -f config/client-accounts.yml ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-06 11:18:25 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        genesisOptions+=" --primordial-accounts-file config/client-accounts.yml"
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-22 21:38:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 13:51:19 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ -n $internalNodesStakeLamports ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-22 09:22:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        args+=(--bootstrap-validator-stake-lamports "$internalNodesStakeLamports")
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 13:51:19 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-29 21:25:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ -n $internalNodesLamports ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-22 09:22:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        args+=(--bootstrap-validator-lamports "$internalNodesLamports")
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-29 21:25:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-18 14:01:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      # shellcheck disable=SC2206 # Do not want to quote $genesisOptions
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      args+=($genesisOptions)
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-06 21:14:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-31 12:14:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ -f net/keypairs/faucet.json ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        export FAUCET_KEYPAIR=net/keypairs/faucet.json
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-06 21:14:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-22 09:22:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ -f net/keypairs/bootstrap-validator-identity.json ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        export BOOTSTRAP_VALIDATOR_IDENTITY_KEYPAIR=net/keypairs/bootstrap-validator-identity.json
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-06 21:14:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-23 13:01:00 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      echo "remote-node.sh: Primordial stakes: $extraPrimordialStakes"
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-03 18:50:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ "$extraPrimordialStakes" -gt 0 ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if [[ "$extraPrimordialStakes" -gt "$numNodes" ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          echo "warning: extraPrimordialStakes($extraPrimordialStakes) clamped to numNodes($numNodes)"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          extraPrimordialStakes=$numNodes
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        for i in $(seq "$extraPrimordialStakes"); do
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          args+=(--bootstrap-validator "$(solana-keygen pubkey "config/validator-identity-$i.json")"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                       "$(solana-keygen pubkey "config/validator-vote-$i.json")"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                       "$(solana-keygen pubkey "config/validator-stake-$i.json")"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        done
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-19 08:31:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      multinode-demo/setup.sh "${args[@]}"
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 15:49:04 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-03 18:50:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      maybeWaitForSupermajority=
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      # shellcheck disable=SC2086 # Do not want to quote $extraNodeArgs
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      set -- $extraNodeArgs
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      while [[ -n $1 ]]; do
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if [[ $1 = "--wait-for-supermajority" ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          maybeWaitForSupermajority=$2
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          break
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        shift
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      done
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-09-09 19:59:56 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ -z "$maybeWarpSlot" && -n "$maybeWaitForSupermajority" ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-03 18:50:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        maybeWarpSlot="--warp-slot $maybeWaitForSupermajority"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-16 19:55:55 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ -n "$maybeWarpSlot" ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # shellcheck disable=SC2086 # Do not want to quote $maybeWarSlot
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        solana-ledger-tool -l config/bootstrap-validator create-snapshot 0 config/bootstrap-validator $maybeWarpSlot
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-30 10:53:34 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      solana-ledger-tool -l config/bootstrap-validator shred-version --max-genesis-archive-unpacked-size 1073741824 | tee config/shred-version
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-03 18:50:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if [[ -n "$maybeWaitForSupermajority" ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        bankHash=$(solana-ledger-tool -l config/bootstrap-validator bank-hash)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        extraNodeArgs="$extraNodeArgs --expected-bank-hash $bankHash"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        echo "$bankHash" > config/bank-hash
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-09 17:28:18 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-03 11:01:35 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    args=(
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-20 15:21:34 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      --gossip-host "$entrypointIp"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      --gossip-port 8001
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-29 21:25:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      --init-complete-file "$initCompleteFile"
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-03 11:01:35 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    )
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-04 14:27:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-05 21:31:01 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [[ "$tmpfsAccounts" = "true" ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      args+=(--accounts /mnt/solana-accounts)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-29 21:25:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [[ $airdropsEnabled = true ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 12:30:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								cat >> ~/solana/on-reboot <<EOF
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-16 14:05:17 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      ./multinode-demo/faucet.sh > faucet.log 2>&1 &
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 12:30:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								EOF
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-10 19:42:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-17 19:26:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # shellcheck disable=SC2206 # Don't want to double quote $extraNodeArgs
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    args+=($extraNodeArgs)
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 12:30:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								cat >> ~/solana/on-reboot <<EOF
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-22 09:22:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    nohup ./multinode-demo/bootstrap-validator.sh ${args[@]} > validator.log.\$now 2>&1 &
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 12:30:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    pid=\$!
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    oom_score_adj "\$pid" 1000
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    disown
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								EOF
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ~/solana/on-reboot
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-25 23:48:58 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if $waitForNodeInit; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      net/remote/remote-node-wait-init.sh 600
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-03 18:15:55 -10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ;;
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-23 15:06:01 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  validator|blockstreamer)
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-22 21:38:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [[ $deployMethod != skip ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      net/scripts/rsync-retry.sh -vPrc "$entrypointIp":~/.cargo/bin/ ~/.cargo/bin/
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-19 22:41:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      net/scripts/rsync-retry.sh -vPrc "$entrypointIp":~/version.yml ~/version.yml
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-22 21:38:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $skipSetup != true ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-17 15:44:45 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      clear_config_dir "$SOLANA_CONFIG_DIR"
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-06 21:14:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if [[ $nodeType = blockstreamer ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        net/scripts/rsync-retry.sh -vPrc \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          "$entrypointIp":~/solana/config/blockstreamer-identity.json "$SOLANA_CONFIG_DIR"/validator-identity.json
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-06 21:14:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        net/scripts/rsync-retry.sh -vPrc \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          "$entrypointIp":~/solana/config/validator-identity-"$nodeIndex".json "$SOLANA_CONFIG_DIR"/validator-identity.json
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-03 18:50:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        net/scripts/rsync-retry.sh -vPrc \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          "$entrypointIp":~/solana/config/validator-stake-"$nodeIndex".json "$SOLANA_CONFIG_DIR"/stake-account.json
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-03 18:50:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        net/scripts/rsync-retry.sh -vPrc \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          "$entrypointIp":~/solana/config/validator-vote-"$nodeIndex".json "$SOLANA_CONFIG_DIR"/vote-account.json
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-06 21:14:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 15:49:04 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      net/scripts/rsync-retry.sh -vPrc \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "$entrypointIp":~/solana/config/shred-version "$SOLANA_CONFIG_DIR"/shred-version
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-19 20:07:30 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-03 18:50:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      net/scripts/rsync-retry.sh -vPrc \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "$entrypointIp":~/solana/config/bank-hash "$SOLANA_CONFIG_DIR"/bank-hash || true
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-03 18:50:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-19 20:07:30 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      net/scripts/rsync-retry.sh -vPrc \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "$entrypointIp":~/solana/config/faucet.json "$SOLANA_CONFIG_DIR"/faucet.json
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-22 21:38:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-03 18:15:55 -10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-04 08:22:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    args=(
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-04 16:42:04 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      --entrypoint "$entrypointIp:8001"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      --gossip-port 8001
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-04 08:22:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      --rpc-port 8899
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      --expected-shred-version "$(cat "$SOLANA_CONFIG_DIR"/shred-version)"
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-04 08:22:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    )
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-21 16:35:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [[ $nodeType = blockstreamer ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-17 12:29:53 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      args+=(
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-04 16:42:04 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        --blockstream /tmp/solana-blockstream.sock
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 13:50:30 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        --no-voting
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-25 21:30:56 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        --dev-no-sigverify
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-23 11:25:39 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        --enable-rpc-transaction-history
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-17 12:29:53 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      )
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-16 13:03:01 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-19 12:51:38 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ -n $internalNodesLamports ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        args+=(--node-lamports "$internalNodesLamports")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-17 09:48:27 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [[ ! -f "$SOLANA_CONFIG_DIR"/validator-identity.json ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      solana-keygen new --no-passphrase -so "$SOLANA_CONFIG_DIR"/validator-identity.json
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-10 19:42:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    args+=(--identity "$SOLANA_CONFIG_DIR"/validator-identity.json)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ ! -f "$SOLANA_CONFIG_DIR"/vote-account.json ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      solana-keygen new --no-passphrase -so "$SOLANA_CONFIG_DIR"/vote-account.json
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-03 18:50:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    args+=(--vote-account "$SOLANA_CONFIG_DIR"/vote-account.json)
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-10 19:42:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-19 12:51:38 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [[ $airdropsEnabled != true ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-10 19:42:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      args+=(--no-airdrop)
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-21 00:13:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      args+=(--rpc-faucet-address "$entrypointIp:9900")
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-10 19:42:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [[ -r "$SOLANA_CONFIG_DIR"/bank-hash ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      args+=(--expected-bank-hash "$(cat "$SOLANA_CONFIG_DIR"/bank-hash)")
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-03 18:50:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 10:50:43 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    set -x
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-31 12:14:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # Add the faucet keypair to validators for convenient access from tools
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-16 14:05:17 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # like bench-tps and add to blocktreamers to run a faucet
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    scp "$entrypointIp":~/solana/config/faucet.json "$SOLANA_CONFIG_DIR"/
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-21 16:35:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [[ $nodeType = blockstreamer ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-31 12:14:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      # Run another faucet with the same keypair on the blockstreamer node.
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-24 12:50:32 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      # Typically the blockstreamer node has a static IP/DNS name for hosting
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      # the blockexplorer web app, and is a location that somebody would expect
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      # to be able to airdrop from
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-19 12:51:38 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ $airdropsEnabled = true ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 12:30:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								cat >> ~/solana/on-reboot <<EOF
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-16 14:05:17 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        multinode-demo/faucet.sh > faucet.log 2>&1 &
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 12:30:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								EOF
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-17 18:15:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-09 15:45:46 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      # Grab the TLS cert generated by /certbot-restore.sh
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if [[ -f /.cert.pem ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        sudo install -o $UID -m 400 /.cert.pem /.key.pem .
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ls -l .cert.pem .key.pem
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-17 12:29:53 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-22 14:51:20 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-13 19:37:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    args+=(--init-complete-file "$initCompleteFile")
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-17 19:26:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # shellcheck disable=SC2206 # Don't want to double quote $extraNodeArgs
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    args+=($extraNodeArgs)
							 | 
						
					
						
							
								
									
										
										
										
											2020-09-10 12:30:34 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    maybeSkipAccountsCreation=
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $nodeIndex -le $extraPrimordialStakes ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      maybeSkipAccountsCreation="export SKIP_ACCOUNTS_CREATION=1"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-05 21:31:01 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [[ "$tmpfsAccounts" = "true" ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      args+=(--accounts /mnt/solana-accounts)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 12:30:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								cat >> ~/solana/on-reboot <<EOF
							 | 
						
					
						
							
								
									
										
										
										
											2020-09-10 12:30:34 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $maybeSkipAccountsCreation
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 21:21:21 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    nohup multinode-demo/validator.sh ${args[@]} > validator.log.\$now 2>&1 &
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-10 12:30:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    pid=\$!
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    oom_score_adj "\$pid" 1000
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    disown
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								EOF
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ~/solana/on-reboot
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-25 23:48:58 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if $waitForNodeInit; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      net/remote/remote-node-wait-init.sh 600
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-01 13:48:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-09-10 12:30:34 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [[ $skipSetup != true && $nodeType != blockstreamer && -z $maybeSkipAccountsCreation ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-22 09:22:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      # Wait for the validator to catch up to the bootstrap validator before
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-13 15:58:14 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      # delegating stake to it
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      solana --url http://"$entrypointIp":8899 catchup config/validator-identity.json
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-01 23:34:55 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      args=(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        --url http://"$entrypointIp":8899
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      )
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-01 22:43:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ $airdropsEnabled != true ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-01 23:00:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        args+=(--no-airdrop)
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-01 22:43:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 21:21:21 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ -f config/validator-identity.json ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        args+=(--keypair config/validator-identity.json)
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-01 23:00:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-23 13:01:00 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if [[ ${extraPrimordialStakes} -eq 0 ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        echo "0 Primordial stakes, staking with $internalNodesStakeLamports"
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 19:20:56 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        multinode-demo/delegate-stake.sh --vote-account "$SOLANA_CONFIG_DIR"/vote-account.json \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                         --stake-account "$SOLANA_CONFIG_DIR"/stake-account.json \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                         "${args[@]}" "$internalNodesStakeLamports"
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-23 13:01:00 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        echo "Skipping staking with extra stakes: ${extraPrimordialStakes}"
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-03 18:50:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-01 13:48:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-03 18:15:55 -10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  *)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    echo "Error: unknown node type: $nodeType"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    exit 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  esac
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								*)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  echo "Unknown deployment method: $deployMethod"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  exit 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								esac
							 |