net/ testnet nodes now stake more lamports (#3812)
* Add --bootstrap-leader-lamports * Generalize --no-stake into --stake NUM * Use a large stake for net/ fullnodes * Setup vote account before starting fullnode to avoid mixed log output
This commit is contained in:
@ -138,6 +138,7 @@ setup_vote_account() {
|
||||
declare drone_address=$1
|
||||
declare node_id_path=$2
|
||||
declare vote_id_path=$3
|
||||
declare stake=$4
|
||||
|
||||
declare node_id
|
||||
node_id=$($solana_wallet --keypair "$node_id_path" address)
|
||||
@ -153,11 +154,11 @@ setup_vote_account() {
|
||||
# A fullnode requires 43 lamports to function:
|
||||
# - one lamport to keep the node identity public key valid. TODO: really??
|
||||
# - 42 more for the vote account we fund
|
||||
airdrop "$node_id_path" "$drone_address" 43 || return $?
|
||||
airdrop "$node_id_path" "$drone_address" "$stake" || return $?
|
||||
|
||||
# Fund the vote account from the node, with the node as the node_id
|
||||
$solana_wallet --keypair "$node_id_path" --host "$drone_address" \
|
||||
create-vote-account "$vote_id" "$node_id" 42 || return $?
|
||||
create-vote-account "$vote_id" "$node_id" $((stake - 1)) || return $?
|
||||
|
||||
touch "$vote_id_path".configured
|
||||
return 0
|
||||
@ -169,7 +170,7 @@ fullnode_usage() {
|
||||
echo
|
||||
fi
|
||||
cat <<EOF
|
||||
usage: $0 [-x] [--blockstream PATH] [--init-complete-file FILE] [--no-stake] [--no-voting] [--rpc-port port] [rsync network path to bootstrap leader configuration] [network entry point]
|
||||
usage: $0 [-x] [--blockstream PATH] [--init-complete-file FILE] [--stake LAMPORTS] [--no-voting] [--rpc-port port] [rsync network path to bootstrap leader configuration] [network entry point]
|
||||
|
||||
Start a full node on the specified network
|
||||
|
||||
@ -178,7 +179,7 @@ Start a full node on the specified network
|
||||
the specified label. Does not apply to the bootstrap leader
|
||||
--blockstream PATH - open blockstream at this unix domain socket location
|
||||
--init-complete-file FILE - create this file, if it doesn't already exist, once node initialization is complete
|
||||
--no-stake - Only stake the bootstrap leader, effectively disabling leader rotation
|
||||
--stake LAMPORTS - Number of lamports to stake
|
||||
--public-address - advertise public machine address in gossip. By default the local machine address is advertised
|
||||
--no-voting - start node without vote signer
|
||||
--rpc-port port - custom RPC port for this node
|
||||
|
@ -16,7 +16,7 @@ fi
|
||||
gossip_port=
|
||||
extra_fullnode_args=()
|
||||
self_setup=0
|
||||
setup_stakes=1
|
||||
stake=43 # number of lamports to assign as stake (plus transaction fee to setup the stake)
|
||||
poll_for_new_genesis_block=0
|
||||
|
||||
while [[ ${1:0:1} = - ]]; do
|
||||
@ -32,7 +32,7 @@ while [[ ${1:0:1} = - ]]; do
|
||||
poll_for_new_genesis_block=1
|
||||
shift
|
||||
elif [[ $1 = --blockstream ]]; then
|
||||
setup_stakes=0
|
||||
stake=0
|
||||
extra_fullnode_args+=("$1" "$2")
|
||||
shift 2
|
||||
elif [[ $1 = --enable-rpc-exit ]]; then
|
||||
@ -41,9 +41,9 @@ while [[ ${1:0:1} = - ]]; do
|
||||
elif [[ $1 = --init-complete-file ]]; then
|
||||
extra_fullnode_args+=("$1" "$2")
|
||||
shift 2
|
||||
elif [[ $1 = --no-stake ]]; then
|
||||
setup_stakes=0
|
||||
shift
|
||||
elif [[ $1 = --stake ]]; then
|
||||
stake="$2"
|
||||
shift 2
|
||||
elif [[ $1 = --public-address ]]; then
|
||||
extra_fullnode_args+=("$1")
|
||||
shift
|
||||
@ -170,6 +170,11 @@ while true; do
|
||||
fi
|
||||
|
||||
trap 'kill "$pid" && wait "$pid"' INT TERM ERR
|
||||
|
||||
if ((stake)); then
|
||||
setup_vote_account "${leader_address%:*}" "$fullnode_id_path" "$fullnode_vote_id_path" "$stake"
|
||||
fi
|
||||
|
||||
$program \
|
||||
--identity "$fullnode_id_path" \
|
||||
--voting-keypair "$fullnode_vote_id_path" \
|
||||
@ -183,9 +188,6 @@ while true; do
|
||||
pid=$!
|
||||
oom_score_adj "$pid" 1000
|
||||
|
||||
if ((setup_stakes)); then
|
||||
setup_vote_account "${leader_address%:*}" "$fullnode_id_path" "$fullnode_vote_id_path"
|
||||
fi
|
||||
set +x
|
||||
|
||||
while true; do
|
||||
|
@ -29,8 +29,10 @@ EOF
|
||||
|
||||
lamports=1000000000
|
||||
bootstrap_leader=true
|
||||
bootstrap_leader_lamports=
|
||||
|
||||
fullnode=true
|
||||
while getopts "h?n:lpt:" opt; do
|
||||
while getopts "h?n:b:lpt:" opt; do
|
||||
case $opt in
|
||||
h|\?)
|
||||
usage
|
||||
@ -39,6 +41,9 @@ while getopts "h?n:lpt:" opt; do
|
||||
n)
|
||||
lamports="$OPTARG"
|
||||
;;
|
||||
b)
|
||||
bootstrap_leader_lamports="$OPTARG"
|
||||
;;
|
||||
t)
|
||||
node_type="$OPTARG"
|
||||
case $OPTARG in
|
||||
@ -77,12 +82,20 @@ if $bootstrap_leader; then
|
||||
$solana_keygen -o "$SOLANA_CONFIG_DIR"/mint-id.json
|
||||
$solana_keygen -o "$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json
|
||||
$solana_keygen -o "$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-id.json
|
||||
$solana_genesis \
|
||||
--bootstrap-leader-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json \
|
||||
--bootstrap-vote-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-id.json \
|
||||
--ledger "$SOLANA_RSYNC_CONFIG_DIR"/ledger \
|
||||
--mint "$SOLANA_CONFIG_DIR"/mint-id.json \
|
||||
|
||||
args=(
|
||||
--bootstrap-leader-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json
|
||||
--bootstrap-vote-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-id.json
|
||||
--ledger "$SOLANA_RSYNC_CONFIG_DIR"/ledger
|
||||
--mint "$SOLANA_CONFIG_DIR"/mint-id.json
|
||||
--lamports "$lamports"
|
||||
)
|
||||
|
||||
if [[ -n $bootstrap_leader_lamports ]]; then
|
||||
args+=(--bootstrap-leader-lamports "$bootstrap_leader_lamports")
|
||||
fi
|
||||
|
||||
$solana_genesis "${args[@]}"
|
||||
cp -a "$SOLANA_RSYNC_CONFIG_DIR"/ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger
|
||||
)
|
||||
fi
|
||||
|
Reference in New Issue
Block a user