From 63d66ece5771b16910d7ff8207f4eecd9541f20a Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Tue, 16 Apr 2019 13:03:01 -0700 Subject: [PATCH] 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 --- book/src/testnet-participation.md | 6 +++--- ci/localnet-sanity.sh | 2 +- core/src/staking_utils.rs | 2 +- genesis/src/main.rs | 13 ++++++++++++- multinode-demo/common.sh | 9 +++++---- multinode-demo/fullnode.sh | 18 ++++++++++-------- multinode-demo/setup.sh | 25 +++++++++++++++++++------ net/remote/remote-node.sh | 20 ++++++++++++++++---- net/remote/remote-sanity.sh | 2 +- 9 files changed, 68 insertions(+), 29 deletions(-) diff --git a/book/src/testnet-participation.md b/book/src/testnet-participation.md index 92a72e755a..aa5d947696 100644 --- a/book/src/testnet-participation.md +++ b/book/src/testnet-participation.md @@ -96,18 +96,18 @@ The following command will start a new validator node. If this is a `solana-install`-installation: ```bash -$ fullnode-x.sh --public-address --no-stake --poll-for-new-genesis-block beta.testnet.solana.com:8001 +$ fullnode-x.sh --public-address --poll-for-new-genesis-block beta.testnet.solana.com:8001 ``` Alternatively, the `solana-install run` command can be used to run the validator node while periodically checking for and applying software updates: ```bash -$ solana-install run fullnode-x.sh --public-address --no-stake --poll-for-new-genesis-block beta.testnet.solana.com:8001 +$ solana-install run fullnode-x.sh --public-address --poll-for-new-genesis-block beta.testnet.solana.com:8001 ``` When not using `solana-install`: ```bash -$ USE_INSTALL=1 ./multinode-demo/fullnode-x.sh --public-address --no-stake --poll-for-new-genesis-block beta.testnet.solana.com:8001 +$ USE_INSTALL=1 ./multinode-demo/fullnode-x.sh --public-address --poll-for-new-genesis-block beta.testnet.solana.com:8001 ``` Then from another console, confirm the IP address if your node is now visible in diff --git a/ci/localnet-sanity.sh b/ci/localnet-sanity.sh index e765bc6193..14a0b61d60 100755 --- a/ci/localnet-sanity.sh +++ b/ci/localnet-sanity.sh @@ -55,7 +55,7 @@ while getopts "ch?i:k:brxR" opt; do restartInterval=$OPTARG ;; b) - maybeNoLeaderRotation="--no-stake" + maybeNoLeaderRotation="--stake 0" ;; x) extraNodes=$((extraNodes + 1)) diff --git a/core/src/staking_utils.rs b/core/src/staking_utils.rs index 237a70a332..77e1055411 100644 --- a/core/src/staking_utils.rs +++ b/core/src/staking_utils.rs @@ -42,7 +42,7 @@ pub fn vote_account_balances_at_epoch( node_staked_accounts.map(|epoch_state| epoch_state.map(|(id, stake, _)| (*id, stake)).collect()) } -/// At the specified epoch, collect the delgate account balance and vote states for delegates +/// At the specified epoch, collect the delegate account balance and vote states for delegates /// that have non-zero balance in any of their managed staking accounts pub fn delegated_stakes_at_epoch(bank: &Bank, epoch_height: u64) -> Option> { let node_staked_accounts = node_staked_accounts_at_epoch(bank, epoch_height); diff --git a/genesis/src/main.rs b/genesis/src/main.rs index 376e30f2c1..6ac8f795ca 100644 --- a/genesis/src/main.rs +++ b/genesis/src/main.rs @@ -14,6 +14,7 @@ use std::error; pub const BOOTSTRAP_LEADER_LAMPORTS: u64 = 43; fn main() -> Result<(), Box> { + let default_bootstrap_leader_lamports = &BOOTSTRAP_LEADER_LAMPORTS.to_string(); let matches = App::new(crate_name!()) .about(crate_description!()) .version(crate_version!()) @@ -62,6 +63,15 @@ fn main() -> Result<(), Box> { .required(true) .help("Path to file containing the bootstrap leader's staking keypair"), ) + .arg( + Arg::with_name("bootstrap_leader_lamports") + .long("bootstrap-leader-lamports") + .value_name("LAMPORTS") + .takes_value(true) + .default_value(default_bootstrap_leader_lamports) + .required(true) + .help("Number of lamports to assign to the bootstrap leader"), + ) .get_matches(); let bootstrap_leader_keypair_file = matches.value_of("bootstrap_leader_keypair_file").unwrap(); @@ -69,6 +79,7 @@ fn main() -> Result<(), Box> { let ledger_path = matches.value_of("ledger_path").unwrap(); let mint_keypair_file = matches.value_of("mint_keypair_file").unwrap(); let lamports = value_t_or_exit!(matches, "lamports", u64); + let bootstrap_leader_lamports = value_t_or_exit!(matches, "bootstrap_leader_lamports", u64); let bootstrap_leader_keypair = read_keypair(bootstrap_leader_keypair_file)?; let bootstrap_vote_keypair = read_keypair(bootstrap_vote_keypair_file)?; @@ -77,7 +88,7 @@ fn main() -> Result<(), Box> { let (mut genesis_block, _mint_keypair) = GenesisBlock::new_with_leader( lamports, &bootstrap_leader_keypair.pubkey(), - BOOTSTRAP_LEADER_LAMPORTS, + bootstrap_leader_lamports, ); genesis_block.mint_id = mint_keypair.pubkey(); genesis_block.bootstrap_leader_vote_account_id = bootstrap_vote_keypair.pubkey(); diff --git a/multinode-demo/common.sh b/multinode-demo/common.sh index fa32b01e1b..bf7d3264f6 100644 --- a/multinode-demo/common.sh +++ b/multinode-demo/common.sh @@ -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 < drone.log 2>&1 & @@ -90,9 +98,6 @@ local|tar) fi args=() - if ! $leaderRotation; then - args+=("--no-stake") - fi if $publicNetwork; then args+=("--public-address") fi @@ -100,7 +105,14 @@ local|tar) args+=( --blockstream /tmp/solana-blockstream.sock --no-voting + --stake 0 ) + else + if $leaderRotation; then + args+=("--stake" "$stake") + else + args+=("--stake" 0) + fi fi args+=( diff --git a/net/remote/remote-sanity.sh b/net/remote/remote-sanity.sh index e5ecdfd335..d029a4d393 100755 --- a/net/remote/remote-sanity.sh +++ b/net/remote/remote-sanity.sh @@ -133,7 +133,7 @@ echo "--- $entrypointIp: validator sanity" if $validatorSanity; then ( set -x -o pipefail - timeout 10s ./multinode-demo/fullnode-x.sh --no-stake \ + timeout 10s ./multinode-demo/fullnode-x.sh --stake 0 \ "$entrypointRsyncUrl" \ "$entrypointIp:8001" 2>&1 | tee validator-sanity.log ) || {