Rename drone to faucet (#7508)

This commit is contained in:
Tyera Eulberg
2019-12-16 14:05:17 -07:00
committed by GitHub
parent f33703aefc
commit 3513f4ee84
50 changed files with 389 additions and 361 deletions

View File

@ -3,7 +3,7 @@ use log::*;
use rayon::prelude::*;
use solana_client::perf_utils::{sample_txs, SampleStats};
use solana_core::gen_keys::GenKeys;
use solana_drone::drone::request_airdrop_transaction;
use solana_faucet::faucet::request_airdrop_transaction;
#[cfg(feature = "move")]
use solana_librapay::{create_genesis, upload_mint_script, upload_payment_script};
use solana_measure::measure::Measure;
@ -624,7 +624,7 @@ pub fn fund_keys<T: Client>(
pub fn airdrop_lamports<T: Client>(
client: &T,
drone_addr: &SocketAddr,
faucet_addr: &SocketAddr,
id: &Keypair,
tx_count: u64,
) -> Result<()> {
@ -637,12 +637,12 @@ pub fn airdrop_lamports<T: Client>(
info!(
"Airdropping {:?} lamports from {} for {}",
airdrop_amount,
drone_addr,
faucet_addr,
id.pubkey(),
);
let (blockhash, _fee_calculator) = get_recent_blockhash(client);
match request_airdrop_transaction(&drone_addr, &id.pubkey(), airdrop_amount, blockhash) {
match request_airdrop_transaction(&faucet_addr, &id.pubkey(), airdrop_amount, blockhash) {
Ok(transaction) => {
let mut tries = 0;
loop {
@ -656,7 +656,7 @@ pub fn airdrop_lamports<T: Client>(
if tries >= 5 {
panic!(
"Error requesting airdrop: to addr: {:?} amount: {} {:?}",
drone_addr, airdrop_amount, result
faucet_addr, airdrop_amount, result
)
}
}
@ -664,7 +664,7 @@ pub fn airdrop_lamports<T: Client>(
Err(err) => {
panic!(
"Error requesting airdrop: {:?} to addr: {:?} amount: {}",
err, drone_addr, airdrop_amount
err, faucet_addr, airdrop_amount
);
}
};
@ -947,7 +947,7 @@ fn fund_move_keys<T: Client>(
pub fn generate_and_fund_keypairs<T: Client>(
client: &T,
drone_addr: Option<SocketAddr>,
faucet_addr: Option<SocketAddr>,
funding_key: &Keypair,
tx_count: usize,
lamports_per_account: u64,
@ -985,7 +985,7 @@ pub fn generate_and_fund_keypairs<T: Client>(
);
if client.get_balance(&funding_key.pubkey()).unwrap_or(0) < total {
airdrop_lamports(client, &drone_addr.unwrap(), funding_key, total)?;
airdrop_lamports(client, &faucet_addr.unwrap(), funding_key, total)?;
}
#[cfg(feature = "move")]

View File

@ -1,5 +1,5 @@
use clap::{crate_description, crate_name, App, Arg, ArgMatches};
use solana_drone::drone::DRONE_PORT;
use solana_faucet::faucet::FAUCET_PORT;
use solana_sdk::fee_calculator::FeeCalculator;
use solana_sdk::signature::{read_keypair_file, Keypair, KeypairUtil};
use std::{net::SocketAddr, process::exit, time::Duration};
@ -9,7 +9,7 @@ const NUM_LAMPORTS_PER_ACCOUNT_DEFAULT: u64 = solana_sdk::native_token::SOL_LAMP
/// Holds the configuration for a single run of the benchmark
pub struct Config {
pub entrypoint_addr: SocketAddr,
pub drone_addr: SocketAddr,
pub faucet_addr: SocketAddr,
pub id: Keypair,
pub threads: usize,
pub num_nodes: usize,
@ -30,7 +30,7 @@ impl Default for Config {
fn default() -> Config {
Config {
entrypoint_addr: SocketAddr::from(([127, 0, 0, 1], 8001)),
drone_addr: SocketAddr::from(([127, 0, 0, 1], DRONE_PORT)),
faucet_addr: SocketAddr::from(([127, 0, 0, 1], FAUCET_PORT)),
id: Keypair::new(),
threads: 4,
num_nodes: 1,
@ -62,12 +62,12 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
.help("Rendezvous with the cluster at this entry point; defaults to 127.0.0.1:8001"),
)
.arg(
Arg::with_name("drone")
Arg::with_name("faucet")
.short("d")
.long("drone")
.long("faucet")
.value_name("HOST:PORT")
.takes_value(true)
.help("Location of the drone; defaults to entrypoint:DRONE_PORT"),
.help("Location of the faucet; defaults to entrypoint:FAUCET_PORT"),
)
.arg(
Arg::with_name("identity")
@ -180,9 +180,9 @@ pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config {
});
}
if let Some(addr) = matches.value_of("drone") {
args.drone_addr = solana_net_utils::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse drone address: {}", e);
if let Some(addr) = matches.value_of("faucet") {
args.faucet_addr = solana_net_utils::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse faucet address: {}", e);
exit(1)
});
}

View File

@ -20,7 +20,7 @@ fn main() {
let cli::Config {
entrypoint_addr,
drone_addr,
faucet_addr,
id,
num_nodes,
tx_count,
@ -119,7 +119,7 @@ fn main() {
} else {
generate_and_fund_keypairs(
&client,
Some(*drone_addr),
Some(*faucet_addr),
&id,
*tx_count,
*num_lamports_per_account,