From 3513f4ee840184aa01bdfbca17fad900775147f3 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Mon, 16 Dec 2019 14:05:17 -0700 Subject: [PATCH] Rename drone to faucet (#7508) --- Cargo.lock | 42 ++-- Cargo.toml | 2 +- bench-exchange/Cargo.toml | 2 +- bench-exchange/src/bench.rs | 10 +- bench-exchange/src/cli.rs | 16 +- bench-exchange/src/main.rs | 4 +- bench-exchange/tests/bench_exchange.rs | 12 +- bench-tps/Cargo.toml | 2 +- bench-tps/src/bench.rs | 16 +- bench-tps/src/cli.rs | 18 +- bench-tps/src/main.rs | 4 +- bench-tps/tests/bench_tps.rs | 12 +- book/src/api-reference/cli.md | 4 +- book/src/getting-started/README.md | 11 +- ci/localnet-sanity.sh | 10 +- ci/nits.sh | 2 +- cli/Cargo.toml | 2 +- cli/src/cli.rs | 90 ++++----- cli/tests/deploy.rs | 10 +- cli/tests/nonce.rs | 8 +- cli/tests/pay.rs | 53 +++-- cli/tests/request_airdrop.rs | 10 +- cli/tests/stake.rs | 14 +- core/Cargo.toml | 2 +- core/src/rpc.rs | 20 +- drone/src/lib.rs | 2 - drone/tests/local-drone.rs | 26 --- {drone => faucet}/.gitignore | 0 {drone => faucet}/Cargo.toml | 10 +- .../bin/drone.rs => faucet/src/bin/faucet.rs | 32 +-- drone/src/drone.rs => faucet/src/faucet.rs | 182 +++++++++--------- .../src/faucet_mock.rs | 20 +- faucet/src/lib.rs | 2 + faucet/tests/local-faucet.rs | 28 +++ local-cluster/Cargo.toml | 2 +- metrics/scripts/README.md | 2 +- .../dashboards/testnet-monitor.json | 2 +- metrics/scripts/test.sh | 2 +- multinode-demo/bench-tps.sh | 2 +- multinode-demo/bootstrap-leader.sh | 2 +- multinode-demo/common.sh | 2 +- multinode-demo/{drone.sh => faucet.sh} | 6 +- multinode-demo/validator.sh | 6 +- net/net.sh | 2 +- net/remote/remote-client.sh | 4 +- net/remote/remote-node.sh | 8 +- run.sh | 10 +- scripts/cargo-install-all.sh | 2 +- validator/Cargo.toml | 2 +- validator/src/main.rs | 10 +- 50 files changed, 385 insertions(+), 357 deletions(-) delete mode 100644 drone/src/lib.rs delete mode 100644 drone/tests/local-drone.rs rename {drone => faucet}/.gitignore (100%) rename {drone => faucet}/Cargo.toml (84%) rename drone/src/bin/drone.rs => faucet/src/bin/faucet.rs (77%) rename drone/src/drone.rs => faucet/src/faucet.rs (71%) rename drone/src/drone_mock.rs => faucet/src/faucet_mock.rs (61%) create mode 100644 faucet/src/lib.rs create mode 100644 faucet/tests/local-faucet.rs rename multinode-demo/{drone.sh => faucet.sh} (75%) diff --git a/Cargo.lock b/Cargo.lock index 28f8dde775ed17..db90e922e4b7f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3133,8 +3133,8 @@ dependencies = [ "solana-clap-utils 0.22.0", "solana-client 0.22.0", "solana-core 0.22.0", - "solana-drone 0.22.0", "solana-exchange-program 0.22.0", + "solana-faucet 0.22.0", "solana-genesis 0.22.0", "solana-local-cluster 0.22.0", "solana-logger 0.22.0", @@ -3174,7 +3174,7 @@ dependencies = [ "solana-clap-utils 0.22.0", "solana-client 0.22.0", "solana-core 0.22.0", - "solana-drone 0.22.0", + "solana-faucet 0.22.0", "solana-genesis 0.22.0", "solana-librapay 0.22.0", "solana-local-cluster 0.22.0", @@ -3279,7 +3279,7 @@ dependencies = [ "solana-client 0.22.0", "solana-config-program 0.22.0", "solana-core 0.22.0", - "solana-drone 0.22.0", + "solana-faucet 0.22.0", "solana-logger 0.22.0", "solana-net-utils 0.22.0", "solana-runtime 0.22.0", @@ -3369,7 +3369,7 @@ dependencies = [ "solana-chacha-sys 0.22.0", "solana-clap-utils 0.22.0", "solana-client 0.22.0", - "solana-drone 0.22.0", + "solana-faucet 0.22.0", "solana-ledger 0.22.0", "solana-logger 0.22.0", "solana-measure 0.22.0", @@ -3420,45 +3420,45 @@ dependencies = [ ] [[package]] -name = "solana-drone" +name = "solana-exchange-program" 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-runtime 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]] -name = "solana-exchange-program" +name = "solana-failure-program" version = "0.22.0" dependencies = [ - "bincode 1.2.1 (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-logger 0.22.0", - "solana-metrics 0.22.0", "solana-runtime 0.22.0", "solana-sdk 0.22.0", ] [[package]] -name = "solana-failure-program" +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)", - "solana-runtime 0.22.0", + "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]] @@ -3663,8 +3663,8 @@ dependencies = [ "solana-client 0.22.0", "solana-config-program 0.22.0", "solana-core 0.22.0", - "solana-drone 0.22.0", "solana-exchange-program 0.22.0", + "solana-faucet 0.22.0", "solana-genesis-programs 0.22.0", "solana-ledger 0.22.0", "solana-logger 0.22.0", @@ -4034,7 +4034,7 @@ dependencies = [ "solana-clap-utils 0.22.0", "solana-client 0.22.0", "solana-core 0.22.0", - "solana-drone 0.22.0", + "solana-faucet 0.22.0", "solana-ledger 0.22.0", "solana-logger 0.22.0", "solana-metrics 0.22.0", diff --git a/Cargo.toml b/Cargo.toml index 529f8ca02f3f8a..9d834593e43d82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ members = [ "chacha-sys", "client", "core", - "drone", + "faucet", "perf", "validator", "genesis", diff --git a/bench-exchange/Cargo.toml b/bench-exchange/Cargo.toml index 5ae3a51d0721d6..d065fef30ed320 100644 --- a/bench-exchange/Cargo.toml +++ b/bench-exchange/Cargo.toml @@ -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" } diff --git a/bench-exchange/src/bench.rs b/bench-exchange/src/bench.rs index 158a9b93ff2ce6..0fa9884560908e 100644 --- a/bench-exchange/src/bench.rs +++ b/bench-exchange/src/bench.rs @@ -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::{ @@ -968,7 +968,7 @@ fn generate_keypairs(num: u64) -> Vec { 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 { @@ -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(), ); @@ -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(); @@ -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 ); } }; diff --git a/bench-exchange/src/cli.rs b/bench-exchange/src/cli.rs index 5cb0fe0bea4dc6..1c953791276f4d 100644 --- a/bench-exchange/src/cli.rs +++ b/bench-exchange/src/cli.rs @@ -1,6 +1,6 @@ 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; @@ -8,7 +8,7 @@ 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, @@ -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, @@ -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") @@ -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) }); diff --git a/bench-exchange/src/main.rs b/bench-exchange/src/main.rs index 3caa3723666a08..8d640b394fd856 100644 --- a/bench-exchange/src/main.rs +++ b/bench-exchange/src/main.rs @@ -16,7 +16,7 @@ fn main() { let cli::Config { entrypoint_addr, - drone_addr, + faucet_addr, identity, threads, num_nodes, @@ -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, ); diff --git a/bench-exchange/tests/bench_exchange.rs b/bench-exchange/tests/bench_exchange.rs index 4c783e1586327d..ac1689c65beb1a 100644 --- a/bench-exchange/tests/bench_exchange.rs +++ b/bench-exchange/tests/bench_exchange.rs @@ -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; @@ -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, _) = @@ -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, ); diff --git a/bench-tps/Cargo.toml b/bench-tps/Cargo.toml index f05ae83c92e9df..676eeb1b0d7a7c 100644 --- a/bench-tps/Cargo.toml +++ b/bench-tps/Cargo.toml @@ -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" } diff --git a/bench-tps/src/bench.rs b/bench-tps/src/bench.rs index 953a9b6b896910..2180d462c5d3ef 100644 --- a/bench-tps/src/bench.rs +++ b/bench-tps/src/bench.rs @@ -3,7 +3,7 @@ use log::*; use rayon::prelude::*; use solana_client::perf_utils::{sample_txs, SampleStats}; use solana_core::gen_keys::GenKeys; -use solana_drone::drone::request_airdrop_transaction; +use solana_faucet::faucet::request_airdrop_transaction; #[cfg(feature = "move")] use solana_librapay::{create_genesis, upload_mint_script, upload_payment_script}; use solana_measure::measure::Measure; @@ -624,7 +624,7 @@ pub fn fund_keys( pub fn airdrop_lamports( client: &T, - drone_addr: &SocketAddr, + faucet_addr: &SocketAddr, id: &Keypair, tx_count: u64, ) -> Result<()> { @@ -637,12 +637,12 @@ pub fn airdrop_lamports( info!( "Airdropping {:?} lamports from {} for {}", airdrop_amount, - drone_addr, + faucet_addr, id.pubkey(), ); let (blockhash, _fee_calculator) = get_recent_blockhash(client); - match request_airdrop_transaction(&drone_addr, &id.pubkey(), airdrop_amount, blockhash) { + match request_airdrop_transaction(&faucet_addr, &id.pubkey(), airdrop_amount, blockhash) { Ok(transaction) => { let mut tries = 0; loop { @@ -656,7 +656,7 @@ pub fn airdrop_lamports( if tries >= 5 { panic!( "Error requesting airdrop: to addr: {:?} amount: {} {:?}", - drone_addr, airdrop_amount, result + faucet_addr, airdrop_amount, result ) } } @@ -664,7 +664,7 @@ pub fn airdrop_lamports( Err(err) => { panic!( "Error requesting airdrop: {:?} to addr: {:?} amount: {}", - err, drone_addr, airdrop_amount + err, faucet_addr, airdrop_amount ); } }; @@ -947,7 +947,7 @@ fn fund_move_keys( pub fn generate_and_fund_keypairs( client: &T, - drone_addr: Option, + faucet_addr: Option, funding_key: &Keypair, tx_count: usize, lamports_per_account: u64, @@ -985,7 +985,7 @@ pub fn generate_and_fund_keypairs( ); 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")] diff --git a/bench-tps/src/cli.rs b/bench-tps/src/cli.rs index 421f0aaa385b6e..a5fec88dd8fc8d 100644 --- a/bench-tps/src/cli.rs +++ b/bench-tps/src/cli.rs @@ -1,5 +1,5 @@ use clap::{crate_description, crate_name, App, Arg, ArgMatches}; -use solana_drone::drone::DRONE_PORT; +use solana_faucet::faucet::FAUCET_PORT; use solana_sdk::fee_calculator::FeeCalculator; use solana_sdk::signature::{read_keypair_file, Keypair, KeypairUtil}; use std::{net::SocketAddr, process::exit, time::Duration}; @@ -9,7 +9,7 @@ const NUM_LAMPORTS_PER_ACCOUNT_DEFAULT: u64 = solana_sdk::native_token::SOL_LAMP /// Holds the configuration for a single run of the benchmark pub struct Config { pub entrypoint_addr: SocketAddr, - pub drone_addr: SocketAddr, + pub faucet_addr: SocketAddr, pub id: Keypair, pub threads: usize, pub num_nodes: usize, @@ -30,7 +30,7 @@ impl Default for Config { fn default() -> Config { Config { entrypoint_addr: SocketAddr::from(([127, 0, 0, 1], 8001)), - drone_addr: SocketAddr::from(([127, 0, 0, 1], DRONE_PORT)), + faucet_addr: SocketAddr::from(([127, 0, 0, 1], FAUCET_PORT)), id: Keypair::new(), threads: 4, num_nodes: 1, @@ -62,12 +62,12 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> { .help("Rendezvous with the cluster at this entry point; defaults to 127.0.0.1:8001"), ) .arg( - Arg::with_name("drone") + Arg::with_name("faucet") .short("d") - .long("drone") + .long("faucet") .value_name("HOST:PORT") .takes_value(true) - .help("Location of the drone; defaults to entrypoint:DRONE_PORT"), + .help("Location of the faucet; defaults to entrypoint:FAUCET_PORT"), ) .arg( Arg::with_name("identity") @@ -180,9 +180,9 @@ pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config { }); } - if let Some(addr) = matches.value_of("drone") { - args.drone_addr = solana_net_utils::parse_host_port(addr).unwrap_or_else(|e| { - eprintln!("failed to parse drone address: {}", e); + if let Some(addr) = matches.value_of("faucet") { + args.faucet_addr = solana_net_utils::parse_host_port(addr).unwrap_or_else(|e| { + eprintln!("failed to parse faucet address: {}", e); exit(1) }); } diff --git a/bench-tps/src/main.rs b/bench-tps/src/main.rs index 9594203ac4b20f..7dbae9e8e9f09c 100644 --- a/bench-tps/src/main.rs +++ b/bench-tps/src/main.rs @@ -20,7 +20,7 @@ fn main() { let cli::Config { entrypoint_addr, - drone_addr, + faucet_addr, id, num_nodes, tx_count, @@ -119,7 +119,7 @@ fn main() { } else { generate_and_fund_keypairs( &client, - Some(*drone_addr), + Some(*faucet_addr), &id, *tx_count, *num_lamports_per_account, diff --git a/bench-tps/tests/bench_tps.rs b/bench-tps/tests/bench_tps.rs index 5d02b447efb317..69685eb09d3fa2 100644 --- a/bench-tps/tests/bench_tps.rs +++ b/bench-tps/tests/bench_tps.rs @@ -4,7 +4,7 @@ use solana_bench_tps::cli::Config; use solana_client::thin_client::create_client; use solana_core::cluster_info::VALIDATOR_PORT_RANGE; 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}; #[cfg(feature = "move")] use solana_sdk::move_loader::solana_move_loader_program; @@ -29,10 +29,10 @@ fn test_bench_tps_local_cluster(config: Config) { ..ClusterConfig::default() }); - let drone_keypair = Keypair::new(); + let faucet_keypair = Keypair::new(); cluster.transfer( &cluster.funding_keypair, - &drone_keypair.pubkey(), + &faucet_keypair.pubkey(), 100_000_000, ); @@ -42,14 +42,14 @@ fn test_bench_tps_local_cluster(config: Config) { ); let (addr_sender, addr_receiver) = channel(); - run_local_drone(drone_keypair, addr_sender, None); - let drone_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap(); + run_local_faucet(faucet_keypair, addr_sender, None); + let faucet_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap(); let lamports_per_account = 100; let (keypairs, move_keypairs, _keypair_balance) = generate_and_fund_keypairs( &client, - Some(drone_addr), + Some(faucet_addr), &config.id, config.tx_count, lamports_per_account, diff --git a/book/src/api-reference/cli.md b/book/src/api-reference/cli.md index f8ad03a0ae0ceb..8a81aaa04903ef 100644 --- a/book/src/api-reference/cli.md +++ b/book/src/api-reference/cli.md @@ -266,8 +266,8 @@ FLAGS: OPTIONS: -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - --drone-host Drone host to use [default: the --url host] - --drone-port Drone port to use [default: 9900] + --faucet-host Drone host to use [default: the --url host] + --faucet-port Drone port to use [default: 9900] -u, --url JSON RPC URL for the solana cluster -k, --keypair /path/to/id.json diff --git a/book/src/getting-started/README.md b/book/src/getting-started/README.md index 9973b7b0bbf168..540b0fa207979d 100644 --- a/book/src/getting-started/README.md +++ b/book/src/getting-started/README.md @@ -42,12 +42,12 @@ $ NDEBUG=1 ./multinode-demo/setup.sh ### 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 -$ NDEBUG=1 ./multinode-demo/drone.sh +$ NDEBUG=1 ./multinode-demo/faucet.sh ``` ### Singlenode Testnet @@ -60,7 +60,7 @@ Now start the bootstrap leader in a separate shell: $ 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 @@ -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`. ```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) - diff --git a/ci/localnet-sanity.sh b/ci/localnet-sanity.sh index 88832317ab2a1a..68605f2289a0e5 100755 --- a/ci/localnet-sanity.sh +++ b/ci/localnet-sanity.sh @@ -73,7 +73,7 @@ source scripts/configure-metrics.sh source multinode-demo/common.sh nodes=( - "multinode-demo/drone.sh" + "multinode-demo/faucet.sh" "multinode-demo/bootstrap-leader.sh \ --no-restart \ --init-complete-file init-complete-node1.log \ @@ -160,7 +160,7 @@ startNodes() { for i in $(seq 0 $((${#nodes[@]} - 1))); do 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" rm -f "$initCompleteFile" initCompleteFiles+=("$initCompleteFile") @@ -243,8 +243,8 @@ rollingNodeRestart() { declare pid=${oldPids[$i]} declare cmd=${nodes[$i]} if [[ $i -eq 0 ]]; then - # First cmd should be the drone, don't restart it. - [[ "$cmd" = "multinode-demo/drone.sh" ]] + # First cmd should be the faucet, don't restart it. + [[ "$cmd" = "multinode-demo/faucet.sh" ]] pids+=("$pid") else echo "--- Restarting $pid: $cmd" @@ -265,7 +265,7 @@ rollingNodeRestart() { # 'Atomically' remove the old pids from the pids array declare oldPidsList oldPidsList="$(printf ":%s" "${oldPids[@]}"):" - declare newPids=("${pids[0]}") # 0 = drone pid + declare newPids=("${pids[0]}") # 0 = faucet pid for pid in "${pids[@]}"; do [[ $oldPidsList =~ :$pid: ]] || { newPids+=("$pid") diff --git a/ci/nits.sh b/ci/nits.sh index a8f24b93adafd8..9ceb784289c68b 100755 --- a/ci/nits.sh +++ b/ci/nits.sh @@ -19,7 +19,7 @@ declare prints=( # Parts of the tree that are expected to be print free declare print_free_tree=( 'core/src' - 'drone/src' + 'faucet/src' 'metrics/src' 'net-utils/src' 'runtime/src' diff --git a/cli/Cargo.toml b/cli/Cargo.toml index bfd8ccc076e416..9a26ce52e510db 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -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-client = { path = "../client", 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-net-utils = { path = "../net-utils", version = "0.22.0" } solana-runtime = { path = "../runtime", version = "0.22.0" } diff --git a/cli/src/cli.rs b/cli/src/cli.rs index dca952f7826428..670dc9f6a87b08 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -16,9 +16,9 @@ use solana_budget_program::budget_instruction::{self, BudgetError}; use solana_clap_utils::{input_parsers::*, input_validators::*}; use solana_client::{client_error::ClientError, rpc_client::RpcClient}; #[cfg(not(test))] -use solana_drone::drone::request_airdrop_transaction; +use solana_faucet::faucet::request_airdrop_transaction; #[cfg(test)] -use solana_drone::drone_mock::request_airdrop_transaction; +use solana_faucet::faucet_mock::request_airdrop_transaction; use solana_sdk::{ bpf_loader, clock::Slot, @@ -208,8 +208,8 @@ pub enum CliCommand { // Wallet Commands Address, Airdrop { - drone_host: Option, - drone_port: u16, + faucet_host: Option, + faucet_port: u16, lamports: u64, use_lamports_unit: bool, }, @@ -401,21 +401,21 @@ pub fn parse_command(matches: &ArgMatches<'_>) -> Result { - let drone_port = matches - .value_of("drone_port") + let faucet_port = matches + .value_of("faucet_port") .unwrap() .parse() .or_else(|err| { Err(CliError::BadParameter(format!( - "Invalid drone port: {:?}", + "Invalid faucet port: {:?}", err ))) })?; - let drone_host = if let Some(drone_host) = matches.value_of("drone_host") { - Some(solana_net_utils::parse_host(drone_host).or_else(|err| { + let faucet_host = if let Some(faucet_host) = matches.value_of("faucet_host") { + Some(solana_net_utils::parse_host(faucet_host).or_else(|err| { Err(CliError::BadParameter(format!( - "Invalid drone host: {:?}", + "Invalid faucet host: {:?}", err ))) })?) @@ -426,8 +426,8 @@ pub fn parse_command(matches: &ArgMatches<'_>) -> Result ProcessResult { println!( "Requesting airdrop of {} from {}", 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)? { 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 .retry_get_balance(&config.keypair.pubkey(), 5)? @@ -1362,31 +1362,31 @@ pub fn process_command(config: &CliConfig) -> ProcessResult { // Get address of this client CliCommand::Address => unreachable!(), - // Request an airdrop from Solana Drone; + // Request an airdrop from Solana Faucet; CliCommand::Airdrop { - drone_host, - drone_port, + faucet_host, + faucet_port, lamports, use_lamports_unit, } => { - let drone_addr = SocketAddr::new( - drone_host.unwrap_or_else(|| { - let drone_host = url::Url::parse(&config.json_rpc_url) + let faucet_addr = SocketAddr::new( + faucet_host.unwrap_or_else(|| { + let faucet_host = url::Url::parse(&config.json_rpc_url) .unwrap() .host() .unwrap() .to_string(); - solana_net_utils::parse_host(&drone_host).unwrap_or_else(|err| { - panic!("Unable to resolve {}: {}", drone_host, err); + solana_net_utils::parse_host(&faucet_host).unwrap_or_else(|err| { + panic!("Unable to resolve {}: {}", faucet_host, err); }) }), - *drone_port, + *faucet_port, ); process_airdrop( &rpc_client, config, - &drone_addr, + &faucet_addr, *lamports, *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 // blockhash. If the client updates the blockhash, the signature will be invalid. -struct DroneKeypair { +struct FaucetKeypair { transaction: Transaction, } -impl DroneKeypair { +impl FaucetKeypair { fn new_keypair( - drone_addr: &SocketAddr, + faucet_addr: &SocketAddr, to_pubkey: &Pubkey, lamports: u64, blockhash: Hash, ) -> Result> { - 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 }) } @@ -1466,7 +1466,7 @@ impl DroneKeypair { } } -impl KeypairUtil for DroneKeypair { +impl KeypairUtil for FaucetKeypair { fn new() -> Self { unimplemented!(); } @@ -1483,7 +1483,7 @@ impl KeypairUtil for DroneKeypair { pub fn request_and_confirm_airdrop( rpc_client: &RpcClient, - drone_addr: &SocketAddr, + faucet_addr: &SocketAddr, to_pubkey: &Pubkey, lamports: u64, ) -> ProcessResult { @@ -1491,7 +1491,7 @@ pub fn request_and_confirm_airdrop( let keypair = { let mut retries = 5; 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 { 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") .about("Request lamports") .arg( - Arg::with_name("drone_host") - .long("drone-host") + Arg::with_name("faucet_host") + .long("faucet-host") .value_name("HOST") .takes_value(true) - .help("Drone host to use [default: the --url host]"), + .help("Faucet host to use [default: the --url host]"), ) .arg( - Arg::with_name("drone_port") - .long("drone-port") + Arg::with_name("faucet_port") + .long("faucet-port") .value_name("PORT") .takes_value(true) - .default_value(solana_drone::drone::DRONE_PORT_STR) - .help("Drone port to use"), + .default_value(solana_faucet::faucet::FAUCET_PORT_STR) + .help("Faucet port to use"), ) .arg( Arg::with_name("amount") @@ -1907,8 +1907,8 @@ mod tests { parse_command(&test_airdrop).unwrap(), CliCommandInfo { command: CliCommand::Airdrop { - drone_host: None, - drone_port: solana_drone::drone::DRONE_PORT, + faucet_host: None, + faucet_port: solana_faucet::faucet::FAUCET_PORT, lamports: 50, use_lamports_unit: true, }, @@ -2545,8 +2545,8 @@ mod tests { // Need airdrop cases config.command = CliCommand::Airdrop { - drone_host: None, - drone_port: 1234, + faucet_host: None, + faucet_port: 1234, lamports: 50, use_lamports_unit: true, }; @@ -2584,8 +2584,8 @@ mod tests { config.rpc_client = Some(RpcClient::new_mock("fails".to_string())); config.command = CliCommand::Airdrop { - drone_host: None, - drone_port: 1234, + faucet_host: None, + faucet_port: 1234, lamports: 50, use_lamports_unit: true, }; diff --git a/cli/tests/deploy.rs b/cli/tests/deploy.rs index 07e451fa8ec608..0cf6d731c10da0 100644 --- a/cli/tests/deploy.rs +++ b/cli/tests/deploy.rs @@ -2,7 +2,7 @@ use serde_json::Value; use solana_cli::cli::{process_command, CliCommand, CliConfig}; use solana_client::rpc_client::RpcClient; 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 std::{ 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 (sender, receiver) = channel(); - run_local_drone(alice, sender, None); - let drone_addr = receiver.recv().unwrap(); + run_local_faucet(alice, sender, None); + let faucet_addr = receiver.recv().unwrap(); let rpc_client = RpcClient::new_socket(leader_data.rpc); @@ -40,8 +40,8 @@ fn test_cli_deploy_program() { let mut config = CliConfig::default(); config.json_rpc_url = format!("http://{}:{}", leader_data.rpc.ip(), leader_data.rpc.port()); config.command = CliCommand::Airdrop { - drone_host: None, - drone_port: drone_addr.port(), + faucet_host: None, + faucet_port: faucet_addr.port(), lamports: minimum_balance_for_rent_exemption + 1, // min balance for rent exemption + leftover for tx processing use_lamports_unit: true, }; diff --git a/cli/tests/nonce.rs b/cli/tests/nonce.rs index 4840e086b731da..2b1822cadf630a 100644 --- a/cli/tests/nonce.rs +++ b/cli/tests/nonce.rs @@ -1,6 +1,6 @@ use solana_cli::cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig}; 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, @@ -38,8 +38,8 @@ fn check_balance(expected_balance: u64, client: &RpcClient, pubkey: &Pubkey) { fn test_nonce() { let (server, leader_data, alice, ledger_path) = new_validator_for_tests(); let (sender, receiver) = channel(); - run_local_drone(alice, sender, None); - let drone_addr = receiver.recv().unwrap(); + run_local_faucet(alice, sender, None); + let faucet_addr = receiver.recv().unwrap(); let rpc_client = RpcClient::new_socket(leader_data.rpc); @@ -55,7 +55,7 @@ fn test_nonce() { request_and_confirm_airdrop( &rpc_client, - &drone_addr, + &faucet_addr, &config_payer.keypair.pubkey(), 2000, ) diff --git a/cli/tests/pay.rs b/cli/tests/pay.rs index 3e44d85d98f940..2179e8d14bbce3 100644 --- a/cli/tests/pay.rs +++ b/cli/tests/pay.rs @@ -2,7 +2,7 @@ use chrono::prelude::*; use serde_json::Value; use solana_cli::cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig}; 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 std::fs::remove_dir_all; use std::str::FromStr; @@ -32,8 +32,8 @@ fn test_cli_timestamp_tx() { let bob_pubkey = Pubkey::new_rand(); let (sender, receiver) = channel(); - run_local_drone(alice, sender, None); - let drone_addr = receiver.recv().unwrap(); + run_local_faucet(alice, sender, None); + let faucet_addr = receiver.recv().unwrap(); let rpc_client = RpcClient::new_socket(leader_data.rpc); @@ -49,13 +49,18 @@ fn test_cli_timestamp_tx() { config_witness.keypair.pubkey() ); - request_and_confirm_airdrop(&rpc_client, &drone_addr, &config_payer.keypair.pubkey(), 50) - .unwrap(); + request_and_confirm_airdrop( + &rpc_client, + &faucet_addr, + &config_payer.keypair.pubkey(), + 50, + ) + .unwrap(); check_balance(50, &rpc_client, &config_payer.keypair.pubkey()); request_and_confirm_airdrop( &rpc_client, - &drone_addr, + &faucet_addr, &config_witness.keypair.pubkey(), 1, ) @@ -106,8 +111,8 @@ fn test_cli_witness_tx() { let bob_pubkey = Pubkey::new_rand(); let (sender, receiver) = channel(); - run_local_drone(alice, sender, None); - let drone_addr = receiver.recv().unwrap(); + run_local_faucet(alice, sender, None); + let faucet_addr = receiver.recv().unwrap(); let rpc_client = RpcClient::new_socket(leader_data.rpc); @@ -123,11 +128,16 @@ fn test_cli_witness_tx() { config_witness.keypair.pubkey() ); - request_and_confirm_airdrop(&rpc_client, &drone_addr, &config_payer.keypair.pubkey(), 50) - .unwrap(); request_and_confirm_airdrop( &rpc_client, - &drone_addr, + &faucet_addr, + &config_payer.keypair.pubkey(), + 50, + ) + .unwrap(); + request_and_confirm_airdrop( + &rpc_client, + &faucet_addr, &config_witness.keypair.pubkey(), 1, ) @@ -176,8 +186,8 @@ fn test_cli_cancel_tx() { let bob_pubkey = Pubkey::new_rand(); let (sender, receiver) = channel(); - run_local_drone(alice, sender, None); - let drone_addr = receiver.recv().unwrap(); + run_local_faucet(alice, sender, None); + let faucet_addr = receiver.recv().unwrap(); let rpc_client = RpcClient::new_socket(leader_data.rpc); @@ -193,8 +203,13 @@ fn test_cli_cancel_tx() { config_witness.keypair.pubkey() ); - request_and_confirm_airdrop(&rpc_client, &drone_addr, &config_payer.keypair.pubkey(), 50) - .unwrap(); + request_and_confirm_airdrop( + &rpc_client, + &faucet_addr, + &config_payer.keypair.pubkey(), + 50, + ) + .unwrap(); // Make transaction (from config_payer to bob_pubkey) requiring witness signature from config_witness config_payer.command = CliCommand::Pay { @@ -239,8 +254,8 @@ fn test_offline_pay_tx() { let bob_pubkey = Pubkey::new_rand(); let (sender, receiver) = channel(); - run_local_drone(alice, sender, None); - let drone_addr = receiver.recv().unwrap(); + run_local_faucet(alice, sender, None); + let faucet_addr = receiver.recv().unwrap(); let rpc_client = RpcClient::new_socket(leader_data.rpc); @@ -257,7 +272,7 @@ fn test_offline_pay_tx() { request_and_confirm_airdrop( &rpc_client, - &drone_addr, + &faucet_addr, &config_offline.keypair.pubkey(), 50, ) @@ -265,7 +280,7 @@ fn test_offline_pay_tx() { request_and_confirm_airdrop( &rpc_client, - &drone_addr, + &faucet_addr, &config_online.keypair.pubkey(), 50, ) diff --git a/cli/tests/request_airdrop.rs b/cli/tests/request_airdrop.rs index 3eedcf09141c7a..3a4b278c0e3545 100644 --- a/cli/tests/request_airdrop.rs +++ b/cli/tests/request_airdrop.rs @@ -1,7 +1,7 @@ use solana_cli::cli::{process_command, CliCommand, CliConfig}; use solana_client::rpc_client::RpcClient; 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 std::fs::remove_dir_all; use std::sync::mpsc::channel; @@ -10,14 +10,14 @@ use std::sync::mpsc::channel; fn test_cli_request_airdrop() { let (server, leader_data, alice, ledger_path) = new_validator_for_tests(); let (sender, receiver) = channel(); - run_local_drone(alice, sender, None); - let drone_addr = receiver.recv().unwrap(); + run_local_faucet(alice, sender, None); + let faucet_addr = receiver.recv().unwrap(); let mut bob_config = CliConfig::default(); bob_config.json_rpc_url = format!("http://{}:{}", leader_data.rpc.ip(), leader_data.rpc.port()); bob_config.command = CliCommand::Airdrop { - drone_host: None, - drone_port: drone_addr.port(), + faucet_host: None, + faucet_port: faucet_addr.port(), lamports: 50, use_lamports_unit: true, }; diff --git a/cli/tests/stake.rs b/cli/tests/stake.rs index 2af1e56dd4cfbd..d38e18ca376ea9 100644 --- a/cli/tests/stake.rs +++ b/cli/tests/stake.rs @@ -1,7 +1,7 @@ use serde_json::Value; use solana_cli::cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig}; 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, @@ -43,8 +43,8 @@ fn test_stake_delegation_and_deactivation() { let (server, leader_data, alice, ledger_path) = new_validator_for_tests(); let (sender, receiver) = channel(); - run_local_drone(alice, sender, None); - let drone_addr = receiver.recv().unwrap(); + run_local_faucet(alice, sender, None); + let faucet_addr = receiver.recv().unwrap(); let rpc_client = RpcClient::new_socket(leader_data.rpc); @@ -66,7 +66,7 @@ fn test_stake_delegation_and_deactivation() { request_and_confirm_airdrop( &rpc_client, - &drone_addr, + &faucet_addr, &config_validator.keypair.pubkey(), 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 (sender, receiver) = channel(); - run_local_drone(alice, sender, None); - let drone_addr = receiver.recv().unwrap(); + run_local_faucet(alice, sender, None); + let faucet_addr = receiver.recv().unwrap(); let rpc_client = RpcClient::new_socket(leader_data.rpc); @@ -153,7 +153,7 @@ fn test_stake_delegation_and_deactivation_offline() { request_and_confirm_airdrop( &rpc_client, - &drone_addr, + &faucet_addr, &config_validator.keypair.pubkey(), 100_000, ) diff --git a/core/Cargo.toml b/core/Cargo.toml index 1e7c4b1953316e..0655cdc851c719 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -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-chacha-sys = { path = "../chacha-sys", 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" solana-ledger = { path = "../ledger", version = "0.22.0" } solana-logger = { path = "../logger", version = "0.22.0" } diff --git a/core/src/rpc.rs b/core/src/rpc.rs index a99fa0996e91c2..4194719b5ce060 100644 --- a/core/src/rpc.rs +++ b/core/src/rpc.rs @@ -15,7 +15,7 @@ use solana_client::rpc_request::{ Response, RpcConfirmedBlock, RpcContactInfo, RpcEpochInfo, RpcResponseContext, RpcVersionInfo, 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_runtime::bank::Bank; use solana_sdk::{ @@ -50,14 +50,14 @@ fn new_response(bank: &Bank, value: T) -> RpcResponse { #[derive(Debug, Clone)] pub struct JsonRpcConfig { pub enable_validator_exit: bool, // Enable the 'validatorExit' command - pub drone_addr: Option, + pub faucet_addr: Option, } impl Default for JsonRpcConfig { fn default() -> Self { Self { enable_validator_exit: false, - drone_addr: None, + faucet_addr: None, } } } @@ -817,12 +817,12 @@ impl RpcSol for RpcSolImpl { &commitment ); - let drone_addr = meta + let faucet_addr = meta .request_processor .read() .unwrap() .config - .drone_addr + .faucet_addr .ok_or_else(Error::invalid_request)?; let pubkey = verify_pubkey(pubkey_str)?; @@ -833,11 +833,11 @@ impl RpcSol for RpcSolImpl { .bank(commitment.clone()) .confirmed_last_blockhash() .0; - let transaction = request_airdrop_transaction(&drone_addr, &pubkey, lamports, blockhash) + let transaction = request_airdrop_transaction(&faucet_addr, &pubkey, lamports, blockhash) .map_err(|err| { - info!("request_airdrop_transaction failed: {:?}", err); - Error::internal_error() - })?; + info!("request_airdrop_transaction failed: {:?}", err); + Error::internal_error() + })?; let data = serialize(&transaction).map_err(|err| { info!("request_airdrop: serialize error: {:?}", err); @@ -1586,7 +1586,7 @@ pub mod tests { let bob_pubkey = Pubkey::new_rand(); 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!( r#"{{"jsonrpc":"2.0","id":1,"method":"requestAirdrop","params":["{}", 50]}}"#, bob_pubkey diff --git a/drone/src/lib.rs b/drone/src/lib.rs deleted file mode 100644 index 6e3e19d5b07ddf..00000000000000 --- a/drone/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod drone; -pub mod drone_mock; diff --git a/drone/tests/local-drone.rs b/drone/tests/local-drone.rs deleted file mode 100644 index 0c2d663ac36f6a..00000000000000 --- a/drone/tests/local-drone.rs +++ /dev/null @@ -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()); -} diff --git a/drone/.gitignore b/faucet/.gitignore similarity index 100% rename from drone/.gitignore rename to faucet/.gitignore diff --git a/drone/Cargo.toml b/faucet/Cargo.toml similarity index 84% rename from drone/Cargo.toml rename to faucet/Cargo.toml index 32c041a655f15d..877fb0b5e40db5 100644 --- a/drone/Cargo.toml +++ b/faucet/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "solana-drone" +name = "solana-faucet" version = "0.22.0" -description = "Solana Drone" +description = "Solana Faucet" authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" license = "Apache-2.0" @@ -28,8 +28,8 @@ tokio-codec = "0.1" [lib] crate-type = ["lib"] -name = "solana_drone" +name = "solana_faucet" [[bin]] -name = "solana-drone" -path = "src/bin/drone.rs" +name = "solana-faucet" +path = "src/bin/faucet.rs" diff --git a/drone/src/bin/drone.rs b/faucet/src/bin/faucet.rs similarity index 77% rename from drone/src/bin/drone.rs rename to faucet/src/bin/faucet.rs index 0e649eaa7db42a..7307b27a5e156d 100644 --- a/drone/src/bin/drone.rs +++ b/faucet/src/bin/faucet.rs @@ -1,15 +1,19 @@ use clap::{crate_description, crate_name, App, Arg}; -use solana_drone::drone::{run_drone, Drone, DRONE_PORT}; -use solana_drone::socketaddr; +use solana_faucet::{ + faucet::{run_faucet, Faucet, FAUCET_PORT}, + socketaddr, +}; use solana_sdk::signature::read_keypair_file; -use std::error; -use std::net::{Ipv4Addr, SocketAddr}; -use std::sync::{Arc, Mutex}; -use std::thread; +use std::{ + error, + net::{Ipv4Addr, SocketAddr}, + sync::{Arc, Mutex}, + thread, +}; fn main() -> Result<(), Box> { 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!()) .about(crate_description!()) .version(solana_clap_utils::version!()) @@ -27,7 +31,7 @@ fn main() -> Result<(), Box> { .long("slice") .value_name("SECS") .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::with_name("cap") @@ -54,21 +58,21 @@ fn main() -> Result<(), Box> { 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, time_slice, request_cap, ))); - let drone1 = drone.clone(); + let faucet1 = faucet.clone(); thread::spawn(move || loop { - let time = drone1.lock().unwrap().time_slice; + let time = faucet1.lock().unwrap().time_slice; 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(()) } diff --git a/drone/src/drone.rs b/faucet/src/faucet.rs similarity index 71% rename from drone/src/drone.rs rename to faucet/src/faucet.rs index 557fde7009939e..2da3ab95d74604 100644 --- a/drone/src/drone.rs +++ b/faucet/src/faucet.rs @@ -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. -//! 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 //! and (to come) an IP rate limit. @@ -10,23 +10,27 @@ use bytes::{Bytes, BytesMut}; use log::*; use serde_derive::{Deserialize, Serialize}; use solana_metrics::datapoint_info; -use solana_sdk::hash::Hash; -use solana_sdk::message::Message; -use solana_sdk::packet::PACKET_DATA_SIZE; -use solana_sdk::pubkey::Pubkey; -use solana_sdk::signature::{Keypair, KeypairUtil}; -use solana_sdk::system_instruction; -use solana_sdk::transaction::Transaction; -use std::io; -use std::io::{Error, ErrorKind}; -use std::net::{IpAddr, Ipv4Addr, SocketAddr, TcpStream}; -use std::sync::mpsc::Sender; -use std::sync::{Arc, Mutex}; -use std::thread; -use std::time::Duration; -use tokio; -use tokio::net::TcpListener; -use tokio::prelude::{Future, Read, Sink, Stream, Write}; +use solana_sdk::{ + hash::Hash, + message::Message, + packet::PACKET_DATA_SIZE, + pubkey::Pubkey, + signature::{Keypair, KeypairUtil}, + system_instruction, + transaction::Transaction, +}; +use std::{ + io::{self, Error, ErrorKind}, + net::{IpAddr, Ipv4Addr, SocketAddr, TcpStream}, + sync::{mpsc::Sender, Arc, Mutex}, + thread, + time::Duration, +}; +use tokio::{ + self, + net::TcpListener, + prelude::{Future, Read, Sink, Stream, Write}, +}; use tokio_codec::{BytesCodec, Decoder}; #[macro_export] @@ -42,11 +46,11 @@ macro_rules! socketaddr { pub const TIME_SLICE: u64 = 60; pub const REQUEST_CAP: u64 = solana_sdk::native_token::SOL_LAMPORTS * 1_000_000; -pub const DRONE_PORT: u16 = 9900; -pub const DRONE_PORT_STR: &str = "9900"; +pub const FAUCET_PORT: u16 = 9900; +pub const FAUCET_PORT_STR: &str = "9900"; #[derive(Serialize, Deserialize, Debug, Clone, Copy)] -pub enum DroneRequest { +pub enum FaucetRequest { GetAirdrop { lamports: u64, to: Pubkey, @@ -54,7 +58,7 @@ pub enum DroneRequest { }, } -pub struct Drone { +pub struct Faucet { mint_keypair: Keypair, ip_cache: Vec, pub time_slice: Duration, @@ -62,12 +66,12 @@ pub struct Drone { pub request_current: u64, } -impl Drone { +impl Faucet { pub fn new( mint_keypair: Keypair, time_input: Option, request_cap_input: Option, - ) -> Drone { + ) -> Faucet { let time_slice = match time_input { Some(time) => Duration::new(time, 0), None => Duration::new(TIME_SLICE, 0), @@ -76,7 +80,7 @@ impl Drone { Some(cap) => cap, None => REQUEST_CAP, }; - Drone { + Faucet { mint_keypair, ip_cache: Vec::new(), time_slice, @@ -103,11 +107,11 @@ impl Drone { pub fn build_airdrop_transaction( &mut self, - req: DroneRequest, + req: FaucetRequest, ) -> Result { trace!("build_airdrop_transaction: {:?}", req); match req { - DroneRequest::GetAirdrop { + FaucetRequest::GetAirdrop { lamports, to, blockhash, @@ -115,7 +119,7 @@ impl Drone { if self.check_request_limit(lamports) { self.request_current += lamports; datapoint_info!( - "drone-airdrop", + "faucet-airdrop", ("request_amount", lamports, i64), ("request_current", self.request_current, i64) ); @@ -137,11 +141,11 @@ impl Drone { } } } - pub fn process_drone_request(&mut self, bytes: &BytesMut) -> Result { - let req: DroneRequest = deserialize(bytes).or_else(|err| { + pub fn process_faucet_request(&mut self, bytes: &BytesMut) -> Result { + let req: FaucetRequest = deserialize(bytes).or_else(|err| { Err(io::Error::new( 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| { Err(io::Error::new( 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) { solana_metrics::flush(); } } pub fn request_airdrop_transaction( - drone_addr: &SocketAddr, + faucet_addr: &SocketAddr, id: &Pubkey, lamports: u64, blockhash: Hash, ) -> Result { info!( - "request_airdrop_transaction: drone_addr={} id={} lamports={} blockhash={}", - drone_addr, id, lamports, blockhash + "request_airdrop_transaction: faucet_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)))?; - let req = DroneRequest::GetAirdrop { + let req = FaucetRequest::GetAirdrop { lamports, blockhash, to: *id, }; - let req = serialize(&req).expect("serialize drone request"); + let req = serialize(&req).expect("serialize faucet request"); stream.write_all(&req)?; // Read length of transaction @@ -213,7 +217,7 @@ pub fn request_airdrop_transaction( return Err(Error::new( ErrorKind::Other, format!( - "request_airdrop_transaction: invalid transaction_length from drone: {}", + "request_airdrop_transaction: invalid transaction_length from faucet: {}", transaction_length ), )); @@ -240,42 +244,42 @@ pub fn request_airdrop_transaction( } // 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, sender: Sender, request_cap_input: Option, ) { thread::spawn(move || { - let drone_addr = socketaddr!(0, 0); - let drone = Arc::new(Mutex::new(Drone::new( + let faucet_addr = socketaddr!(0, 0); + let faucet = Arc::new(Mutex::new(Faucet::new( mint_keypair, None, request_cap_input, ))); - run_drone(drone, drone_addr, Some(sender)); + run_faucet(faucet, faucet_addr, Some(sender)); }); } -pub fn run_drone( - drone: Arc>, - drone_addr: SocketAddr, +pub fn run_faucet( + faucet: Arc>, + faucet_addr: SocketAddr, send_addr: Option>, ) { - let socket = TcpListener::bind(&drone_addr).unwrap(); + let socket = TcpListener::bind(&faucet_addr).unwrap(); if let Some(send_addr) = send_addr { 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 .incoming() .map_err(|e| debug!("failed to accept socket; error = {:?}", e)) .for_each(move |socket| { - let drone2 = drone.clone(); + let faucet2 = faucet.clone(); let framed = BytesCodec::new().framed(socket); let (writer, reader) = framed.split(); 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) => { trace!("Airdrop response_bytes: {:?}", response_bytes.to_vec()); Ok(response_bytes) @@ -290,7 +294,7 @@ pub fn run_drone( .send_all(processor.or_else(|err| { Err(io::Error::new( io::ErrorKind::Other, - format!("Drone response: {:?}", err), + format!("Faucet response: {:?}", err), )) })) .then(|_| Ok(())); @@ -309,61 +313,61 @@ mod tests { #[test] fn test_check_request_limit() { let keypair = Keypair::new(); - let mut drone = Drone::new(keypair, None, Some(3)); - assert!(drone.check_request_limit(1)); - drone.request_current = 3; - assert!(!drone.check_request_limit(1)); + let mut faucet = Faucet::new(keypair, None, Some(3)); + assert!(faucet.check_request_limit(1)); + faucet.request_current = 3; + assert!(!faucet.check_request_limit(1)); } #[test] fn test_clear_request_count() { let keypair = Keypair::new(); - let mut drone = Drone::new(keypair, None, None); - drone.request_current = drone.request_current + 256; - assert_eq!(drone.request_current, 256); - drone.clear_request_count(); - assert_eq!(drone.request_current, 0); + let mut faucet = Faucet::new(keypair, None, None); + faucet.request_current = faucet.request_current + 256; + assert_eq!(faucet.request_current, 256); + faucet.clear_request_count(); + assert_eq!(faucet.request_current, 0); } #[test] fn test_add_ip_to_cache() { 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"); - assert_eq!(drone.ip_cache.len(), 0); - drone.add_ip_to_cache(ip); - assert_eq!(drone.ip_cache.len(), 1); - assert!(drone.ip_cache.contains(&ip)); + assert_eq!(faucet.ip_cache.len(), 0); + faucet.add_ip_to_cache(ip); + assert_eq!(faucet.ip_cache.len(), 1); + assert!(faucet.ip_cache.contains(&ip)); } #[test] fn test_clear_ip_cache() { 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"); - assert_eq!(drone.ip_cache.len(), 0); - drone.add_ip_to_cache(ip); - assert_eq!(drone.ip_cache.len(), 1); - drone.clear_ip_cache(); - assert_eq!(drone.ip_cache.len(), 0); - assert!(drone.ip_cache.is_empty()); + assert_eq!(faucet.ip_cache.len(), 0); + faucet.add_ip_to_cache(ip); + assert_eq!(faucet.ip_cache.len(), 1); + faucet.clear_ip_cache(); + assert_eq!(faucet.ip_cache.len(), 0); + assert!(faucet.ip_cache.is_empty()); } #[test] - fn test_drone_default_init() { + fn test_faucet_default_init() { let keypair = Keypair::new(); let time_slice: Option = None; let request_cap: Option = None; - let drone = Drone::new(keypair, time_slice, request_cap); - assert_eq!(drone.time_slice, Duration::new(TIME_SLICE, 0)); - assert_eq!(drone.request_cap, REQUEST_CAP); + let faucet = Faucet::new(keypair, time_slice, request_cap); + assert_eq!(faucet.time_slice, Duration::new(TIME_SLICE, 0)); + assert_eq!(faucet.request_cap, REQUEST_CAP); } #[test] - fn test_drone_build_airdrop_transaction() { + fn test_faucet_build_airdrop_transaction() { let to = Pubkey::new_rand(); let blockhash = Hash::default(); - let request = DroneRequest::GetAirdrop { + let request = FaucetRequest::GetAirdrop { lamports: 2, to, blockhash, @@ -371,9 +375,9 @@ mod tests { let mint = Keypair::new(); 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(); assert_eq!(tx.signatures.len(), 1); @@ -388,17 +392,17 @@ mod tests { assert_eq!(instruction, SystemInstruction::Transfer { lamports: 2 }); let mint = Keypair::new(); - drone = Drone::new(mint, None, Some(1)); - let tx = drone.build_airdrop_transaction(request); + faucet = Faucet::new(mint, None, Some(1)); + let tx = faucet.build_airdrop_transaction(request); assert!(tx.is_err()); } #[test] - fn test_process_drone_request() { + fn test_process_faucet_request() { let to = Pubkey::new_rand(); let blockhash = Hash::new(&to.as_ref()); let lamports = 50; - let req = DroneRequest::GetAirdrop { + let req = FaucetRequest::GetAirdrop { lamports, blockhash, to, @@ -416,13 +420,13 @@ mod tests { LittleEndian::write_u16(&mut expected_vec_with_length, expected_bytes.len() as u16); expected_vec_with_length.extend_from_slice(&expected_bytes); - let mut drone = Drone::new(keypair, None, None); - let response = drone.process_drone_request(&bytes); + let mut faucet = Faucet::new(keypair, None, None); + let response = faucet.process_faucet_request(&bytes); let response_vec = response.unwrap().to_vec(); assert_eq!(expected_vec_with_length, response_vec); let mut bad_bytes = BytesMut::with_capacity(9); bad_bytes.put("bad bytes"); - assert!(drone.process_drone_request(&bad_bytes).is_err()); + assert!(faucet.process_faucet_request(&bad_bytes).is_err()); } } diff --git a/drone/src/drone_mock.rs b/faucet/src/faucet_mock.rs similarity index 61% rename from drone/src/drone_mock.rs rename to faucet/src/faucet_mock.rs index c5ee6d88de0aca..1815b3c395098b 100644 --- a/drone/src/drone_mock.rs +++ b/faucet/src/faucet_mock.rs @@ -1,13 +1,17 @@ -use solana_sdk::hash::Hash; -use solana_sdk::pubkey::Pubkey; -use solana_sdk::signature::{Keypair, KeypairUtil}; -use solana_sdk::system_transaction; -use solana_sdk::transaction::Transaction; -use std::io::{Error, ErrorKind}; -use std::net::SocketAddr; +use solana_sdk::{ + hash::Hash, + pubkey::Pubkey, + signature::{Keypair, KeypairUtil}, + system_transaction, + transaction::Transaction, +}; +use std::{ + io::{Error, ErrorKind}, + net::SocketAddr, +}; pub fn request_airdrop_transaction( - _drone_addr: &SocketAddr, + _faucet_addr: &SocketAddr, _id: &Pubkey, lamports: u64, _blockhash: Hash, diff --git a/faucet/src/lib.rs b/faucet/src/lib.rs new file mode 100644 index 00000000000000..7421799dd2aa00 --- /dev/null +++ b/faucet/src/lib.rs @@ -0,0 +1,2 @@ +pub mod faucet; +pub mod faucet_mock; diff --git a/faucet/tests/local-faucet.rs b/faucet/tests/local-faucet.rs new file mode 100644 index 00000000000000..a916d50b3adda4 --- /dev/null +++ b/faucet/tests/local-faucet.rs @@ -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()); +} diff --git a/local-cluster/Cargo.toml b/local-cluster/Cargo.toml index 5b18c779442889..1dba0b078d9ab2 100644 --- a/local-cluster/Cargo.toml +++ b/local-cluster/Cargo.toml @@ -15,7 +15,7 @@ rand = "0.6.5" solana-config-program = { path = "../programs/config", version = "0.22.0" } solana-core = { path = "../core", 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-genesis-programs = { path = "../genesis-programs", version = "0.22.0" } solana-ledger = { path = "../ledger", version = "0.22.0" } diff --git a/metrics/scripts/README.md b/metrics/scripts/README.md index db8f66bc977ab9..c8dcb465aa15c9 100644 --- a/metrics/scripts/README.md +++ b/metrics/scripts/README.md @@ -37,7 +37,7 @@ adhoc metrics collection/viewing Simple example of pulling all airdrop measurements out of the `testnet` database: ```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/ diff --git a/metrics/scripts/grafana-provisioning/dashboards/testnet-monitor.json b/metrics/scripts/grafana-provisioning/dashboards/testnet-monitor.json index 65159f5f5ced71..db12ddbe807efa 100644 --- a/metrics/scripts/grafana-provisioning/dashboards/testnet-monitor.json +++ b/metrics/scripts/grafana-provisioning/dashboards/testnet-monitor.json @@ -1997,7 +1997,7 @@ "measurement": "cluster_info-vote-count", "orderByTime": "ASC", "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, "refId": "A", "resultFormat": "time_series", diff --git a/metrics/scripts/test.sh b/metrics/scripts/test.sh index 99f169732b4532..ce3c11039b1d05 100755 --- a/metrics/scripts/test.sh +++ b/metrics/scripts/test.sh @@ -22,6 +22,6 @@ fi 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}" \ | xargs curl -XPOST --data-binary "$point" diff --git a/multinode-demo/bench-tps.sh b/multinode-demo/bench-tps.sh index 45f4b35d407020..a6649b24d5b432 100755 --- a/multinode-demo/bench-tps.sh +++ b/multinode-demo/bench-tps.sh @@ -22,7 +22,7 @@ usage() { if [[ -z $1 ]]; then # default behavior $solana_bench_tps \ --entrypoint 127.0.0.1:8001 \ - --drone 127.0.0.1:9900 \ + --faucet 127.0.0.1:9900 \ --duration 90 \ --tx_count 50000 \ --thread-batch-sleep-ms 0 \ diff --git a/multinode-demo/bootstrap-leader.sh b/multinode-demo/bootstrap-leader.sh index 963c543a44d763..5041b801101ed9 100755 --- a/multinode-demo/bootstrap-leader.sh +++ b/multinode-demo/bootstrap-leader.sh @@ -82,7 +82,7 @@ args+=( --identity-keypair "$identity_keypair" --storage-keypair "$storage_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 --log - diff --git a/multinode-demo/common.sh b/multinode-demo/common.sh index b6052ab071dedb..cfe5d9f1d537d8 100644 --- a/multinode-demo/common.sh +++ b/multinode-demo/common.sh @@ -51,7 +51,7 @@ else fi solana_bench_tps=$(solana_program bench-tps) -solana_drone=$(solana_program drone) +solana_faucet=$(solana_program faucet) solana_validator=$(solana_program validator) solana_validator_cuda="$solana_validator --cuda" solana_genesis=$(solana_program genesis) diff --git a/multinode-demo/drone.sh b/multinode-demo/faucet.sh similarity index 75% rename from multinode-demo/drone.sh rename to multinode-demo/faucet.sh index 7b7285102524bc..eaa9ef2944d214 100755 --- a/multinode-demo/drone.sh +++ b/multinode-demo/faucet.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Starts an instance of solana-drone +# Starts an instance of solana-faucet # here=$(dirname "$0") @@ -15,5 +15,5 @@ source "$here"/common.sh } set -x -# shellcheck disable=SC2086 # Don't want to double quote $solana_drone -exec $solana_drone --keypair "$SOLANA_CONFIG_DIR"/faucet-keypair.json "$@" +# shellcheck disable=SC2086 # Don't want to double quote $solana_faucet +exec $solana_faucet --keypair "$SOLANA_CONFIG_DIR"/faucet-keypair.json "$@" diff --git a/multinode-demo/validator.sh b/multinode-demo/validator.sh index 025102b3baa9e0..ba942aebc16c15 100755 --- a/multinode-demo/validator.sh +++ b/multinode-demo/validator.sh @@ -109,7 +109,7 @@ while [[ -n $1 ]]; do elif [[ $1 = --enable-rpc-exit ]]; then args+=("$1") shift - elif [[ $1 = --rpc-drone-address ]]; then + elif [[ $1 = --rpc-faucet-address ]]; then args+=("$1" "$2") shift 2 elif [[ $1 = --vote-signer-address ]]; then @@ -194,7 +194,7 @@ else fi fi -drone_address="${gossip_entrypoint%:*}":9900 +faucet_address="${gossip_entrypoint%:*}":9900 : "${identity_keypair_path:=$ledger_dir/identity-keypair.json}" : "${voting_keypair_path:=$ledger_dir/vote-keypair.json}" @@ -202,7 +202,7 @@ drone_address="${gossip_entrypoint%:*}":9900 default_arg --entrypoint "$gossip_entrypoint" if ((airdrops_enabled)); then - default_arg --rpc-drone-address "$drone_address" + default_arg --rpc-faucet-address "$faucet_address" fi default_arg --identity-keypair "$identity_keypair_path" diff --git a/net/net.sh b/net/net.sh index 7fa6bda1c6908d..98121c5ac2ef55 100755 --- a/net/net.sh +++ b/net/net.sh @@ -1006,7 +1006,7 @@ logs) "$ipAddress":solana/"$log".log "$netLogDir"/remote-"$log"-"$ipAddress".log ) || echo "failed to fetch log" } - fetchRemoteLog "${validatorIpList[0]}" drone + fetchRemoteLog "${validatorIpList[0]}" faucet for ipAddress in "${validatorIpList[@]}"; do fetchRemoteLog "$ipAddress" validator done diff --git a/net/remote/remote-client.sh b/net/remote/remote-client.sh index 5467dcd70b5388..081e2ad73fe0f3 100755 --- a/net/remote/remote-client.sh +++ b/net/remote/remote-client.sh @@ -49,7 +49,7 @@ solana-bench-tps) clientCommand="\ solana-bench-tps \ --entrypoint $entrypointIp:8001 \ - --drone $entrypointIp:9900 \ + --faucet $entrypointIp:9900 \ --duration 7500 \ --sustained \ --threads $threadCount \ @@ -64,7 +64,7 @@ solana-bench-exchange) clientCommand="\ solana-bench-exchange \ --entrypoint $entrypointIp:8001 \ - --drone $entrypointIp:9900 \ + --faucet $entrypointIp:9900 \ --threads $threadCount \ --batch-size 1000 \ --fund-amount 20000 \ diff --git a/net/remote/remote-node.sh b/net/remote/remote-node.sh index 875d38366cdb87..ef412ca220c2ce 100755 --- a/net/remote/remote-node.sh +++ b/net/remote/remote-node.sh @@ -237,7 +237,7 @@ EOF if [[ $airdropsEnabled = true ]]; then cat >> ~/solana/on-reboot < drone.log 2>&1 & + ./multinode-demo/faucet.sh > faucet.log 2>&1 & EOF fi # shellcheck disable=SC2206 # Don't want to double quote $extraNodeArgs @@ -304,17 +304,17 @@ EOF set -x # 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/ 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 # the blockexplorer web app, and is a location that somebody would expect # to be able to airdrop from scp "$entrypointIp":~/solana/config/faucet-keypair.json config/ if [[ $airdropsEnabled = true ]]; then cat >> ~/solana/on-reboot < drone.log 2>&1 & + multinode-demo/faucet.sh > faucet.log 2>&1 & EOF fi diff --git a/run.sh b/run.sh index ff7b027092a75a..65a1567a79e082 100755 --- a/run.sh +++ b/run.sh @@ -17,7 +17,7 @@ fi PATH=$PWD/target/$profile:$PATH ok=true -for program in solana-{drone,genesis,keygen,validator}; do +for program in solana-{faucet,genesis,keygen,validator}; do $program -V || ok=false done $ok || { @@ -90,13 +90,13 @@ solana-genesis \ abort() { set +e - kill "$drone" "$validator" + kill "$faucet" "$validator" wait "$validator" } trap abort INT TERM EXIT -solana-drone --keypair "$dataDir"/faucet-keypair.json & -drone=$! +solana-faucet --keypair "$dataDir"/faucet-keypair.json & +faucet=$! args=( --identity-keypair "$dataDir"/leader-keypair.json @@ -105,7 +105,7 @@ args=( --ledger "$ledgerDir" --gossip-port 8001 --rpc-port 8899 - --rpc-drone-address 127.0.0.1:9900 + --rpc-faucet-address 127.0.0.1:9900 --accounts "$dataDir"/accounts --log - --enable-rpc-exit diff --git a/scripts/cargo-install-all.sh b/scripts/cargo-install-all.sh index 912019d580d102..712da290a7436d 100755 --- a/scripts/cargo-install-all.sh +++ b/scripts/cargo-install-all.sh @@ -73,7 +73,7 @@ BINS=( solana solana-bench-exchange solana-bench-tps - solana-drone + solana-faucet solana-gossip solana-install solana-install-init diff --git a/validator/Cargo.toml b/validator/Cargo.toml index 85739d7da5e22c..0a764fe747bd1f 100644 --- a/validator/Cargo.toml +++ b/validator/Cargo.toml @@ -20,7 +20,7 @@ serde_json = "1.0.44" solana-clap-utils = { path = "../clap-utils", version = "0.22.0" } solana-client = { path = "../client", 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-logger = { path = "../logger", version = "0.22.0" } solana-perf = { path = "../perf", version = "0.22.0" } diff --git a/validator/src/main.rs b/validator/src/main.rs index 59b1ee3f9f7507..3ffb1b1d45861c 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -447,12 +447,12 @@ pub fn main() { .help("Enable the JSON RPC 'validatorExit' API. Only enable in a debug environment"), ) .arg( - Arg::with_name("rpc_drone_addr") - .long("rpc-drone-address") + Arg::with_name("rpc_faucet_addr") + .long("rpc-faucet-address") .value_name("HOST:PORT") .takes_value(true) .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::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.drone_addr = matches.value_of("rpc_drone_addr").map(|address| { - solana_net_utils::parse_host_port(address).expect("failed to parse drone 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 faucet address") }); let dynamic_port_range =