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

View File

@ -15,7 +15,7 @@ fn main() {
let cli_config = cli::extract_args(&matches); let cli_config = cli::extract_args(&matches);
let cli::Config { let cli::Config {
network_addr, entrypoint_addr,
drone_addr, drone_addr,
identity, identity,
threads, threads,
@ -30,7 +30,7 @@ fn main() {
} = cli_config; } = cli_config;
info!("Connecting to the cluster"); 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"); 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 /// Holds the configuration for a single run of the benchmark
pub struct Config { pub struct Config {
pub network_addr: SocketAddr, pub entrypoint_addr: SocketAddr,
pub drone_addr: SocketAddr, pub drone_addr: SocketAddr,
pub id: Keypair, pub id: Keypair,
pub threads: usize, pub threads: usize,
@ -22,7 +22,7 @@ pub struct Config {
impl Default for Config { impl Default for Config {
fn default() -> Config { fn default() -> Config {
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)), drone_addr: SocketAddr::from(([127, 0, 0, 1], DRONE_PORT)),
id: Keypair::new(), id: Keypair::new(),
threads: 4, threads: 4,
@ -40,12 +40,12 @@ pub fn build_args<'a, 'b>() -> App<'a, 'b> {
App::new(crate_name!()).about(crate_description!()) App::new(crate_name!()).about(crate_description!())
.version(crate_version!()) .version(crate_version!())
.arg( .arg(
Arg::with_name("network") Arg::with_name("entrypoint")
.short("n") .short("n")
.long("network") .long("entrypoint")
.value_name("HOST:PORT") .value_name("HOST:PORT")
.takes_value(true) .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(
Arg::with_name("drone") Arg::with_name("drone")
@ -53,7 +53,7 @@ pub fn build_args<'a, 'b>() -> App<'a, 'b> {
.long("drone") .long("drone")
.value_name("HOST:PORT") .value_name("HOST:PORT")
.takes_value(true) .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(
Arg::with_name("identity") 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 { pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config {
let mut args = Config::default(); let mut args = Config::default();
if let Some(addr) = matches.value_of("network") { if let Some(addr) = matches.value_of("entrypoint") {
args.network_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| { args.entrypoint_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse network address: {}", e); eprintln!("failed to parse entrypoint address: {}", e);
exit(1) exit(1)
}); });
} }

View File

@ -13,7 +13,7 @@ fn main() {
let cli_config = cli::extract_args(&matches); let cli_config = cli::extract_args(&matches);
let cli::Config { let cli::Config {
network_addr, entrypoint_addr,
drone_addr, drone_addr,
id, id,
threads, threads,
@ -25,7 +25,7 @@ fn main() {
} = cli_config; } = cli_config;
println!("Connecting to the cluster"); 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); eprintln!("Failed to discover {} nodes: {:?}", num_nodes, err);
exit(1); 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`. 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 ```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) 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: Also try running following command to join the gossip network and view all the other nodes in the cluster:
```bash ```bash
$ solana-gossip --network testnet.solana.com:8001 spy --public-address $ solana-gossip --entrypoint testnet.solana.com:8001 spy
# Press ^C to exit # 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 From another console, confirm the IP address of your validator is visible in the
gossip network by running: gossip network by running:
```bash ```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 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"), .help("Use DIR as persistent ledger location"),
) )
.arg( .arg(
Arg::with_name("network") Arg::with_name("entrypoint")
.short("n") .short("n")
.long("network") .long("entrypoint")
.value_name("HOST:PORT") .value_name("HOST:PORT")
.takes_value(true) .takes_value(true)
.help("Rendezvous with the cluster at this gossip entry point"), .help("Rendezvous with the cluster at this entry point"),
) )
.arg( .arg(
Arg::with_name("no_voting") Arg::with_name("no_voting")
@ -204,9 +204,9 @@ fn main() {
} else { } else {
fullnode_config.account_paths = None; fullnode_config.account_paths = None;
} }
let cluster_entrypoint = matches.value_of("network").map(|network| { let cluster_entrypoint = matches.value_of("entrypoint").map(|entrypoint| {
let entrypoint_addr = let entrypoint_addr = solana_netutil::parse_host_port(entrypoint)
solana_netutil::parse_host_port(network).expect("failed to parse network address"); .expect("failed to parse entrypoint address");
gossip_addr.set_ip(solana_netutil::get_public_ip_addr(&entrypoint_addr).unwrap()); gossip_addr.set_ip(solana_netutil::get_public_ip_addr(&entrypoint_addr).unwrap());
ContactInfo::new_gossip_entry_point(&entrypoint_addr) 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>> { fn main() -> Result<(), Box<dyn error::Error>> {
env_logger::Builder::from_env(env_logger::Env::new().default_filter_or("solana=info")).init(); 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 mut entrypoint_addr = SocketAddr::from(([127, 0, 0, 1], 8001));
let network_string = network_addr.to_string(); let entrypoint_string = entrypoint_addr.to_string();
let matches = App::new(crate_name!()) let matches = App::new(crate_name!())
.about(crate_description!()) .about(crate_description!())
.version(crate_version!()) .version(crate_version!())
.setting(AppSettings::SubcommandRequiredElseHelp) .setting(AppSettings::SubcommandRequiredElseHelp)
.arg( .arg(
Arg::with_name("network") Arg::with_name("entrypoint")
.short("n") .short("n")
.long("network") .long("entrypoint")
.value_name("HOST:PORT") .value_name("HOST:PORT")
.takes_value(true) .takes_value(true)
.default_value(&network_string) .default_value(&entrypoint_string)
.help("Rendezvous with the cluster at this gossip entry point"), .help("Rendezvous with the cluster at this entry point"),
) )
.subcommand( .subcommand(
SubCommand::with_name("spy") SubCommand::with_name("spy")
.about("Monitor the gossip network") .about("Monitor the gossip entrypoint")
.setting(AppSettings::DisableVersion) .setting(AppSettings::DisableVersion)
.arg( .arg(
clap::Arg::with_name("pull_only") clap::Arg::with_name("pull_only")
.long("pull-only") .long("pull-only")
.takes_value(false) .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(
Arg::with_name("num_nodes") Arg::with_name("num_nodes")
@ -98,9 +98,9 @@ fn main() -> Result<(), Box<dyn error::Error>> {
) )
.get_matches(); .get_matches();
if let Some(addr) = matches.value_of("network") { if let Some(addr) = matches.value_of("entrypoint") {
network_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| { entrypoint_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse network address: {}", e); eprintln!("failed to parse entrypoint address: {}", e);
exit(1) exit(1)
}); });
} }
@ -125,8 +125,8 @@ fn main() -> Result<(), Box<dyn error::Error>> {
} else { } else {
let mut addr = socketaddr_any!(); let mut addr = socketaddr_any!();
addr.set_ip( addr.set_ip(
solana_netutil::get_public_ip_addr(&network_addr).unwrap_or_else(|err| { solana_netutil::get_public_ip_addr(&entrypoint_addr).unwrap_or_else(|err| {
eprintln!("failed to contact {}: {}", network_addr, err); eprintln!("failed to contact {}: {}", entrypoint_addr, err);
exit(1) exit(1)
}), }),
); );
@ -134,7 +134,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
}; };
let nodes = discover( let nodes = discover(
&network_addr, &entrypoint_addr,
num_nodes, num_nodes,
timeout, timeout,
pubkey, pubkey,
@ -174,7 +174,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.unwrap() .unwrap()
.parse::<Pubkey>() .parse::<Pubkey>()
.unwrap(); .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(); let node = nodes.iter().find(|x| x.id == pubkey).unwrap();
if !ContactInfo::is_valid_address(&node.rpc) { if !ContactInfo::is_valid_address(&node.rpc) {

View File

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

View File

@ -243,7 +243,7 @@ else
[[ -r "$fullnode_id_path" ]] || $solana_keygen -o "$fullnode_id_path" [[ -r "$fullnode_id_path" ]] || $solana_keygen -o "$fullnode_id_path"
[[ -r "$fullnode_vote_id_path" ]] || $solana_keygen -o "$fullnode_vote_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" default_fullnode_arg --rpc-drone-address "${leader_address%:*}:9900"
fi fi

View File

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

View File

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

View File

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