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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 389 additions and 361 deletions

50
Cargo.lock generated
View File

@ -3133,8 +3133,8 @@ dependencies = [
"solana-clap-utils 0.22.0", "solana-clap-utils 0.22.0",
"solana-client 0.22.0", "solana-client 0.22.0",
"solana-core 0.22.0", "solana-core 0.22.0",
"solana-drone 0.22.0",
"solana-exchange-program 0.22.0", "solana-exchange-program 0.22.0",
"solana-faucet 0.22.0",
"solana-genesis 0.22.0", "solana-genesis 0.22.0",
"solana-local-cluster 0.22.0", "solana-local-cluster 0.22.0",
"solana-logger 0.22.0", "solana-logger 0.22.0",
@ -3174,7 +3174,7 @@ dependencies = [
"solana-clap-utils 0.22.0", "solana-clap-utils 0.22.0",
"solana-client 0.22.0", "solana-client 0.22.0",
"solana-core 0.22.0", "solana-core 0.22.0",
"solana-drone 0.22.0", "solana-faucet 0.22.0",
"solana-genesis 0.22.0", "solana-genesis 0.22.0",
"solana-librapay 0.22.0", "solana-librapay 0.22.0",
"solana-local-cluster 0.22.0", "solana-local-cluster 0.22.0",
@ -3279,7 +3279,7 @@ dependencies = [
"solana-client 0.22.0", "solana-client 0.22.0",
"solana-config-program 0.22.0", "solana-config-program 0.22.0",
"solana-core 0.22.0", "solana-core 0.22.0",
"solana-drone 0.22.0", "solana-faucet 0.22.0",
"solana-logger 0.22.0", "solana-logger 0.22.0",
"solana-net-utils 0.22.0", "solana-net-utils 0.22.0",
"solana-runtime 0.22.0", "solana-runtime 0.22.0",
@ -3369,7 +3369,7 @@ dependencies = [
"solana-chacha-sys 0.22.0", "solana-chacha-sys 0.22.0",
"solana-clap-utils 0.22.0", "solana-clap-utils 0.22.0",
"solana-client 0.22.0", "solana-client 0.22.0",
"solana-drone 0.22.0", "solana-faucet 0.22.0",
"solana-ledger 0.22.0", "solana-ledger 0.22.0",
"solana-logger 0.22.0", "solana-logger 0.22.0",
"solana-measure 0.22.0", "solana-measure 0.22.0",
@ -3419,25 +3419,6 @@ dependencies = [
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "solana-drone"
version = "0.22.0"
dependencies = [
"bincode 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-clap-utils 0.22.0",
"solana-logger 0.22.0",
"solana-metrics 0.22.0",
"solana-sdk 0.22.0",
"tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "solana-exchange-program" name = "solana-exchange-program"
version = "0.22.0" version = "0.22.0"
@ -3461,6 +3442,25 @@ dependencies = [
"solana-sdk 0.22.0", "solana-sdk 0.22.0",
] ]
[[package]]
name = "solana-faucet"
version = "0.22.0"
dependencies = [
"bincode 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-clap-utils 0.22.0",
"solana-logger 0.22.0",
"solana-metrics 0.22.0",
"solana-sdk 0.22.0",
"tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "solana-fixed-buf" name = "solana-fixed-buf"
version = "0.22.0" version = "0.22.0"
@ -3663,8 +3663,8 @@ dependencies = [
"solana-client 0.22.0", "solana-client 0.22.0",
"solana-config-program 0.22.0", "solana-config-program 0.22.0",
"solana-core 0.22.0", "solana-core 0.22.0",
"solana-drone 0.22.0",
"solana-exchange-program 0.22.0", "solana-exchange-program 0.22.0",
"solana-faucet 0.22.0",
"solana-genesis-programs 0.22.0", "solana-genesis-programs 0.22.0",
"solana-ledger 0.22.0", "solana-ledger 0.22.0",
"solana-logger 0.22.0", "solana-logger 0.22.0",
@ -4034,7 +4034,7 @@ dependencies = [
"solana-clap-utils 0.22.0", "solana-clap-utils 0.22.0",
"solana-client 0.22.0", "solana-client 0.22.0",
"solana-core 0.22.0", "solana-core 0.22.0",
"solana-drone 0.22.0", "solana-faucet 0.22.0",
"solana-ledger 0.22.0", "solana-ledger 0.22.0",
"solana-logger 0.22.0", "solana-logger 0.22.0",
"solana-metrics 0.22.0", "solana-metrics 0.22.0",

View File

@ -7,7 +7,7 @@ members = [
"chacha-sys", "chacha-sys",
"client", "client",
"core", "core",
"drone", "faucet",
"perf", "perf",
"validator", "validator",
"genesis", "genesis",

View File

@ -27,7 +27,7 @@ solana-clap-utils = { path = "../clap-utils", version = "0.22.0" }
solana-core = { path = "../core", version = "0.22.0" } solana-core = { path = "../core", version = "0.22.0" }
solana-genesis = { path = "../genesis", version = "0.22.0" } solana-genesis = { path = "../genesis", version = "0.22.0" }
solana-client = { path = "../client", 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-exchange-program = { path = "../programs/exchange", version = "0.22.0" }
solana-logger = { path = "../logger", version = "0.22.0" } solana-logger = { path = "../logger", version = "0.22.0" }
solana-metrics = { path = "../metrics", version = "0.22.0" } solana-metrics = { path = "../metrics", version = "0.22.0" }

View File

@ -7,8 +7,8 @@ use rand::{thread_rng, Rng};
use rayon::prelude::*; use rayon::prelude::*;
use solana_client::perf_utils::{sample_txs, SampleStats}; use solana_client::perf_utils::{sample_txs, SampleStats};
use solana_core::gen_keys::GenKeys; use solana_core::gen_keys::GenKeys;
use solana_drone::drone::request_airdrop_transaction;
use solana_exchange_program::{exchange_instruction, exchange_state::*, id}; use solana_exchange_program::{exchange_instruction, exchange_state::*, id};
use solana_faucet::faucet::request_airdrop_transaction;
use solana_genesis::Base64Account; use solana_genesis::Base64Account;
use solana_metrics::datapoint_info; use solana_metrics::datapoint_info;
use solana_sdk::{ use solana_sdk::{
@ -968,7 +968,7 @@ fn generate_keypairs(num: u64) -> Vec<Keypair> {
rnd.gen_n_keypairs(num) 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 = client.get_balance_with_commitment(&id.pubkey(), CommitmentConfig::recent());
let balance = balance.unwrap_or(0); let balance = balance.unwrap_or(0);
if balance >= amount { if balance >= amount {
@ -980,7 +980,7 @@ pub fn airdrop_lamports(client: &dyn Client, drone_addr: &SocketAddr, id: &Keypa
info!( info!(
"Airdropping {:?} lamports from {} for {}", "Airdropping {:?} lamports from {} for {}",
amount_to_drop, amount_to_drop,
drone_addr, faucet_addr,
id.pubkey(), id.pubkey(),
); );
@ -989,7 +989,7 @@ pub fn airdrop_lamports(client: &dyn Client, drone_addr: &SocketAddr, id: &Keypa
let (blockhash, _fee_calculator) = client let (blockhash, _fee_calculator) = client
.get_recent_blockhash_with_commitment(CommitmentConfig::recent()) .get_recent_blockhash_with_commitment(CommitmentConfig::recent())
.expect("Failed to get blockhash"); .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) => { Ok(transaction) => {
let signature = client.async_send_transaction(transaction).unwrap(); let signature = client.async_send_transaction(transaction).unwrap();
@ -1013,7 +1013,7 @@ pub fn airdrop_lamports(client: &dyn Client, drone_addr: &SocketAddr, id: &Keypa
Err(err) => { Err(err) => {
panic!( panic!(
"Error requesting airdrop: {:?} to addr: {:?} amount: {}", "Error requesting airdrop: {:?} to addr: {:?} amount: {}",
err, drone_addr, amount err, faucet_addr, amount
); );
} }
}; };

View File

@ -1,6 +1,6 @@
use clap::{crate_description, crate_name, value_t, App, Arg, ArgMatches}; use clap::{crate_description, crate_name, value_t, App, Arg, ArgMatches};
use solana_core::gen_keys::GenKeys; 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 solana_sdk::signature::{read_keypair_file, Keypair, KeypairUtil};
use std::net::SocketAddr; use std::net::SocketAddr;
use std::process::exit; use std::process::exit;
@ -8,7 +8,7 @@ use std::time::Duration;
pub struct Config { pub struct Config {
pub entrypoint_addr: SocketAddr, pub entrypoint_addr: SocketAddr,
pub drone_addr: SocketAddr, pub faucet_addr: SocketAddr,
pub identity: Keypair, pub identity: Keypair,
pub threads: usize, pub threads: usize,
pub num_nodes: usize, pub num_nodes: usize,
@ -27,7 +27,7 @@ impl Default for Config {
fn default() -> Self { fn default() -> Self {
Self { Self {
entrypoint_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)), faucet_addr: SocketAddr::from(([127, 0, 0, 1], FAUCET_PORT)),
identity: Keypair::new(), identity: Keypair::new(),
num_nodes: 1, num_nodes: 1,
threads: 4, threads: 4,
@ -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"), .help("Cluster entry point; defaults to 127.0.0.1:8001"),
) )
.arg( .arg(
Arg::with_name("drone") Arg::with_name("faucet")
.short("d") .short("d")
.long("drone") .long("faucet")
.value_name("HOST:PORT") .value_name("HOST:PORT")
.takes_value(true) .takes_value(true)
.required(false) .required(false)
.default_value("127.0.0.1:9900") .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(
Arg::with_name("identity") Arg::with_name("identity")
@ -174,9 +174,9 @@ pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config {
exit(1) 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| { .unwrap_or_else(|e| {
eprintln!("failed to parse drone address: {}", e); eprintln!("failed to parse faucet address: {}", e);
exit(1) exit(1)
}); });

View File

@ -16,7 +16,7 @@ fn main() {
let cli::Config { let cli::Config {
entrypoint_addr, entrypoint_addr,
drone_addr, faucet_addr,
identity, identity,
threads, threads,
num_nodes, num_nodes,
@ -73,7 +73,7 @@ fn main() {
const NUM_SIGNERS: u64 = 2; const NUM_SIGNERS: u64 = 2;
airdrop_lamports( airdrop_lamports(
&client, &client,
&drone_addr, &faucet_addr,
&config.identity, &config.identity,
fund_amount * (accounts_in_groups + 1) as u64 * NUM_SIGNERS, fund_amount * (accounts_in_groups + 1) as u64 * NUM_SIGNERS,
); );

View File

@ -2,10 +2,10 @@ use log::*;
use solana_bench_exchange::bench::{airdrop_lamports, do_bench_exchange, Config}; use solana_bench_exchange::bench::{airdrop_lamports, do_bench_exchange, Config};
use solana_core::gossip_service::{discover_cluster, get_multi_client}; use solana_core::gossip_service::{discover_cluster, get_multi_client};
use solana_core::validator::ValidatorConfig; use solana_core::validator::ValidatorConfig;
use solana_drone::drone::run_local_drone;
use solana_exchange_program::exchange_processor::process_instruction; use solana_exchange_program::exchange_processor::process_instruction;
use solana_exchange_program::id; use solana_exchange_program::id;
use solana_exchange_program::solana_exchange_program; use solana_exchange_program::solana_exchange_program;
use solana_faucet::faucet::run_local_faucet;
use solana_local_cluster::local_cluster::{ClusterConfig, LocalCluster}; use solana_local_cluster::local_cluster::{ClusterConfig, LocalCluster};
use solana_runtime::bank::Bank; use solana_runtime::bank::Bank;
use solana_runtime::bank_client::BankClient; use solana_runtime::bank_client::BankClient;
@ -46,16 +46,16 @@ fn test_exchange_local_cluster() {
..ClusterConfig::default() ..ClusterConfig::default()
}); });
let drone_keypair = Keypair::new(); let faucet_keypair = Keypair::new();
cluster.transfer( cluster.transfer(
&cluster.funding_keypair, &cluster.funding_keypair,
&drone_keypair.pubkey(), &faucet_keypair.pubkey(),
2_000_000_000_000, 2_000_000_000_000,
); );
let (addr_sender, addr_receiver) = channel(); let (addr_sender, addr_receiver) = channel();
run_local_drone(drone_keypair, addr_sender, Some(1_000_000_000_000)); run_local_faucet(faucet_keypair, addr_sender, Some(1_000_000_000_000));
let drone_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap(); let faucet_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap();
info!("Connecting to the cluster"); info!("Connecting to the cluster");
let (nodes, _) = let (nodes, _) =
@ -72,7 +72,7 @@ fn test_exchange_local_cluster() {
const NUM_SIGNERS: u64 = 2; const NUM_SIGNERS: u64 = 2;
airdrop_lamports( airdrop_lamports(
&client, &client,
&drone_addr, &faucet_addr,
&config.identity, &config.identity,
fund_amount * (accounts_in_groups + 1) as u64 * NUM_SIGNERS, fund_amount * (accounts_in_groups + 1) as u64 * NUM_SIGNERS,
); );

View File

@ -20,7 +20,7 @@ solana-clap-utils = { path = "../clap-utils", version = "0.22.0" }
solana-core = { path = "../core", version = "0.22.0" } solana-core = { path = "../core", version = "0.22.0" }
solana-genesis = { path = "../genesis", version = "0.22.0" } solana-genesis = { path = "../genesis", version = "0.22.0" }
solana-client = { path = "../client", 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-librapay = { path = "../programs/librapay", version = "0.22.0", optional = true }
solana-logger = { path = "../logger", version = "0.22.0" } solana-logger = { path = "../logger", version = "0.22.0" }
solana-metrics = { path = "../metrics", version = "0.22.0" } solana-metrics = { path = "../metrics", version = "0.22.0" }

View File

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

View File

@ -1,5 +1,5 @@
use clap::{crate_description, crate_name, App, Arg, ArgMatches}; 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::fee_calculator::FeeCalculator;
use solana_sdk::signature::{read_keypair_file, Keypair, KeypairUtil}; use solana_sdk::signature::{read_keypair_file, Keypair, KeypairUtil};
use std::{net::SocketAddr, process::exit, time::Duration}; 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 /// Holds the configuration for a single run of the benchmark
pub struct Config { pub struct Config {
pub entrypoint_addr: SocketAddr, pub entrypoint_addr: SocketAddr,
pub drone_addr: SocketAddr, pub faucet_addr: SocketAddr,
pub id: Keypair, pub id: Keypair,
pub threads: usize, pub threads: usize,
pub num_nodes: usize, pub num_nodes: usize,
@ -30,7 +30,7 @@ impl Default for Config {
fn default() -> Config { fn default() -> Config {
Config { Config {
entrypoint_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)), faucet_addr: SocketAddr::from(([127, 0, 0, 1], FAUCET_PORT)),
id: Keypair::new(), id: Keypair::new(),
threads: 4, threads: 4,
num_nodes: 1, 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"), .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("faucet")
.short("d") .short("d")
.long("drone") .long("faucet")
.value_name("HOST:PORT") .value_name("HOST:PORT")
.takes_value(true) .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(
Arg::with_name("identity") 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") { if let Some(addr) = matches.value_of("faucet") {
args.drone_addr = solana_net_utils::parse_host_port(addr).unwrap_or_else(|e| { args.faucet_addr = solana_net_utils::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse drone address: {}", e); eprintln!("failed to parse faucet address: {}", e);
exit(1) exit(1)
}); });
} }

View File

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

View File

@ -4,7 +4,7 @@ use solana_bench_tps::cli::Config;
use solana_client::thin_client::create_client; use solana_client::thin_client::create_client;
use solana_core::cluster_info::VALIDATOR_PORT_RANGE; use solana_core::cluster_info::VALIDATOR_PORT_RANGE;
use solana_core::validator::ValidatorConfig; use solana_core::validator::ValidatorConfig;
use solana_drone::drone::run_local_drone; use solana_faucet::faucet::run_local_faucet;
use solana_local_cluster::local_cluster::{ClusterConfig, LocalCluster}; use solana_local_cluster::local_cluster::{ClusterConfig, LocalCluster};
#[cfg(feature = "move")] #[cfg(feature = "move")]
use solana_sdk::move_loader::solana_move_loader_program; use solana_sdk::move_loader::solana_move_loader_program;
@ -29,10 +29,10 @@ fn test_bench_tps_local_cluster(config: Config) {
..ClusterConfig::default() ..ClusterConfig::default()
}); });
let drone_keypair = Keypair::new(); let faucet_keypair = Keypair::new();
cluster.transfer( cluster.transfer(
&cluster.funding_keypair, &cluster.funding_keypair,
&drone_keypair.pubkey(), &faucet_keypair.pubkey(),
100_000_000, 100_000_000,
); );
@ -42,14 +42,14 @@ fn test_bench_tps_local_cluster(config: Config) {
); );
let (addr_sender, addr_receiver) = channel(); let (addr_sender, addr_receiver) = channel();
run_local_drone(drone_keypair, addr_sender, None); run_local_faucet(faucet_keypair, addr_sender, None);
let drone_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap(); let faucet_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap();
let lamports_per_account = 100; let lamports_per_account = 100;
let (keypairs, move_keypairs, _keypair_balance) = generate_and_fund_keypairs( let (keypairs, move_keypairs, _keypair_balance) = generate_and_fund_keypairs(
&client, &client,
Some(drone_addr), Some(faucet_addr),
&config.id, &config.id,
config.tx_count, config.tx_count,
lamports_per_account, lamports_per_account,

View File

@ -266,8 +266,8 @@ FLAGS:
OPTIONS: OPTIONS:
-C, --config <PATH> Configuration file to use [default: ~/.config/solana/cli/config.yml] -C, --config <PATH> Configuration file to use [default: ~/.config/solana/cli/config.yml]
--drone-host <HOST> Drone host to use [default: the --url host] --faucet-host <HOST> Drone host to use [default: the --url host]
--drone-port <PORT> Drone port to use [default: 9900] --faucet-port <PORT> Drone port to use [default: 9900]
-u, --url <URL> JSON RPC URL for the solana cluster -u, --url <URL> JSON RPC URL for the solana cluster
-k, --keypair <PATH> /path/to/id.json -k, --keypair <PATH> /path/to/id.json

View File

@ -42,12 +42,12 @@ $ NDEBUG=1 ./multinode-demo/setup.sh
### Drone ### Drone
In order for the validators and clients to work, we'll need to spin up a drone to give out some test tokens. The drone delivers Milton Friedman-style "air drops" \(free tokens to requesting clients\) to be used in test transactions. In order for the validators and clients to work, we'll need to spin up a faucet to give out some test tokens. The faucet delivers Milton Friedman-style "air drops" \(free tokens to requesting clients\) to be used in test transactions.
Start the drone with: Start the faucet with:
```bash ```bash
$ NDEBUG=1 ./multinode-demo/drone.sh $ NDEBUG=1 ./multinode-demo/faucet.sh
``` ```
### Singlenode Testnet ### Singlenode Testnet
@ -60,7 +60,7 @@ Now start the bootstrap leader in a separate shell:
$ NDEBUG=1 ./multinode-demo/bootstrap-leader.sh $ NDEBUG=1 ./multinode-demo/bootstrap-leader.sh
``` ```
Wait a few seconds for the server to initialize. It will print "leader ready..." when it's ready to receive transactions. The leader will request some tokens from the drone if it doesn't have any. The drone does not need to be running for subsequent leader starts. Wait a few seconds for the server to initialize. It will print "leader ready..." when it's ready to receive transactions. The leader will request some tokens from the faucet if it doesn't have any. The faucet does not need to be running for subsequent leader starts.
### Multinode Testnet ### Multinode Testnet
@ -126,8 +126,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
$ NDEBUG=1 ./multinode-demo/bench-tps.sh --entrypoint testnet.solana.com:8001 --drone testnet.solana.com:9900 --duration 60 --tx_count 50 $ NDEBUG=1 ./multinode-demo/bench-tps.sh --entrypoint testnet.solana.com:8001 --faucet testnet.solana.com:9900 --duration 60 --tx_count 50
``` ```
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

@ -73,7 +73,7 @@ source scripts/configure-metrics.sh
source multinode-demo/common.sh source multinode-demo/common.sh
nodes=( nodes=(
"multinode-demo/drone.sh" "multinode-demo/faucet.sh"
"multinode-demo/bootstrap-leader.sh \ "multinode-demo/bootstrap-leader.sh \
--no-restart \ --no-restart \
--init-complete-file init-complete-node1.log \ --init-complete-file init-complete-node1.log \
@ -160,7 +160,7 @@ startNodes() {
for i in $(seq 0 $((${#nodes[@]} - 1))); do for i in $(seq 0 $((${#nodes[@]} - 1))); do
declare cmd=${nodes[$i]} declare cmd=${nodes[$i]}
if [[ "$i" -ne 0 ]]; then # 0 == drone, skip it if [[ "$i" -ne 0 ]]; then # 0 == faucet, skip it
declare initCompleteFile="init-complete-node$i.log" declare initCompleteFile="init-complete-node$i.log"
rm -f "$initCompleteFile" rm -f "$initCompleteFile"
initCompleteFiles+=("$initCompleteFile") initCompleteFiles+=("$initCompleteFile")
@ -243,8 +243,8 @@ rollingNodeRestart() {
declare pid=${oldPids[$i]} declare pid=${oldPids[$i]}
declare cmd=${nodes[$i]} declare cmd=${nodes[$i]}
if [[ $i -eq 0 ]]; then if [[ $i -eq 0 ]]; then
# First cmd should be the drone, don't restart it. # First cmd should be the faucet, don't restart it.
[[ "$cmd" = "multinode-demo/drone.sh" ]] [[ "$cmd" = "multinode-demo/faucet.sh" ]]
pids+=("$pid") pids+=("$pid")
else else
echo "--- Restarting $pid: $cmd" echo "--- Restarting $pid: $cmd"
@ -265,7 +265,7 @@ rollingNodeRestart() {
# 'Atomically' remove the old pids from the pids array # 'Atomically' remove the old pids from the pids array
declare oldPidsList declare oldPidsList
oldPidsList="$(printf ":%s" "${oldPids[@]}"):" oldPidsList="$(printf ":%s" "${oldPids[@]}"):"
declare newPids=("${pids[0]}") # 0 = drone pid declare newPids=("${pids[0]}") # 0 = faucet pid
for pid in "${pids[@]}"; do for pid in "${pids[@]}"; do
[[ $oldPidsList =~ :$pid: ]] || { [[ $oldPidsList =~ :$pid: ]] || {
newPids+=("$pid") newPids+=("$pid")

View File

@ -19,7 +19,7 @@ declare prints=(
# Parts of the tree that are expected to be print free # Parts of the tree that are expected to be print free
declare print_free_tree=( declare print_free_tree=(
'core/src' 'core/src'
'drone/src' 'faucet/src'
'metrics/src' 'metrics/src'
'net-utils/src' 'net-utils/src'
'runtime/src' 'runtime/src'

View File

@ -32,7 +32,7 @@ solana-budget-program = { path = "../programs/budget", version = "0.22.0" }
solana-clap-utils = { path = "../clap-utils", version = "0.22.0" } solana-clap-utils = { path = "../clap-utils", version = "0.22.0" }
solana-client = { path = "../client", version = "0.22.0" } solana-client = { path = "../client", version = "0.22.0" }
solana-config-program = { path = "../programs/config", version = "0.22.0" } solana-config-program = { path = "../programs/config", version = "0.22.0" }
solana-drone = { path = "../drone", version = "0.22.0" } solana-faucet = { path = "../faucet", version = "0.22.0" }
solana-logger = { path = "../logger", version = "0.22.0" } solana-logger = { path = "../logger", version = "0.22.0" }
solana-net-utils = { path = "../net-utils", version = "0.22.0" } solana-net-utils = { path = "../net-utils", version = "0.22.0" }
solana-runtime = { path = "../runtime", version = "0.22.0" } solana-runtime = { path = "../runtime", version = "0.22.0" }

View File

@ -16,9 +16,9 @@ use solana_budget_program::budget_instruction::{self, BudgetError};
use solana_clap_utils::{input_parsers::*, input_validators::*}; use solana_clap_utils::{input_parsers::*, input_validators::*};
use solana_client::{client_error::ClientError, rpc_client::RpcClient}; use solana_client::{client_error::ClientError, rpc_client::RpcClient};
#[cfg(not(test))] #[cfg(not(test))]
use solana_drone::drone::request_airdrop_transaction; use solana_faucet::faucet::request_airdrop_transaction;
#[cfg(test)] #[cfg(test)]
use solana_drone::drone_mock::request_airdrop_transaction; use solana_faucet::faucet_mock::request_airdrop_transaction;
use solana_sdk::{ use solana_sdk::{
bpf_loader, bpf_loader,
clock::Slot, clock::Slot,
@ -208,8 +208,8 @@ pub enum CliCommand {
// Wallet Commands // Wallet Commands
Address, Address,
Airdrop { Airdrop {
drone_host: Option<IpAddr>, faucet_host: Option<IpAddr>,
drone_port: u16, faucet_port: u16,
lamports: u64, lamports: u64,
use_lamports_unit: bool, use_lamports_unit: bool,
}, },
@ -401,21 +401,21 @@ pub fn parse_command(matches: &ArgMatches<'_>) -> Result<CliCommandInfo, Box<dyn
require_keypair: true, require_keypair: true,
}), }),
("airdrop", Some(matches)) => { ("airdrop", Some(matches)) => {
let drone_port = matches let faucet_port = matches
.value_of("drone_port") .value_of("faucet_port")
.unwrap() .unwrap()
.parse() .parse()
.or_else(|err| { .or_else(|err| {
Err(CliError::BadParameter(format!( Err(CliError::BadParameter(format!(
"Invalid drone port: {:?}", "Invalid faucet port: {:?}",
err err
))) )))
})?; })?;
let drone_host = if let Some(drone_host) = matches.value_of("drone_host") { let faucet_host = if let Some(faucet_host) = matches.value_of("faucet_host") {
Some(solana_net_utils::parse_host(drone_host).or_else(|err| { Some(solana_net_utils::parse_host(faucet_host).or_else(|err| {
Err(CliError::BadParameter(format!( Err(CliError::BadParameter(format!(
"Invalid drone host: {:?}", "Invalid faucet host: {:?}",
err err
))) )))
})?) })?)
@ -426,8 +426,8 @@ pub fn parse_command(matches: &ArgMatches<'_>) -> Result<CliCommandInfo, Box<dyn
let use_lamports_unit = matches.value_of("unit") == Some("lamports"); let use_lamports_unit = matches.value_of("unit") == Some("lamports");
Ok(CliCommandInfo { Ok(CliCommandInfo {
command: CliCommand::Airdrop { command: CliCommand::Airdrop {
drone_host, faucet_host,
drone_port, faucet_port,
lamports, lamports,
use_lamports_unit, use_lamports_unit,
}, },
@ -684,14 +684,14 @@ fn process_create_address_with_seed(
fn process_airdrop( fn process_airdrop(
rpc_client: &RpcClient, rpc_client: &RpcClient,
config: &CliConfig, config: &CliConfig,
drone_addr: &SocketAddr, faucet_addr: &SocketAddr,
lamports: u64, lamports: u64,
use_lamports_unit: bool, use_lamports_unit: bool,
) -> ProcessResult { ) -> ProcessResult {
println!( println!(
"Requesting airdrop of {} from {}", "Requesting airdrop of {} from {}",
build_balance_message(lamports, use_lamports_unit, true), build_balance_message(lamports, use_lamports_unit, true),
drone_addr faucet_addr
); );
let previous_balance = match rpc_client.retry_get_balance(&config.keypair.pubkey(), 5)? { let previous_balance = match rpc_client.retry_get_balance(&config.keypair.pubkey(), 5)? {
Some(lamports) => lamports, Some(lamports) => lamports,
@ -703,7 +703,7 @@ fn process_airdrop(
} }
}; };
request_and_confirm_airdrop(&rpc_client, drone_addr, &config.keypair.pubkey(), lamports)?; request_and_confirm_airdrop(&rpc_client, faucet_addr, &config.keypair.pubkey(), lamports)?;
let current_balance = rpc_client let current_balance = rpc_client
.retry_get_balance(&config.keypair.pubkey(), 5)? .retry_get_balance(&config.keypair.pubkey(), 5)?
@ -1362,31 +1362,31 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
// Get address of this client // Get address of this client
CliCommand::Address => unreachable!(), CliCommand::Address => unreachable!(),
// Request an airdrop from Solana Drone; // Request an airdrop from Solana Faucet;
CliCommand::Airdrop { CliCommand::Airdrop {
drone_host, faucet_host,
drone_port, faucet_port,
lamports, lamports,
use_lamports_unit, use_lamports_unit,
} => { } => {
let drone_addr = SocketAddr::new( let faucet_addr = SocketAddr::new(
drone_host.unwrap_or_else(|| { faucet_host.unwrap_or_else(|| {
let drone_host = url::Url::parse(&config.json_rpc_url) let faucet_host = url::Url::parse(&config.json_rpc_url)
.unwrap() .unwrap()
.host() .host()
.unwrap() .unwrap()
.to_string(); .to_string();
solana_net_utils::parse_host(&drone_host).unwrap_or_else(|err| { solana_net_utils::parse_host(&faucet_host).unwrap_or_else(|err| {
panic!("Unable to resolve {}: {}", drone_host, err); panic!("Unable to resolve {}: {}", faucet_host, err);
}) })
}), }),
*drone_port, *faucet_port,
); );
process_airdrop( process_airdrop(
&rpc_client, &rpc_client,
config, config,
&drone_addr, &faucet_addr,
*lamports, *lamports,
*use_lamports_unit, *use_lamports_unit,
) )
@ -1446,18 +1446,18 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
// Quick and dirty Keypair that assumes the client will do retries but not update the // Quick and dirty Keypair that assumes the client will do retries but not update the
// blockhash. If the client updates the blockhash, the signature will be invalid. // blockhash. If the client updates the blockhash, the signature will be invalid.
struct DroneKeypair { struct FaucetKeypair {
transaction: Transaction, transaction: Transaction,
} }
impl DroneKeypair { impl FaucetKeypair {
fn new_keypair( fn new_keypair(
drone_addr: &SocketAddr, faucet_addr: &SocketAddr,
to_pubkey: &Pubkey, to_pubkey: &Pubkey,
lamports: u64, lamports: u64,
blockhash: Hash, blockhash: Hash,
) -> Result<Self, Box<dyn error::Error>> { ) -> Result<Self, Box<dyn error::Error>> {
let transaction = request_airdrop_transaction(drone_addr, to_pubkey, lamports, blockhash)?; let transaction = request_airdrop_transaction(faucet_addr, to_pubkey, lamports, blockhash)?;
Ok(Self { transaction }) Ok(Self { transaction })
} }
@ -1466,7 +1466,7 @@ impl DroneKeypair {
} }
} }
impl KeypairUtil for DroneKeypair { impl KeypairUtil for FaucetKeypair {
fn new() -> Self { fn new() -> Self {
unimplemented!(); unimplemented!();
} }
@ -1483,7 +1483,7 @@ impl KeypairUtil for DroneKeypair {
pub fn request_and_confirm_airdrop( pub fn request_and_confirm_airdrop(
rpc_client: &RpcClient, rpc_client: &RpcClient,
drone_addr: &SocketAddr, faucet_addr: &SocketAddr,
to_pubkey: &Pubkey, to_pubkey: &Pubkey,
lamports: u64, lamports: u64,
) -> ProcessResult { ) -> ProcessResult {
@ -1491,7 +1491,7 @@ pub fn request_and_confirm_airdrop(
let keypair = { let keypair = {
let mut retries = 5; let mut retries = 5;
loop { loop {
let result = DroneKeypair::new_keypair(drone_addr, to_pubkey, lamports, blockhash); let result = FaucetKeypair::new_keypair(faucet_addr, to_pubkey, lamports, blockhash);
if result.is_ok() || retries == 0 { if result.is_ok() || retries == 0 {
break result; break result;
} }
@ -1579,19 +1579,19 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
SubCommand::with_name("airdrop") SubCommand::with_name("airdrop")
.about("Request lamports") .about("Request lamports")
.arg( .arg(
Arg::with_name("drone_host") Arg::with_name("faucet_host")
.long("drone-host") .long("faucet-host")
.value_name("HOST") .value_name("HOST")
.takes_value(true) .takes_value(true)
.help("Drone host to use [default: the --url host]"), .help("Faucet host to use [default: the --url host]"),
) )
.arg( .arg(
Arg::with_name("drone_port") Arg::with_name("faucet_port")
.long("drone-port") .long("faucet-port")
.value_name("PORT") .value_name("PORT")
.takes_value(true) .takes_value(true)
.default_value(solana_drone::drone::DRONE_PORT_STR) .default_value(solana_faucet::faucet::FAUCET_PORT_STR)
.help("Drone port to use"), .help("Faucet port to use"),
) )
.arg( .arg(
Arg::with_name("amount") Arg::with_name("amount")
@ -1907,8 +1907,8 @@ mod tests {
parse_command(&test_airdrop).unwrap(), parse_command(&test_airdrop).unwrap(),
CliCommandInfo { CliCommandInfo {
command: CliCommand::Airdrop { command: CliCommand::Airdrop {
drone_host: None, faucet_host: None,
drone_port: solana_drone::drone::DRONE_PORT, faucet_port: solana_faucet::faucet::FAUCET_PORT,
lamports: 50, lamports: 50,
use_lamports_unit: true, use_lamports_unit: true,
}, },
@ -2545,8 +2545,8 @@ mod tests {
// Need airdrop cases // Need airdrop cases
config.command = CliCommand::Airdrop { config.command = CliCommand::Airdrop {
drone_host: None, faucet_host: None,
drone_port: 1234, faucet_port: 1234,
lamports: 50, lamports: 50,
use_lamports_unit: true, use_lamports_unit: true,
}; };
@ -2584,8 +2584,8 @@ mod tests {
config.rpc_client = Some(RpcClient::new_mock("fails".to_string())); config.rpc_client = Some(RpcClient::new_mock("fails".to_string()));
config.command = CliCommand::Airdrop { config.command = CliCommand::Airdrop {
drone_host: None, faucet_host: None,
drone_port: 1234, faucet_port: 1234,
lamports: 50, lamports: 50,
use_lamports_unit: true, use_lamports_unit: true,
}; };

View File

@ -2,7 +2,7 @@ use serde_json::Value;
use solana_cli::cli::{process_command, CliCommand, CliConfig}; use solana_cli::cli::{process_command, CliCommand, CliConfig};
use solana_client::rpc_client::RpcClient; use solana_client::rpc_client::RpcClient;
use solana_core::validator::new_validator_for_tests; use solana_core::validator::new_validator_for_tests;
use solana_drone::drone::run_local_drone; use solana_faucet::faucet::run_local_faucet;
use solana_sdk::{bpf_loader, pubkey::Pubkey}; use solana_sdk::{bpf_loader, pubkey::Pubkey};
use std::{ use std::{
fs::{remove_dir_all, File}, fs::{remove_dir_all, File},
@ -25,8 +25,8 @@ fn test_cli_deploy_program() {
let (server, leader_data, alice, ledger_path) = new_validator_for_tests(); let (server, leader_data, alice, ledger_path) = new_validator_for_tests();
let (sender, receiver) = channel(); let (sender, receiver) = channel();
run_local_drone(alice, sender, None); run_local_faucet(alice, sender, None);
let drone_addr = receiver.recv().unwrap(); let faucet_addr = receiver.recv().unwrap();
let rpc_client = RpcClient::new_socket(leader_data.rpc); let rpc_client = RpcClient::new_socket(leader_data.rpc);
@ -40,8 +40,8 @@ fn test_cli_deploy_program() {
let mut config = CliConfig::default(); let mut config = CliConfig::default();
config.json_rpc_url = format!("http://{}:{}", leader_data.rpc.ip(), leader_data.rpc.port()); config.json_rpc_url = format!("http://{}:{}", leader_data.rpc.ip(), leader_data.rpc.port());
config.command = CliCommand::Airdrop { config.command = CliCommand::Airdrop {
drone_host: None, faucet_host: None,
drone_port: drone_addr.port(), faucet_port: faucet_addr.port(),
lamports: minimum_balance_for_rent_exemption + 1, // min balance for rent exemption + leftover for tx processing lamports: minimum_balance_for_rent_exemption + 1, // min balance for rent exemption + leftover for tx processing
use_lamports_unit: true, use_lamports_unit: true,
}; };

View File

@ -1,6 +1,6 @@
use solana_cli::cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig}; use solana_cli::cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig};
use solana_client::rpc_client::RpcClient; use solana_client::rpc_client::RpcClient;
use solana_drone::drone::run_local_drone; use solana_faucet::faucet::run_local_faucet;
use solana_sdk::{ use solana_sdk::{
hash::Hash, hash::Hash,
pubkey::Pubkey, pubkey::Pubkey,
@ -38,8 +38,8 @@ fn check_balance(expected_balance: u64, client: &RpcClient, pubkey: &Pubkey) {
fn test_nonce() { fn test_nonce() {
let (server, leader_data, alice, ledger_path) = new_validator_for_tests(); let (server, leader_data, alice, ledger_path) = new_validator_for_tests();
let (sender, receiver) = channel(); let (sender, receiver) = channel();
run_local_drone(alice, sender, None); run_local_faucet(alice, sender, None);
let drone_addr = receiver.recv().unwrap(); let faucet_addr = receiver.recv().unwrap();
let rpc_client = RpcClient::new_socket(leader_data.rpc); let rpc_client = RpcClient::new_socket(leader_data.rpc);
@ -55,7 +55,7 @@ fn test_nonce() {
request_and_confirm_airdrop( request_and_confirm_airdrop(
&rpc_client, &rpc_client,
&drone_addr, &faucet_addr,
&config_payer.keypair.pubkey(), &config_payer.keypair.pubkey(),
2000, 2000,
) )

View File

@ -2,7 +2,7 @@ use chrono::prelude::*;
use serde_json::Value; use serde_json::Value;
use solana_cli::cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig}; use solana_cli::cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig};
use solana_client::rpc_client::RpcClient; use solana_client::rpc_client::RpcClient;
use solana_drone::drone::run_local_drone; use solana_faucet::faucet::run_local_faucet;
use solana_sdk::{hash::Hash, pubkey::Pubkey, signature::KeypairUtil, signature::Signature}; use solana_sdk::{hash::Hash, pubkey::Pubkey, signature::KeypairUtil, signature::Signature};
use std::fs::remove_dir_all; use std::fs::remove_dir_all;
use std::str::FromStr; use std::str::FromStr;
@ -32,8 +32,8 @@ fn test_cli_timestamp_tx() {
let bob_pubkey = Pubkey::new_rand(); let bob_pubkey = Pubkey::new_rand();
let (sender, receiver) = channel(); let (sender, receiver) = channel();
run_local_drone(alice, sender, None); run_local_faucet(alice, sender, None);
let drone_addr = receiver.recv().unwrap(); let faucet_addr = receiver.recv().unwrap();
let rpc_client = RpcClient::new_socket(leader_data.rpc); let rpc_client = RpcClient::new_socket(leader_data.rpc);
@ -49,13 +49,18 @@ fn test_cli_timestamp_tx() {
config_witness.keypair.pubkey() config_witness.keypair.pubkey()
); );
request_and_confirm_airdrop(&rpc_client, &drone_addr, &config_payer.keypair.pubkey(), 50) request_and_confirm_airdrop(
&rpc_client,
&faucet_addr,
&config_payer.keypair.pubkey(),
50,
)
.unwrap(); .unwrap();
check_balance(50, &rpc_client, &config_payer.keypair.pubkey()); check_balance(50, &rpc_client, &config_payer.keypair.pubkey());
request_and_confirm_airdrop( request_and_confirm_airdrop(
&rpc_client, &rpc_client,
&drone_addr, &faucet_addr,
&config_witness.keypair.pubkey(), &config_witness.keypair.pubkey(),
1, 1,
) )
@ -106,8 +111,8 @@ fn test_cli_witness_tx() {
let bob_pubkey = Pubkey::new_rand(); let bob_pubkey = Pubkey::new_rand();
let (sender, receiver) = channel(); let (sender, receiver) = channel();
run_local_drone(alice, sender, None); run_local_faucet(alice, sender, None);
let drone_addr = receiver.recv().unwrap(); let faucet_addr = receiver.recv().unwrap();
let rpc_client = RpcClient::new_socket(leader_data.rpc); let rpc_client = RpcClient::new_socket(leader_data.rpc);
@ -123,11 +128,16 @@ fn test_cli_witness_tx() {
config_witness.keypair.pubkey() config_witness.keypair.pubkey()
); );
request_and_confirm_airdrop(&rpc_client, &drone_addr, &config_payer.keypair.pubkey(), 50) request_and_confirm_airdrop(
&rpc_client,
&faucet_addr,
&config_payer.keypair.pubkey(),
50,
)
.unwrap(); .unwrap();
request_and_confirm_airdrop( request_and_confirm_airdrop(
&rpc_client, &rpc_client,
&drone_addr, &faucet_addr,
&config_witness.keypair.pubkey(), &config_witness.keypair.pubkey(),
1, 1,
) )
@ -176,8 +186,8 @@ fn test_cli_cancel_tx() {
let bob_pubkey = Pubkey::new_rand(); let bob_pubkey = Pubkey::new_rand();
let (sender, receiver) = channel(); let (sender, receiver) = channel();
run_local_drone(alice, sender, None); run_local_faucet(alice, sender, None);
let drone_addr = receiver.recv().unwrap(); let faucet_addr = receiver.recv().unwrap();
let rpc_client = RpcClient::new_socket(leader_data.rpc); let rpc_client = RpcClient::new_socket(leader_data.rpc);
@ -193,7 +203,12 @@ fn test_cli_cancel_tx() {
config_witness.keypair.pubkey() config_witness.keypair.pubkey()
); );
request_and_confirm_airdrop(&rpc_client, &drone_addr, &config_payer.keypair.pubkey(), 50) request_and_confirm_airdrop(
&rpc_client,
&faucet_addr,
&config_payer.keypair.pubkey(),
50,
)
.unwrap(); .unwrap();
// Make transaction (from config_payer to bob_pubkey) requiring witness signature from config_witness // Make transaction (from config_payer to bob_pubkey) requiring witness signature from config_witness
@ -239,8 +254,8 @@ fn test_offline_pay_tx() {
let bob_pubkey = Pubkey::new_rand(); let bob_pubkey = Pubkey::new_rand();
let (sender, receiver) = channel(); let (sender, receiver) = channel();
run_local_drone(alice, sender, None); run_local_faucet(alice, sender, None);
let drone_addr = receiver.recv().unwrap(); let faucet_addr = receiver.recv().unwrap();
let rpc_client = RpcClient::new_socket(leader_data.rpc); let rpc_client = RpcClient::new_socket(leader_data.rpc);
@ -257,7 +272,7 @@ fn test_offline_pay_tx() {
request_and_confirm_airdrop( request_and_confirm_airdrop(
&rpc_client, &rpc_client,
&drone_addr, &faucet_addr,
&config_offline.keypair.pubkey(), &config_offline.keypair.pubkey(),
50, 50,
) )
@ -265,7 +280,7 @@ fn test_offline_pay_tx() {
request_and_confirm_airdrop( request_and_confirm_airdrop(
&rpc_client, &rpc_client,
&drone_addr, &faucet_addr,
&config_online.keypair.pubkey(), &config_online.keypair.pubkey(),
50, 50,
) )

View File

@ -1,7 +1,7 @@
use solana_cli::cli::{process_command, CliCommand, CliConfig}; use solana_cli::cli::{process_command, CliCommand, CliConfig};
use solana_client::rpc_client::RpcClient; use solana_client::rpc_client::RpcClient;
use solana_core::validator::new_validator_for_tests; use solana_core::validator::new_validator_for_tests;
use solana_drone::drone::run_local_drone; use solana_faucet::faucet::run_local_faucet;
use solana_sdk::signature::KeypairUtil; use solana_sdk::signature::KeypairUtil;
use std::fs::remove_dir_all; use std::fs::remove_dir_all;
use std::sync::mpsc::channel; use std::sync::mpsc::channel;
@ -10,14 +10,14 @@ use std::sync::mpsc::channel;
fn test_cli_request_airdrop() { fn test_cli_request_airdrop() {
let (server, leader_data, alice, ledger_path) = new_validator_for_tests(); let (server, leader_data, alice, ledger_path) = new_validator_for_tests();
let (sender, receiver) = channel(); let (sender, receiver) = channel();
run_local_drone(alice, sender, None); run_local_faucet(alice, sender, None);
let drone_addr = receiver.recv().unwrap(); let faucet_addr = receiver.recv().unwrap();
let mut bob_config = CliConfig::default(); let mut bob_config = CliConfig::default();
bob_config.json_rpc_url = format!("http://{}:{}", leader_data.rpc.ip(), leader_data.rpc.port()); bob_config.json_rpc_url = format!("http://{}:{}", leader_data.rpc.ip(), leader_data.rpc.port());
bob_config.command = CliCommand::Airdrop { bob_config.command = CliCommand::Airdrop {
drone_host: None, faucet_host: None,
drone_port: drone_addr.port(), faucet_port: faucet_addr.port(),
lamports: 50, lamports: 50,
use_lamports_unit: true, use_lamports_unit: true,
}; };

View File

@ -1,7 +1,7 @@
use serde_json::Value; use serde_json::Value;
use solana_cli::cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig}; use solana_cli::cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig};
use solana_client::rpc_client::RpcClient; use solana_client::rpc_client::RpcClient;
use solana_drone::drone::run_local_drone; use solana_faucet::faucet::run_local_faucet;
use solana_sdk::{ use solana_sdk::{
hash::Hash, hash::Hash,
pubkey::Pubkey, pubkey::Pubkey,
@ -43,8 +43,8 @@ fn test_stake_delegation_and_deactivation() {
let (server, leader_data, alice, ledger_path) = new_validator_for_tests(); let (server, leader_data, alice, ledger_path) = new_validator_for_tests();
let (sender, receiver) = channel(); let (sender, receiver) = channel();
run_local_drone(alice, sender, None); run_local_faucet(alice, sender, None);
let drone_addr = receiver.recv().unwrap(); let faucet_addr = receiver.recv().unwrap();
let rpc_client = RpcClient::new_socket(leader_data.rpc); let rpc_client = RpcClient::new_socket(leader_data.rpc);
@ -66,7 +66,7 @@ fn test_stake_delegation_and_deactivation() {
request_and_confirm_airdrop( request_and_confirm_airdrop(
&rpc_client, &rpc_client,
&drone_addr, &faucet_addr,
&config_validator.keypair.pubkey(), &config_validator.keypair.pubkey(),
100_000, 100_000,
) )
@ -126,8 +126,8 @@ fn test_stake_delegation_and_deactivation_offline() {
let (server, leader_data, alice, ledger_path) = new_validator_for_tests(); let (server, leader_data, alice, ledger_path) = new_validator_for_tests();
let (sender, receiver) = channel(); let (sender, receiver) = channel();
run_local_drone(alice, sender, None); run_local_faucet(alice, sender, None);
let drone_addr = receiver.recv().unwrap(); let faucet_addr = receiver.recv().unwrap();
let rpc_client = RpcClient::new_socket(leader_data.rpc); let rpc_client = RpcClient::new_socket(leader_data.rpc);
@ -153,7 +153,7 @@ fn test_stake_delegation_and_deactivation_offline() {
request_and_confirm_airdrop( request_and_confirm_airdrop(
&rpc_client, &rpc_client,
&drone_addr, &faucet_addr,
&config_validator.keypair.pubkey(), &config_validator.keypair.pubkey(),
100_000, 100_000,
) )

View File

@ -45,7 +45,7 @@ solana-budget-program = { path = "../programs/budget", version = "0.22.0" }
solana-clap-utils = { path = "../clap-utils", version = "0.22.0" } solana-clap-utils = { path = "../clap-utils", version = "0.22.0" }
solana-chacha-sys = { path = "../chacha-sys", version = "0.22.0" } solana-chacha-sys = { path = "../chacha-sys", version = "0.22.0" }
solana-client = { path = "../client", 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" }
ed25519-dalek = "=1.0.0-pre.1" ed25519-dalek = "=1.0.0-pre.1"
solana-ledger = { path = "../ledger", version = "0.22.0" } solana-ledger = { path = "../ledger", version = "0.22.0" }
solana-logger = { path = "../logger", version = "0.22.0" } solana-logger = { path = "../logger", version = "0.22.0" }

View File

@ -15,7 +15,7 @@ use solana_client::rpc_request::{
Response, RpcConfirmedBlock, RpcContactInfo, RpcEpochInfo, RpcResponseContext, RpcVersionInfo, Response, RpcConfirmedBlock, RpcContactInfo, RpcEpochInfo, RpcResponseContext, RpcVersionInfo,
RpcVoteAccountInfo, RpcVoteAccountStatus, RpcVoteAccountInfo, RpcVoteAccountStatus,
}; };
use solana_drone::drone::request_airdrop_transaction; use solana_faucet::faucet::request_airdrop_transaction;
use solana_ledger::{bank_forks::BankForks, blocktree::Blocktree}; use solana_ledger::{bank_forks::BankForks, blocktree::Blocktree};
use solana_runtime::bank::Bank; use solana_runtime::bank::Bank;
use solana_sdk::{ use solana_sdk::{
@ -50,14 +50,14 @@ fn new_response<T>(bank: &Bank, value: T) -> RpcResponse<T> {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct JsonRpcConfig { pub struct JsonRpcConfig {
pub enable_validator_exit: bool, // Enable the 'validatorExit' command pub enable_validator_exit: bool, // Enable the 'validatorExit' command
pub drone_addr: Option<SocketAddr>, pub faucet_addr: Option<SocketAddr>,
} }
impl Default for JsonRpcConfig { impl Default for JsonRpcConfig {
fn default() -> Self { fn default() -> Self {
Self { Self {
enable_validator_exit: false, enable_validator_exit: false,
drone_addr: None, faucet_addr: None,
} }
} }
} }
@ -817,12 +817,12 @@ impl RpcSol for RpcSolImpl {
&commitment &commitment
); );
let drone_addr = meta let faucet_addr = meta
.request_processor .request_processor
.read() .read()
.unwrap() .unwrap()
.config .config
.drone_addr .faucet_addr
.ok_or_else(Error::invalid_request)?; .ok_or_else(Error::invalid_request)?;
let pubkey = verify_pubkey(pubkey_str)?; let pubkey = verify_pubkey(pubkey_str)?;
@ -833,7 +833,7 @@ impl RpcSol for RpcSolImpl {
.bank(commitment.clone()) .bank(commitment.clone())
.confirmed_last_blockhash() .confirmed_last_blockhash()
.0; .0;
let transaction = request_airdrop_transaction(&drone_addr, &pubkey, lamports, blockhash) let transaction = request_airdrop_transaction(&faucet_addr, &pubkey, lamports, blockhash)
.map_err(|err| { .map_err(|err| {
info!("request_airdrop_transaction failed: {:?}", err); info!("request_airdrop_transaction failed: {:?}", err);
Error::internal_error() Error::internal_error()
@ -1586,7 +1586,7 @@ pub mod tests {
let bob_pubkey = Pubkey::new_rand(); let bob_pubkey = Pubkey::new_rand();
let RpcHandler { io, meta, .. } = start_rpc_handler_with_tx(&bob_pubkey); let RpcHandler { io, meta, .. } = start_rpc_handler_with_tx(&bob_pubkey);
// Expect internal error because no drone is available // Expect internal error because no faucet is available
let req = format!( let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"requestAirdrop","params":["{}", 50]}}"#, r#"{{"jsonrpc":"2.0","id":1,"method":"requestAirdrop","params":["{}", 50]}}"#,
bob_pubkey bob_pubkey

View File

@ -1,2 +0,0 @@
pub mod drone;
pub mod drone_mock;

View File

@ -1,26 +0,0 @@
use solana_drone::drone::{request_airdrop_transaction, run_local_drone};
use solana_sdk::hash::Hash;
use solana_sdk::message::Message;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::system_instruction;
use solana_sdk::transaction::Transaction;
use std::sync::mpsc::channel;
#[test]
fn test_local_drone() {
let keypair = Keypair::new();
let to = Pubkey::new_rand();
let lamports = 50;
let blockhash = Hash::new(&to.as_ref());
let create_instruction = system_instruction::transfer(&keypair.pubkey(), &to, lamports);
let message = Message::new(vec![create_instruction]);
let expected_tx = Transaction::new(&[&keypair], message, blockhash);
let (sender, receiver) = channel();
run_local_drone(keypair, sender, None);
let drone_addr = receiver.recv().unwrap();
let result = request_airdrop_transaction(&drone_addr, &to, lamports, blockhash);
assert_eq!(expected_tx, result.unwrap());
}

View File

@ -1,7 +1,7 @@
[package] [package]
name = "solana-drone" name = "solana-faucet"
version = "0.22.0" version = "0.22.0"
description = "Solana Drone" description = "Solana Faucet"
authors = ["Solana Maintainers <maintainers@solana.com>"] authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana" repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0" license = "Apache-2.0"
@ -28,8 +28,8 @@ tokio-codec = "0.1"
[lib] [lib]
crate-type = ["lib"] crate-type = ["lib"]
name = "solana_drone" name = "solana_faucet"
[[bin]] [[bin]]
name = "solana-drone" name = "solana-faucet"
path = "src/bin/drone.rs" path = "src/bin/faucet.rs"

View File

@ -1,15 +1,19 @@
use clap::{crate_description, crate_name, App, Arg}; use clap::{crate_description, crate_name, App, Arg};
use solana_drone::drone::{run_drone, Drone, DRONE_PORT}; use solana_faucet::{
use solana_drone::socketaddr; faucet::{run_faucet, Faucet, FAUCET_PORT},
socketaddr,
};
use solana_sdk::signature::read_keypair_file; use solana_sdk::signature::read_keypair_file;
use std::error; use std::{
use std::net::{Ipv4Addr, SocketAddr}; error,
use std::sync::{Arc, Mutex}; net::{Ipv4Addr, SocketAddr},
use std::thread; sync::{Arc, Mutex},
thread,
};
fn main() -> Result<(), Box<dyn error::Error>> { fn main() -> Result<(), Box<dyn error::Error>> {
solana_logger::setup_with_filter("solana=info"); solana_logger::setup_with_filter("solana=info");
solana_metrics::set_panic_hook("drone"); solana_metrics::set_panic_hook("faucet");
let matches = App::new(crate_name!()) let matches = App::new(crate_name!())
.about(crate_description!()) .about(crate_description!())
.version(solana_clap_utils::version!()) .version(solana_clap_utils::version!())
@ -27,7 +31,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.long("slice") .long("slice")
.value_name("SECS") .value_name("SECS")
.takes_value(true) .takes_value(true)
.help("Time slice over which to limit requests to drone"), .help("Time slice over which to limit requests to faucet"),
) )
.arg( .arg(
Arg::with_name("cap") Arg::with_name("cap")
@ -54,21 +58,21 @@ fn main() -> Result<(), Box<dyn error::Error>> {
request_cap = None; request_cap = None;
} }
let drone_addr = socketaddr!(0, DRONE_PORT); let faucet_addr = socketaddr!(0, FAUCET_PORT);
let drone = Arc::new(Mutex::new(Drone::new( let faucet = Arc::new(Mutex::new(Faucet::new(
mint_keypair, mint_keypair,
time_slice, time_slice,
request_cap, request_cap,
))); )));
let drone1 = drone.clone(); let faucet1 = faucet.clone();
thread::spawn(move || loop { thread::spawn(move || loop {
let time = drone1.lock().unwrap().time_slice; let time = faucet1.lock().unwrap().time_slice;
thread::sleep(time); thread::sleep(time);
drone1.lock().unwrap().clear_request_count(); faucet1.lock().unwrap().clear_request_count();
}); });
run_drone(drone, drone_addr, None); run_faucet(faucet, faucet_addr, None);
Ok(()) Ok(())
} }

View File

@ -1,6 +1,6 @@
//! The `drone` module provides an object for launching a Solana Drone, //! The `faucet` module provides an object for launching a Solana Faucet,
//! which is the custodian of any remaining lamports in a mint. //! which is the custodian of any remaining lamports in a mint.
//! The Solana Drone builds and send airdrop transactions, //! The Solana Faucet builds and send airdrop transactions,
//! checking requests against a request cap for a given time time_slice //! checking requests against a request cap for a given time time_slice
//! and (to come) an IP rate limit. //! and (to come) an IP rate limit.
@ -10,23 +10,27 @@ use bytes::{Bytes, BytesMut};
use log::*; use log::*;
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
use solana_metrics::datapoint_info; use solana_metrics::datapoint_info;
use solana_sdk::hash::Hash; use solana_sdk::{
use solana_sdk::message::Message; hash::Hash,
use solana_sdk::packet::PACKET_DATA_SIZE; message::Message,
use solana_sdk::pubkey::Pubkey; packet::PACKET_DATA_SIZE,
use solana_sdk::signature::{Keypair, KeypairUtil}; pubkey::Pubkey,
use solana_sdk::system_instruction; signature::{Keypair, KeypairUtil},
use solana_sdk::transaction::Transaction; system_instruction,
use std::io; transaction::Transaction,
use std::io::{Error, ErrorKind}; };
use std::net::{IpAddr, Ipv4Addr, SocketAddr, TcpStream}; use std::{
use std::sync::mpsc::Sender; io::{self, Error, ErrorKind},
use std::sync::{Arc, Mutex}; net::{IpAddr, Ipv4Addr, SocketAddr, TcpStream},
use std::thread; sync::{mpsc::Sender, Arc, Mutex},
use std::time::Duration; thread,
use tokio; time::Duration,
use tokio::net::TcpListener; };
use tokio::prelude::{Future, Read, Sink, Stream, Write}; use tokio::{
self,
net::TcpListener,
prelude::{Future, Read, Sink, Stream, Write},
};
use tokio_codec::{BytesCodec, Decoder}; use tokio_codec::{BytesCodec, Decoder};
#[macro_export] #[macro_export]
@ -42,11 +46,11 @@ macro_rules! socketaddr {
pub const TIME_SLICE: u64 = 60; pub const TIME_SLICE: u64 = 60;
pub const REQUEST_CAP: u64 = solana_sdk::native_token::SOL_LAMPORTS * 1_000_000; pub const REQUEST_CAP: u64 = solana_sdk::native_token::SOL_LAMPORTS * 1_000_000;
pub const DRONE_PORT: u16 = 9900; pub const FAUCET_PORT: u16 = 9900;
pub const DRONE_PORT_STR: &str = "9900"; pub const FAUCET_PORT_STR: &str = "9900";
#[derive(Serialize, Deserialize, Debug, Clone, Copy)] #[derive(Serialize, Deserialize, Debug, Clone, Copy)]
pub enum DroneRequest { pub enum FaucetRequest {
GetAirdrop { GetAirdrop {
lamports: u64, lamports: u64,
to: Pubkey, to: Pubkey,
@ -54,7 +58,7 @@ pub enum DroneRequest {
}, },
} }
pub struct Drone { pub struct Faucet {
mint_keypair: Keypair, mint_keypair: Keypair,
ip_cache: Vec<IpAddr>, ip_cache: Vec<IpAddr>,
pub time_slice: Duration, pub time_slice: Duration,
@ -62,12 +66,12 @@ pub struct Drone {
pub request_current: u64, pub request_current: u64,
} }
impl Drone { impl Faucet {
pub fn new( pub fn new(
mint_keypair: Keypair, mint_keypair: Keypair,
time_input: Option<u64>, time_input: Option<u64>,
request_cap_input: Option<u64>, request_cap_input: Option<u64>,
) -> Drone { ) -> Faucet {
let time_slice = match time_input { let time_slice = match time_input {
Some(time) => Duration::new(time, 0), Some(time) => Duration::new(time, 0),
None => Duration::new(TIME_SLICE, 0), None => Duration::new(TIME_SLICE, 0),
@ -76,7 +80,7 @@ impl Drone {
Some(cap) => cap, Some(cap) => cap,
None => REQUEST_CAP, None => REQUEST_CAP,
}; };
Drone { Faucet {
mint_keypair, mint_keypair,
ip_cache: Vec::new(), ip_cache: Vec::new(),
time_slice, time_slice,
@ -103,11 +107,11 @@ impl Drone {
pub fn build_airdrop_transaction( pub fn build_airdrop_transaction(
&mut self, &mut self,
req: DroneRequest, req: FaucetRequest,
) -> Result<Transaction, io::Error> { ) -> Result<Transaction, io::Error> {
trace!("build_airdrop_transaction: {:?}", req); trace!("build_airdrop_transaction: {:?}", req);
match req { match req {
DroneRequest::GetAirdrop { FaucetRequest::GetAirdrop {
lamports, lamports,
to, to,
blockhash, blockhash,
@ -115,7 +119,7 @@ impl Drone {
if self.check_request_limit(lamports) { if self.check_request_limit(lamports) {
self.request_current += lamports; self.request_current += lamports;
datapoint_info!( datapoint_info!(
"drone-airdrop", "faucet-airdrop",
("request_amount", lamports, i64), ("request_amount", lamports, i64),
("request_current", self.request_current, i64) ("request_current", self.request_current, i64)
); );
@ -137,11 +141,11 @@ impl Drone {
} }
} }
} }
pub fn process_drone_request(&mut self, bytes: &BytesMut) -> Result<Bytes, io::Error> { pub fn process_faucet_request(&mut self, bytes: &BytesMut) -> Result<Bytes, io::Error> {
let req: DroneRequest = deserialize(bytes).or_else(|err| { let req: FaucetRequest = deserialize(bytes).or_else(|err| {
Err(io::Error::new( Err(io::Error::new(
io::ErrorKind::Other, io::ErrorKind::Other,
format!("deserialize packet in drone: {:?}", err), format!("deserialize packet in faucet: {:?}", err),
)) ))
})?; })?;
@ -152,7 +156,7 @@ impl Drone {
let response_vec = bincode::serialize(&tx).or_else(|err| { let response_vec = bincode::serialize(&tx).or_else(|err| {
Err(io::Error::new( Err(io::Error::new(
io::ErrorKind::Other, io::ErrorKind::Other,
format!("deserialize packet in drone: {:?}", err), format!("deserialize packet in faucet: {:?}", err),
)) ))
})?; })?;
@ -172,31 +176,31 @@ impl Drone {
} }
} }
impl Drop for Drone { impl Drop for Faucet {
fn drop(&mut self) { fn drop(&mut self) {
solana_metrics::flush(); solana_metrics::flush();
} }
} }
pub fn request_airdrop_transaction( pub fn request_airdrop_transaction(
drone_addr: &SocketAddr, faucet_addr: &SocketAddr,
id: &Pubkey, id: &Pubkey,
lamports: u64, lamports: u64,
blockhash: Hash, blockhash: Hash,
) -> Result<Transaction, Error> { ) -> Result<Transaction, Error> {
info!( info!(
"request_airdrop_transaction: drone_addr={} id={} lamports={} blockhash={}", "request_airdrop_transaction: faucet_addr={} id={} lamports={} blockhash={}",
drone_addr, id, lamports, blockhash faucet_addr, id, lamports, blockhash
); );
let mut stream = TcpStream::connect_timeout(drone_addr, Duration::new(3, 0))?; let mut stream = TcpStream::connect_timeout(faucet_addr, Duration::new(3, 0))?;
stream.set_read_timeout(Some(Duration::new(10, 0)))?; stream.set_read_timeout(Some(Duration::new(10, 0)))?;
let req = DroneRequest::GetAirdrop { let req = FaucetRequest::GetAirdrop {
lamports, lamports,
blockhash, blockhash,
to: *id, to: *id,
}; };
let req = serialize(&req).expect("serialize drone request"); let req = serialize(&req).expect("serialize faucet request");
stream.write_all(&req)?; stream.write_all(&req)?;
// Read length of transaction // Read length of transaction
@ -213,7 +217,7 @@ pub fn request_airdrop_transaction(
return Err(Error::new( return Err(Error::new(
ErrorKind::Other, ErrorKind::Other,
format!( format!(
"request_airdrop_transaction: invalid transaction_length from drone: {}", "request_airdrop_transaction: invalid transaction_length from faucet: {}",
transaction_length transaction_length
), ),
)); ));
@ -240,42 +244,42 @@ pub fn request_airdrop_transaction(
} }
// For integration tests. Listens on random open port and reports port to Sender. // For integration tests. Listens on random open port and reports port to Sender.
pub fn run_local_drone( pub fn run_local_faucet(
mint_keypair: Keypair, mint_keypair: Keypair,
sender: Sender<SocketAddr>, sender: Sender<SocketAddr>,
request_cap_input: Option<u64>, request_cap_input: Option<u64>,
) { ) {
thread::spawn(move || { thread::spawn(move || {
let drone_addr = socketaddr!(0, 0); let faucet_addr = socketaddr!(0, 0);
let drone = Arc::new(Mutex::new(Drone::new( let faucet = Arc::new(Mutex::new(Faucet::new(
mint_keypair, mint_keypair,
None, None,
request_cap_input, request_cap_input,
))); )));
run_drone(drone, drone_addr, Some(sender)); run_faucet(faucet, faucet_addr, Some(sender));
}); });
} }
pub fn run_drone( pub fn run_faucet(
drone: Arc<Mutex<Drone>>, faucet: Arc<Mutex<Faucet>>,
drone_addr: SocketAddr, faucet_addr: SocketAddr,
send_addr: Option<Sender<SocketAddr>>, send_addr: Option<Sender<SocketAddr>>,
) { ) {
let socket = TcpListener::bind(&drone_addr).unwrap(); let socket = TcpListener::bind(&faucet_addr).unwrap();
if let Some(send_addr) = send_addr { if let Some(send_addr) = send_addr {
send_addr.send(socket.local_addr().unwrap()).unwrap(); send_addr.send(socket.local_addr().unwrap()).unwrap();
} }
info!("Drone started. Listening on: {}", drone_addr); info!("Faucet started. Listening on: {}", faucet_addr);
let done = socket let done = socket
.incoming() .incoming()
.map_err(|e| debug!("failed to accept socket; error = {:?}", e)) .map_err(|e| debug!("failed to accept socket; error = {:?}", e))
.for_each(move |socket| { .for_each(move |socket| {
let drone2 = drone.clone(); let faucet2 = faucet.clone();
let framed = BytesCodec::new().framed(socket); let framed = BytesCodec::new().framed(socket);
let (writer, reader) = framed.split(); let (writer, reader) = framed.split();
let processor = reader.and_then(move |bytes| { let processor = reader.and_then(move |bytes| {
match drone2.lock().unwrap().process_drone_request(&bytes) { match faucet2.lock().unwrap().process_faucet_request(&bytes) {
Ok(response_bytes) => { Ok(response_bytes) => {
trace!("Airdrop response_bytes: {:?}", response_bytes.to_vec()); trace!("Airdrop response_bytes: {:?}", response_bytes.to_vec());
Ok(response_bytes) Ok(response_bytes)
@ -290,7 +294,7 @@ pub fn run_drone(
.send_all(processor.or_else(|err| { .send_all(processor.or_else(|err| {
Err(io::Error::new( Err(io::Error::new(
io::ErrorKind::Other, io::ErrorKind::Other,
format!("Drone response: {:?}", err), format!("Faucet response: {:?}", err),
)) ))
})) }))
.then(|_| Ok(())); .then(|_| Ok(()));
@ -309,61 +313,61 @@ mod tests {
#[test] #[test]
fn test_check_request_limit() { fn test_check_request_limit() {
let keypair = Keypair::new(); let keypair = Keypair::new();
let mut drone = Drone::new(keypair, None, Some(3)); let mut faucet = Faucet::new(keypair, None, Some(3));
assert!(drone.check_request_limit(1)); assert!(faucet.check_request_limit(1));
drone.request_current = 3; faucet.request_current = 3;
assert!(!drone.check_request_limit(1)); assert!(!faucet.check_request_limit(1));
} }
#[test] #[test]
fn test_clear_request_count() { fn test_clear_request_count() {
let keypair = Keypair::new(); let keypair = Keypair::new();
let mut drone = Drone::new(keypair, None, None); let mut faucet = Faucet::new(keypair, None, None);
drone.request_current = drone.request_current + 256; faucet.request_current = faucet.request_current + 256;
assert_eq!(drone.request_current, 256); assert_eq!(faucet.request_current, 256);
drone.clear_request_count(); faucet.clear_request_count();
assert_eq!(drone.request_current, 0); assert_eq!(faucet.request_current, 0);
} }
#[test] #[test]
fn test_add_ip_to_cache() { fn test_add_ip_to_cache() {
let keypair = Keypair::new(); let keypair = Keypair::new();
let mut drone = Drone::new(keypair, None, None); let mut faucet = Faucet::new(keypair, None, None);
let ip = "127.0.0.1".parse().expect("create IpAddr from string"); let ip = "127.0.0.1".parse().expect("create IpAddr from string");
assert_eq!(drone.ip_cache.len(), 0); assert_eq!(faucet.ip_cache.len(), 0);
drone.add_ip_to_cache(ip); faucet.add_ip_to_cache(ip);
assert_eq!(drone.ip_cache.len(), 1); assert_eq!(faucet.ip_cache.len(), 1);
assert!(drone.ip_cache.contains(&ip)); assert!(faucet.ip_cache.contains(&ip));
} }
#[test] #[test]
fn test_clear_ip_cache() { fn test_clear_ip_cache() {
let keypair = Keypair::new(); let keypair = Keypair::new();
let mut drone = Drone::new(keypair, None, None); let mut faucet = Faucet::new(keypair, None, None);
let ip = "127.0.0.1".parse().expect("create IpAddr from string"); let ip = "127.0.0.1".parse().expect("create IpAddr from string");
assert_eq!(drone.ip_cache.len(), 0); assert_eq!(faucet.ip_cache.len(), 0);
drone.add_ip_to_cache(ip); faucet.add_ip_to_cache(ip);
assert_eq!(drone.ip_cache.len(), 1); assert_eq!(faucet.ip_cache.len(), 1);
drone.clear_ip_cache(); faucet.clear_ip_cache();
assert_eq!(drone.ip_cache.len(), 0); assert_eq!(faucet.ip_cache.len(), 0);
assert!(drone.ip_cache.is_empty()); assert!(faucet.ip_cache.is_empty());
} }
#[test] #[test]
fn test_drone_default_init() { fn test_faucet_default_init() {
let keypair = Keypair::new(); let keypair = Keypair::new();
let time_slice: Option<u64> = None; let time_slice: Option<u64> = None;
let request_cap: Option<u64> = None; let request_cap: Option<u64> = None;
let drone = Drone::new(keypair, time_slice, request_cap); let faucet = Faucet::new(keypair, time_slice, request_cap);
assert_eq!(drone.time_slice, Duration::new(TIME_SLICE, 0)); assert_eq!(faucet.time_slice, Duration::new(TIME_SLICE, 0));
assert_eq!(drone.request_cap, REQUEST_CAP); assert_eq!(faucet.request_cap, REQUEST_CAP);
} }
#[test] #[test]
fn test_drone_build_airdrop_transaction() { fn test_faucet_build_airdrop_transaction() {
let to = Pubkey::new_rand(); let to = Pubkey::new_rand();
let blockhash = Hash::default(); let blockhash = Hash::default();
let request = DroneRequest::GetAirdrop { let request = FaucetRequest::GetAirdrop {
lamports: 2, lamports: 2,
to, to,
blockhash, blockhash,
@ -371,9 +375,9 @@ mod tests {
let mint = Keypair::new(); let mint = Keypair::new();
let mint_pubkey = mint.pubkey(); let mint_pubkey = mint.pubkey();
let mut drone = Drone::new(mint, None, None); let mut faucet = Faucet::new(mint, None, None);
let tx = drone.build_airdrop_transaction(request).unwrap(); let tx = faucet.build_airdrop_transaction(request).unwrap();
let message = tx.message(); let message = tx.message();
assert_eq!(tx.signatures.len(), 1); assert_eq!(tx.signatures.len(), 1);
@ -388,17 +392,17 @@ mod tests {
assert_eq!(instruction, SystemInstruction::Transfer { lamports: 2 }); assert_eq!(instruction, SystemInstruction::Transfer { lamports: 2 });
let mint = Keypair::new(); let mint = Keypair::new();
drone = Drone::new(mint, None, Some(1)); faucet = Faucet::new(mint, None, Some(1));
let tx = drone.build_airdrop_transaction(request); let tx = faucet.build_airdrop_transaction(request);
assert!(tx.is_err()); assert!(tx.is_err());
} }
#[test] #[test]
fn test_process_drone_request() { fn test_process_faucet_request() {
let to = Pubkey::new_rand(); let to = Pubkey::new_rand();
let blockhash = Hash::new(&to.as_ref()); let blockhash = Hash::new(&to.as_ref());
let lamports = 50; let lamports = 50;
let req = DroneRequest::GetAirdrop { let req = FaucetRequest::GetAirdrop {
lamports, lamports,
blockhash, blockhash,
to, to,
@ -416,13 +420,13 @@ mod tests {
LittleEndian::write_u16(&mut expected_vec_with_length, expected_bytes.len() as u16); LittleEndian::write_u16(&mut expected_vec_with_length, expected_bytes.len() as u16);
expected_vec_with_length.extend_from_slice(&expected_bytes); expected_vec_with_length.extend_from_slice(&expected_bytes);
let mut drone = Drone::new(keypair, None, None); let mut faucet = Faucet::new(keypair, None, None);
let response = drone.process_drone_request(&bytes); let response = faucet.process_faucet_request(&bytes);
let response_vec = response.unwrap().to_vec(); let response_vec = response.unwrap().to_vec();
assert_eq!(expected_vec_with_length, response_vec); assert_eq!(expected_vec_with_length, response_vec);
let mut bad_bytes = BytesMut::with_capacity(9); let mut bad_bytes = BytesMut::with_capacity(9);
bad_bytes.put("bad bytes"); bad_bytes.put("bad bytes");
assert!(drone.process_drone_request(&bad_bytes).is_err()); assert!(faucet.process_faucet_request(&bad_bytes).is_err());
} }
} }

View File

@ -1,13 +1,17 @@
use solana_sdk::hash::Hash; use solana_sdk::{
use solana_sdk::pubkey::Pubkey; hash::Hash,
use solana_sdk::signature::{Keypair, KeypairUtil}; pubkey::Pubkey,
use solana_sdk::system_transaction; signature::{Keypair, KeypairUtil},
use solana_sdk::transaction::Transaction; system_transaction,
use std::io::{Error, ErrorKind}; transaction::Transaction,
use std::net::SocketAddr; };
use std::{
io::{Error, ErrorKind},
net::SocketAddr,
};
pub fn request_airdrop_transaction( pub fn request_airdrop_transaction(
_drone_addr: &SocketAddr, _faucet_addr: &SocketAddr,
_id: &Pubkey, _id: &Pubkey,
lamports: u64, lamports: u64,
_blockhash: Hash, _blockhash: Hash,

2
faucet/src/lib.rs Normal file
View File

@ -0,0 +1,2 @@
pub mod faucet;
pub mod faucet_mock;

View File

@ -0,0 +1,28 @@
use solana_faucet::faucet::{request_airdrop_transaction, run_local_faucet};
use solana_sdk::{
hash::Hash,
message::Message,
pubkey::Pubkey,
signature::{Keypair, KeypairUtil},
system_instruction,
transaction::Transaction,
};
use std::sync::mpsc::channel;
#[test]
fn test_local_faucet() {
let keypair = Keypair::new();
let to = Pubkey::new_rand();
let lamports = 50;
let blockhash = Hash::new(&to.as_ref());
let create_instruction = system_instruction::transfer(&keypair.pubkey(), &to, lamports);
let message = Message::new(vec![create_instruction]);
let expected_tx = Transaction::new(&[&keypair], message, blockhash);
let (sender, receiver) = channel();
run_local_faucet(keypair, sender, None);
let faucet_addr = receiver.recv().unwrap();
let result = request_airdrop_transaction(&faucet_addr, &to, lamports, blockhash);
assert_eq!(expected_tx, result.unwrap());
}

View File

@ -15,7 +15,7 @@ rand = "0.6.5"
solana-config-program = { path = "../programs/config", version = "0.22.0" } solana-config-program = { path = "../programs/config", version = "0.22.0" }
solana-core = { path = "../core", version = "0.22.0" } solana-core = { path = "../core", version = "0.22.0" }
solana-client = { path = "../client", 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-exchange-program = { path = "../programs/exchange", version = "0.22.0" }
solana-genesis-programs = { path = "../genesis-programs", version = "0.22.0" } solana-genesis-programs = { path = "../genesis-programs", version = "0.22.0" }
solana-ledger = { path = "../ledger", version = "0.22.0" } solana-ledger = { path = "../ledger", version = "0.22.0" }

View File

@ -37,7 +37,7 @@ adhoc metrics collection/viewing
Simple example of pulling all airdrop measurements out of the `testnet` database: Simple example of pulling all airdrop measurements out of the `testnet` database:
```sh ```sh
$ influx -database testnet -username read -password read -execute 'SELECT * FROM "drone-airdrop"' $ influx -database testnet -username read -password read -execute 'SELECT * FROM "faucet-airdrop"'
``` ```
Reference: https://docs.influxdata.com/influxdb/v1.5/query_language/ Reference: https://docs.influxdata.com/influxdb/v1.5/query_language/

View File

@ -1997,7 +1997,7 @@
"measurement": "cluster_info-vote-count", "measurement": "cluster_info-vote-count",
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "autogen", "policy": "autogen",
"query": "SELECT \"request_amount\" FROM \"$testnet\".\"autogen\".\"drone-airdrop\" WHERE $timeFilter fill(null)\n\n\n\n", "query": "SELECT \"request_amount\" FROM \"$testnet\".\"autogen\".\"faucet-airdrop\" WHERE $timeFilter fill(null)\n\n\n\n",
"rawQuery": true, "rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",

View File

@ -22,6 +22,6 @@ fi
set -x set -x
point="drone-airdrop,localmetrics=test request_amount=1i,request_current=1i" point="faucet-airdrop,localmetrics=test request_amount=1i,request_current=1i"
echo "${host}/write?db=${INFLUX_DATABASE}&u=${INFLUX_USERNAME}&p={$INFLUX_PASSWORD}" \ echo "${host}/write?db=${INFLUX_DATABASE}&u=${INFLUX_USERNAME}&p={$INFLUX_PASSWORD}" \
| xargs curl -XPOST --data-binary "$point" | xargs curl -XPOST --data-binary "$point"

View File

@ -22,7 +22,7 @@ usage() {
if [[ -z $1 ]]; then # default behavior if [[ -z $1 ]]; then # default behavior
$solana_bench_tps \ $solana_bench_tps \
--entrypoint 127.0.0.1:8001 \ --entrypoint 127.0.0.1:8001 \
--drone 127.0.0.1:9900 \ --faucet 127.0.0.1:9900 \
--duration 90 \ --duration 90 \
--tx_count 50000 \ --tx_count 50000 \
--thread-batch-sleep-ms 0 \ --thread-batch-sleep-ms 0 \

View File

@ -82,7 +82,7 @@ args+=(
--identity-keypair "$identity_keypair" --identity-keypair "$identity_keypair"
--storage-keypair "$storage_keypair" --storage-keypair "$storage_keypair"
--voting-keypair "$vote_keypair" --voting-keypair "$vote_keypair"
--rpc-drone-address 127.0.0.1:9900 --rpc-faucet-address 127.0.0.1:9900
) )
default_arg --gossip-port 8001 default_arg --gossip-port 8001
default_arg --log - default_arg --log -

View File

@ -51,7 +51,7 @@ else
fi fi
solana_bench_tps=$(solana_program bench-tps) solana_bench_tps=$(solana_program bench-tps)
solana_drone=$(solana_program drone) solana_faucet=$(solana_program faucet)
solana_validator=$(solana_program validator) solana_validator=$(solana_program validator)
solana_validator_cuda="$solana_validator --cuda" solana_validator_cuda="$solana_validator --cuda"
solana_genesis=$(solana_program genesis) solana_genesis=$(solana_program genesis)

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# Starts an instance of solana-drone # Starts an instance of solana-faucet
# #
here=$(dirname "$0") here=$(dirname "$0")
@ -15,5 +15,5 @@ source "$here"/common.sh
} }
set -x set -x
# shellcheck disable=SC2086 # Don't want to double quote $solana_drone # shellcheck disable=SC2086 # Don't want to double quote $solana_faucet
exec $solana_drone --keypair "$SOLANA_CONFIG_DIR"/faucet-keypair.json "$@" exec $solana_faucet --keypair "$SOLANA_CONFIG_DIR"/faucet-keypair.json "$@"

View File

@ -109,7 +109,7 @@ while [[ -n $1 ]]; do
elif [[ $1 = --enable-rpc-exit ]]; then elif [[ $1 = --enable-rpc-exit ]]; then
args+=("$1") args+=("$1")
shift shift
elif [[ $1 = --rpc-drone-address ]]; then elif [[ $1 = --rpc-faucet-address ]]; then
args+=("$1" "$2") args+=("$1" "$2")
shift 2 shift 2
elif [[ $1 = --vote-signer-address ]]; then elif [[ $1 = --vote-signer-address ]]; then
@ -194,7 +194,7 @@ else
fi fi
fi fi
drone_address="${gossip_entrypoint%:*}":9900 faucet_address="${gossip_entrypoint%:*}":9900
: "${identity_keypair_path:=$ledger_dir/identity-keypair.json}" : "${identity_keypair_path:=$ledger_dir/identity-keypair.json}"
: "${voting_keypair_path:=$ledger_dir/vote-keypair.json}" : "${voting_keypair_path:=$ledger_dir/vote-keypair.json}"
@ -202,7 +202,7 @@ drone_address="${gossip_entrypoint%:*}":9900
default_arg --entrypoint "$gossip_entrypoint" default_arg --entrypoint "$gossip_entrypoint"
if ((airdrops_enabled)); then if ((airdrops_enabled)); then
default_arg --rpc-drone-address "$drone_address" default_arg --rpc-faucet-address "$faucet_address"
fi fi
default_arg --identity-keypair "$identity_keypair_path" default_arg --identity-keypair "$identity_keypair_path"

View File

@ -1006,7 +1006,7 @@ logs)
"$ipAddress":solana/"$log".log "$netLogDir"/remote-"$log"-"$ipAddress".log "$ipAddress":solana/"$log".log "$netLogDir"/remote-"$log"-"$ipAddress".log
) || echo "failed to fetch log" ) || echo "failed to fetch log"
} }
fetchRemoteLog "${validatorIpList[0]}" drone fetchRemoteLog "${validatorIpList[0]}" faucet
for ipAddress in "${validatorIpList[@]}"; do for ipAddress in "${validatorIpList[@]}"; do
fetchRemoteLog "$ipAddress" validator fetchRemoteLog "$ipAddress" validator
done done

View File

@ -49,7 +49,7 @@ solana-bench-tps)
clientCommand="\ clientCommand="\
solana-bench-tps \ solana-bench-tps \
--entrypoint $entrypointIp:8001 \ --entrypoint $entrypointIp:8001 \
--drone $entrypointIp:9900 \ --faucet $entrypointIp:9900 \
--duration 7500 \ --duration 7500 \
--sustained \ --sustained \
--threads $threadCount \ --threads $threadCount \
@ -64,7 +64,7 @@ solana-bench-exchange)
clientCommand="\ clientCommand="\
solana-bench-exchange \ solana-bench-exchange \
--entrypoint $entrypointIp:8001 \ --entrypoint $entrypointIp:8001 \
--drone $entrypointIp:9900 \ --faucet $entrypointIp:9900 \
--threads $threadCount \ --threads $threadCount \
--batch-size 1000 \ --batch-size 1000 \
--fund-amount 20000 \ --fund-amount 20000 \

View File

@ -237,7 +237,7 @@ EOF
if [[ $airdropsEnabled = true ]]; then if [[ $airdropsEnabled = true ]]; then
cat >> ~/solana/on-reboot <<EOF cat >> ~/solana/on-reboot <<EOF
./multinode-demo/drone.sh > drone.log 2>&1 & ./multinode-demo/faucet.sh > faucet.log 2>&1 &
EOF EOF
fi fi
# shellcheck disable=SC2206 # Don't want to double quote $extraNodeArgs # shellcheck disable=SC2206 # Don't want to double quote $extraNodeArgs
@ -304,17 +304,17 @@ EOF
set -x set -x
# Add the mint keypair to validators for convenient access from tools # Add the mint keypair to validators for convenient access from tools
# like bench-tps and add to blocktreamers to run a drone # like bench-tps and add to blocktreamers to run a faucet
scp "$entrypointIp":~/solana/config/faucet-keypair.json config/ scp "$entrypointIp":~/solana/config/faucet-keypair.json config/
if [[ $nodeType = blockstreamer ]]; then if [[ $nodeType = blockstreamer ]]; then
# Run another drone with the mint keypair on the blockstreamer node. # Run another faucet with the mint keypair on the blockstreamer node.
# Typically the blockstreamer node has a static IP/DNS name for hosting # Typically the blockstreamer node has a static IP/DNS name for hosting
# the blockexplorer web app, and is a location that somebody would expect # the blockexplorer web app, and is a location that somebody would expect
# to be able to airdrop from # to be able to airdrop from
scp "$entrypointIp":~/solana/config/faucet-keypair.json config/ scp "$entrypointIp":~/solana/config/faucet-keypair.json config/
if [[ $airdropsEnabled = true ]]; then if [[ $airdropsEnabled = true ]]; then
cat >> ~/solana/on-reboot <<EOF cat >> ~/solana/on-reboot <<EOF
multinode-demo/drone.sh > drone.log 2>&1 & multinode-demo/faucet.sh > faucet.log 2>&1 &
EOF EOF
fi fi

10
run.sh
View File

@ -17,7 +17,7 @@ fi
PATH=$PWD/target/$profile:$PATH PATH=$PWD/target/$profile:$PATH
ok=true ok=true
for program in solana-{drone,genesis,keygen,validator}; do for program in solana-{faucet,genesis,keygen,validator}; do
$program -V || ok=false $program -V || ok=false
done done
$ok || { $ok || {
@ -90,13 +90,13 @@ solana-genesis \
abort() { abort() {
set +e set +e
kill "$drone" "$validator" kill "$faucet" "$validator"
wait "$validator" wait "$validator"
} }
trap abort INT TERM EXIT trap abort INT TERM EXIT
solana-drone --keypair "$dataDir"/faucet-keypair.json & solana-faucet --keypair "$dataDir"/faucet-keypair.json &
drone=$! faucet=$!
args=( args=(
--identity-keypair "$dataDir"/leader-keypair.json --identity-keypair "$dataDir"/leader-keypair.json
@ -105,7 +105,7 @@ args=(
--ledger "$ledgerDir" --ledger "$ledgerDir"
--gossip-port 8001 --gossip-port 8001
--rpc-port 8899 --rpc-port 8899
--rpc-drone-address 127.0.0.1:9900 --rpc-faucet-address 127.0.0.1:9900
--accounts "$dataDir"/accounts --accounts "$dataDir"/accounts
--log - --log -
--enable-rpc-exit --enable-rpc-exit

View File

@ -73,7 +73,7 @@ BINS=(
solana solana
solana-bench-exchange solana-bench-exchange
solana-bench-tps solana-bench-tps
solana-drone solana-faucet
solana-gossip solana-gossip
solana-install solana-install
solana-install-init solana-install-init

View File

@ -20,7 +20,7 @@ serde_json = "1.0.44"
solana-clap-utils = { path = "../clap-utils", version = "0.22.0" } solana-clap-utils = { path = "../clap-utils", version = "0.22.0" }
solana-client = { path = "../client", version = "0.22.0" } solana-client = { path = "../client", version = "0.22.0" }
solana-core = { path = "../core", version = "0.22.0" } solana-core = { path = "../core", version = "0.22.0" }
solana-drone = { path = "../drone", version = "0.22.0" } solana-faucet = { path = "../faucet", version = "0.22.0" }
solana-ledger = { path = "../ledger", version = "0.22.0" } solana-ledger = { path = "../ledger", version = "0.22.0" }
solana-logger = { path = "../logger", version = "0.22.0" } solana-logger = { path = "../logger", version = "0.22.0" }
solana-perf = { path = "../perf", version = "0.22.0" } solana-perf = { path = "../perf", version = "0.22.0" }

View File

@ -447,12 +447,12 @@ pub fn main() {
.help("Enable the JSON RPC 'validatorExit' API. Only enable in a debug environment"), .help("Enable the JSON RPC 'validatorExit' API. Only enable in a debug environment"),
) )
.arg( .arg(
Arg::with_name("rpc_drone_addr") Arg::with_name("rpc_faucet_addr")
.long("rpc-drone-address") .long("rpc-faucet-address")
.value_name("HOST:PORT") .value_name("HOST:PORT")
.takes_value(true) .takes_value(true)
.validator(solana_net_utils::is_host_port) .validator(solana_net_utils::is_host_port)
.help("Enable the JSON RPC 'requestAirdrop' API with this drone address."), .help("Enable the JSON RPC 'requestAirdrop' API with this faucet address."),
) )
.arg( .arg(
Arg::with_name("signer_addr") Arg::with_name("signer_addr")
@ -583,8 +583,8 @@ pub fn main() {
validator_config.rpc_config.enable_validator_exit = matches.is_present("enable_rpc_exit"); validator_config.rpc_config.enable_validator_exit = matches.is_present("enable_rpc_exit");
validator_config.rpc_config.drone_addr = matches.value_of("rpc_drone_addr").map(|address| { validator_config.rpc_config.faucet_addr = matches.value_of("rpc_faucet_addr").map(|address| {
solana_net_utils::parse_host_port(address).expect("failed to parse drone address") solana_net_utils::parse_host_port(address).expect("failed to parse faucet address")
}); });
let dynamic_port_range = let dynamic_port_range =