Skip to content

Commit

Permalink
Rename drone to faucet (solana-labs#7508)
Browse files Browse the repository at this point in the history
  • Loading branch information
CriesofCarrots authored Dec 16, 2019
1 parent f33703a commit 3513f4e
Show file tree
Hide file tree
Showing 50 changed files with 385 additions and 357 deletions.
42 changes: 21 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ members = [
"chacha-sys",
"client",
"core",
"drone",
"faucet",
"perf",
"validator",
"genesis",
Expand Down
2 changes: 1 addition & 1 deletion bench-exchange/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ solana-clap-utils = { path = "../clap-utils", version = "0.22.0" }
solana-core = { path = "../core", version = "0.22.0" }
solana-genesis = { path = "../genesis", version = "0.22.0" }
solana-client = { path = "../client", version = "0.22.0" }
solana-drone = { path = "../drone", version = "0.22.0" }
solana-faucet = { path = "../faucet", version = "0.22.0" }
solana-exchange-program = { path = "../programs/exchange", version = "0.22.0" }
solana-logger = { path = "../logger", version = "0.22.0" }
solana-metrics = { path = "../metrics", version = "0.22.0" }
Expand Down
10 changes: 5 additions & 5 deletions bench-exchange/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use rand::{thread_rng, Rng};
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_exchange_program::{exchange_instruction, exchange_state::*, id};
use solana_faucet::faucet::request_airdrop_transaction;
use solana_genesis::Base64Account;
use solana_metrics::datapoint_info;
use solana_sdk::{
Expand Down Expand Up @@ -968,7 +968,7 @@ fn generate_keypairs(num: u64) -> Vec<Keypair> {
rnd.gen_n_keypairs(num)
}

pub fn airdrop_lamports(client: &dyn Client, drone_addr: &SocketAddr, id: &Keypair, amount: u64) {
pub fn airdrop_lamports(client: &dyn Client, faucet_addr: &SocketAddr, id: &Keypair, amount: u64) {
let balance = client.get_balance_with_commitment(&id.pubkey(), CommitmentConfig::recent());
let balance = balance.unwrap_or(0);
if balance >= amount {
Expand All @@ -980,7 +980,7 @@ pub fn airdrop_lamports(client: &dyn Client, drone_addr: &SocketAddr, id: &Keypa
info!(
"Airdropping {:?} lamports from {} for {}",
amount_to_drop,
drone_addr,
faucet_addr,
id.pubkey(),
);

Expand All @@ -989,7 +989,7 @@ pub fn airdrop_lamports(client: &dyn Client, drone_addr: &SocketAddr, id: &Keypa
let (blockhash, _fee_calculator) = client
.get_recent_blockhash_with_commitment(CommitmentConfig::recent())
.expect("Failed to get blockhash");
match request_airdrop_transaction(&drone_addr, &id.pubkey(), amount_to_drop, blockhash) {
match request_airdrop_transaction(&faucet_addr, &id.pubkey(), amount_to_drop, blockhash) {
Ok(transaction) => {
let signature = client.async_send_transaction(transaction).unwrap();

Expand All @@ -1013,7 +1013,7 @@ pub fn airdrop_lamports(client: &dyn Client, drone_addr: &SocketAddr, id: &Keypa
Err(err) => {
panic!(
"Error requesting airdrop: {:?} to addr: {:?} amount: {}",
err, drone_addr, amount
err, faucet_addr, amount
);
}
};
Expand Down
16 changes: 8 additions & 8 deletions bench-exchange/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use clap::{crate_description, crate_name, value_t, App, Arg, ArgMatches};
use solana_core::gen_keys::GenKeys;
use solana_drone::drone::DRONE_PORT;
use solana_faucet::faucet::FAUCET_PORT;
use solana_sdk::signature::{read_keypair_file, Keypair, KeypairUtil};
use std::net::SocketAddr;
use std::process::exit;
use std::time::Duration;

pub struct Config {
pub entrypoint_addr: SocketAddr,
pub drone_addr: SocketAddr,
pub faucet_addr: SocketAddr,
pub identity: Keypair,
pub threads: usize,
pub num_nodes: usize,
Expand All @@ -27,7 +27,7 @@ impl Default for Config {
fn default() -> Self {
Self {
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)),
identity: Keypair::new(),
num_nodes: 1,
threads: 4,
Expand Down Expand Up @@ -59,14 +59,14 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
.help("Cluster 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)
.required(false)
.default_value("127.0.0.1:9900")
.help("Location of the drone; defaults to 127.0.0.1:9900"),
.help("Location of the faucet; defaults to 127.0.0.1:9900"),
)
.arg(
Arg::with_name("identity")
Expand Down Expand Up @@ -174,9 +174,9 @@ pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config {
exit(1)
});

args.drone_addr = solana_net_utils::parse_host_port(matches.value_of("drone").unwrap())
args.faucet_addr = solana_net_utils::parse_host_port(matches.value_of("faucet").unwrap())
.unwrap_or_else(|e| {
eprintln!("failed to parse drone address: {}", e);
eprintln!("failed to parse faucet address: {}", e);
exit(1)
});

Expand Down
4 changes: 2 additions & 2 deletions bench-exchange/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn main() {

let cli::Config {
entrypoint_addr,
drone_addr,
faucet_addr,
identity,
threads,
num_nodes,
Expand Down Expand Up @@ -73,7 +73,7 @@ fn main() {
const NUM_SIGNERS: u64 = 2;
airdrop_lamports(
&client,
&drone_addr,
&faucet_addr,
&config.identity,
fund_amount * (accounts_in_groups + 1) as u64 * NUM_SIGNERS,
);
Expand Down
12 changes: 6 additions & 6 deletions bench-exchange/tests/bench_exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use log::*;
use solana_bench_exchange::bench::{airdrop_lamports, do_bench_exchange, Config};
use solana_core::gossip_service::{discover_cluster, get_multi_client};
use solana_core::validator::ValidatorConfig;
use solana_drone::drone::run_local_drone;
use solana_exchange_program::exchange_processor::process_instruction;
use solana_exchange_program::id;
use solana_exchange_program::solana_exchange_program;
use solana_faucet::faucet::run_local_faucet;
use solana_local_cluster::local_cluster::{ClusterConfig, LocalCluster};
use solana_runtime::bank::Bank;
use solana_runtime::bank_client::BankClient;
Expand Down Expand Up @@ -46,16 +46,16 @@ fn test_exchange_local_cluster() {
..ClusterConfig::default()
});

let drone_keypair = Keypair::new();
let faucet_keypair = Keypair::new();
cluster.transfer(
&cluster.funding_keypair,
&drone_keypair.pubkey(),
&faucet_keypair.pubkey(),
2_000_000_000_000,
);

let (addr_sender, addr_receiver) = channel();
run_local_drone(drone_keypair, addr_sender, Some(1_000_000_000_000));
let drone_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap();
run_local_faucet(faucet_keypair, addr_sender, Some(1_000_000_000_000));
let faucet_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap();

info!("Connecting to the cluster");
let (nodes, _) =
Expand All @@ -72,7 +72,7 @@ fn test_exchange_local_cluster() {
const NUM_SIGNERS: u64 = 2;
airdrop_lamports(
&client,
&drone_addr,
&faucet_addr,
&config.identity,
fund_amount * (accounts_in_groups + 1) as u64 * NUM_SIGNERS,
);
Expand Down
2 changes: 1 addition & 1 deletion bench-tps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ solana-clap-utils = { path = "../clap-utils", version = "0.22.0" }
solana-core = { path = "../core", version = "0.22.0" }
solana-genesis = { path = "../genesis", version = "0.22.0" }
solana-client = { path = "../client", version = "0.22.0" }
solana-drone = { path = "../drone", version = "0.22.0" }
solana-faucet = { path = "../faucet", version = "0.22.0" }
solana-librapay = { path = "../programs/librapay", version = "0.22.0", optional = true }
solana-logger = { path = "../logger", version = "0.22.0" }
solana-metrics = { path = "../metrics", version = "0.22.0" }
Expand Down
16 changes: 8 additions & 8 deletions bench-tps/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<()> {
Expand All @@ -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 {
Expand All @@ -656,15 +656,15 @@ 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
)
}
}
}
Err(err) => {
panic!(
"Error requesting airdrop: {:?} to addr: {:?} amount: {}",
err, drone_addr, airdrop_amount
err, faucet_addr, airdrop_amount
);
}
};
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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")]
Expand Down
Loading

0 comments on commit 3513f4e

Please sign in to comment.