From 81026f9ea5b133389fa7c37590a06f69cc425c09 Mon Sep 17 00:00:00 2001 From: behzad nouri Date: Thu, 29 Jul 2021 19:04:45 +0000 Subject: [PATCH] passes through --allow-private-addr to validators in system perf tests (#18876) --- gossip/src/main.rs | 15 ++++++++------- multinode-demo/bootstrap-validator.sh | 3 +++ multinode-demo/validator.sh | 8 +++++++- net/net.sh | 8 ++++++-- net/remote/remote-sanity.sh | 2 +- .../gce-perf-stability-5-node-single-region.yml | 1 + system-test/testnet-automation.sh | 8 +++++++- 7 files changed, 33 insertions(+), 12 deletions(-) diff --git a/gossip/src/main.rs b/gossip/src/main.rs index 520a0c167f..f2bb071b2a 100644 --- a/gossip/src/main.rs +++ b/gossip/src/main.rs @@ -217,7 +217,7 @@ fn process_spy_results( } } -fn process_spy(matches: &ArgMatches) -> std::io::Result<()> { +fn process_spy(matches: &ArgMatches, socket_addr_space: SocketAddrSpace) -> std::io::Result<()> { let num_nodes_exactly = matches .value_of("num_nodes_exactly") .map(|num| num.to_string().parse().unwrap()); @@ -231,7 +231,6 @@ fn process_spy(matches: &ArgMatches) -> std::io::Result<()> { let pubkey = matches .value_of("node_pubkey") .map(|pubkey_str| pubkey_str.parse::().unwrap()); - let socket_addr_space = SocketAddrSpace::new(matches.is_present("allow_private_addr")); let shred_version = value_t_or_exit!(matches, "shred_version", u16); let identity_keypair = keypair_of(matches, "identity"); @@ -276,13 +275,15 @@ fn parse_entrypoint(matches: &ArgMatches) -> Option { }) } -fn process_rpc_url(matches: &ArgMatches) -> std::io::Result<()> { +fn process_rpc_url( + matches: &ArgMatches, + socket_addr_space: SocketAddrSpace, +) -> std::io::Result<()> { let any = matches.is_present("any"); let all = matches.is_present("all"); let entrypoint_addr = parse_entrypoint(matches); let timeout = value_t_or_exit!(matches, "timeout", u64); let shred_version = value_t_or_exit!(matches, "shred_version", u16); - let socket_addr_space = SocketAddrSpace::new(matches.is_present("allow_private_addr")); let (_all_peers, validators) = discover( None, // keypair entrypoint_addr.as_ref(), @@ -326,13 +327,13 @@ fn main() -> Result<(), Box> { solana_logger::setup_with_default("solana=info"); let matches = parse_matches(); - + let socket_addr_space = SocketAddrSpace::new(matches.is_present("allow_private_addr")); match matches.subcommand() { ("spy", Some(matches)) => { - process_spy(matches)?; + process_spy(matches, socket_addr_space)?; } ("rpc-url", Some(matches)) => { - process_rpc_url(matches)?; + process_rpc_url(matches, socket_addr_space)?; } _ => unreachable!(), } diff --git a/multinode-demo/bootstrap-validator.sh b/multinode-demo/bootstrap-validator.sh index 6a8c53219d..e93aed322d 100755 --- a/multinode-demo/bootstrap-validator.sh +++ b/multinode-demo/bootstrap-validator.sh @@ -78,6 +78,9 @@ while [[ -n $1 ]]; do elif [[ $1 == --no-snapshot-fetch ]]; then args+=("$1") shift + elif [[ $1 == --allow-private-addr ]]; then + args+=("$1") + shift else echo "Unknown argument: $1" $program --help diff --git a/multinode-demo/validator.sh b/multinode-demo/validator.sh index 224300954c..60fba2d17c 100755 --- a/multinode-demo/validator.sh +++ b/multinode-demo/validator.sh @@ -18,6 +18,7 @@ vote_account= no_restart=0 gossip_entrypoint= ledger_dir= +maybe_allow_private_addr= usage() { if [[ -n $1 ]]; then @@ -155,6 +156,10 @@ while [[ -n $1 ]]; do elif [[ $1 == --expected-bank-hash ]]; then args+=("$1" "$2") shift 2 + elif [[ $1 == --allow-private-addr ]]; then + args+=("$1") + maybe_allow_private_addr=$1 + shift elif [[ $1 = -h ]]; then usage "$@" else @@ -294,7 +299,8 @@ setup_validator_accounts() { return 0 } -rpc_url=$($solana_gossip rpc-url --timeout 180 --entrypoint "$gossip_entrypoint") +# shellcheck disable=SC2086 # Don't want to double quote "$maybe_allow_private_addr" +rpc_url=$($solana_gossip $maybe_allow_private_addr rpc-url --timeout 180 --entrypoint "$gossip_entrypoint") [[ -r "$identity" ]] || $solana_keygen new --no-passphrase -so "$identity" [[ -r "$vote_account" ]] || $solana_keygen new --no-passphrase -so "$vote_account" diff --git a/net/net.sh b/net/net.sh index b3da0ad32a..9bb5378604 100755 --- a/net/net.sh +++ b/net/net.sh @@ -307,7 +307,7 @@ startBootstrapLeader() { $nodeIndex \ ${#clientIpList[@]} \"$benchTpsExtraArgs\" \ \"$genesisOptions\" \ - \"$maybeNoSnapshot $maybeSkipLedgerVerify $maybeLimitLedgerSize $maybeWaitForSupermajority\" \ + \"$maybeNoSnapshot $maybeSkipLedgerVerify $maybeLimitLedgerSize $maybeWaitForSupermajority $maybeAllowPrivateAddr\" \ \"$gpuMode\" \ \"$maybeWarpSlot\" \ \"$waitForNodeInit\" \ @@ -378,7 +378,7 @@ startNode() { $nodeIndex \ ${#clientIpList[@]} \"$benchTpsExtraArgs\" \ \"$genesisOptions\" \ - \"$maybeNoSnapshot $maybeSkipLedgerVerify $maybeLimitLedgerSize $maybeWaitForSupermajority\" \ + \"$maybeNoSnapshot $maybeSkipLedgerVerify $maybeLimitLedgerSize $maybeWaitForSupermajority $maybeAllowPrivateAddr\" \ \"$gpuMode\" \ \"$maybeWarpSlot\" \ \"$waitForNodeInit\" \ @@ -775,6 +775,7 @@ maybeLimitLedgerSize="" maybeSkipLedgerVerify="" maybeDisableAirdrops="" maybeWaitForSupermajority="" +maybeAllowPrivateAddr="" debugBuild=false doBuild=true gpuMode=auto @@ -899,6 +900,9 @@ while [[ -n $1 ]]; do elif [[ $1 == --extra-primordial-stakes ]]; then extraPrimordialStakes=$2 shift 2 + elif [[ $1 = --allow-private-addr ]]; then + maybeAllowPrivateAddr="$1" + shift 1 else usage "Unknown long option: $1" fi diff --git a/net/remote/remote-sanity.sh b/net/remote/remote-sanity.sh index 4d21afd680..8c36e99ffd 100755 --- a/net/remote/remote-sanity.sh +++ b/net/remote/remote-sanity.sh @@ -97,7 +97,7 @@ echo "--- $sanityTargetIp: node count ($numSanityNodes expected)" nodeArg="num-nodes-exactly" fi - $solana_gossip spy --entrypoint "$sanityTargetIp:8001" \ + $solana_gossip --allow-private-addr spy --entrypoint "$sanityTargetIp:8001" \ --$nodeArg "$numSanityNodes" --timeout 60 \ ) diff --git a/system-test/stability-testcases/gce-perf-stability-5-node-single-region.yml b/system-test/stability-testcases/gce-perf-stability-5-node-single-region.yml index 7970c27d15..5136286621 100755 --- a/system-test/stability-testcases/gce-perf-stability-5-node-single-region.yml +++ b/system-test/stability-testcases/gce-perf-stability-5-node-single-region.yml @@ -15,5 +15,6 @@ steps: USE_PUBLIC_IP_ADDRESSES: "false" ADDITIONAL_FLAGS: "--dedicated" TEST_TYPE: "fixed_duration" + ALLOW_PRIVATE_ADDR: "true" agents: - "queue=gce-deploy" diff --git a/system-test/testnet-automation.sh b/system-test/testnet-automation.sh index 7b2d865ac1..f372c99ebe 100755 --- a/system-test/testnet-automation.sh +++ b/system-test/testnet-automation.sh @@ -131,6 +131,11 @@ function launch_testnet() { maybeAsyncNodeInit="--async-node-init" fi + declare maybeAllowPrivateAddr + if [[ "$ALLOW_PRIVATE_ADDR" = "true" ]]; then + maybeAllowPrivateAddr="--allow-private-addr" + fi + declare maybeExtraPrimordialStakes if [[ -n "$EXTRA_PRIMORDIAL_STAKES" ]]; then maybeExtraPrimordialStakes="--extra-primordial-stakes $EXTRA_PRIMORDIAL_STAKES" @@ -140,7 +145,8 @@ function launch_testnet() { # shellcheck disable=SC2086 "${REPO_ROOT}"/net/net.sh start $version_args \ -c idle=$NUMBER_OF_CLIENT_NODES $maybeStartAllowBootFailures \ - --gpu-mode $startGpuMode $maybeWarpSlot $maybeAsyncNodeInit $maybeExtraPrimordialStakes + --gpu-mode $startGpuMode $maybeWarpSlot $maybeAsyncNodeInit \ + $maybeExtraPrimordialStakes $maybeAllowPrivateAddr if [[ -n "$WAIT_FOR_EQUAL_STAKE" ]]; then wait_for_equal_stake