Delete uptime command, report total credits in `solana validators` instead

This commit is contained in:
Michael Vines 2020-02-03 11:37:50 -07:00
parent 0d7e093415
commit 4c0420b884
5 changed files with 89 additions and 271 deletions

View File

@ -241,7 +241,6 @@ SUBCOMMANDS:
stakes Show stake account information
storage-account Show the contents of a storage account
transaction-count Get current transaction count
uptime Show the uptime of a validator, based on epoch voting history
validator-info Publish/get Validator info on Solana
validators Show summary information about the current validators
vote-account Show the contents of a vote account
@ -254,7 +253,7 @@ SUBCOMMANDS:
#### solana-account
```text
solana-account
solana-account
Show the contents of an account
USAGE:
@ -283,7 +282,7 @@ ARGS:
#### solana-address
```text
solana-address
solana-address
Get your public key
USAGE:
@ -307,7 +306,7 @@ OPTIONS:
#### solana-airdrop
```text
solana-airdrop
solana-airdrop
Request lamports
USAGE:
@ -337,7 +336,7 @@ ARGS:
#### solana-authorize-nonce-account
```text
solana-authorize-nonce-account
solana-authorize-nonce-account
Assign account authority to a new entity
USAGE:
@ -373,7 +372,7 @@ ARGS:
#### solana-balance
```text
solana-balance
solana-balance
Get your balance
USAGE:
@ -401,7 +400,7 @@ ARGS:
#### solana-block-production
```text
solana-block-production
solana-block-production
Show information about block production
USAGE:
@ -428,7 +427,7 @@ OPTIONS:
#### solana-block-time
```text
solana-block-time
solana-block-time
Get estimated production time of a block
USAGE:
@ -455,7 +454,7 @@ ARGS:
#### solana-cancel
```text
solana-cancel
solana-cancel
Cancel a transfer
USAGE:
@ -482,7 +481,7 @@ ARGS:
#### solana-catchup
```text
solana-catchup
solana-catchup
Wait for a validator to catch up to the cluster
USAGE:
@ -509,7 +508,7 @@ ARGS:
#### solana-claim-storage-reward
```text
solana-claim-storage-reward
solana-claim-storage-reward
Redeem storage reward credits
USAGE:
@ -537,7 +536,7 @@ ARGS:
#### solana-cluster-version
```text
solana-cluster-version
solana-cluster-version
Get the version of the cluster entrypoint
USAGE:
@ -561,7 +560,7 @@ OPTIONS:
#### solana-config
```text
solana-config
solana-config
Solana command-line tool configuration settings
USAGE:
@ -590,7 +589,7 @@ SUBCOMMANDS:
#### solana-confirm
```text
solana-confirm
solana-confirm
Confirm transaction by signature
USAGE:
@ -617,7 +616,7 @@ ARGS:
#### solana-create-address-with-seed
```text
solana-create-address-with-seed
solana-create-address-with-seed
Generate a derived account address with a seed
USAGE:
@ -641,13 +640,13 @@ OPTIONS:
ARGS:
<SEED_STRING> The seed. Must not take more than 32 bytes to encode as utf-8
<PROGRAM_ID> The program_id that the address will ultimately be used for,
<PROGRAM_ID> The program_id that the address will ultimately be used for,
or one of STAKE, VOTE, and STORAGE keywords
```
#### solana-create-archiver-storage-account
```text
solana-create-archiver-storage-account
solana-create-archiver-storage-account
Create an archiver storage account
USAGE:
@ -669,13 +668,13 @@ OPTIONS:
-k, --keypair <PATH> /path/to/id.json
ARGS:
<STORAGE ACCOUNT OWNER PUBKEY>
<STORAGE ACCOUNT>
<STORAGE ACCOUNT OWNER PUBKEY>
<STORAGE ACCOUNT>
```
#### solana-create-nonce-account
```text
solana-create-nonce-account
solana-create-nonce-account
Create a nonce account
USAGE:
@ -705,7 +704,7 @@ ARGS:
#### solana-create-stake-account
```text
solana-create-stake-account
solana-create-stake-account
Create a stake account
USAGE:
@ -741,7 +740,7 @@ ARGS:
#### solana-create-validator-storage-account
```text
solana-create-validator-storage-account
solana-create-validator-storage-account
Create a validator storage account
USAGE:
@ -763,13 +762,13 @@ OPTIONS:
-k, --keypair <PATH> /path/to/id.json
ARGS:
<STORAGE ACCOUNT OWNER PUBKEY>
<STORAGE ACCOUNT>
<STORAGE ACCOUNT OWNER PUBKEY>
<STORAGE ACCOUNT>
```
#### solana-create-vote-account
```text
solana-create-vote-account
solana-create-vote-account
Create a vote account
USAGE:
@ -802,7 +801,7 @@ ARGS:
#### solana-deactivate-stake
```text
solana-deactivate-stake
solana-deactivate-stake
Deactivate the delegated stake from the stake account
USAGE:
@ -827,9 +826,9 @@ OPTIONS:
-u, --url <URL> JSON RPC URL for the solana cluster
-k, --keypair <PATH> /path/to/id.json
--nonce <PUBKEY>
Provide the nonce account to use when creating a nonced
transaction. Nonced transactions are useful when a transaction
requires a lengthy signing process. Learn more about nonced
Provide the nonce account to use when creating a nonced
transaction. Nonced transactions are useful when a transaction
requires a lengthy signing process. Learn more about nonced
transactions at https://docs.solana.com/offline-signing/durable-nonce
--nonce-authority <KEYPAIR or PUBKEY>
Provide the nonce authority keypair to use when signing a nonced transaction
@ -843,7 +842,7 @@ ARGS:
#### solana-delegate-stake
```text
solana-delegate-stake
solana-delegate-stake
Delegate stake to a vote account
USAGE:
@ -868,9 +867,9 @@ OPTIONS:
-u, --url <URL> JSON RPC URL for the solana cluster
-k, --keypair <PATH> /path/to/id.json
--nonce <PUBKEY>
Provide the nonce account to use when creating a nonced
transaction. Nonced transactions are useful when a transaction
requires a lengthy signing process. Learn more about nonced
Provide the nonce account to use when creating a nonced
transaction. Nonced transactions are useful when a transaction
requires a lengthy signing process. Learn more about nonced
transactions at https://docs.solana.com/offline-signing/durable-nonce
--nonce-authority <KEYPAIR or PUBKEY>
Provide the nonce authority keypair to use when signing a nonced transaction
@ -885,7 +884,7 @@ ARGS:
#### solana-deploy
```text
solana-deploy
solana-deploy
Deploy a program
USAGE:
@ -912,7 +911,7 @@ ARGS:
#### solana-epoch-info
```text
solana-epoch-info
solana-epoch-info
Get information about the current epoch
USAGE:
@ -937,7 +936,7 @@ OPTIONS:
#### solana-fees
```text
solana-fees
solana-fees
Display current cluster fees
USAGE:
@ -961,7 +960,7 @@ OPTIONS:
#### solana-genesis-hash
```text
solana-genesis-hash
solana-genesis-hash
Get the genesis hash
USAGE:
@ -985,7 +984,7 @@ OPTIONS:
#### solana-gossip
```text
solana-gossip
solana-gossip
Show the current gossip network nodes
USAGE:
@ -1009,7 +1008,7 @@ OPTIONS:
#### solana-help
```text
solana-help
solana-help
Prints this message or the help of the given subcommand(s)
USAGE:
@ -1021,7 +1020,7 @@ ARGS:
#### solana-new-nonce
```text
solana-new-nonce
solana-new-nonce
Generate a new nonce, rendering the existing nonce useless
USAGE:
@ -1053,7 +1052,7 @@ ARGS:
#### solana-nonce
```text
solana-nonce
solana-nonce
Get the current nonce value
USAGE:
@ -1080,7 +1079,7 @@ ARGS:
#### solana-nonce-account
```text
solana-nonce-account
solana-nonce-account
Show the contents of a nonce account
USAGE:
@ -1108,14 +1107,14 @@ ARGS:
#### solana-pay
```text
solana-pay
solana-pay
Send a payment
USAGE:
solana pay [FLAGS] [OPTIONS] <TO PUBKEY> <AMOUNT> [--] [UNIT]
FLAGS:
--cancelable
--cancelable
-h, --help Prints help information
--sign-only Sign the transaction offline
--skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39
@ -1134,9 +1133,9 @@ OPTIONS:
-u, --url <URL> JSON RPC URL for the solana cluster
-k, --keypair <PATH> /path/to/id.json
--nonce <PUBKEY>
Provide the nonce account to use when creating a nonced
transaction. Nonced transactions are useful when a transaction
requires a lengthy signing process. Learn more about nonced
Provide the nonce account to use when creating a nonced
transaction. Nonced transactions are useful when a transaction
requires a lengthy signing process. Learn more about nonced
transactions at https://docs.solana.com/offline-signing/durable-nonce
--nonce-authority <KEYPAIR or PUBKEY>
Provide the nonce authority keypair to use when signing a nonced transaction
@ -1154,7 +1153,7 @@ ARGS:
#### solana-ping
```text
solana-ping
solana-ping
Submit transactions sequentially
USAGE:
@ -1183,7 +1182,7 @@ OPTIONS:
#### solana-send-signature
```text
solana-send-signature
solana-send-signature
Send a signature to authorize a transfer
USAGE:
@ -1211,7 +1210,7 @@ ARGS:
#### solana-send-timestamp
```text
solana-send-timestamp
solana-send-timestamp
Send a timestamp to unlock a transfer
USAGE:
@ -1240,7 +1239,7 @@ ARGS:
#### solana-show-stake-account
```text
solana-show-stake-account
solana-show-stake-account
Show the contents of a stake account
USAGE:
@ -1268,7 +1267,7 @@ ARGS:
#### solana-slot
```text
solana-slot
solana-slot
Get current slot
USAGE:
@ -1293,7 +1292,7 @@ OPTIONS:
#### solana-stake-authorize-staker
```text
solana-stake-authorize-staker
solana-stake-authorize-staker
Authorize a new stake signing keypair for the given stake account
USAGE:
@ -1318,9 +1317,9 @@ OPTIONS:
-u, --url <URL> JSON RPC URL for the solana cluster
-k, --keypair <PATH> /path/to/id.json
--nonce <PUBKEY>
Provide the nonce account to use when creating a nonced
transaction. Nonced transactions are useful when a transaction
requires a lengthy signing process. Learn more about nonced
Provide the nonce account to use when creating a nonced
transaction. Nonced transactions are useful when a transaction
requires a lengthy signing process. Learn more about nonced
transactions at https://docs.solana.com/offline-signing/durable-nonce
--nonce-authority <KEYPAIR or PUBKEY>
Provide the nonce authority keypair to use when signing a nonced transaction
@ -1335,7 +1334,7 @@ ARGS:
#### solana-stake-authorize-withdrawer
```text
solana-stake-authorize-withdrawer
solana-stake-authorize-withdrawer
Authorize a new withdraw signing keypair for the given stake account
USAGE:
@ -1360,9 +1359,9 @@ OPTIONS:
-u, --url <URL> JSON RPC URL for the solana cluster
-k, --keypair <PATH> /path/to/id.json
--nonce <PUBKEY>
Provide the nonce account to use when creating a nonced
transaction. Nonced transactions are useful when a transaction
requires a lengthy signing process. Learn more about nonced
Provide the nonce account to use when creating a nonced
transaction. Nonced transactions are useful when a transaction
requires a lengthy signing process. Learn more about nonced
transactions at https://docs.solana.com/offline-signing/durable-nonce
--nonce-authority <KEYPAIR or PUBKEY>
Provide the nonce authority keypair to use when signing a nonced transaction
@ -1377,7 +1376,7 @@ ARGS:
#### solana-stake-history
```text
solana-stake-history
solana-stake-history
Show the stake history
USAGE:
@ -1402,7 +1401,7 @@ OPTIONS:
#### solana-stakes
```text
solana-stakes
solana-stakes
Show stake account information
USAGE:
@ -1430,7 +1429,7 @@ ARGS:
#### solana-storage-account
```text
solana-storage-account
solana-storage-account
Show the contents of a storage account
USAGE:
@ -1457,7 +1456,7 @@ ARGS:
#### solana-transaction-count
```text
solana-transaction-count
solana-transaction-count
Get current transaction count
USAGE:
@ -1480,38 +1479,9 @@ OPTIONS:
-k, --keypair <PATH> /path/to/id.json
```
#### solana-uptime
```text
solana-uptime
Show the uptime of a validator, based on epoch voting history
USAGE:
solana uptime [FLAGS] [OPTIONS] <VOTE ACCOUNT PUBKEY>
FLAGS:
--aggregate Aggregate uptime data across span
-h, --help Prints help information
--skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39
official English word list
-V, --version Prints version information
-v, --verbose Show extra information header
OPTIONS:
--ask-seed-phrase <KEYPAIR NAME> Recover a keypair using a seed phrase and optional passphrase [possible
values: keypair]
-C, --config <PATH> Configuration file to use [default:
~/.config/solana/cli/config.yml]
-u, --url <URL> JSON RPC URL for the solana cluster
-k, --keypair <PATH> /path/to/id.json
--span <NUM OF EPOCHS> Number of recent epochs to examine
ARGS:
<VOTE ACCOUNT PUBKEY> Vote account pubkey
```
#### solana-validator-info
```text
solana-validator-info
solana-validator-info
Publish/get Validator info on Solana
USAGE:
@ -1540,7 +1510,7 @@ SUBCOMMANDS:
#### solana-validators
```text
solana-validators
solana-validators
Show summary information about the current validators
USAGE:
@ -1565,7 +1535,7 @@ OPTIONS:
#### solana-vote-account
```text
solana-vote-account
solana-vote-account
Show the contents of a vote account
USAGE:
@ -1593,7 +1563,7 @@ ARGS:
#### solana-vote-authorize-voter
```text
solana-vote-authorize-voter
solana-vote-authorize-voter
Authorize a new vote signing keypair for the given vote account
USAGE:
@ -1621,7 +1591,7 @@ ARGS:
#### solana-vote-authorize-withdrawer
```text
solana-vote-authorize-withdrawer
solana-vote-authorize-withdrawer
Authorize a new withdraw signing keypair for the given vote account
USAGE:
@ -1649,7 +1619,7 @@ ARGS:
#### solana-vote-update-validator
```text
solana-vote-update-validator
solana-vote-update-validator
Update the vote account's validator identity
USAGE:
@ -1678,7 +1648,7 @@ ARGS:
#### solana-withdraw-from-nonce-account
```text
solana-withdraw-from-nonce-account
solana-withdraw-from-nonce-account
Withdraw lamports from the nonce account
USAGE:
@ -1713,7 +1683,7 @@ ARGS:
#### solana-withdraw-stake
```text
solana-withdraw-stake
solana-withdraw-stake
Withdraw the unstaked lamports from the stake account
USAGE:

View File

@ -83,7 +83,6 @@ To monitor your validator during its warmup period:
* View your vote account:`solana vote-account ~/validator-vote-keypair.json` This displays the current state of all the votes the validator has submitted to the network.
* View your stake account, the delegation preference and details of your stake:`solana stake-account ~/validator-stake-keypair.json`
* `solana uptime ~/validator-vote-keypair.json` will display the voting history \(aka, uptime\) of your validator over recent Epochs
* `solana validators` displays the current active stake of all validators, including yours
* `solana stake-history ` shows the history of stake warming up and cooling down over recent epochs
* Look for log messages on your validator indicating your next leader slot: `[2019-09-27T20:16:00.319721164Z INFO solana_core::replay_stage] <VALIDATOR_IDENTITY_PUBKEY> voted and reset PoH at tick height ####. My next leader slot is ####`

View File

@ -343,11 +343,6 @@ pub enum CliCommand {
pubkey: Pubkey,
use_lamports_unit: bool,
},
Uptime {
pubkey: Pubkey,
aggregate: bool,
span: Option<u64>,
},
VoteAuthorize {
vote_account_pubkey: Pubkey,
new_authorized_pubkey: Pubkey,
@ -539,7 +534,6 @@ pub fn parse_command(matches: &ArgMatches<'_>) -> Result<CliCommandInfo, Box<dyn
parse_vote_authorize(matches, VoteAuthorize::Withdrawer)
}
("vote-account", Some(matches)) => parse_vote_get_account_command(matches),
("uptime", Some(matches)) => parse_vote_uptime_command(matches),
// Wallet Commands
("address", Some(_matches)) => Ok(CliCommandInfo {
command: CliCommand::Address,
@ -1609,11 +1603,6 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
&new_identity_pubkey,
authorized_voter,
),
CliCommand::Uptime {
pubkey: vote_account_pubkey,
aggregate,
span,
} => process_uptime(&rpc_client, config, &vote_account_pubkey, *aggregate, *span),
// Wallet Commands

View File

@ -14,7 +14,7 @@ use solana_sdk::{
account_utils::StateMut,
clock::{self, Slot},
commitment_config::CommitmentConfig,
epoch_schedule::{Epoch, EpochSchedule},
epoch_schedule::Epoch,
hash::Hash,
pubkey::Pubkey,
signature::{Keypair, KeypairUtil},
@ -321,20 +321,6 @@ fn new_spinner_progress_bar() -> ProgressBar {
progress_bar
}
/// Aggregate epoch credit stats and return (total credits, total slots, total epochs)
pub fn aggregate_epoch_credits(
epoch_credits: &[(Epoch, u64, u64)],
epoch_schedule: &EpochSchedule,
) -> (u64, u64, u64) {
epoch_credits
.iter()
.fold((0, 0, 0), |acc, (epoch, credits, prev_credits)| {
let credits_earned = credits - prev_credits;
let slots_in_epoch = epoch_schedule.get_slots_in_epoch(*epoch);
(acc.0 + credits_earned, acc.1 + slots_in_epoch, acc.2 + 1)
})
}
pub fn process_catchup(rpc_client: &RpcClient, node_pubkey: &Pubkey) -> ProcessResult {
let cluster_nodes = rpc_client.get_cluster_nodes()?;
@ -900,7 +886,7 @@ pub fn process_show_stakes(
}
pub fn process_show_validators(rpc_client: &RpcClient, use_lamports_unit: bool) -> ProcessResult {
let epoch_schedule = rpc_client.get_epoch_schedule()?;
let epoch_info = rpc_client.get_epoch_info()?;
let vote_accounts = rpc_client.get_vote_accounts()?;
let total_active_stake = vote_accounts
.current
@ -949,7 +935,7 @@ pub fn process_show_validators(rpc_client: &RpcClient, use_lamports_unit: bool)
"Commission",
"Last Vote",
"Root Block",
"Uptime",
"Credits",
"Active Stake",
))
.bold()
@ -957,7 +943,7 @@ pub fn process_show_validators(rpc_client: &RpcClient, use_lamports_unit: bool)
fn print_vote_account(
vote_account: RpcVoteAccountInfo,
epoch_schedule: &EpochSchedule,
current_epoch: Epoch,
total_active_stake: f64,
use_lamports_unit: bool,
delinquent: bool,
@ -970,17 +956,6 @@ pub fn process_show_validators(rpc_client: &RpcClient, use_lamports_unit: bool)
}
}
fn uptime(epoch_credits: Vec<(Epoch, u64, u64)>, epoch_schedule: &EpochSchedule) -> String {
let (total_credits, total_slots, _) =
aggregate_epoch_credits(&epoch_credits, &epoch_schedule);
if total_slots > 0 {
let total_uptime = 100_f64 * total_credits as f64 / total_slots as f64;
format!("{:.2}%", total_uptime)
} else {
"-".into()
}
}
println!(
"{} {:<44} {:<44} {:>9}% {:>8} {:>10} {:>7} {}",
if delinquent {
@ -993,7 +968,15 @@ pub fn process_show_validators(rpc_client: &RpcClient, use_lamports_unit: bool)
vote_account.commission,
non_zero_or_dash(vote_account.last_vote),
non_zero_or_dash(vote_account.root_slot),
uptime(vote_account.epoch_credits, epoch_schedule),
vote_account
.epoch_credits
.iter()
.find_map(|(epoch, credits, _)| if *epoch == current_epoch {
Some(*credits)
} else {
None
})
.unwrap_or(0),
if vote_account.activated_stake > 0 {
format!(
"{} ({:.2}%)",
@ -1009,7 +992,7 @@ pub fn process_show_validators(rpc_client: &RpcClient, use_lamports_unit: bool)
for vote_account in vote_accounts.current.into_iter() {
print_vote_account(
vote_account,
&epoch_schedule,
epoch_info.epoch,
total_active_stake,
use_lamports_unit,
false,
@ -1018,7 +1001,7 @@ pub fn process_show_validators(rpc_client: &RpcClient, use_lamports_unit: bool)
for vote_account in vote_accounts.delinquent.into_iter() {
print_vote_account(
vote_account,
&epoch_schedule,
epoch_info.epoch,
total_active_stake,
use_lamports_unit,
true,

View File

@ -1,10 +1,6 @@
use crate::{
cli::{
build_balance_message, check_account_for_fee, check_unique_pubkeys,
log_instruction_custom_error, CliCommand, CliCommandInfo, CliConfig, CliError,
ProcessResult,
},
cluster_query::aggregate_epoch_credits,
use crate::cli::{
build_balance_message, check_account_for_fee, check_unique_pubkeys,
log_instruction_custom_error, CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult,
};
use clap::{value_t_or_exit, App, Arg, ArgMatches, SubCommand};
use solana_clap_utils::{input_parsers::*, input_validators::*};
@ -176,31 +172,6 @@ impl VoteSubCommands for App<'_, '_> {
.help("Display balance in lamports instead of SOL"),
),
)
.subcommand(
SubCommand::with_name("uptime")
.about("Show the uptime of a validator, based on epoch voting history")
.arg(
Arg::with_name("vote_account_pubkey")
.index(1)
.value_name("VOTE ACCOUNT PUBKEY")
.takes_value(true)
.required(true)
.validator(is_pubkey_or_keypair)
.help("Vote account pubkey"),
)
.arg(
Arg::with_name("span")
.long("span")
.value_name("NUM OF EPOCHS")
.takes_value(true)
.help("Number of recent epochs to examine"),
)
.arg(
Arg::with_name("aggregate")
.long("aggregate")
.help("Aggregate uptime data across span"),
),
)
}
}
@ -271,24 +242,6 @@ pub fn parse_vote_get_account_command(
})
}
pub fn parse_vote_uptime_command(matches: &ArgMatches<'_>) -> Result<CliCommandInfo, CliError> {
let vote_account_pubkey = pubkey_of(matches, "vote_account_pubkey").unwrap();
let aggregate = matches.is_present("aggregate");
let span = if matches.is_present("span") {
Some(value_t_or_exit!(matches, "span", u64))
} else {
None
};
Ok(CliCommandInfo {
command: CliCommand::Uptime {
pubkey: vote_account_pubkey,
aggregate,
span,
},
require_keypair: false,
})
}
pub fn process_create_vote_account(
rpc_client: &RpcClient,
config: &CliConfig,
@ -517,60 +470,6 @@ pub fn process_show_vote_account(
Ok("".to_string())
}
pub fn process_uptime(
rpc_client: &RpcClient,
_config: &CliConfig,
vote_account_pubkey: &Pubkey,
aggregate: bool,
span: Option<u64>,
) -> ProcessResult {
let (_vote_account, vote_state) = get_vote_account(rpc_client, vote_account_pubkey)?;
let epoch_schedule = rpc_client.get_epoch_schedule()?;
println!("validator identity: {}", vote_state.node_pubkey);
println!("authorized voter: {}", vote_state.authorized_voter);
if !vote_state.votes.is_empty() {
println!("uptime:");
let epoch_credits: Vec<(u64, u64, u64)> = if let Some(x) = span {
vote_state
.epoch_credits()
.iter()
.rev()
.take(x as usize)
.cloned()
.collect()
} else {
vote_state.epoch_credits().iter().rev().cloned().collect()
};
if aggregate {
let (total_credits, total_slots, epochs) =
aggregate_epoch_credits(&epoch_credits, &epoch_schedule);
if total_slots > 0 {
let total_uptime = 100_f64 * total_credits as f64 / total_slots as f64;
println!("{:.2}% over {} epochs", total_uptime, epochs);
} else {
println!("Insufficient voting history available");
}
} else {
for (epoch, credits, prev_credits) in epoch_credits {
let credits_earned = credits - prev_credits;
let slots_in_epoch = epoch_schedule.get_slots_in_epoch(epoch);
let uptime = credits_earned as f64 / slots_in_epoch as f64;
println!("- epoch: {} {:.2}% uptime", epoch, uptime * 100_f64,);
}
}
if let Some(x) = span {
if x > vote_state.epoch_credits().len() as u64 {
println!("(span longer than available epochs)");
}
}
}
Ok("".to_string())
}
#[cfg(test)]
mod tests {
use super::*;
@ -741,27 +640,5 @@ mod tests {
require_keypair: true
}
);
// Test Uptime Subcommand
let pubkey = Pubkey::new_rand();
let matches = test_commands.clone().get_matches_from(vec![
"test",
"uptime",
&pubkey.to_string(),
"--span",
"4",
"--aggregate",
]);
assert_eq!(
parse_command(&matches).unwrap(),
CliCommandInfo {
command: CliCommand::Uptime {
pubkey,
aggregate: true,
span: Some(4)
},
require_keypair: false
}
);
}
}