Skip to content

Commit b17e938

Browse files
committed
update source files
1 parent 3d45c46 commit b17e938

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+360
-1116
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Cargo.lock
88
# node configuration files
99
/config/
1010
/config-private/
11-
/config-drone/
11+
/config-faucet/
1212
/config-validator/
1313
/config-client/
1414
/multinode-demo/test/config-client/

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ name = "hypercube-bench-tps"
3030
path = "src/bin/bench-tps.rs"
3131

3232
[[bin]]
33-
name = "hypercube-drone"
34-
path = "src/bin/drone.rs"
33+
name = "hypercube-faucet"
34+
path = "src/bin/faucet.rs"
3535

3636
[[bin]]
3737
name = "hypercube-replicator"

src/bin/bench-tps.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use influx_db_client as influxdb;
1212
use rayon::prelude::*;
1313
use hypercube::client::mk_client;
1414
use hypercube::blockthread::{BlockThread, NodeInfo};
15-
use hypercube::drone::DRONE_PORT;
15+
use hypercube::faucet::DRONE_PORT;
1616
use hypercube::hash::Hash;
1717
use hypercube::logger;
1818
use hypercube::metrics;
@@ -152,7 +152,7 @@ fn send_barrier_transaction(barrier_client: &mut ThinClient, last_id: &mut Hash,
152152
break;
153153
}
154154

155-
// Timeout after 3 minutes. When running a CPU-only leader+validator+drone+bench-tps on a dev
155+
// Timeout after 3 minutes. When running a CPU-only leader+validator+faucet+bench-tps on a dev
156156
// machine, some batches of transactions can take upwards of 1 minute...
157157
if duration_ms > 1000 * 60 * 3 {
158158
println!("Error: Couldn't confirm barrier transaction!");
@@ -273,8 +273,8 @@ fn do_tx_transfers(
273273
}
274274

275275
fn airdrop_tokens(client: &mut ThinClient, leader: &NodeInfo, id: &Keypair, tx_count: i64) {
276-
let mut drone_addr = leader.contact_info.tx_creator;
277-
drone_addr.set_port(DRONE_PORT);
276+
let mut faucet_addr = leader.contact_info.tx_creator;
277+
faucet_addr.set_port(DRONE_PORT);
278278

279279
let starting_balance = client.poll_get_balance(&id.pubkey()).unwrap_or(0);
280280
metrics_submit_token_balance(starting_balance);
@@ -285,14 +285,14 @@ fn airdrop_tokens(client: &mut ThinClient, leader: &NodeInfo, id: &Keypair, tx_c
285285
println!(
286286
"Airdropping {:?} tokens from {} for {}",
287287
airdrop_amount,
288-
drone_addr,
288+
faucet_addr,
289289
id.pubkey(),
290290
);
291291

292-
if let Err(e) = request_airdrop(&drone_addr, &id.pubkey(), airdrop_amount as u64) {
292+
if let Err(e) = request_airdrop(&faucet_addr, &id.pubkey(), airdrop_amount as u64) {
293293
panic!(
294294
"Error requesting airdrop: {:?} to addr: {:?} amount: {}",
295-
e, drone_addr, airdrop_amount
295+
e, faucet_addr, airdrop_amount
296296
);
297297
}
298298

src/bin/drone.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extern crate tokio_codec;
1111
use bincode::{deserialize, serialize};
1212
use bytes::Bytes;
1313
use clap::{App, Arg};
14-
use hypercube::drone::{Drone, DroneRequest, DRONE_PORT};
14+
use hypercube::faucet::{Drone, DroneRequest, DRONE_PORT};
1515
use hypercube::logger;
1616
use hypercube::metrics::set_panic_hook;
1717
use hypercube::signature::read_keypair;
@@ -37,8 +37,8 @@ macro_rules! socketaddr {
3737

3838
fn main() -> Result<(), Box<error::Error>> {
3939
logger::setup();
40-
set_panic_hook("drone");
41-
let matches = App::new("drone")
40+
set_panic_hook("faucet");
41+
let matches = App::new("faucet")
4242
.version(crate_version!())
4343
.arg(
4444
Arg::with_name("network")
@@ -61,7 +61,7 @@ fn main() -> Result<(), Box<error::Error>> {
6161
.long("slice")
6262
.value_name("SECS")
6363
.takes_value(true)
64-
.help("Time slice over which to limit requests to drone"),
64+
.help("Time slice over which to limit requests to faucet"),
6565
).arg(
6666
Arg::with_name("cap")
6767
.long("cap")
@@ -95,45 +95,45 @@ fn main() -> Result<(), Box<error::Error>> {
9595
request_cap = None;
9696
}
9797

98-
let drone_addr = socketaddr!(0, DRONE_PORT);
98+
let faucet_addr = socketaddr!(0, DRONE_PORT);
9999

100-
let drone = Arc::new(Mutex::new(Drone::new(
100+
let faucet = Arc::new(Mutex::new(Drone::new(
101101
mint_keypair,
102-
drone_addr,
102+
faucet_addr,
103103
network,
104104
time_slice,
105105
request_cap,
106106
)));
107107

108-
let drone1 = drone.clone();
108+
let faucet1 = faucet.clone();
109109
thread::spawn(move || loop {
110-
let time = drone1.lock().unwrap().time_slice;
110+
let time = faucet1.lock().unwrap().time_slice;
111111
thread::sleep(time);
112-
drone1.lock().unwrap().clear_request_count();
112+
faucet1.lock().unwrap().clear_request_count();
113113
});
114114

115-
let socket = TcpListener::bind(&drone_addr).unwrap();
116-
println!("Drone started. Listening on: {}", drone_addr);
115+
let socket = TcpListener::bind(&faucet_addr).unwrap();
116+
println!("Drone started. Listening on: {}", faucet_addr);
117117
let done = socket
118118
.incoming()
119119
.map_err(|e| println!("failed to accept socket; error = {:?}", e))
120120
.for_each(move |socket| {
121-
let drone2 = drone.clone();
122-
// let client_ip = socket.peer_addr().expect("drone peer_addr").ip();
121+
let faucet2 = faucet.clone();
122+
// let client_ip = socket.peer_addr().expect("faucet peer_addr").ip();
123123
let framed = BytesCodec::new().framed(socket);
124124
let (writer, reader) = framed.split();
125125

126126
let processor = reader.and_then(move |bytes| {
127127
let req: DroneRequest = deserialize(&bytes).or_else(|err| {
128128
Err(io::Error::new(
129129
io::ErrorKind::Other,
130-
format!("deserialize packet in drone: {:?}", err),
130+
format!("deserialize packet in faucet: {:?}", err),
131131
))
132132
})?;
133133

134134
println!("Airdrop requested...");
135-
// let res = drone2.lock().unwrap().check_rate_limit(client_ip);
136-
let res1 = drone2.lock().unwrap().send_airdrop(req);
135+
// let res = faucet2.lock().unwrap().check_rate_limit(client_ip);
136+
let res1 = faucet2.lock().unwrap().send_airdrop(req);
137137
match res1 {
138138
Ok(_) => println!("Airdrop sent!"),
139139
Err(_) => println!("Request limit reached for this time slice"),
@@ -143,7 +143,7 @@ fn main() -> Result<(), Box<error::Error>> {
143143
let response_vec = serialize(&response).or_else(|err| {
144144
Err(io::Error::new(
145145
io::ErrorKind::Other,
146-
format!("serialize signature in drone: {:?}", err),
146+
format!("serialize signature in faucet: {:?}", err),
147147
))
148148
})?;
149149
let response_bytes = Bytes::from(response_vec.clone());

src/bin/fullnode.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ extern crate hypercube;
1010
use clap::{App, Arg};
1111
use hypercube::client::mk_client;
1212
use hypercube::blockthread::Node;
13-
use hypercube::drone::DRONE_PORT;
13+
use hypercube::faucet::DRONE_PORT;
1414
use hypercube::fullnode::{Config, Fullnode, FullnodeReturnType};
1515
use hypercube::logger;
1616
use hypercube::metrics::set_panic_hook;
@@ -95,8 +95,8 @@ fn main() -> () {
9595

9696
let mut client = mk_client(&leader);
9797

98-
// TODO: maybe have the drone put itself in gossip somewhere instead of hardcoding?
99-
let drone_addr = match network {
98+
// TODO: maybe have the faucet put itself in gossip somewhere instead of hardcoding?
99+
let faucet_addr = match network {
100100
Some(network) => SocketAddr::new(network.ip(), DRONE_PORT),
101101
None => SocketAddr::new(ncp.ip(), DRONE_PORT),
102102
};
@@ -110,14 +110,14 @@ fn main() -> () {
110110
break;
111111
}
112112

113-
info!("requesting airdrop from {}", drone_addr);
113+
info!("requesting airdrop from {}", faucet_addr);
114114
loop {
115-
if request_airdrop(&drone_addr, &pubkey, 50).is_ok() {
115+
if request_airdrop(&faucet_addr, &pubkey, 50).is_ok() {
116116
break;
117117
}
118118
info!(
119-
"airdrop request, is the drone address correct {:?}, drone running?",
120-
drone_addr
119+
"airdrop request, is the faucet address correct {:?}, faucet running?",
120+
faucet_addr
121121
);
122122
sleep(Duration::from_secs(2));
123123
}

src/bin/wallet.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extern crate dirs;
55
extern crate hypercube;
66

77
use clap::{App, Arg, ArgMatches, SubCommand};
8-
use hypercube::drone::DRONE_PORT;
8+
use hypercube::faucet::DRONE_PORT;
99
use hypercube::logger;
1010
use hypercube::rpc::RPC_PORT;
1111
use hypercube::signature::{read_keypair, KeypairUtil};
@@ -51,8 +51,8 @@ pub fn parse_args(matches: &ArgMatches) -> Result<WalletConfig, Box<error::Error
5151

5252
let leader = poll_gossip_for_leader(network, timeout)?;
5353

54-
let mut drone_addr = leader.contact_info.tx_creator;
55-
drone_addr.set_port(DRONE_PORT);
54+
let mut faucet_addr = leader.contact_info.tx_creator;
55+
faucet_addr.set_port(DRONE_PORT);
5656

5757
let rpc_addr = if let Some(proxy) = matches.value_of("proxy") {
5858
proxy.to_string()
@@ -72,7 +72,7 @@ pub fn parse_args(matches: &ArgMatches) -> Result<WalletConfig, Box<error::Error
7272
Ok(WalletConfig {
7373
leader,
7474
id,
75-
drone_addr, // TODO: Add an option for this.
75+
faucet_addr, // TODO: Add an option for this.
7676
rpc_addr,
7777
command,
7878
})

0 commit comments

Comments
 (0)