diff --git a/multinode-demo/common.sh b/multinode-demo/common.sh index c5e866594..029f4ba3d 100644 --- a/multinode-demo/common.sh +++ b/multinode-demo/common.sh @@ -107,9 +107,11 @@ tune_networking() { # Reference: https://medium.com/@CameronSparr/increase-os-udp-buffers-to-improve-performance-51d167bb1360 [[ $(uname) = Linux ]] && ( set -x + set +e # these error out on WSL # TODO: Check values and warn instead, it's a little rude to set them here. sudo sysctl -w net.core.rmem_max=26214400 1>/dev/null 2>/dev/null sudo sysctl -w net.core.rmem_default=26214400 1>/dev/null 2>/dev/null + : ) } diff --git a/multinode-demo/leader.sh b/multinode-demo/leader.sh index ec5b62a39..68f06784e 100755 --- a/multinode-demo/leader.sh +++ b/multinode-demo/leader.sh @@ -25,9 +25,15 @@ fi tune_networking +# migrate from old ledger format? why not... +if [[ ! -f "$SOLANA_CONFIG_DIR"/ledger.log && + -f "$SOLANA_CONFIG_DIR"/genesis.log ]]; then + (shopt -s nullglob && + cat "$SOLANA_CONFIG_DIR"/genesis.log \ + "$SOLANA_CONFIG_DIR"/tx-*.log) > "$SOLANA_CONFIG_DIR"/ledger.log +fi + # shellcheck disable=SC2086 # $program should not be quoted exec $program \ - -l "$SOLANA_CONFIG_DIR"/leader.json \ - < <(shopt -s nullglob && cat "$SOLANA_CONFIG_DIR"/genesis.log \ - "$SOLANA_CONFIG_DIR"/tx-*.log) \ - > "$SOLANA_CONFIG_DIR"/tx-"$(date -u +%Y%m%d%H%M%S%N)".log + --identity "$SOLANA_CONFIG_DIR"/leader.json \ + --ledger "$SOLANA_CONFIG_DIR"/ledger.log diff --git a/multinode-demo/myip.sh b/multinode-demo/myip.sh deleted file mode 100755 index 25ab4c72f..000000000 --- a/multinode-demo/myip.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -function myip() -{ - # shellcheck disable=SC2207 - declare ipaddrs=( - # query interwebs - $(curl -s ifconfig.co) - # machine's interfaces - $(ifconfig | - awk '/inet addr:/ {gsub("addr:","",$2); print $2; next} - /inet6 addr:/ {gsub("/.*", "", $3); print $3; next} - /inet(6)? / {print $2}' - ) - ) - - if (( ! ${#ipaddrs[*]} )) - then - echo " -myip: error: I'm having trouble determining what our IP address is... - Are we connected to a network? - -" - return 1 - fi - - - declare prompt=" -Please choose the IP address you want to advertise to the network: - - 0) ${ipaddrs[0]} <====== this one was returned by the interwebs... -" - - for ((i=1; i < ${#ipaddrs[*]}; i++)) - do - prompt+=" $i) ${ipaddrs[i]} -" - done - - while read -r -p "${prompt} -please enter a number [0 for default]: " which - do - [[ -z ${which} ]] && break; - [[ ${which} =~ [0-9]+ ]] && (( which < ${#ipaddrs[*]} )) && break; - echo "Ug. invalid entry \"${which}\"... -" - sleep 1 - done - - which=${which:-0} - - echo "${ipaddrs[which]}" - -} - -if [[ ${0} == "${BASH_SOURCE[0]}" ]] -then - myip "$@" -fi diff --git a/multinode-demo/setup.sh b/multinode-demo/setup.sh index da50e2e27..bb370dcff 100755 --- a/multinode-demo/setup.sh +++ b/multinode-demo/setup.sh @@ -89,8 +89,8 @@ if $node_type_leader; then echo "Creating $SOLANA_CONFIG_DIR/mint.json with $num_tokens tokens" $solana_keygen -o "$mint_path" - echo "Creating $SOLANA_CONFIG_DIR/genesis.log" - $solana_genesis --tokens="$num_tokens" < "$mint_path" > "$SOLANA_CONFIG_DIR"/genesis.log + echo "Creating $SOLANA_CONFIG_DIR/ledger.log" + $solana_genesis --tokens="$num_tokens" < "$mint_path" > "$SOLANA_CONFIG_DIR"/ledger.log echo "Creating $SOLANA_CONFIG_DIR/leader.json" $solana_fullnode_config --keypair="$id_path" "${leader_address_args[@]}" > "$SOLANA_CONFIG_DIR"/leader.json diff --git a/multinode-demo/validator.sh b/multinode-demo/validator.sh index 9b17dabaa..8679d9417 100755 --- a/multinode-demo/validator.sh +++ b/multinode-demo/validator.sh @@ -73,8 +73,16 @@ ls -lh "$SOLANA_LEADER_CONFIG_DIR" tune_networking +# migrate from old ledger format? why not... +if [[ ! -f "$SOLANA_LEADER_CONFIG_DIR"/ledger.log && + -f "$SOLANA_LEADER_CONFIG_DIR"/genesis.log ]]; then + (shopt -s nullglob && + cat "$SOLANA_LEADER_CONFIG_DIR"/genesis.log \ + "$SOLANA_LEADER_CONFIG_DIR"/tx-*.log) > "$SOLANA_LEADER_CONFIG_DIR"/ledger.log +fi + # shellcheck disable=SC2086 # $program should not be quoted exec $program \ - -l "$SOLANA_CONFIG_DIR"/validator.json -t "$leader_address:$leader_port" \ - < <(shopt -s nullglob && cat "$SOLANA_LEADER_CONFIG_DIR"/genesis.log \ - "$SOLANA_LEADER_CONFIG_DIR"/tx-*.log) + --identity "$SOLANA_CONFIG_DIR"/validator.json \ + --testnet "$leader_address:$leader_port" \ + --ledger "$SOLANA_LEADER_CONFIG_DIR"/ledger.log diff --git a/src/bin/fullnode.rs b/src/bin/fullnode.rs index 717d9980d..31d012543 100644 --- a/src/bin/fullnode.rs +++ b/src/bin/fullnode.rs @@ -1,4 +1,3 @@ -extern crate atty; extern crate clap; extern crate env_logger; extern crate getopts; @@ -6,7 +5,6 @@ extern crate log; extern crate serde_json; extern crate solana; -use atty::{is, Stream}; use clap::{App, Arg}; use solana::crdt::{NodeInfo, TestNode}; use solana::fullnode::{Config, FullNode, Ledger}; @@ -22,8 +20,8 @@ fn main() -> () { let matches = App::new("fullnode") .arg( Arg::with_name("identity") - .short("l") - .long("local") + .short("i") + .long("identity") .value_name("FILE") .takes_value(true) .help("run with the identity found in FILE"), @@ -34,7 +32,7 @@ fn main() -> () { .long("testnet") .value_name("HOST:PORT") .takes_value(true) - .help("testnet; connect to the network at this gossip entry point"), + .help("connect to the network at this gossip entry point"), ) .arg( Arg::with_name("ledger") @@ -45,16 +43,12 @@ fn main() -> () { .help("use FILE as persistent ledger (defaults to stdin/stdout)"), ) .get_matches(); - if is(Stream::Stdin) { - eprintln!("nothing found on stdin, expected a log file"); - exit(1); - } let bind_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 8000); let mut keypair = KeyPair::new(); let mut repl_data = NodeInfo::new_leader_with_pubkey(keypair.pubkey(), &bind_addr); - if let Some(l) = matches.value_of("identity") { - let path = l.to_string(); + if let Some(i) = matches.value_of("identity") { + let path = i.to_string(); if let Ok(file) = File::open(path.clone()) { let parse: serde_json::Result = serde_json::from_reader(file); if let Ok(data) = parse {