diff --git a/ci/localnet-sanity.sh b/ci/localnet-sanity.sh index 42cf144a7b..3b03a999a8 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-leader-rotation" + maybeNoLeaderRotation="--only-bootstrap-stake" ;; x) extraNodes=$((extraNodes + 1)) diff --git a/fullnode/src/main.rs b/fullnode/src/main.rs index 61ef74d84b..2dcf98934d 100644 --- a/fullnode/src/main.rs +++ b/fullnode/src/main.rs @@ -5,7 +5,6 @@ use solana::contact_info::ContactInfo; use solana::fullnode::{Fullnode, FullnodeConfig}; use solana::local_vote_signer_service::LocalVoteSignerService; use solana::service::Service; -use solana_sdk::genesis_block::GenesisBlock; use solana_sdk::signature::{read_keypair, Keypair, KeypairUtil}; use std::fs::File; use std::process::exit; @@ -70,11 +69,6 @@ fn main() { .takes_value(true) .help("Rendezvous with the cluster at this gossip entry point"), ) - .arg( - Arg::with_name("no_leader_rotation") - .long("no-leader-rotation") - .help("Disable leader rotation"), - ) .arg( Arg::with_name("no_voting") .long("no-voting") @@ -169,8 +163,6 @@ fn main() { fullnode_config.voting_disabled = matches.is_present("no_voting"); - let use_only_bootstrap_leader = matches.is_present("no_leader_rotation"); - if matches.is_present("enable_rpc_exit") { fullnode_config.rpc_config.enable_fullnode_exit = true; } @@ -233,11 +225,6 @@ fn main() { node.info.rpc.set_port(rpc_port); node.info.rpc_pubsub.set_port(rpc_pubsub_port); - let genesis_block = GenesisBlock::load(ledger_path).expect("Unable to load genesis block"); - if use_only_bootstrap_leader && node.info.id != genesis_block.bootstrap_leader_id { - fullnode_config.voting_disabled = true; - } - let fullnode = Fullnode::new( node, &keypair, diff --git a/multinode-demo/bootstrap-leader.sh b/multinode-demo/bootstrap-leader.sh index 0c10b7b244..2026f9f141 100755 --- a/multinode-demo/bootstrap-leader.sh +++ b/multinode-demo/bootstrap-leader.sh @@ -10,6 +10,46 @@ source "$here"/common.sh # shellcheck source=scripts/oom-score-adj.sh source "$here"/../scripts/oom-score-adj.sh +if [[ $1 = -h ]]; then + fullnode_usage "$@" +fi + +extra_fullnode_args=() +setup_stakes=true + +while [[ ${1:0:1} = - ]]; do + if [[ $1 = --blockstream ]]; then + extra_fullnode_args+=("$1" "$2") + shift 2 + elif [[ $1 = --enable-rpc-exit ]]; then + extra_fullnode_args+=("$1") + shift + elif [[ $1 = --init-complete-file ]]; then + extra_fullnode_args+=("$1" "$2") + shift 2 + elif [[ $1 = --only-bootstrap-stake ]]; then + setup_stakes=false + shift + elif [[ $1 = --public-address ]]; then + extra_fullnode_args+=("$1") + shift + elif [[ $1 = --no-signer ]]; then + extra_fullnode_args+=("$1") + shift + elif [[ $1 = --rpc-port ]]; then + extra_fullnode_args+=("$1" "$2") + shift 2 + else + echo "Unknown argument: $1" + exit 1 + fi +done + +if [[ -n $3 ]]; then + fullnode_usage "$@" +fi + + [[ -f "$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json ]] || { echo "$SOLANA_CONFIG_DIR/bootstrap-leader-id.json not found, create it by running:" echo @@ -27,12 +67,10 @@ tune_system $solana_ledger_tool --ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger verify - bootstrap_leader_id_path="$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json bootstrap_leader_staker_id_path="$SOLANA_CONFIG_DIR"/bootstrap-leader-staker-id.json bootstrap_leader_staker_id=$($solana_wallet --keypair "$bootstrap_leader_staker_id_path" address) -set -x trap 'kill "$pid" && wait "$pid"' INT TERM ERR $program \ --identity "$bootstrap_leader_id_path" \ @@ -42,11 +80,13 @@ $program \ --accounts "$SOLANA_CONFIG_DIR"/bootstrap-leader-accounts \ --rpc-port 8899 \ --rpc-drone-address 127.0.0.1:9900 \ - "$@" \ + "${extra_fullnode_args[@]}" \ > >($bootstrap_leader_logger) 2>&1 & pid=$! oom_score_adj "$pid" 1000 -setup_fullnode_staking 127.0.0.1 "$bootstrap_leader_id_path" "$bootstrap_leader_staker_id_path" +if [[ $setup_stakes = true ]] ; then + setup_fullnode_staking 127.0.0.1 "$bootstrap_leader_id_path" "$bootstrap_leader_staker_id_path" +fi wait "$pid" diff --git a/multinode-demo/common.sh b/multinode-demo/common.sh index 1aebe5adfa..56ac41beb1 100644 --- a/multinode-demo/common.sh +++ b/multinode-demo/common.sh @@ -171,6 +171,29 @@ setup_fullnode_staking() { return 0 } +fullnode_usage() { + if [[ -n $1 ]]; then + echo "$*" + echo + fi + cat <&1 - output=$($solana_wallet "${entrypoint[@]}" get-transaction-count | tee >(cat - >&42)) - if [[ $output -gt 0 ]]; then + output=$($solana_wallet "${entrypoint[@]}" get-transaction-count) + if [[ -n $output ]]; then node_readiness=true break fi