automerge
This commit is contained in:
@ -9,7 +9,7 @@ use solana_client::rpc_client::RpcClient;
|
|||||||
use solana_core::{contact_info::ContactInfo, gossip_service::discover};
|
use solana_core::{contact_info::ContactInfo, gossip_service::discover};
|
||||||
use solana_sdk::pubkey::Pubkey;
|
use solana_sdk::pubkey::Pubkey;
|
||||||
use std::error;
|
use std::error;
|
||||||
use std::net::SocketAddr;
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn error::Error>> {
|
fn main() -> Result<(), Box<dyn error::Error>> {
|
||||||
@ -38,6 +38,13 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
|||||||
.takes_value(false)
|
.takes_value(false)
|
||||||
.help("Return all RPC URLs"),
|
.help("Return all RPC URLs"),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("any")
|
||||||
|
.long("any")
|
||||||
|
.takes_value(false)
|
||||||
|
.conflicts_with("all")
|
||||||
|
.help("Return any RPC URL"),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("timeout")
|
Arg::with_name("timeout")
|
||||||
.long("timeout")
|
.long("timeout")
|
||||||
@ -74,9 +81,8 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
|||||||
.long("gossip-host")
|
.long("gossip-host")
|
||||||
.value_name("HOST")
|
.value_name("HOST")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.conflicts_with("entrypoint")
|
|
||||||
.validator(solana_net_utils::is_host)
|
.validator(solana_net_utils::is_host)
|
||||||
.help("Gossip DNS name or IP address for the node when --entrypoint is not provided [default: 127.0.0.1]"),
|
.help("Gossip DNS name or IP address for the node [default: ask --entrypoint, or 127.0.0.1 when --entrypoint is not provided]"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("num_nodes")
|
Arg::with_name("num_nodes")
|
||||||
@ -164,21 +170,29 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
|||||||
|
|
||||||
let entrypoint_addr = parse_entrypoint(&matches);
|
let entrypoint_addr = parse_entrypoint(&matches);
|
||||||
|
|
||||||
let gossip_host = if let Some(entrypoint_addr) = entrypoint_addr {
|
let gossip_host = matches
|
||||||
solana_net_utils::get_public_ip_addr(&entrypoint_addr).unwrap_or_else(|err| {
|
.value_of("gossip_host")
|
||||||
eprintln!(
|
.map(|gossip_host| {
|
||||||
"Failed to contact cluster entrypoint {}: {}",
|
solana_net_utils::parse_host(gossip_host).unwrap_or_else(|e| {
|
||||||
entrypoint_addr, err
|
eprintln!("failed to parse gossip-host: {}", e);
|
||||||
);
|
|
||||||
exit(1);
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
solana_net_utils::parse_host(matches.value_of("gossip_host").unwrap_or("127.0.0.1"))
|
|
||||||
.unwrap_or_else(|err| {
|
|
||||||
eprintln!("Error: {}", err);
|
|
||||||
exit(1);
|
exit(1);
|
||||||
})
|
})
|
||||||
};
|
})
|
||||||
|
.unwrap_or_else(|| {
|
||||||
|
if let Some(entrypoint_addr) = entrypoint_addr {
|
||||||
|
solana_net_utils::get_public_ip_addr(&entrypoint_addr).unwrap_or_else(
|
||||||
|
|err| {
|
||||||
|
eprintln!(
|
||||||
|
"Failed to contact cluster entrypoint {}: {}",
|
||||||
|
entrypoint_addr, err
|
||||||
|
);
|
||||||
|
exit(1);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let gossip_addr = SocketAddr::new(
|
let gossip_addr = SocketAddr::new(
|
||||||
gossip_host,
|
gossip_host,
|
||||||
@ -230,6 +244,8 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
("get-rpc-url", Some(matches)) => {
|
("get-rpc-url", Some(matches)) => {
|
||||||
|
let any = matches.is_present("any");
|
||||||
|
let all = matches.is_present("all");
|
||||||
let entrypoint_addr = parse_entrypoint(&matches);
|
let entrypoint_addr = parse_entrypoint(&matches);
|
||||||
let timeout = value_t_or_exit!(matches, "timeout", u64);
|
let timeout = value_t_or_exit!(matches, "timeout", u64);
|
||||||
let (nodes, _archivers) = discover(
|
let (nodes, _archivers) = discover(
|
||||||
@ -244,7 +260,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
|||||||
let rpc_addrs: Vec<_> = nodes
|
let rpc_addrs: Vec<_> = nodes
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|contact_info| {
|
.filter_map(|contact_info| {
|
||||||
if (matches.is_present("all") || Some(contact_info.gossip) == entrypoint_addr)
|
if (any || all || Some(contact_info.gossip) == entrypoint_addr)
|
||||||
&& ContactInfo::is_valid_address(&contact_info.rpc)
|
&& ContactInfo::is_valid_address(&contact_info.rpc)
|
||||||
{
|
{
|
||||||
return Some(contact_info.rpc);
|
return Some(contact_info.rpc);
|
||||||
@ -260,6 +276,9 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
|||||||
|
|
||||||
for rpc_addr in rpc_addrs {
|
for rpc_addr in rpc_addrs {
|
||||||
println!("http://{}", rpc_addr);
|
println!("http://{}", rpc_addr);
|
||||||
|
if any {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
("stop", Some(matches)) => {
|
("stop", Some(matches)) => {
|
||||||
|
@ -278,7 +278,7 @@ setup_validator_accounts() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
rpc_url=$($solana_gossip get-rpc-url --entrypoint "$gossip_entrypoint")
|
rpc_url=$($solana_gossip get-rpc-url --entrypoint "$gossip_entrypoint" --any)
|
||||||
|
|
||||||
[[ -r "$identity_keypair_path" ]] || $solana_keygen new --no-passphrase -so "$identity_keypair_path"
|
[[ -r "$identity_keypair_path" ]] || $solana_keygen new --no-passphrase -so "$identity_keypair_path"
|
||||||
[[ -r "$voting_keypair_path" ]] || $solana_keygen new --no-passphrase -so "$voting_keypair_path"
|
[[ -r "$voting_keypair_path" ]] || $solana_keygen new --no-passphrase -so "$voting_keypair_path"
|
||||||
|
@ -489,6 +489,7 @@ startBootstrapLeader() {
|
|||||||
ssh "${sshOptions[@]}" -n "$ipAddress" \
|
ssh "${sshOptions[@]}" -n "$ipAddress" \
|
||||||
"./solana/net/remote/remote-node.sh \
|
"./solana/net/remote/remote-node.sh \
|
||||||
$deployMethod \
|
$deployMethod \
|
||||||
|
$ipAddress \
|
||||||
bootstrap-leader \
|
bootstrap-leader \
|
||||||
$entrypointIp \
|
$entrypointIp \
|
||||||
$((${#validatorIpList[@]} + ${#blockstreamerIpList[@]} + ${#archiverIpList[@]})) \
|
$((${#validatorIpList[@]} + ${#blockstreamerIpList[@]} + ${#archiverIpList[@]})) \
|
||||||
@ -558,6 +559,7 @@ startNode() {
|
|||||||
ssh "${sshOptions[@]}" -n "$ipAddress" \
|
ssh "${sshOptions[@]}" -n "$ipAddress" \
|
||||||
"./solana/net/remote/remote-node.sh \
|
"./solana/net/remote/remote-node.sh \
|
||||||
$deployMethod \
|
$deployMethod \
|
||||||
|
$ipAddress \
|
||||||
$nodeType \
|
$nodeType \
|
||||||
$entrypointIp \
|
$entrypointIp \
|
||||||
$((${#validatorIpList[@]} + ${#blockstreamerIpList[@]} + ${#archiverIpList[@]})) \
|
$((${#validatorIpList[@]} + ${#blockstreamerIpList[@]} + ${#archiverIpList[@]})) \
|
||||||
|
@ -5,27 +5,28 @@ cd "$(dirname "$0")"/../..
|
|||||||
|
|
||||||
set -x
|
set -x
|
||||||
deployMethod="$1"
|
deployMethod="$1"
|
||||||
nodeType="$2"
|
ipAddress="$2"
|
||||||
entrypointIp="$3"
|
nodeType="$3"
|
||||||
numNodes="$4"
|
entrypointIp="$4"
|
||||||
if [[ -n $5 ]]; then
|
numNodes="$5"
|
||||||
export RUST_LOG="$5"
|
if [[ -n $6 ]]; then
|
||||||
|
export RUST_LOG="$6"
|
||||||
fi
|
fi
|
||||||
skipSetup="$6"
|
skipSetup="$7"
|
||||||
failOnValidatorBootupFailure="$7"
|
failOnValidatorBootupFailure="$8"
|
||||||
externalPrimordialAccountsFile="$8"
|
externalPrimordialAccountsFile="$9"
|
||||||
maybeDisableAirdrops="$9"
|
maybeDisableAirdrops="${10}"
|
||||||
internalNodesStakeLamports="${10}"
|
internalNodesStakeLamports="${11}"
|
||||||
internalNodesLamports="${11}"
|
internalNodesLamports="${12}"
|
||||||
nodeIndex="${12}"
|
nodeIndex="${13}"
|
||||||
numBenchTpsClients="${13}"
|
numBenchTpsClients="${14}"
|
||||||
benchTpsExtraArgs="${14}"
|
benchTpsExtraArgs="${15}"
|
||||||
numBenchExchangeClients="${15}"
|
numBenchExchangeClients="${16}"
|
||||||
benchExchangeExtraArgs="${16}"
|
benchExchangeExtraArgs="${17}"
|
||||||
genesisOptions="${17}"
|
genesisOptions="${18}"
|
||||||
extraNodeArgs="${18}"
|
extraNodeArgs="${19}"
|
||||||
gpuMode="${19:-auto}"
|
gpuMode="${20:-auto}"
|
||||||
GEOLOCATION_API_KEY="${20}"
|
GEOLOCATION_API_KEY="${21}"
|
||||||
set +x
|
set +x
|
||||||
|
|
||||||
# Use a very large stake (relative to the default multinode-demo/ stake of 42)
|
# Use a very large stake (relative to the default multinode-demo/ stake of 42)
|
||||||
@ -42,6 +43,7 @@ missing() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[ -n $deployMethod ]] || missing deployMethod
|
[[ -n $deployMethod ]] || missing deployMethod
|
||||||
|
[[ -n $ipAddress ]] || missing ipAddress
|
||||||
[[ -n $nodeType ]] || missing nodeType
|
[[ -n $nodeType ]] || missing nodeType
|
||||||
[[ -n $entrypointIp ]] || missing entrypointIp
|
[[ -n $entrypointIp ]] || missing entrypointIp
|
||||||
[[ -n $numNodes ]] || missing numNodes
|
[[ -n $numNodes ]] || missing numNodes
|
||||||
@ -284,18 +286,22 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
args=(
|
args=(
|
||||||
--entrypoint "$entrypointIp:8001"
|
|
||||||
--gossip-port 8001
|
|
||||||
--rpc-port 8899
|
--rpc-port 8899
|
||||||
)
|
)
|
||||||
if [[ $nodeType = blockstreamer ]]; then
|
if [[ $nodeType = blockstreamer ]]; then
|
||||||
args+=(
|
args+=(
|
||||||
--blockstream /tmp/solana-blockstream.sock
|
--entrypoint "$ipAddress:8001"
|
||||||
|
--gossip-port 9001
|
||||||
--no-voting
|
--no-voting
|
||||||
--dev-no-sigverify
|
--dev-no-sigverify
|
||||||
|
--blockstream /tmp/solana-blockstream.sock
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
args+=(--enable-rpc-exit)
|
args+=(
|
||||||
|
--entrypoint "$entrypointIp:8001"
|
||||||
|
--gossip-port 8001
|
||||||
|
--enable-rpc-exit
|
||||||
|
)
|
||||||
if [[ -n $internalNodesLamports ]]; then
|
if [[ -n $internalNodesLamports ]]; then
|
||||||
args+=(--node-lamports "$internalNodesLamports")
|
args+=(--node-lamports "$internalNodesLamports")
|
||||||
fi
|
fi
|
||||||
@ -365,6 +371,11 @@ EOF
|
|||||||
|
|
||||||
cat >> ~/solana/on-reboot <<EOF
|
cat >> ~/solana/on-reboot <<EOF
|
||||||
~/solana/restart-explorer
|
~/solana/restart-explorer
|
||||||
|
echo --- Starting gossip spy node
|
||||||
|
ln -sfT gossip.log.\$now gossip.log
|
||||||
|
nohup solana-gossip spy --gossip-port 8001 --gossip-host "$ipAddress" --entrypoint $entrypointIp:8001 > gossip.log.\$now 2>&1 &
|
||||||
|
sleep 1
|
||||||
|
head gossip.log
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user