Rename --network argument to --entrypoint (#4149)

This commit is contained in:
Michael Vines 2019-05-03 15:00:19 -07:00 committed by GitHub
parent 31b74bdf0b
commit f3f416b7ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 59 additions and 59 deletions

View File

@ -7,7 +7,7 @@ use std::process::exit;
use std::time::Duration;
pub struct Config {
pub network_addr: SocketAddr,
pub entrypoint_addr: SocketAddr,
pub drone_addr: SocketAddr,
pub identity: Keypair,
pub threads: usize,
@ -23,7 +23,7 @@ pub struct Config {
impl Default for Config {
fn default() -> Self {
Self {
network_addr: SocketAddr::from(([127, 0, 0, 1], 8001)),
entrypoint_addr: SocketAddr::from(([127, 0, 0, 1], 8001)),
drone_addr: SocketAddr::from(([127, 0, 0, 1], DRONE_PORT)),
identity: Keypair::new(),
num_nodes: 1,
@ -43,14 +43,14 @@ pub fn build_args<'a, 'b>() -> App<'a, 'b> {
.about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("network")
Arg::with_name("entrypoint")
.short("n")
.long("network")
.long("entrypoint")
.value_name("HOST:PORT")
.takes_value(true)
.required(false)
.default_value("127.0.0.1:8001")
.help("Network's gossip entry point; defaults to 127.0.0.1:8001"),
.help("Cluster entry point; defaults to 127.0.0.1:8001"),
)
.arg(
Arg::with_name("drone")
@ -146,9 +146,9 @@ pub fn build_args<'a, 'b>() -> App<'a, 'b> {
pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config {
let mut args = Config::default();
args.network_addr = solana_netutil::parse_host_port(matches.value_of("network").unwrap())
args.entrypoint_addr = solana_netutil::parse_host_port(matches.value_of("entrypoint").unwrap())
.unwrap_or_else(|e| {
eprintln!("failed to parse network address: {}", e);
eprintln!("failed to parse entrypoint address: {}", e);
exit(1)
});

View File

@ -15,7 +15,7 @@ fn main() {
let cli_config = cli::extract_args(&matches);
let cli::Config {
network_addr,
entrypoint_addr,
drone_addr,
identity,
threads,
@ -30,7 +30,7 @@ fn main() {
} = cli_config;
info!("Connecting to the cluster");
let nodes = discover_nodes(&network_addr, num_nodes).unwrap_or_else(|_| {
let nodes = discover_nodes(&entrypoint_addr, num_nodes).unwrap_or_else(|_| {
panic!("Failed to discover nodes");
});

View File

@ -8,7 +8,7 @@ use solana_sdk::signature::{read_keypair, Keypair, KeypairUtil};
/// Holds the configuration for a single run of the benchmark
pub struct Config {
pub network_addr: SocketAddr,
pub entrypoint_addr: SocketAddr,
pub drone_addr: SocketAddr,
pub id: Keypair,
pub threads: usize,
@ -22,7 +22,7 @@ pub struct Config {
impl Default for Config {
fn default() -> Config {
Config {
network_addr: SocketAddr::from(([127, 0, 0, 1], 8001)),
entrypoint_addr: SocketAddr::from(([127, 0, 0, 1], 8001)),
drone_addr: SocketAddr::from(([127, 0, 0, 1], DRONE_PORT)),
id: Keypair::new(),
threads: 4,
@ -40,12 +40,12 @@ pub fn build_args<'a, 'b>() -> App<'a, 'b> {
App::new(crate_name!()).about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("network")
Arg::with_name("entrypoint")
.short("n")
.long("network")
.long("entrypoint")
.value_name("HOST:PORT")
.takes_value(true)
.help("Rendezvous with the network at this gossip entry point; defaults to 127.0.0.1:8001"),
.help("Rendezvous with the cluster at this entry point; defaults to 127.0.0.1:8001"),
)
.arg(
Arg::with_name("drone")
@ -53,7 +53,7 @@ pub fn build_args<'a, 'b>() -> App<'a, 'b> {
.long("drone")
.value_name("HOST:PORT")
.takes_value(true)
.help("Location of the drone; defaults to network:DRONE_PORT"),
.help("Location of the drone; defaults to entrypoint:DRONE_PORT"),
)
.arg(
Arg::with_name("identity")
@ -116,9 +116,9 @@ pub fn build_args<'a, 'b>() -> App<'a, 'b> {
pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config {
let mut args = Config::default();
if let Some(addr) = matches.value_of("network") {
args.network_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse network address: {}", e);
if let Some(addr) = matches.value_of("entrypoint") {
args.entrypoint_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse entrypoint address: {}", e);
exit(1)
});
}

View File

@ -13,7 +13,7 @@ fn main() {
let cli_config = cli::extract_args(&matches);
let cli::Config {
network_addr,
entrypoint_addr,
drone_addr,
id,
threads,
@ -25,7 +25,7 @@ fn main() {
} = cli_config;
println!("Connecting to the cluster");
let nodes = discover_nodes(&network_addr, num_nodes).unwrap_or_else(|err| {
let nodes = discover_nodes(&entrypoint_addr, num_nodes).unwrap_or_else(|err| {
eprintln!("Failed to discover {} nodes: {:?}", num_nodes, err);
exit(1);
});

View File

@ -161,7 +161,7 @@ This will dump all the threads stack traces into gdb.txt
In this example the client connects to our public testnet. To run validators on the testnet you would need to open udp ports `8000-10000`.
```bash
$ ./multinode-demo/client.sh --network testnet.solana.com:8001 --duration 60
$ ./multinode-demo/client.sh --entrypoint testnet.solana.com:8001 --duration 60
```
You can observe the effects of your client's transactions on our [dashboard](https://metrics.solana.com:3000/d/testnet/testnet-hud?orgId=2&from=now-30m&to=now&refresh=5s&var-testnet=testnet)

View File

@ -110,7 +110,7 @@ $ solana-wallet -n testnet.solana.com balance
Also try running following command to join the gossip network and view all the other nodes in the cluster:
```bash
$ solana-gossip --network testnet.solana.com:8001 spy --public-address
$ solana-gossip --entrypoint testnet.solana.com:8001 spy
# Press ^C to exit
```
@ -145,7 +145,7 @@ validator to ports 11000-11011.
From another console, confirm the IP address of your validator is visible in the
gossip network by running:
```bash
$ solana-gossip --network edge.testnet.solana.com:8001 spy --public-address
$ solana-gossip --entrypoint testnet.solana.com:8001 spy
```
When `fullnode.sh` starts, it will output a fullnode configuration that looks

View File

@ -76,12 +76,12 @@ fn main() {
.help("Use DIR as persistent ledger location"),
)
.arg(
Arg::with_name("network")
Arg::with_name("entrypoint")
.short("n")
.long("network")
.long("entrypoint")
.value_name("HOST:PORT")
.takes_value(true)
.help("Rendezvous with the cluster at this gossip entry point"),
.help("Rendezvous with the cluster at this entry point"),
)
.arg(
Arg::with_name("no_voting")
@ -204,9 +204,9 @@ fn main() {
} else {
fullnode_config.account_paths = None;
}
let cluster_entrypoint = matches.value_of("network").map(|network| {
let entrypoint_addr =
solana_netutil::parse_host_port(network).expect("failed to parse network address");
let cluster_entrypoint = matches.value_of("entrypoint").map(|entrypoint| {
let entrypoint_addr = solana_netutil::parse_host_port(entrypoint)
.expect("failed to parse entrypoint address");
gossip_addr.set_ip(solana_netutil::get_public_ip_addr(&entrypoint_addr).unwrap());
ContactInfo::new_gossip_entry_point(&entrypoint_addr)

View File

@ -22,30 +22,30 @@ fn pubkey_validator(pubkey: String) -> Result<(), String> {
fn main() -> Result<(), Box<dyn error::Error>> {
env_logger::Builder::from_env(env_logger::Env::new().default_filter_or("solana=info")).init();
let mut network_addr = SocketAddr::from(([127, 0, 0, 1], 8001));
let network_string = network_addr.to_string();
let mut entrypoint_addr = SocketAddr::from(([127, 0, 0, 1], 8001));
let entrypoint_string = entrypoint_addr.to_string();
let matches = App::new(crate_name!())
.about(crate_description!())
.version(crate_version!())
.setting(AppSettings::SubcommandRequiredElseHelp)
.arg(
Arg::with_name("network")
Arg::with_name("entrypoint")
.short("n")
.long("network")
.long("entrypoint")
.value_name("HOST:PORT")
.takes_value(true)
.default_value(&network_string)
.help("Rendezvous with the cluster at this gossip entry point"),
.default_value(&entrypoint_string)
.help("Rendezvous with the cluster at this entry point"),
)
.subcommand(
SubCommand::with_name("spy")
.about("Monitor the gossip network")
.about("Monitor the gossip entrypoint")
.setting(AppSettings::DisableVersion)
.arg(
clap::Arg::with_name("pull_only")
.long("pull-only")
.takes_value(false)
.help("Use a partial gossip node (Pulls only) to spy on the network. By default it will use a full fledged gossip node(Pushes and Pulls). Useful when behind a NAT"),
.help("Use a partial gossip node (Pulls only) to spy on the cluster. By default it will use a full fledged gossip node (Pushes and Pulls). Useful when behind a NAT"),
)
.arg(
Arg::with_name("num_nodes")
@ -98,9 +98,9 @@ fn main() -> Result<(), Box<dyn error::Error>> {
)
.get_matches();
if let Some(addr) = matches.value_of("network") {
network_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse network address: {}", e);
if let Some(addr) = matches.value_of("entrypoint") {
entrypoint_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse entrypoint address: {}", e);
exit(1)
});
}
@ -125,8 +125,8 @@ fn main() -> Result<(), Box<dyn error::Error>> {
} else {
let mut addr = socketaddr_any!();
addr.set_ip(
solana_netutil::get_public_ip_addr(&network_addr).unwrap_or_else(|err| {
eprintln!("failed to contact {}: {}", network_addr, err);
solana_netutil::get_public_ip_addr(&entrypoint_addr).unwrap_or_else(|err| {
eprintln!("failed to contact {}: {}", entrypoint_addr, err);
exit(1)
}),
);
@ -134,7 +134,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
};
let nodes = discover(
&network_addr,
&entrypoint_addr,
num_nodes,
timeout,
pubkey,
@ -174,7 +174,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.unwrap()
.parse::<Pubkey>()
.unwrap();
let nodes = discover(&network_addr, None, None, Some(pubkey), None)?;
let nodes = discover(&entrypoint_addr, None, None, Some(pubkey), None)?;
let node = nodes.iter().find(|x| x.id == pubkey).unwrap();
if !ContactInfo::is_valid_address(&node.rpc) {

View File

@ -21,7 +21,7 @@ usage() {
if [[ -z $1 ]]; then # default behavior
$solana_bench_tps \
--network 127.0.0.1:8001 \
--entrypoint 127.0.0.1:8001 \
--drone 127.0.0.1:9900 \
--duration 90 \
--tx_count 50000 \

View File

@ -243,7 +243,7 @@ else
[[ -r "$fullnode_id_path" ]] || $solana_keygen -o "$fullnode_id_path"
[[ -r "$fullnode_vote_id_path" ]] || $solana_keygen -o "$fullnode_vote_id_path"
default_fullnode_arg --network "$leader_address"
default_fullnode_arg --entrypoint "$leader_address"
default_fullnode_arg --rpc-drone-address "${leader_address%:*}:9900"
fi

View File

@ -56,7 +56,7 @@ case $clientToRun in
solana-bench-tps)
clientCommand="\
solana-bench-tps \
--network $entrypointIp:8001 \
--entrypoint $entrypointIp:8001 \
--drone $entrypointIp:9900 \
--duration 7500 \
--sustained \
@ -68,7 +68,7 @@ solana-bench-exchange)
solana-keygen -o bench.keypair
clientCommand="\
solana-bench-exchange \
--network $entrypointIp:8001 \
--entrypoint $entrypointIp:8001 \
--drone $entrypointIp:9900 \
--threads $threadCount \
--batch-size 1000 \

View File

@ -101,7 +101,7 @@ echo "+++ $entrypointIp: node count ($numSanityNodes expected)"
nodeArg="num-nodes-exactly"
fi
timeout 2m $solana_gossip --network "$entrypointIp:8001" \
timeout 2m $solana_gossip --entrypoint "$entrypointIp:8001" \
spy --$nodeArg "$numSanityNodes" \
)

View File

@ -22,13 +22,13 @@ fn main() {
.help("File containing an identity (keypair)"),
)
.arg(
Arg::with_name("network")
Arg::with_name("entrypoint")
.short("n")
.long("network")
.long("entrypoint")
.value_name("HOST:PORT")
.takes_value(true)
.required(true)
.help("Rendezvous with the network at this gossip entry point"),
.help("Rendezvous with the cluster at this entry point"),
)
.arg(
Arg::with_name("ledger")
@ -52,16 +52,16 @@ fn main() {
Keypair::new()
};
let network_addr = matches
.value_of("network")
.map(|network| {
solana_netutil::parse_host_port(network).expect("failed to parse network address")
let entrypoint_addr = matches
.value_of("entrypoint")
.map(|entrypoint| {
solana_netutil::parse_host_port(entrypoint).expect("failed to parse entrypoint address")
})
.unwrap();
let gossip_addr = {
let mut addr = socketaddr!([127, 0, 0, 1], 8700);
addr.set_ip(solana_netutil::get_public_ip_addr(&network_addr).unwrap());
addr.set_ip(solana_netutil::get_public_ip_addr(&entrypoint_addr).unwrap());
addr
};
let node =
@ -73,12 +73,12 @@ fn main() {
gossip_addr
);
let leader_info = ContactInfo::new_gossip_entry_point(&network_addr);
let entrypoint_info = ContactInfo::new_gossip_entry_point(&entrypoint_addr);
let storage_keypair = Arc::new(Keypair::new());
let mut replicator = Replicator::new(
ledger_path,
node,
leader_info,
entrypoint_info,
Arc::new(keypair),
storage_keypair,
None,