Reformat imports to a consistent style for imports
rustfmt.toml configuration: imports_granularity = "One" group_imports = "One"
This commit is contained in:
parent
0ef1b25e4b
commit
b8837c04ec
@ -17,8 +17,10 @@ pub mod validator_info;
|
|||||||
use {
|
use {
|
||||||
crate::parse_account_data::{parse_account_data, AccountAdditionalData, ParsedAccount},
|
crate::parse_account_data::{parse_account_data, AccountAdditionalData, ParsedAccount},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::ReadableAccount, account::WritableAccount, clock::Epoch,
|
account::{ReadableAccount, WritableAccount},
|
||||||
fee_calculator::FeeCalculator, pubkey::Pubkey,
|
clock::Epoch,
|
||||||
|
fee_calculator::FeeCalculator,
|
||||||
|
pubkey::Pubkey,
|
||||||
},
|
},
|
||||||
std::{
|
std::{
|
||||||
io::{Read, Write},
|
io::{Read, Write},
|
||||||
@ -202,8 +204,10 @@ fn slice_data(data: &[u8], data_slice_config: Option<UiDataSliceConfig>) -> &[u8
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use {
|
||||||
use solana_sdk::account::{Account, AccountSharedData};
|
super::*,
|
||||||
|
solana_sdk::account::{Account, AccountSharedData},
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_slice_data() {
|
fn test_slice_data() {
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
use crate::{
|
use {
|
||||||
parse_bpf_loader::parse_bpf_upgradeable_loader,
|
crate::{
|
||||||
parse_config::parse_config,
|
parse_bpf_loader::parse_bpf_upgradeable_loader,
|
||||||
parse_nonce::parse_nonce,
|
parse_config::parse_config,
|
||||||
parse_stake::parse_stake,
|
parse_nonce::parse_nonce,
|
||||||
parse_sysvar::parse_sysvar,
|
parse_stake::parse_stake,
|
||||||
parse_token::{parse_token, spl_token_id},
|
parse_sysvar::parse_sysvar,
|
||||||
parse_vote::parse_vote,
|
parse_token::{parse_token, spl_token_id},
|
||||||
|
parse_vote::parse_vote,
|
||||||
|
},
|
||||||
|
inflector::Inflector,
|
||||||
|
serde_json::Value,
|
||||||
|
solana_sdk::{instruction::InstructionError, pubkey::Pubkey, stake, system_program, sysvar},
|
||||||
|
std::collections::HashMap,
|
||||||
|
thiserror::Error,
|
||||||
};
|
};
|
||||||
use inflector::Inflector;
|
|
||||||
use serde_json::Value;
|
|
||||||
use solana_sdk::{instruction::InstructionError, pubkey::Pubkey, stake, system_program, sysvar};
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref BPF_UPGRADEABLE_LOADER_PROGRAM_ID: Pubkey = solana_sdk::bpf_loader_upgradeable::id();
|
static ref BPF_UPGRADEABLE_LOADER_PROGRAM_ID: Pubkey = solana_sdk::bpf_loader_upgradeable::id();
|
||||||
@ -112,12 +114,14 @@ pub fn parse_account_data(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use {
|
||||||
use solana_sdk::nonce::{
|
super::*,
|
||||||
state::{Data, Versions},
|
solana_sdk::nonce::{
|
||||||
State,
|
state::{Data, Versions},
|
||||||
|
State,
|
||||||
|
},
|
||||||
|
solana_vote_program::vote_state::{VoteState, VoteStateVersions},
|
||||||
};
|
};
|
||||||
use solana_vote_program::vote_state::{VoteState, VoteStateVersions};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_account_data() {
|
fn test_parse_account_data() {
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
use crate::{
|
use {
|
||||||
parse_account_data::{ParsableAccount, ParseAccountError},
|
crate::{
|
||||||
UiAccountData, UiAccountEncoding,
|
parse_account_data::{ParsableAccount, ParseAccountError},
|
||||||
|
UiAccountData, UiAccountEncoding,
|
||||||
|
},
|
||||||
|
bincode::{deserialize, serialized_size},
|
||||||
|
solana_sdk::{bpf_loader_upgradeable::UpgradeableLoaderState, pubkey::Pubkey},
|
||||||
};
|
};
|
||||||
use bincode::{deserialize, serialized_size};
|
|
||||||
use solana_sdk::{bpf_loader_upgradeable::UpgradeableLoaderState, pubkey::Pubkey};
|
|
||||||
|
|
||||||
pub fn parse_bpf_upgradeable_loader(
|
pub fn parse_bpf_upgradeable_loader(
|
||||||
data: &[u8],
|
data: &[u8],
|
||||||
@ -90,9 +92,7 @@ pub struct UiProgramData {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use {super::*, bincode::serialize, solana_sdk::pubkey::Pubkey};
|
||||||
use bincode::serialize;
|
|
||||||
use solana_sdk::pubkey::Pubkey;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_bpf_upgradeable_loader_accounts() {
|
fn test_parse_bpf_upgradeable_loader_accounts() {
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
use crate::{
|
use {
|
||||||
parse_account_data::{ParsableAccount, ParseAccountError},
|
crate::{
|
||||||
validator_info,
|
parse_account_data::{ParsableAccount, ParseAccountError},
|
||||||
|
validator_info,
|
||||||
|
},
|
||||||
|
bincode::deserialize,
|
||||||
|
serde_json::Value,
|
||||||
|
solana_config_program::{get_config_data, ConfigKeys},
|
||||||
|
solana_sdk::{
|
||||||
|
pubkey::Pubkey,
|
||||||
|
stake::config::{self as stake_config, Config as StakeConfig},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use bincode::deserialize;
|
|
||||||
use serde_json::Value;
|
|
||||||
use solana_config_program::{get_config_data, ConfigKeys};
|
|
||||||
use solana_sdk::pubkey::Pubkey;
|
|
||||||
use solana_sdk::stake::config::{self as stake_config, Config as StakeConfig};
|
|
||||||
|
|
||||||
pub fn parse_config(data: &[u8], pubkey: &Pubkey) -> Result<ConfigAccountType, ParseAccountError> {
|
pub fn parse_config(data: &[u8], pubkey: &Pubkey) -> Result<ConfigAccountType, ParseAccountError> {
|
||||||
let parsed_account = if pubkey == &stake_config::id() {
|
let parsed_account = if pubkey == &stake_config::id() {
|
||||||
@ -87,11 +91,10 @@ pub struct UiConfig<T> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use {
|
||||||
use crate::validator_info::ValidatorInfo;
|
super::*, crate::validator_info::ValidatorInfo, serde_json::json,
|
||||||
use serde_json::json;
|
solana_config_program::create_config_account, solana_sdk::account::ReadableAccount,
|
||||||
use solana_config_program::create_config_account;
|
};
|
||||||
use solana_sdk::account::ReadableAccount;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_config() {
|
fn test_parse_config() {
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use crate::{parse_account_data::ParseAccountError, UiFeeCalculator};
|
use {
|
||||||
use solana_sdk::{
|
crate::{parse_account_data::ParseAccountError, UiFeeCalculator},
|
||||||
instruction::InstructionError,
|
solana_sdk::{
|
||||||
nonce::{state::Versions, State},
|
instruction::InstructionError,
|
||||||
|
nonce::{state::Versions, State},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn parse_nonce(data: &[u8]) -> Result<UiNonceState, ParseAccountError> {
|
pub fn parse_nonce(data: &[u8]) -> Result<UiNonceState, ParseAccountError> {
|
||||||
@ -42,14 +44,16 @@ pub struct UiNonceData {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use {
|
||||||
use solana_sdk::{
|
super::*,
|
||||||
hash::Hash,
|
solana_sdk::{
|
||||||
nonce::{
|
hash::Hash,
|
||||||
state::{Data, Versions},
|
nonce::{
|
||||||
State,
|
state::{Data, Versions},
|
||||||
|
State,
|
||||||
|
},
|
||||||
|
pubkey::Pubkey,
|
||||||
},
|
},
|
||||||
pubkey::Pubkey,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
use crate::{
|
use {
|
||||||
parse_account_data::{ParsableAccount, ParseAccountError},
|
crate::{
|
||||||
StringAmount,
|
parse_account_data::{ParsableAccount, ParseAccountError},
|
||||||
|
StringAmount,
|
||||||
|
},
|
||||||
|
bincode::deserialize,
|
||||||
|
solana_sdk::{
|
||||||
|
clock::{Epoch, UnixTimestamp},
|
||||||
|
stake::state::{Authorized, Delegation, Lockup, Meta, Stake, StakeState},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use bincode::deserialize;
|
|
||||||
use solana_sdk::clock::{Epoch, UnixTimestamp};
|
|
||||||
use solana_sdk::stake::state::{Authorized, Delegation, Lockup, Meta, Stake, StakeState};
|
|
||||||
|
|
||||||
pub fn parse_stake(data: &[u8]) -> Result<StakeAccountType, ParseAccountError> {
|
pub fn parse_stake(data: &[u8]) -> Result<StakeAccountType, ParseAccountError> {
|
||||||
let stake_state: StakeState = deserialize(data)
|
let stake_state: StakeState = deserialize(data)
|
||||||
@ -132,8 +136,7 @@ impl From<Delegation> for UiDelegation {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use {super::*, bincode::serialize};
|
||||||
use bincode::serialize;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_stake() {
|
fn test_parse_stake() {
|
||||||
|
@ -1,20 +1,22 @@
|
|||||||
use crate::{
|
|
||||||
parse_account_data::{ParsableAccount, ParseAccountError},
|
|
||||||
StringAmount, UiFeeCalculator,
|
|
||||||
};
|
|
||||||
use bincode::deserialize;
|
|
||||||
use bv::BitVec;
|
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
use solana_sdk::sysvar::{fees::Fees, recent_blockhashes::RecentBlockhashes};
|
use solana_sdk::sysvar::{fees::Fees, recent_blockhashes::RecentBlockhashes};
|
||||||
use solana_sdk::{
|
use {
|
||||||
clock::{Clock, Epoch, Slot, UnixTimestamp},
|
crate::{
|
||||||
epoch_schedule::EpochSchedule,
|
parse_account_data::{ParsableAccount, ParseAccountError},
|
||||||
pubkey::Pubkey,
|
StringAmount, UiFeeCalculator,
|
||||||
rent::Rent,
|
},
|
||||||
slot_hashes::SlotHashes,
|
bincode::deserialize,
|
||||||
slot_history::{self, SlotHistory},
|
bv::BitVec,
|
||||||
stake_history::{StakeHistory, StakeHistoryEntry},
|
solana_sdk::{
|
||||||
sysvar::{self, rewards::Rewards},
|
clock::{Clock, Epoch, Slot, UnixTimestamp},
|
||||||
|
epoch_schedule::EpochSchedule,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
rent::Rent,
|
||||||
|
slot_hashes::SlotHashes,
|
||||||
|
slot_history::{self, SlotHistory},
|
||||||
|
stake_history::{StakeHistory, StakeHistoryEntry},
|
||||||
|
sysvar::{self, rewards::Rewards},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn parse_sysvar(data: &[u8], pubkey: &Pubkey) -> Result<SysvarAccountType, ParseAccountError> {
|
pub fn parse_sysvar(data: &[u8], pubkey: &Pubkey) -> Result<SysvarAccountType, ParseAccountError> {
|
||||||
@ -218,10 +220,12 @@ pub struct UiStakeHistoryEntry {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
use solana_sdk::sysvar::recent_blockhashes::IterItem;
|
use solana_sdk::sysvar::recent_blockhashes::IterItem;
|
||||||
use solana_sdk::{account::create_account_for_test, fee_calculator::FeeCalculator, hash::Hash};
|
use {
|
||||||
|
super::*,
|
||||||
|
solana_sdk::{account::create_account_for_test, fee_calculator::FeeCalculator, hash::Hash},
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_sysvars() {
|
fn test_parse_sysvars() {
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
use crate::{
|
use {
|
||||||
parse_account_data::{ParsableAccount, ParseAccountError},
|
crate::{
|
||||||
StringAmount, StringDecimals,
|
parse_account_data::{ParsableAccount, ParseAccountError},
|
||||||
};
|
StringAmount, StringDecimals,
|
||||||
use solana_sdk::pubkey::Pubkey;
|
|
||||||
use spl_token::{
|
|
||||||
solana_program::{
|
|
||||||
program_option::COption, program_pack::Pack, pubkey::Pubkey as SplTokenPubkey,
|
|
||||||
},
|
},
|
||||||
state::{Account, AccountState, Mint, Multisig},
|
solana_sdk::pubkey::Pubkey,
|
||||||
|
spl_token::{
|
||||||
|
solana_program::{
|
||||||
|
program_option::COption, program_pack::Pack, pubkey::Pubkey as SplTokenPubkey,
|
||||||
|
},
|
||||||
|
state::{Account, AccountState, Mint, Multisig},
|
||||||
|
},
|
||||||
|
std::str::FromStr,
|
||||||
};
|
};
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
// A helper function to convert spl_token::id() as spl_sdk::pubkey::Pubkey to
|
// A helper function to convert spl_token::id() as spl_sdk::pubkey::Pubkey to
|
||||||
// solana_sdk::pubkey::Pubkey
|
// solana_sdk::pubkey::Pubkey
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
use crate::{parse_account_data::ParseAccountError, StringAmount};
|
use {
|
||||||
use solana_sdk::{
|
crate::{parse_account_data::ParseAccountError, StringAmount},
|
||||||
clock::{Epoch, Slot},
|
solana_sdk::{
|
||||||
pubkey::Pubkey,
|
clock::{Epoch, Slot},
|
||||||
|
pubkey::Pubkey,
|
||||||
|
},
|
||||||
|
solana_vote_program::vote_state::{BlockTimestamp, Lockout, VoteState},
|
||||||
};
|
};
|
||||||
use solana_vote_program::vote_state::{BlockTimestamp, Lockout, VoteState};
|
|
||||||
|
|
||||||
pub fn parse_vote(data: &[u8]) -> Result<VoteAccountType, ParseAccountError> {
|
pub fn parse_vote(data: &[u8]) -> Result<VoteAccountType, ParseAccountError> {
|
||||||
let mut vote_state = VoteState::deserialize(data).map_err(ParseAccountError::from)?;
|
let mut vote_state = VoteState::deserialize(data).map_err(ParseAccountError::from)?;
|
||||||
@ -121,8 +123,7 @@ struct UiEpochCredits {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use {super::*, solana_vote_program::vote_state::VoteStateVersions};
|
||||||
use solana_vote_program::vote_state::VoteStateVersions;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_vote() {
|
fn test_parse_vote() {
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
#![allow(clippy::integer_arithmetic)]
|
#![allow(clippy::integer_arithmetic)]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
use clap::{crate_description, crate_name, value_t, App, Arg};
|
use {
|
||||||
use rayon::prelude::*;
|
clap::{crate_description, crate_name, value_t, App, Arg},
|
||||||
use solana_measure::measure::Measure;
|
rayon::prelude::*,
|
||||||
use solana_runtime::{
|
solana_measure::measure::Measure,
|
||||||
accounts::{create_test_accounts, update_accounts_bench, Accounts},
|
solana_runtime::{
|
||||||
accounts_db::AccountShrinkThreshold,
|
accounts::{create_test_accounts, update_accounts_bench, Accounts},
|
||||||
accounts_index::AccountSecondaryIndexes,
|
accounts_db::AccountShrinkThreshold,
|
||||||
ancestors::Ancestors,
|
accounts_index::AccountSecondaryIndexes,
|
||||||
|
ancestors::Ancestors,
|
||||||
|
},
|
||||||
|
solana_sdk::{genesis_config::ClusterType, pubkey::Pubkey},
|
||||||
|
std::{env, fs, path::PathBuf},
|
||||||
};
|
};
|
||||||
use solana_sdk::{genesis_config::ClusterType, pubkey::Pubkey};
|
|
||||||
use std::{env, fs, path::PathBuf};
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
solana_logger::setup();
|
solana_logger::setup();
|
||||||
|
@ -1,35 +1,37 @@
|
|||||||
#![allow(clippy::integer_arithmetic)]
|
#![allow(clippy::integer_arithmetic)]
|
||||||
use clap::{crate_description, crate_name, value_t, values_t_or_exit, App, Arg};
|
use {
|
||||||
use log::*;
|
clap::{crate_description, crate_name, value_t, values_t_or_exit, App, Arg},
|
||||||
use rand::{thread_rng, Rng};
|
log::*,
|
||||||
use rayon::prelude::*;
|
rand::{thread_rng, Rng},
|
||||||
use solana_account_decoder::parse_token::spl_token_pubkey;
|
rayon::prelude::*,
|
||||||
use solana_clap_utils::input_parsers::pubkey_of;
|
solana_account_decoder::parse_token::spl_token_pubkey,
|
||||||
use solana_client::{rpc_client::RpcClient, transaction_executor::TransactionExecutor};
|
solana_clap_utils::input_parsers::pubkey_of,
|
||||||
use solana_faucet::faucet::{request_airdrop_transaction, FAUCET_PORT};
|
solana_client::{rpc_client::RpcClient, transaction_executor::TransactionExecutor},
|
||||||
use solana_gossip::gossip_service::discover;
|
solana_faucet::faucet::{request_airdrop_transaction, FAUCET_PORT},
|
||||||
use solana_runtime::inline_spl_token;
|
solana_gossip::gossip_service::discover,
|
||||||
use solana_sdk::{
|
solana_runtime::inline_spl_token,
|
||||||
commitment_config::CommitmentConfig,
|
solana_sdk::{
|
||||||
instruction::{AccountMeta, Instruction},
|
commitment_config::CommitmentConfig,
|
||||||
message::Message,
|
instruction::{AccountMeta, Instruction},
|
||||||
pubkey::Pubkey,
|
message::Message,
|
||||||
rpc_port::DEFAULT_RPC_PORT,
|
pubkey::Pubkey,
|
||||||
signature::{read_keypair_file, Keypair, Signer},
|
rpc_port::DEFAULT_RPC_PORT,
|
||||||
system_instruction, system_program,
|
signature::{read_keypair_file, Keypair, Signer},
|
||||||
transaction::Transaction,
|
system_instruction, system_program,
|
||||||
};
|
transaction::Transaction,
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
},
|
||||||
use solana_transaction_status::parse_token::spl_token_instruction;
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
use std::{
|
solana_transaction_status::parse_token::spl_token_instruction,
|
||||||
net::SocketAddr,
|
std::{
|
||||||
process::exit,
|
net::SocketAddr,
|
||||||
sync::{
|
process::exit,
|
||||||
atomic::{AtomicU64, Ordering},
|
sync::{
|
||||||
Arc,
|
atomic::{AtomicU64, Ordering},
|
||||||
|
Arc,
|
||||||
|
},
|
||||||
|
thread::sleep,
|
||||||
|
time::{Duration, Instant},
|
||||||
},
|
},
|
||||||
thread::sleep,
|
|
||||||
time::{Duration, Instant},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn airdrop_lamports(
|
pub fn airdrop_lamports(
|
||||||
@ -559,14 +561,16 @@ fn main() {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod test {
|
pub mod test {
|
||||||
use super::*;
|
use {
|
||||||
use solana_core::validator::ValidatorConfig;
|
super::*,
|
||||||
use solana_local_cluster::{
|
solana_core::validator::ValidatorConfig,
|
||||||
local_cluster::{ClusterConfig, LocalCluster},
|
solana_local_cluster::{
|
||||||
validator_configs::make_identical_validator_configs,
|
local_cluster::{ClusterConfig, LocalCluster},
|
||||||
|
validator_configs::make_identical_validator_configs,
|
||||||
|
},
|
||||||
|
solana_measure::measure::Measure,
|
||||||
|
solana_sdk::poh_config::PohConfig,
|
||||||
};
|
};
|
||||||
use solana_measure::measure::Measure;
|
|
||||||
use solana_sdk::poh_config::PohConfig;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_accounts_cluster_bench() {
|
fn test_accounts_cluster_bench() {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use solana_measure::measure::Measure;
|
use solana_measure::measure::Measure;
|
||||||
|
|
||||||
/// Main entry for the PostgreSQL plugin
|
/// Main entry for the PostgreSQL plugin
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
|
@ -1,36 +1,37 @@
|
|||||||
#![allow(clippy::integer_arithmetic)]
|
#![allow(clippy::integer_arithmetic)]
|
||||||
use clap::{crate_description, crate_name, value_t, App, Arg};
|
use {
|
||||||
use crossbeam_channel::unbounded;
|
clap::{crate_description, crate_name, value_t, App, Arg},
|
||||||
use log::*;
|
crossbeam_channel::unbounded,
|
||||||
use rand::{thread_rng, Rng};
|
log::*,
|
||||||
use rayon::prelude::*;
|
rand::{thread_rng, Rng},
|
||||||
use solana_core::banking_stage::BankingStage;
|
rayon::prelude::*,
|
||||||
use solana_gossip::{cluster_info::ClusterInfo, cluster_info::Node};
|
solana_core::banking_stage::BankingStage,
|
||||||
use solana_ledger::{
|
solana_gossip::cluster_info::{ClusterInfo, Node},
|
||||||
blockstore::Blockstore,
|
solana_ledger::{
|
||||||
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
blockstore::Blockstore,
|
||||||
get_tmp_ledger_path,
|
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||||
};
|
get_tmp_ledger_path,
|
||||||
use solana_measure::measure::Measure;
|
},
|
||||||
use solana_perf::packet::to_packets_chunked;
|
solana_measure::measure::Measure,
|
||||||
use solana_poh::poh_recorder::{create_test_recorder, PohRecorder, WorkingBankEntry};
|
solana_perf::packet::to_packets_chunked,
|
||||||
use solana_runtime::{
|
solana_poh::poh_recorder::{create_test_recorder, PohRecorder, WorkingBankEntry},
|
||||||
accounts_background_service::AbsRequestSender, bank::Bank, bank_forks::BankForks,
|
solana_runtime::{
|
||||||
cost_model::CostModel,
|
accounts_background_service::AbsRequestSender, bank::Bank, bank_forks::BankForks,
|
||||||
};
|
cost_model::CostModel,
|
||||||
use solana_sdk::{
|
},
|
||||||
hash::Hash,
|
solana_sdk::{
|
||||||
signature::Keypair,
|
hash::Hash,
|
||||||
signature::Signature,
|
signature::{Keypair, Signature},
|
||||||
system_transaction,
|
system_transaction,
|
||||||
timing::{duration_as_us, timestamp},
|
timing::{duration_as_us, timestamp},
|
||||||
transaction::Transaction,
|
transaction::Transaction,
|
||||||
};
|
},
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
use std::{
|
std::{
|
||||||
sync::{atomic::Ordering, mpsc::Receiver, Arc, Mutex, RwLock},
|
sync::{atomic::Ordering, mpsc::Receiver, Arc, Mutex, RwLock},
|
||||||
thread::sleep,
|
thread::sleep,
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
fn check_txs(
|
fn check_txs(
|
||||||
|
@ -379,16 +379,18 @@ pub async fn start_tcp_client<T: ToSocketAddrs>(addr: T) -> io::Result<BanksClie
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use solana_banks_server::banks_server::start_local_server;
|
super::*,
|
||||||
use solana_runtime::{
|
solana_banks_server::banks_server::start_local_server,
|
||||||
bank::Bank, bank_forks::BankForks, commitment::BlockCommitmentCache,
|
solana_runtime::{
|
||||||
genesis_utils::create_genesis_config,
|
bank::Bank, bank_forks::BankForks, commitment::BlockCommitmentCache,
|
||||||
|
genesis_utils::create_genesis_config,
|
||||||
|
},
|
||||||
|
solana_sdk::{message::Message, signature::Signer, system_instruction},
|
||||||
|
std::sync::{Arc, RwLock},
|
||||||
|
tarpc::transport,
|
||||||
|
tokio::{runtime::Runtime, time::sleep},
|
||||||
};
|
};
|
||||||
use solana_sdk::{message::Message, signature::Signer, system_instruction};
|
|
||||||
use std::sync::{Arc, RwLock};
|
|
||||||
use tarpc::transport;
|
|
||||||
use tokio::{runtime::Runtime, time::sleep};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_banks_client_new() {
|
fn test_banks_client_new() {
|
||||||
|
@ -64,8 +64,10 @@ pub trait Banks {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use tarpc::{client, transport};
|
super::*,
|
||||||
|
tarpc::{client, transport},
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_banks_client_new() {
|
fn test_banks_client_new() {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
use solana_sdk::feature_set::FeatureSet;
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
bincode::{deserialize, serialize},
|
bincode::{deserialize, serialize},
|
||||||
futures::{future, prelude::stream::StreamExt},
|
futures::{future, prelude::stream::StreamExt},
|
||||||
@ -11,6 +9,7 @@ use {
|
|||||||
account::Account,
|
account::Account,
|
||||||
clock::Slot,
|
clock::Slot,
|
||||||
commitment_config::CommitmentLevel,
|
commitment_config::CommitmentLevel,
|
||||||
|
feature_set::FeatureSet,
|
||||||
fee_calculator::FeeCalculator,
|
fee_calculator::FeeCalculator,
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
message::{Message, SanitizedMessage},
|
message::{Message, SanitizedMessage},
|
||||||
|
@ -103,8 +103,7 @@ impl RpcBanksService {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {super::*, solana_runtime::bank::Bank};
|
||||||
use solana_runtime::bank::Bank;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rpc_banks_server_exit() {
|
fn test_rpc_banks_server_exit() {
|
||||||
|
@ -1,16 +1,22 @@
|
|||||||
#![allow(clippy::integer_arithmetic)]
|
#![allow(clippy::integer_arithmetic)]
|
||||||
use clap::{crate_description, crate_name, App, Arg};
|
use {
|
||||||
use solana_streamer::packet::{Packet, Packets, PacketsRecycler, PACKET_DATA_SIZE};
|
clap::{crate_description, crate_name, App, Arg},
|
||||||
use solana_streamer::streamer::{receiver, PacketReceiver};
|
solana_streamer::{
|
||||||
use std::cmp::max;
|
packet::{Packet, Packets, PacketsRecycler, PACKET_DATA_SIZE},
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
|
streamer::{receiver, PacketReceiver},
|
||||||
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
|
},
|
||||||
use std::sync::mpsc::channel;
|
std::{
|
||||||
use std::sync::Arc;
|
cmp::max,
|
||||||
use std::thread::sleep;
|
net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket},
|
||||||
use std::thread::{spawn, JoinHandle, Result};
|
sync::{
|
||||||
use std::time::Duration;
|
atomic::{AtomicBool, AtomicUsize, Ordering},
|
||||||
use std::time::SystemTime;
|
mpsc::channel,
|
||||||
|
Arc,
|
||||||
|
},
|
||||||
|
thread::{sleep, spawn, JoinHandle, Result},
|
||||||
|
time::{Duration, SystemTime},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
fn producer(addr: &SocketAddr, exit: Arc<AtomicBool>) -> JoinHandle<()> {
|
fn producer(addr: &SocketAddr, exit: Arc<AtomicBool>) -> JoinHandle<()> {
|
||||||
let send = UdpSocket::bind("0.0.0.0:0").unwrap();
|
let send = UdpSocket::bind("0.0.0.0:0").unwrap();
|
||||||
|
@ -1,34 +1,36 @@
|
|||||||
use crate::cli::Config;
|
use {
|
||||||
use log::*;
|
crate::cli::Config,
|
||||||
use rayon::prelude::*;
|
log::*,
|
||||||
use solana_client::perf_utils::{sample_txs, SampleStats};
|
rayon::prelude::*,
|
||||||
use solana_core::gen_keys::GenKeys;
|
solana_client::perf_utils::{sample_txs, SampleStats},
|
||||||
use solana_faucet::faucet::request_airdrop_transaction;
|
solana_core::gen_keys::GenKeys,
|
||||||
use solana_measure::measure::Measure;
|
solana_faucet::faucet::request_airdrop_transaction,
|
||||||
use solana_metrics::{self, datapoint_info};
|
solana_measure::measure::Measure,
|
||||||
use solana_sdk::{
|
solana_metrics::{self, datapoint_info},
|
||||||
client::Client,
|
solana_sdk::{
|
||||||
clock::{DEFAULT_MS_PER_SLOT, DEFAULT_S_PER_SLOT, MAX_PROCESSING_AGE},
|
client::Client,
|
||||||
commitment_config::CommitmentConfig,
|
clock::{DEFAULT_MS_PER_SLOT, DEFAULT_S_PER_SLOT, MAX_PROCESSING_AGE},
|
||||||
hash::Hash,
|
commitment_config::CommitmentConfig,
|
||||||
instruction::{AccountMeta, Instruction},
|
hash::Hash,
|
||||||
message::Message,
|
instruction::{AccountMeta, Instruction},
|
||||||
pubkey::Pubkey,
|
message::Message,
|
||||||
signature::{Keypair, Signer},
|
pubkey::Pubkey,
|
||||||
system_instruction, system_transaction,
|
signature::{Keypair, Signer},
|
||||||
timing::{duration_as_ms, duration_as_s, duration_as_us, timestamp},
|
system_instruction, system_transaction,
|
||||||
transaction::Transaction,
|
timing::{duration_as_ms, duration_as_s, duration_as_us, timestamp},
|
||||||
};
|
transaction::Transaction,
|
||||||
use std::{
|
},
|
||||||
collections::{HashSet, VecDeque},
|
std::{
|
||||||
net::SocketAddr,
|
collections::{HashSet, VecDeque},
|
||||||
process::exit,
|
net::SocketAddr,
|
||||||
sync::{
|
process::exit,
|
||||||
atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering},
|
sync::{
|
||||||
Arc, Mutex, RwLock,
|
atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering},
|
||||||
|
Arc, Mutex, RwLock,
|
||||||
|
},
|
||||||
|
thread::{sleep, Builder, JoinHandle},
|
||||||
|
time::{Duration, Instant},
|
||||||
},
|
},
|
||||||
thread::{sleep, Builder, JoinHandle},
|
|
||||||
time::{Duration, Instant},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// The point at which transactions become "too old", in seconds.
|
// The point at which transactions become "too old", in seconds.
|
||||||
@ -946,12 +948,14 @@ pub fn generate_and_fund_keypairs<T: 'static + Client + Send + Sync>(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use solana_runtime::bank::Bank;
|
super::*,
|
||||||
use solana_runtime::bank_client::BankClient;
|
solana_runtime::{bank::Bank, bank_client::BankClient},
|
||||||
use solana_sdk::client::SyncClient;
|
solana_sdk::{
|
||||||
use solana_sdk::fee_calculator::FeeRateGovernor;
|
client::SyncClient, fee_calculator::FeeRateGovernor,
|
||||||
use solana_sdk::genesis_config::create_genesis_config;
|
genesis_config::create_genesis_config,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_bench_tps_bank_client() {
|
fn test_bench_tps_bank_client() {
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
use clap::{crate_description, crate_name, App, Arg, ArgMatches};
|
use {
|
||||||
use solana_faucet::faucet::FAUCET_PORT;
|
clap::{crate_description, crate_name, App, Arg, ArgMatches},
|
||||||
use solana_sdk::fee_calculator::FeeRateGovernor;
|
solana_faucet::faucet::FAUCET_PORT,
|
||||||
use solana_sdk::{
|
solana_sdk::{
|
||||||
pubkey::Pubkey,
|
fee_calculator::FeeRateGovernor,
|
||||||
signature::{read_keypair_file, Keypair},
|
pubkey::Pubkey,
|
||||||
|
signature::{read_keypair_file, Keypair},
|
||||||
|
},
|
||||||
|
std::{net::SocketAddr, process::exit, time::Duration},
|
||||||
};
|
};
|
||||||
use std::{net::SocketAddr, process::exit, time::Duration};
|
|
||||||
|
|
||||||
const NUM_LAMPORTS_PER_ACCOUNT_DEFAULT: u64 = solana_sdk::native_token::LAMPORTS_PER_SOL;
|
const NUM_LAMPORTS_PER_ACCOUNT_DEFAULT: u64 = solana_sdk::native_token::LAMPORTS_PER_SOL;
|
||||||
|
|
||||||
|
@ -1,14 +1,20 @@
|
|||||||
#![allow(clippy::integer_arithmetic)]
|
#![allow(clippy::integer_arithmetic)]
|
||||||
use log::*;
|
use {
|
||||||
use solana_bench_tps::bench::{do_bench_tps, generate_and_fund_keypairs, generate_keypairs};
|
log::*,
|
||||||
use solana_bench_tps::cli;
|
solana_bench_tps::{
|
||||||
use solana_genesis::Base64Account;
|
bench::{do_bench_tps, generate_and_fund_keypairs, generate_keypairs},
|
||||||
use solana_gossip::gossip_service::{discover_cluster, get_client, get_multi_client};
|
cli,
|
||||||
use solana_sdk::fee_calculator::FeeRateGovernor;
|
},
|
||||||
use solana_sdk::signature::{Keypair, Signer};
|
solana_genesis::Base64Account,
|
||||||
use solana_sdk::system_program;
|
solana_gossip::gossip_service::{discover_cluster, get_client, get_multi_client},
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
solana_sdk::{
|
||||||
use std::{collections::HashMap, fs::File, io::prelude::*, path::Path, process::exit, sync::Arc};
|
fee_calculator::FeeRateGovernor,
|
||||||
|
signature::{Keypair, Signer},
|
||||||
|
system_program,
|
||||||
|
},
|
||||||
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
|
std::{collections::HashMap, fs::File, io::prelude::*, path::Path, process::exit, sync::Arc},
|
||||||
|
};
|
||||||
|
|
||||||
/// Number of signatures for all transactions in ~1 week at ~100K TPS
|
/// Number of signatures for all transactions in ~1 week at ~100K TPS
|
||||||
pub const NUM_SIGNATURES_FOR_TXS: u64 = 100_000 * 60 * 60 * 24 * 7;
|
pub const NUM_SIGNATURES_FOR_TXS: u64 = 100_000 * 60 * 60 * 24 * 7;
|
||||||
|
@ -1,22 +1,24 @@
|
|||||||
#![allow(clippy::integer_arithmetic)]
|
#![allow(clippy::integer_arithmetic)]
|
||||||
use serial_test::serial;
|
use {
|
||||||
use solana_bench_tps::{
|
serial_test::serial,
|
||||||
bench::{do_bench_tps, generate_and_fund_keypairs},
|
solana_bench_tps::{
|
||||||
cli::Config,
|
bench::{do_bench_tps, generate_and_fund_keypairs},
|
||||||
};
|
cli::Config,
|
||||||
use solana_client::thin_client::create_client;
|
},
|
||||||
use solana_core::validator::ValidatorConfig;
|
solana_client::thin_client::create_client,
|
||||||
use solana_faucet::faucet::run_local_faucet_with_port;
|
solana_core::validator::ValidatorConfig,
|
||||||
use solana_gossip::cluster_info::VALIDATOR_PORT_RANGE;
|
solana_faucet::faucet::run_local_faucet_with_port,
|
||||||
use solana_local_cluster::{
|
solana_gossip::cluster_info::VALIDATOR_PORT_RANGE,
|
||||||
local_cluster::{ClusterConfig, LocalCluster},
|
solana_local_cluster::{
|
||||||
validator_configs::make_identical_validator_configs,
|
local_cluster::{ClusterConfig, LocalCluster},
|
||||||
};
|
validator_configs::make_identical_validator_configs,
|
||||||
use solana_sdk::signature::{Keypair, Signer};
|
},
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
solana_sdk::signature::{Keypair, Signer},
|
||||||
use std::{
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
sync::{mpsc::channel, Arc},
|
std::{
|
||||||
time::Duration,
|
sync::{mpsc::channel, Arc},
|
||||||
|
time::Duration,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
fn test_bench_tps_local_cluster(config: Config) {
|
fn test_bench_tps_local_cluster(config: Config) {
|
||||||
|
@ -19,12 +19,13 @@ macro_rules! DEFINE_NxM_BENCH {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern crate test;
|
extern crate test;
|
||||||
use rayon::prelude::*;
|
use {
|
||||||
use solana_bucket_map::bucket_map::{BucketMap, BucketMapConfig};
|
rayon::prelude::*,
|
||||||
use solana_sdk::pubkey::Pubkey;
|
solana_bucket_map::bucket_map::{BucketMap, BucketMapConfig},
|
||||||
use std::collections::hash_map::HashMap;
|
solana_sdk::pubkey::Pubkey,
|
||||||
use std::sync::RwLock;
|
std::{collections::hash_map::HashMap, sync::RwLock},
|
||||||
use test::Bencher;
|
test::Bencher,
|
||||||
|
};
|
||||||
|
|
||||||
type IndexValue = u64;
|
type IndexValue = u64;
|
||||||
|
|
||||||
|
@ -1,21 +1,27 @@
|
|||||||
use crate::bucket_item::BucketItem;
|
use {
|
||||||
use crate::bucket_map::BucketMapError;
|
crate::{
|
||||||
use crate::bucket_stats::BucketMapStats;
|
bucket_item::BucketItem,
|
||||||
use crate::bucket_storage::{BucketStorage, Uid, DEFAULT_CAPACITY_POW2, UID_UNLOCKED};
|
bucket_map::BucketMapError,
|
||||||
use crate::index_entry::IndexEntry;
|
bucket_stats::BucketMapStats,
|
||||||
use crate::{MaxSearch, RefCount};
|
bucket_storage::{BucketStorage, Uid, DEFAULT_CAPACITY_POW2, UID_UNLOCKED},
|
||||||
use rand::thread_rng;
|
index_entry::IndexEntry,
|
||||||
use rand::Rng;
|
MaxSearch, RefCount,
|
||||||
use solana_measure::measure::Measure;
|
},
|
||||||
use solana_sdk::pubkey::Pubkey;
|
rand::{thread_rng, Rng},
|
||||||
use std::collections::hash_map::DefaultHasher;
|
solana_measure::measure::Measure,
|
||||||
use std::hash::{Hash, Hasher};
|
solana_sdk::pubkey::Pubkey,
|
||||||
use std::marker::PhantomData;
|
std::{
|
||||||
use std::ops::RangeBounds;
|
collections::hash_map::DefaultHasher,
|
||||||
use std::path::PathBuf;
|
hash::{Hash, Hasher},
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
marker::PhantomData,
|
||||||
use std::sync::Arc;
|
ops::RangeBounds,
|
||||||
use std::sync::Mutex;
|
path::PathBuf,
|
||||||
|
sync::{
|
||||||
|
atomic::{AtomicUsize, Ordering},
|
||||||
|
Arc, Mutex,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct ReallocatedItems {
|
pub struct ReallocatedItems {
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
use crate::bucket::Bucket;
|
use {
|
||||||
use crate::bucket_item::BucketItem;
|
crate::{
|
||||||
use crate::bucket_map::BucketMapError;
|
bucket::Bucket, bucket_item::BucketItem, bucket_map::BucketMapError,
|
||||||
use crate::bucket_stats::BucketMapStats;
|
bucket_stats::BucketMapStats, MaxSearch, RefCount,
|
||||||
use crate::{MaxSearch, RefCount};
|
},
|
||||||
use solana_sdk::pubkey::Pubkey;
|
solana_sdk::pubkey::Pubkey,
|
||||||
use std::ops::RangeBounds;
|
std::{
|
||||||
use std::path::PathBuf;
|
ops::RangeBounds,
|
||||||
|
path::PathBuf,
|
||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
sync::{
|
||||||
use std::sync::Arc;
|
atomic::{AtomicU64, Ordering},
|
||||||
use std::sync::{RwLock, RwLockWriteGuard};
|
Arc, RwLock, RwLockWriteGuard,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
type LockedBucket<T> = RwLock<Option<Bucket<T>>>;
|
type LockedBucket<T> = RwLock<Option<Bucket<T>>>;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use crate::RefCount;
|
use {crate::RefCount, solana_sdk::pubkey::Pubkey};
|
||||||
use solana_sdk::pubkey::Pubkey;
|
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub struct BucketItem<T> {
|
pub struct BucketItem<T> {
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
//! BucketMap is a mostly contention free concurrent map backed by MmapMut
|
//! BucketMap is a mostly contention free concurrent map backed by MmapMut
|
||||||
|
|
||||||
use crate::bucket_api::BucketApi;
|
use {
|
||||||
use crate::bucket_stats::BucketMapStats;
|
crate::{bucket_api::BucketApi, bucket_stats::BucketMapStats, MaxSearch, RefCount},
|
||||||
use crate::{MaxSearch, RefCount};
|
solana_sdk::pubkey::Pubkey,
|
||||||
use solana_sdk::pubkey::Pubkey;
|
std::{convert::TryInto, fmt::Debug, fs, path::PathBuf, sync::Arc},
|
||||||
use std::convert::TryInto;
|
tempfile::TempDir,
|
||||||
use std::fmt::Debug;
|
};
|
||||||
use std::fs;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
use std::sync::Arc;
|
|
||||||
use tempfile::TempDir;
|
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub struct BucketMapConfig {
|
pub struct BucketMapConfig {
|
||||||
@ -194,11 +190,11 @@ fn read_be_u64(input: &[u8]) -> u64 {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use rand::thread_rng;
|
super::*,
|
||||||
use rand::Rng;
|
rand::{thread_rng, Rng},
|
||||||
use std::collections::HashMap;
|
std::{collections::HashMap, sync::RwLock},
|
||||||
use std::sync::RwLock;
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bucket_map_test_insert() {
|
fn bucket_map_test_insert() {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::{atomic::AtomicU64, Arc, Mutex};
|
||||||
use std::sync::{atomic::AtomicU64, Mutex};
|
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct BucketStats {
|
pub struct BucketStats {
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
use crate::bucket_stats::BucketStats;
|
use {
|
||||||
use crate::MaxSearch;
|
crate::{bucket_stats::BucketStats, MaxSearch},
|
||||||
use memmap2::MmapMut;
|
memmap2::MmapMut,
|
||||||
use rand::{thread_rng, Rng};
|
rand::{thread_rng, Rng},
|
||||||
use solana_measure::measure::Measure;
|
solana_measure::measure::Measure,
|
||||||
use std::fs::{remove_file, OpenOptions};
|
std::{
|
||||||
use std::io::Seek;
|
fs::{remove_file, OpenOptions},
|
||||||
use std::io::SeekFrom;
|
io::{Seek, SeekFrom, Write},
|
||||||
use std::io::Write;
|
path::PathBuf,
|
||||||
use std::path::PathBuf;
|
sync::{
|
||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
atomic::{AtomicU64, Ordering},
|
||||||
use std::sync::Arc;
|
Arc,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
1 2
|
1 2
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
use crate::bucket::Bucket;
|
use {
|
||||||
use crate::bucket_storage::{BucketStorage, Uid};
|
crate::{
|
||||||
use crate::RefCount;
|
bucket::Bucket,
|
||||||
use solana_sdk::clock::Slot;
|
bucket_storage::{BucketStorage, Uid},
|
||||||
use solana_sdk::pubkey::Pubkey;
|
RefCount,
|
||||||
use std::collections::hash_map::DefaultHasher;
|
},
|
||||||
use std::fmt::Debug;
|
solana_sdk::{clock::Slot, pubkey::Pubkey},
|
||||||
use std::hash::{Hash, Hasher};
|
std::{
|
||||||
|
collections::hash_map::DefaultHasher,
|
||||||
|
fmt::Debug,
|
||||||
|
hash::{Hash, Hasher},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
use rayon::prelude::*;
|
use {
|
||||||
use solana_bucket_map::bucket_map::{BucketMap, BucketMapConfig};
|
rayon::prelude::*,
|
||||||
use solana_measure::measure::Measure;
|
solana_bucket_map::bucket_map::{BucketMap, BucketMapConfig},
|
||||||
use solana_sdk::pubkey::Pubkey;
|
solana_measure::measure::Measure,
|
||||||
use std::path::PathBuf;
|
solana_sdk::pubkey::Pubkey,
|
||||||
|
std::path::PathBuf,
|
||||||
|
};
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
#[ignore]
|
||||||
fn bucket_map_test_mt() {
|
fn bucket_map_test_mt() {
|
||||||
|
@ -196,10 +196,12 @@ pub fn commitment_of(matches: &ArgMatches<'_>, name: &str) -> Option<CommitmentC
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use clap::{App, Arg};
|
super::*,
|
||||||
use solana_sdk::signature::write_keypair_file;
|
clap::{App, Arg},
|
||||||
use std::fs;
|
solana_sdk::signature::write_keypair_file,
|
||||||
|
std::fs,
|
||||||
|
};
|
||||||
|
|
||||||
fn app<'ab, 'v>() -> App<'ab, 'v> {
|
fn app<'ab, 'v>() -> App<'ab, 'v> {
|
||||||
App::new("test")
|
App::new("test")
|
||||||
|
@ -7,8 +7,7 @@ use {
|
|||||||
pubkey::{Pubkey, MAX_SEED_LEN},
|
pubkey::{Pubkey, MAX_SEED_LEN},
|
||||||
signature::{read_keypair_file, Signature},
|
signature::{read_keypair_file, Signature},
|
||||||
},
|
},
|
||||||
std::fmt::Display,
|
std::{fmt::Display, str::FromStr},
|
||||||
std::str::FromStr,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fn is_parsable_generic<U, T>(string: T) -> Result<(), String>
|
fn is_parsable_generic<U, T>(string: T) -> Result<(), String>
|
||||||
|
@ -1123,14 +1123,14 @@ fn sanitize_seed_phrase(seed_phrase: &str) -> String {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use crate::offline::OfflineArgs;
|
super::*,
|
||||||
use clap::{value_t_or_exit, App, Arg};
|
crate::offline::OfflineArgs,
|
||||||
use solana_remote_wallet::locator::Manufacturer;
|
clap::{value_t_or_exit, App, Arg},
|
||||||
use solana_remote_wallet::remote_wallet::initialize_wallet_manager;
|
solana_remote_wallet::{locator::Manufacturer, remote_wallet::initialize_wallet_manager},
|
||||||
use solana_sdk::signer::keypair::write_keypair_file;
|
solana_sdk::{signer::keypair::write_keypair_file, system_instruction},
|
||||||
use solana_sdk::system_instruction;
|
tempfile::{NamedTempFile, TempDir},
|
||||||
use tempfile::{NamedTempFile, TempDir};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_sanitize_seed_phrase() {
|
fn test_sanitize_seed_phrase() {
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
// Wallet settings that can be configured for long-term use
|
// Wallet settings that can be configured for long-term use
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use {
|
||||||
use std::{collections::HashMap, io, path::Path};
|
serde_derive::{Deserialize, Serialize},
|
||||||
use url::Url;
|
std::{collections::HashMap, io, path::Path},
|
||||||
|
url::Url,
|
||||||
|
};
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
/// The default path to the CLI configuration file.
|
/// The default path to the CLI configuration file.
|
||||||
|
@ -56,7 +56,6 @@ extern crate lazy_static;
|
|||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
pub use config::{Config, CONFIG_FILE};
|
pub use config::{Config, CONFIG_FILE};
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
fs::{create_dir_all, File},
|
fs::{create_dir_all, File},
|
||||||
io::{self, Write},
|
io::{self, Write},
|
||||||
|
@ -2525,14 +2525,16 @@ impl VerboseDisplay for CliGossipNodes {}
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use clap::{App, Arg};
|
super::*,
|
||||||
use solana_sdk::{
|
clap::{App, Arg},
|
||||||
message::Message,
|
solana_sdk::{
|
||||||
pubkey::Pubkey,
|
message::Message,
|
||||||
signature::{keypair_from_seed, NullSigner, Signature, Signer, SignerError},
|
pubkey::Pubkey,
|
||||||
system_instruction,
|
signature::{keypair_from_seed, NullSigner, Signature, Signer, SignerError},
|
||||||
transaction::Transaction,
|
system_instruction,
|
||||||
|
transaction::Transaction,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -8,8 +8,7 @@ use {
|
|||||||
program_utils::limited_deserialize, pubkey::Pubkey, stake, transaction::Transaction,
|
program_utils::limited_deserialize, pubkey::Pubkey, stake, transaction::Transaction,
|
||||||
},
|
},
|
||||||
solana_transaction_status::UiTransactionStatusMeta,
|
solana_transaction_status::UiTransactionStatusMeta,
|
||||||
spl_memo::id as spl_memo_id,
|
spl_memo::{id as spl_memo_id, v1::id as spl_memo_v1_id},
|
||||||
spl_memo::v1::id as spl_memo_v1_id,
|
|
||||||
std::{collections::HashMap, fmt, io},
|
std::{collections::HashMap, fmt, io},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -428,8 +427,7 @@ pub fn unix_timestamp_to_string(unix_timestamp: UnixTimestamp) -> String {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use {super::*, solana_sdk::pubkey::Pubkey};
|
||||||
use solana_sdk::pubkey::Pubkey;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_format_labeled_address() {
|
fn test_format_labeled_address() {
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
use crate::cli::CliError;
|
use {
|
||||||
use solana_client::{
|
crate::cli::CliError,
|
||||||
client_error::{ClientError, Result as ClientResult},
|
solana_client::{
|
||||||
rpc_client::RpcClient,
|
client_error::{ClientError, Result as ClientResult},
|
||||||
};
|
rpc_client::RpcClient,
|
||||||
use solana_sdk::{
|
},
|
||||||
commitment_config::CommitmentConfig, message::Message, native_token::lamports_to_sol,
|
solana_sdk::{
|
||||||
pubkey::Pubkey,
|
commitment_config::CommitmentConfig, message::Message, native_token::lamports_to_sol,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn check_account_for_fee(
|
pub fn check_account_for_fee(
|
||||||
@ -149,14 +151,16 @@ pub fn check_unique_pubkeys(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use serde_json::json;
|
super::*,
|
||||||
use solana_client::{
|
serde_json::json,
|
||||||
rpc_request::RpcRequest,
|
solana_client::{
|
||||||
rpc_response::{Response, RpcResponseContext},
|
rpc_request::RpcRequest,
|
||||||
|
rpc_response::{Response, RpcResponseContext},
|
||||||
|
},
|
||||||
|
solana_sdk::system_instruction,
|
||||||
|
std::collections::HashMap,
|
||||||
};
|
};
|
||||||
use solana_sdk::system_instruction;
|
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_check_account_for_fees() {
|
fn test_check_account_for_fees() {
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
use crate::{
|
use {
|
||||||
cli::*, cluster_query::*, feature::*, inflation::*, nonce::*, program::*, stake::*,
|
crate::{
|
||||||
validator_info::*, vote::*, wallet::*,
|
cli::*, cluster_query::*, feature::*, inflation::*, nonce::*, program::*, stake::*,
|
||||||
|
validator_info::*, vote::*, wallet::*,
|
||||||
|
},
|
||||||
|
clap::{App, AppSettings, Arg, ArgGroup, SubCommand},
|
||||||
|
solana_clap_utils::{self, input_validators::*, keypair::*},
|
||||||
|
solana_cli_config::CONFIG_FILE,
|
||||||
};
|
};
|
||||||
use clap::{App, AppSettings, Arg, ArgGroup, SubCommand};
|
|
||||||
use solana_clap_utils::{self, input_validators::*, keypair::*};
|
|
||||||
use solana_cli_config::CONFIG_FILE;
|
|
||||||
|
|
||||||
pub fn get_clap_app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, 'v> {
|
pub fn get_clap_app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, 'v> {
|
||||||
App::new(name)
|
App::new(name)
|
||||||
|
104
cli/src/cli.rs
104
cli/src/cli.rs
@ -1,37 +1,41 @@
|
|||||||
use crate::{
|
use {
|
||||||
clap_app::*, cluster_query::*, feature::*, inflation::*, nonce::*, program::*, spend_utils::*,
|
crate::{
|
||||||
stake::*, validator_info::*, vote::*, wallet::*,
|
clap_app::*, cluster_query::*, feature::*, inflation::*, nonce::*, program::*,
|
||||||
|
spend_utils::*, stake::*, validator_info::*, vote::*, wallet::*,
|
||||||
|
},
|
||||||
|
clap::{crate_description, crate_name, value_t_or_exit, ArgMatches, Shell},
|
||||||
|
log::*,
|
||||||
|
num_traits::FromPrimitive,
|
||||||
|
serde_json::{self, Value},
|
||||||
|
solana_clap_utils::{self, input_parsers::*, input_validators::*, keypair::*},
|
||||||
|
solana_cli_output::{
|
||||||
|
display::println_name_value, CliSignature, CliValidatorsSortOrder, OutputFormat,
|
||||||
|
},
|
||||||
|
solana_client::{
|
||||||
|
blockhash_query::BlockhashQuery,
|
||||||
|
client_error::{ClientError, Result as ClientResult},
|
||||||
|
nonce_utils,
|
||||||
|
rpc_client::RpcClient,
|
||||||
|
rpc_config::{
|
||||||
|
RpcLargestAccountsFilter, RpcSendTransactionConfig, RpcTransactionLogsFilter,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
solana_remote_wallet::remote_wallet::RemoteWalletManager,
|
||||||
|
solana_sdk::{
|
||||||
|
clock::{Epoch, Slot},
|
||||||
|
commitment_config::CommitmentConfig,
|
||||||
|
decode_error::DecodeError,
|
||||||
|
hash::Hash,
|
||||||
|
instruction::InstructionError,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
signature::{Signature, Signer, SignerError},
|
||||||
|
stake::{instruction::LockupArgs, state::Lockup},
|
||||||
|
transaction::{Transaction, TransactionError},
|
||||||
|
},
|
||||||
|
solana_vote_program::vote_state::VoteAuthorize,
|
||||||
|
std::{collections::HashMap, error, io::stdout, str::FromStr, sync::Arc, time::Duration},
|
||||||
|
thiserror::Error,
|
||||||
};
|
};
|
||||||
use clap::{crate_description, crate_name, value_t_or_exit, ArgMatches, Shell};
|
|
||||||
use log::*;
|
|
||||||
use num_traits::FromPrimitive;
|
|
||||||
use serde_json::{self, Value};
|
|
||||||
use solana_clap_utils::{self, input_parsers::*, input_validators::*, keypair::*};
|
|
||||||
use solana_cli_output::{
|
|
||||||
display::println_name_value, CliSignature, CliValidatorsSortOrder, OutputFormat,
|
|
||||||
};
|
|
||||||
use solana_client::{
|
|
||||||
blockhash_query::BlockhashQuery,
|
|
||||||
client_error::{ClientError, Result as ClientResult},
|
|
||||||
nonce_utils,
|
|
||||||
rpc_client::RpcClient,
|
|
||||||
rpc_config::{RpcLargestAccountsFilter, RpcSendTransactionConfig, RpcTransactionLogsFilter},
|
|
||||||
};
|
|
||||||
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
|
||||||
use solana_sdk::{
|
|
||||||
clock::{Epoch, Slot},
|
|
||||||
commitment_config::CommitmentConfig,
|
|
||||||
decode_error::DecodeError,
|
|
||||||
hash::Hash,
|
|
||||||
instruction::InstructionError,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
signature::{Signature, Signer, SignerError},
|
|
||||||
stake::{instruction::LockupArgs, state::Lockup},
|
|
||||||
transaction::{Transaction, TransactionError},
|
|
||||||
};
|
|
||||||
use solana_vote_program::vote_state::VoteAuthorize;
|
|
||||||
use std::{collections::HashMap, error, io::stdout, str::FromStr, sync::Arc, time::Duration};
|
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
pub const DEFAULT_RPC_TIMEOUT_SECONDS: &str = "30";
|
pub const DEFAULT_RPC_TIMEOUT_SECONDS: &str = "30";
|
||||||
pub const DEFAULT_CONFIRM_TX_TIMEOUT_SECONDS: &str = "5";
|
pub const DEFAULT_CONFIRM_TX_TIMEOUT_SECONDS: &str = "5";
|
||||||
@ -1607,22 +1611,26 @@ where
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use serde_json::{json, Value};
|
super::*,
|
||||||
use solana_client::{
|
serde_json::{json, Value},
|
||||||
blockhash_query,
|
solana_client::{
|
||||||
mock_sender::SIGNATURE,
|
blockhash_query,
|
||||||
rpc_request::RpcRequest,
|
mock_sender::SIGNATURE,
|
||||||
rpc_response::{Response, RpcResponseContext},
|
rpc_request::RpcRequest,
|
||||||
|
rpc_response::{Response, RpcResponseContext},
|
||||||
|
},
|
||||||
|
solana_sdk::{
|
||||||
|
pubkey::Pubkey,
|
||||||
|
signature::{
|
||||||
|
keypair_from_seed, read_keypair_file, write_keypair_file, Keypair, Presigner,
|
||||||
|
},
|
||||||
|
stake, system_program,
|
||||||
|
transaction::TransactionError,
|
||||||
|
},
|
||||||
|
solana_transaction_status::TransactionConfirmationStatus,
|
||||||
|
std::path::PathBuf,
|
||||||
};
|
};
|
||||||
use solana_sdk::{
|
|
||||||
pubkey::Pubkey,
|
|
||||||
signature::{keypair_from_seed, read_keypair_file, write_keypair_file, Keypair, Presigner},
|
|
||||||
stake, system_program,
|
|
||||||
transaction::TransactionError,
|
|
||||||
};
|
|
||||||
use solana_transaction_status::TransactionConfirmationStatus;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
fn make_tmp_path(name: &str) -> String {
|
fn make_tmp_path(name: &str) -> String {
|
||||||
let out_dir = std::env::var("FARF_DIR").unwrap_or_else(|_| "farf".to_string());
|
let out_dir = std::env::var("FARF_DIR").unwrap_or_else(|_| "farf".to_string());
|
||||||
|
@ -1,76 +1,78 @@
|
|||||||
use crate::{
|
use {
|
||||||
cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult},
|
crate::{
|
||||||
spend_utils::{resolve_spend_tx_and_check_account_balance, SpendAmount},
|
cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult},
|
||||||
};
|
spend_utils::{resolve_spend_tx_and_check_account_balance, SpendAmount},
|
||||||
use clap::{value_t, value_t_or_exit, App, AppSettings, Arg, ArgMatches, SubCommand};
|
|
||||||
use console::{style, Emoji};
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use solana_clap_utils::{
|
|
||||||
input_parsers::*,
|
|
||||||
input_validators::*,
|
|
||||||
keypair::DefaultSigner,
|
|
||||||
offline::{blockhash_arg, BLOCKHASH_ARG},
|
|
||||||
};
|
|
||||||
use solana_cli_output::{
|
|
||||||
display::{
|
|
||||||
build_balance_message, format_labeled_address, new_spinner_progress_bar,
|
|
||||||
println_name_value, println_transaction, unix_timestamp_to_string, writeln_name_value,
|
|
||||||
},
|
},
|
||||||
*,
|
clap::{value_t, value_t_or_exit, App, AppSettings, Arg, ArgMatches, SubCommand},
|
||||||
};
|
console::{style, Emoji},
|
||||||
use solana_client::{
|
serde::{Deserialize, Serialize},
|
||||||
client_error::ClientErrorKind,
|
solana_clap_utils::{
|
||||||
pubsub_client::PubsubClient,
|
input_parsers::*,
|
||||||
rpc_client::{GetConfirmedSignaturesForAddress2Config, RpcClient},
|
input_validators::*,
|
||||||
rpc_config::{
|
keypair::DefaultSigner,
|
||||||
RpcAccountInfoConfig, RpcBlockConfig, RpcGetVoteAccountsConfig, RpcLargestAccountsConfig,
|
offline::{blockhash_arg, BLOCKHASH_ARG},
|
||||||
RpcLargestAccountsFilter, RpcProgramAccountsConfig, RpcTransactionConfig,
|
|
||||||
RpcTransactionLogsConfig, RpcTransactionLogsFilter,
|
|
||||||
},
|
},
|
||||||
rpc_filter,
|
solana_cli_output::{
|
||||||
rpc_request::DELINQUENT_VALIDATOR_SLOT_DISTANCE,
|
display::{
|
||||||
rpc_response::SlotInfo,
|
build_balance_message, format_labeled_address, new_spinner_progress_bar,
|
||||||
};
|
println_name_value, println_transaction, unix_timestamp_to_string, writeln_name_value,
|
||||||
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
},
|
||||||
use solana_sdk::{
|
*,
|
||||||
account::from_account,
|
|
||||||
account_utils::StateMut,
|
|
||||||
clock::{self, Clock, Slot},
|
|
||||||
commitment_config::CommitmentConfig,
|
|
||||||
epoch_schedule::Epoch,
|
|
||||||
hash::Hash,
|
|
||||||
message::Message,
|
|
||||||
native_token::lamports_to_sol,
|
|
||||||
nonce::State as NonceState,
|
|
||||||
pubkey::{self, Pubkey},
|
|
||||||
rent::Rent,
|
|
||||||
rpc_port::DEFAULT_RPC_PORT_STR,
|
|
||||||
signature::Signature,
|
|
||||||
slot_history,
|
|
||||||
stake::{self, state::StakeState},
|
|
||||||
system_instruction, system_program,
|
|
||||||
sysvar::{
|
|
||||||
self,
|
|
||||||
slot_history::SlotHistory,
|
|
||||||
stake_history::{self},
|
|
||||||
},
|
},
|
||||||
timing,
|
solana_client::{
|
||||||
transaction::Transaction,
|
client_error::ClientErrorKind,
|
||||||
};
|
pubsub_client::PubsubClient,
|
||||||
use solana_transaction_status::UiTransactionEncoding;
|
rpc_client::{GetConfirmedSignaturesForAddress2Config, RpcClient},
|
||||||
use solana_vote_program::vote_state::VoteState;
|
rpc_config::{
|
||||||
use std::{
|
RpcAccountInfoConfig, RpcBlockConfig, RpcGetVoteAccountsConfig,
|
||||||
collections::{BTreeMap, HashMap, VecDeque},
|
RpcLargestAccountsConfig, RpcLargestAccountsFilter, RpcProgramAccountsConfig,
|
||||||
fmt,
|
RpcTransactionConfig, RpcTransactionLogsConfig, RpcTransactionLogsFilter,
|
||||||
str::FromStr,
|
},
|
||||||
sync::{
|
rpc_filter,
|
||||||
atomic::{AtomicBool, Ordering},
|
rpc_request::DELINQUENT_VALIDATOR_SLOT_DISTANCE,
|
||||||
Arc,
|
rpc_response::SlotInfo,
|
||||||
},
|
},
|
||||||
thread::sleep,
|
solana_remote_wallet::remote_wallet::RemoteWalletManager,
|
||||||
time::{Duration, Instant, SystemTime, UNIX_EPOCH},
|
solana_sdk::{
|
||||||
|
account::from_account,
|
||||||
|
account_utils::StateMut,
|
||||||
|
clock::{self, Clock, Slot},
|
||||||
|
commitment_config::CommitmentConfig,
|
||||||
|
epoch_schedule::Epoch,
|
||||||
|
hash::Hash,
|
||||||
|
message::Message,
|
||||||
|
native_token::lamports_to_sol,
|
||||||
|
nonce::State as NonceState,
|
||||||
|
pubkey::{self, Pubkey},
|
||||||
|
rent::Rent,
|
||||||
|
rpc_port::DEFAULT_RPC_PORT_STR,
|
||||||
|
signature::Signature,
|
||||||
|
slot_history,
|
||||||
|
stake::{self, state::StakeState},
|
||||||
|
system_instruction, system_program,
|
||||||
|
sysvar::{
|
||||||
|
self,
|
||||||
|
slot_history::SlotHistory,
|
||||||
|
stake_history::{self},
|
||||||
|
},
|
||||||
|
timing,
|
||||||
|
transaction::Transaction,
|
||||||
|
},
|
||||||
|
solana_transaction_status::UiTransactionEncoding,
|
||||||
|
solana_vote_program::vote_state::VoteState,
|
||||||
|
std::{
|
||||||
|
collections::{BTreeMap, HashMap, VecDeque},
|
||||||
|
fmt,
|
||||||
|
str::FromStr,
|
||||||
|
sync::{
|
||||||
|
atomic::{AtomicBool, Ordering},
|
||||||
|
Arc,
|
||||||
|
},
|
||||||
|
thread::sleep,
|
||||||
|
time::{Duration, Instant, SystemTime, UNIX_EPOCH},
|
||||||
|
},
|
||||||
|
thiserror::Error,
|
||||||
};
|
};
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
static CHECK_MARK: Emoji = Emoji("✅ ", "");
|
static CHECK_MARK: Emoji = Emoji("✅ ", "");
|
||||||
static CROSS_MARK: Emoji = Emoji("❌ ", "");
|
static CROSS_MARK: Emoji = Emoji("❌ ", "");
|
||||||
@ -2139,11 +2141,13 @@ pub fn process_calculate_rent(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use crate::{clap_app::get_clap_app, cli::parse_command};
|
super::*,
|
||||||
use solana_sdk::signature::{write_keypair, Keypair};
|
crate::{clap_app::get_clap_app, cli::parse_command},
|
||||||
use std::str::FromStr;
|
solana_sdk::signature::{write_keypair, Keypair},
|
||||||
use tempfile::NamedTempFile;
|
std::str::FromStr,
|
||||||
|
tempfile::NamedTempFile,
|
||||||
|
};
|
||||||
|
|
||||||
fn make_tmp_file() -> (String, NamedTempFile) {
|
fn make_tmp_file() -> (String, NamedTempFile) {
|
||||||
let tmp_file = NamedTempFile::new().unwrap();
|
let tmp_file = NamedTempFile::new().unwrap();
|
||||||
|
@ -1,28 +1,30 @@
|
|||||||
use crate::{
|
use {
|
||||||
cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult},
|
crate::{
|
||||||
spend_utils::{resolve_spend_tx_and_check_account_balance, SpendAmount},
|
cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult},
|
||||||
};
|
spend_utils::{resolve_spend_tx_and_check_account_balance, SpendAmount},
|
||||||
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
|
},
|
||||||
use console::style;
|
clap::{App, AppSettings, Arg, ArgMatches, SubCommand},
|
||||||
use serde::{Deserialize, Serialize};
|
console::style,
|
||||||
use solana_clap_utils::{input_parsers::*, input_validators::*, keypair::*};
|
serde::{Deserialize, Serialize},
|
||||||
use solana_cli_output::{QuietDisplay, VerboseDisplay};
|
solana_clap_utils::{input_parsers::*, input_validators::*, keypair::*},
|
||||||
use solana_client::{client_error::ClientError, rpc_client::RpcClient};
|
solana_cli_output::{QuietDisplay, VerboseDisplay},
|
||||||
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
solana_client::{client_error::ClientError, rpc_client::RpcClient},
|
||||||
use solana_sdk::{
|
solana_remote_wallet::remote_wallet::RemoteWalletManager,
|
||||||
account::Account,
|
solana_sdk::{
|
||||||
clock::Slot,
|
account::Account,
|
||||||
feature::{self, Feature},
|
clock::Slot,
|
||||||
feature_set::FEATURE_NAMES,
|
feature::{self, Feature},
|
||||||
message::Message,
|
feature_set::FEATURE_NAMES,
|
||||||
pubkey::Pubkey,
|
message::Message,
|
||||||
transaction::Transaction,
|
pubkey::Pubkey,
|
||||||
};
|
transaction::Transaction,
|
||||||
use std::{
|
},
|
||||||
cmp::Ordering,
|
std::{
|
||||||
collections::{HashMap, HashSet},
|
cmp::Ordering,
|
||||||
fmt,
|
collections::{HashMap, HashSet},
|
||||||
sync::Arc,
|
fmt,
|
||||||
|
sync::Arc,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
use crate::cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult};
|
use {
|
||||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
crate::cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult},
|
||||||
use solana_clap_utils::{
|
clap::{App, Arg, ArgMatches, SubCommand},
|
||||||
input_parsers::{pubkeys_of, value_of},
|
solana_clap_utils::{
|
||||||
input_validators::is_valid_pubkey,
|
input_parsers::{pubkeys_of, value_of},
|
||||||
keypair::*,
|
input_validators::is_valid_pubkey,
|
||||||
|
keypair::*,
|
||||||
|
},
|
||||||
|
solana_cli_output::{
|
||||||
|
CliEpochRewardshMetadata, CliInflation, CliKeyedEpochReward, CliKeyedEpochRewards,
|
||||||
|
},
|
||||||
|
solana_client::rpc_client::RpcClient,
|
||||||
|
solana_remote_wallet::remote_wallet::RemoteWalletManager,
|
||||||
|
solana_sdk::{clock::Epoch, pubkey::Pubkey},
|
||||||
|
std::sync::Arc,
|
||||||
};
|
};
|
||||||
use solana_cli_output::{
|
|
||||||
CliEpochRewardshMetadata, CliInflation, CliKeyedEpochReward, CliKeyedEpochRewards,
|
|
||||||
};
|
|
||||||
use solana_client::rpc_client::RpcClient;
|
|
||||||
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
|
||||||
use solana_sdk::{clock::Epoch, pubkey::Pubkey};
|
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub enum InflationCliCommand {
|
pub enum InflationCliCommand {
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
use clap::{crate_description, crate_name, value_t_or_exit, ArgMatches};
|
use {
|
||||||
use console::style;
|
clap::{crate_description, crate_name, value_t_or_exit, ArgMatches},
|
||||||
use solana_clap_utils::{
|
console::style,
|
||||||
input_validators::normalize_to_url_if_moniker,
|
solana_clap_utils::{
|
||||||
keypair::{CliSigners, DefaultSigner},
|
input_validators::normalize_to_url_if_moniker,
|
||||||
DisplayError,
|
keypair::{CliSigners, DefaultSigner},
|
||||||
|
DisplayError,
|
||||||
|
},
|
||||||
|
solana_cli::{
|
||||||
|
clap_app::get_clap_app,
|
||||||
|
cli::{parse_command, process_command, CliCommandInfo, CliConfig, SettingType},
|
||||||
|
},
|
||||||
|
solana_cli_config::Config,
|
||||||
|
solana_cli_output::{display::println_name_value, OutputFormat},
|
||||||
|
solana_client::rpc_config::RpcSendTransactionConfig,
|
||||||
|
solana_remote_wallet::remote_wallet::RemoteWalletManager,
|
||||||
|
std::{collections::HashMap, error, path::PathBuf, sync::Arc, time::Duration},
|
||||||
};
|
};
|
||||||
use solana_cli::{
|
|
||||||
clap_app::get_clap_app,
|
|
||||||
cli::{parse_command, process_command, CliCommandInfo, CliConfig, SettingType},
|
|
||||||
};
|
|
||||||
use solana_cli_config::Config;
|
|
||||||
use solana_cli_output::{display::println_name_value, OutputFormat};
|
|
||||||
use solana_client::rpc_config::RpcSendTransactionConfig;
|
|
||||||
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
|
||||||
use std::{collections::HashMap, error, path::PathBuf, sync::Arc, time::Duration};
|
|
||||||
|
|
||||||
pub fn println_name_value_or(name: &str, value: &str, setting_type: SettingType) {
|
pub fn println_name_value_or(name: &str, value: &str, setting_type: SettingType) {
|
||||||
let description = match setting_type {
|
let description = match setting_type {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use solana_sdk::instruction::Instruction;
|
use {
|
||||||
use solana_sdk::pubkey::Pubkey;
|
solana_sdk::{instruction::Instruction, pubkey::Pubkey},
|
||||||
use spl_memo::id;
|
spl_memo::id,
|
||||||
|
};
|
||||||
|
|
||||||
pub trait WithMemo {
|
pub trait WithMemo {
|
||||||
fn with_memo<T: AsRef<str>>(self, memo: Option<T>) -> Self;
|
fn with_memo<T: AsRef<str>>(self, memo: Option<T>) -> Self;
|
||||||
|
@ -1,41 +1,43 @@
|
|||||||
use crate::{
|
use {
|
||||||
checks::{check_account_for_fee_with_commitment, check_unique_pubkeys},
|
crate::{
|
||||||
cli::{
|
checks::{check_account_for_fee_with_commitment, check_unique_pubkeys},
|
||||||
log_instruction_custom_error, log_instruction_custom_error_ex, CliCommand, CliCommandInfo,
|
cli::{
|
||||||
CliConfig, CliError, ProcessResult,
|
log_instruction_custom_error, log_instruction_custom_error_ex, CliCommand,
|
||||||
|
CliCommandInfo, CliConfig, CliError, ProcessResult,
|
||||||
|
},
|
||||||
|
feature::get_feature_is_active,
|
||||||
|
memo::WithMemo,
|
||||||
|
spend_utils::{resolve_spend_tx_and_check_account_balance, SpendAmount},
|
||||||
},
|
},
|
||||||
feature::get_feature_is_active,
|
clap::{App, Arg, ArgMatches, SubCommand},
|
||||||
memo::WithMemo,
|
solana_clap_utils::{
|
||||||
spend_utils::{resolve_spend_tx_and_check_account_balance, SpendAmount},
|
input_parsers::*,
|
||||||
};
|
input_validators::*,
|
||||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
keypair::{DefaultSigner, SignerIndex},
|
||||||
use solana_clap_utils::{
|
memo::{memo_arg, MEMO_ARG},
|
||||||
input_parsers::*,
|
nonce::*,
|
||||||
input_validators::*,
|
|
||||||
keypair::{DefaultSigner, SignerIndex},
|
|
||||||
memo::{memo_arg, MEMO_ARG},
|
|
||||||
nonce::*,
|
|
||||||
};
|
|
||||||
use solana_cli_output::CliNonceAccount;
|
|
||||||
use solana_client::{nonce_utils::*, rpc_client::RpcClient};
|
|
||||||
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
|
||||||
use solana_sdk::{
|
|
||||||
account::Account,
|
|
||||||
feature_set::merge_nonce_error_into_system_error,
|
|
||||||
hash::Hash,
|
|
||||||
instruction::InstructionError,
|
|
||||||
message::Message,
|
|
||||||
nonce::{self, State},
|
|
||||||
pubkey::Pubkey,
|
|
||||||
system_instruction::{
|
|
||||||
advance_nonce_account, authorize_nonce_account, create_nonce_account,
|
|
||||||
create_nonce_account_with_seed, instruction_to_nonce_error, withdraw_nonce_account,
|
|
||||||
NonceError, SystemError,
|
|
||||||
},
|
},
|
||||||
system_program,
|
solana_cli_output::CliNonceAccount,
|
||||||
transaction::{Transaction, TransactionError},
|
solana_client::{nonce_utils::*, rpc_client::RpcClient},
|
||||||
|
solana_remote_wallet::remote_wallet::RemoteWalletManager,
|
||||||
|
solana_sdk::{
|
||||||
|
account::Account,
|
||||||
|
feature_set::merge_nonce_error_into_system_error,
|
||||||
|
hash::Hash,
|
||||||
|
instruction::InstructionError,
|
||||||
|
message::Message,
|
||||||
|
nonce::{self, State},
|
||||||
|
pubkey::Pubkey,
|
||||||
|
system_instruction::{
|
||||||
|
advance_nonce_account, authorize_nonce_account, create_nonce_account,
|
||||||
|
create_nonce_account_with_seed, instruction_to_nonce_error, withdraw_nonce_account,
|
||||||
|
NonceError, SystemError,
|
||||||
|
},
|
||||||
|
system_program,
|
||||||
|
transaction::{Transaction, TransactionError},
|
||||||
|
},
|
||||||
|
std::sync::Arc,
|
||||||
};
|
};
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
pub trait NonceSubCommands {
|
pub trait NonceSubCommands {
|
||||||
fn nonce_subcommands(self) -> Self;
|
fn nonce_subcommands(self) -> Self;
|
||||||
@ -648,18 +650,20 @@ pub fn process_withdraw_from_nonce_account(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use crate::{clap_app::get_clap_app, cli::parse_command};
|
super::*,
|
||||||
use solana_sdk::{
|
crate::{clap_app::get_clap_app, cli::parse_command},
|
||||||
account::Account,
|
solana_sdk::{
|
||||||
account_utils::StateMut,
|
account::Account,
|
||||||
hash::hash,
|
account_utils::StateMut,
|
||||||
nonce::{self, state::Versions, State},
|
hash::hash,
|
||||||
nonce_account,
|
nonce::{self, state::Versions, State},
|
||||||
signature::{read_keypair_file, write_keypair, Keypair, Signer},
|
nonce_account,
|
||||||
system_program,
|
signature::{read_keypair_file, write_keypair, Keypair, Signer},
|
||||||
|
system_program,
|
||||||
|
},
|
||||||
|
tempfile::NamedTempFile,
|
||||||
};
|
};
|
||||||
use tempfile::NamedTempFile;
|
|
||||||
|
|
||||||
fn make_tmp_file() -> (String, NamedTempFile) {
|
fn make_tmp_file() -> (String, NamedTempFile) {
|
||||||
let tmp_file = NamedTempFile::new().unwrap();
|
let tmp_file = NamedTempFile::new().unwrap();
|
||||||
|
@ -1,57 +1,56 @@
|
|||||||
use crate::{
|
use {
|
||||||
checks::*,
|
crate::{
|
||||||
cli::{
|
checks::*,
|
||||||
log_instruction_custom_error, CliCommand, CliCommandInfo, CliConfig, CliError,
|
cli::{
|
||||||
ProcessResult,
|
log_instruction_custom_error, CliCommand, CliCommandInfo, CliConfig, CliError,
|
||||||
|
ProcessResult,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
bip39::{Language, Mnemonic, MnemonicType, Seed},
|
||||||
|
clap::{App, AppSettings, Arg, ArgMatches, SubCommand},
|
||||||
|
log::*,
|
||||||
|
solana_account_decoder::{UiAccountEncoding, UiDataSliceConfig},
|
||||||
|
solana_bpf_loader_program::{syscalls::register_syscalls, BpfError, ThisInstructionMeter},
|
||||||
|
solana_clap_utils::{self, input_parsers::*, input_validators::*, keypair::*},
|
||||||
|
solana_cli_output::{
|
||||||
|
CliProgram, CliProgramAccountType, CliProgramAuthority, CliProgramBuffer, CliProgramId,
|
||||||
|
CliUpgradeableBuffer, CliUpgradeableBuffers, CliUpgradeableProgram,
|
||||||
|
CliUpgradeableProgramClosed, CliUpgradeablePrograms,
|
||||||
|
},
|
||||||
|
solana_client::{
|
||||||
|
client_error::ClientErrorKind,
|
||||||
|
rpc_client::RpcClient,
|
||||||
|
rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig, RpcSendTransactionConfig},
|
||||||
|
rpc_filter::{Memcmp, MemcmpEncodedBytes, RpcFilterType},
|
||||||
|
tpu_client::{TpuClient, TpuClientConfig},
|
||||||
|
},
|
||||||
|
solana_program_runtime::invoke_context::InvokeContext,
|
||||||
|
solana_rbpf::{elf::Executable, verifier, vm::Config},
|
||||||
|
solana_remote_wallet::remote_wallet::RemoteWalletManager,
|
||||||
|
solana_sdk::{
|
||||||
|
account::Account,
|
||||||
|
account_utils::StateMut,
|
||||||
|
bpf_loader, bpf_loader_deprecated,
|
||||||
|
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
|
||||||
|
instruction::{Instruction, InstructionError},
|
||||||
|
loader_instruction,
|
||||||
|
message::Message,
|
||||||
|
native_token::Sol,
|
||||||
|
packet::PACKET_DATA_SIZE,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
signature::{keypair_from_seed, read_keypair_file, Keypair, Signature, Signer},
|
||||||
|
system_instruction::{self, SystemError},
|
||||||
|
system_program,
|
||||||
|
transaction::{Transaction, TransactionError},
|
||||||
|
},
|
||||||
|
std::{
|
||||||
|
fs::File,
|
||||||
|
io::{Read, Write},
|
||||||
|
mem::size_of,
|
||||||
|
path::PathBuf,
|
||||||
|
str::FromStr,
|
||||||
|
sync::Arc,
|
||||||
},
|
},
|
||||||
};
|
|
||||||
use bip39::{Language, Mnemonic, MnemonicType, Seed};
|
|
||||||
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
|
|
||||||
use log::*;
|
|
||||||
use solana_account_decoder::{UiAccountEncoding, UiDataSliceConfig};
|
|
||||||
use solana_bpf_loader_program::{syscalls::register_syscalls, BpfError, ThisInstructionMeter};
|
|
||||||
use solana_clap_utils::{self, input_parsers::*, input_validators::*, keypair::*};
|
|
||||||
use solana_cli_output::{
|
|
||||||
CliProgram, CliProgramAccountType, CliProgramAuthority, CliProgramBuffer, CliProgramId,
|
|
||||||
CliUpgradeableBuffer, CliUpgradeableBuffers, CliUpgradeableProgram,
|
|
||||||
CliUpgradeableProgramClosed, CliUpgradeablePrograms,
|
|
||||||
};
|
|
||||||
use solana_client::{
|
|
||||||
client_error::ClientErrorKind,
|
|
||||||
rpc_client::RpcClient,
|
|
||||||
rpc_config::RpcSendTransactionConfig,
|
|
||||||
rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig},
|
|
||||||
rpc_filter::{Memcmp, MemcmpEncodedBytes, RpcFilterType},
|
|
||||||
tpu_client::{TpuClient, TpuClientConfig},
|
|
||||||
};
|
|
||||||
use solana_program_runtime::invoke_context::InvokeContext;
|
|
||||||
use solana_rbpf::{elf::Executable, verifier, vm::Config};
|
|
||||||
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
|
||||||
use solana_sdk::{
|
|
||||||
account::Account,
|
|
||||||
account_utils::StateMut,
|
|
||||||
bpf_loader, bpf_loader_deprecated,
|
|
||||||
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
|
|
||||||
instruction::Instruction,
|
|
||||||
instruction::InstructionError,
|
|
||||||
loader_instruction,
|
|
||||||
message::Message,
|
|
||||||
native_token::Sol,
|
|
||||||
packet::PACKET_DATA_SIZE,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
signature::{keypair_from_seed, read_keypair_file, Keypair, Signature, Signer},
|
|
||||||
system_instruction::{self, SystemError},
|
|
||||||
system_program,
|
|
||||||
transaction::Transaction,
|
|
||||||
transaction::TransactionError,
|
|
||||||
};
|
|
||||||
use std::{
|
|
||||||
fs::File,
|
|
||||||
io::{Read, Write},
|
|
||||||
mem::size_of,
|
|
||||||
path::PathBuf,
|
|
||||||
str::FromStr,
|
|
||||||
sync::Arc,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
@ -2203,14 +2202,16 @@ fn report_ephemeral_mnemonic(words: usize, mnemonic: bip39::Mnemonic) {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use crate::{
|
super::*,
|
||||||
clap_app::get_clap_app,
|
crate::{
|
||||||
cli::{parse_command, process_command},
|
clap_app::get_clap_app,
|
||||||
|
cli::{parse_command, process_command},
|
||||||
|
},
|
||||||
|
serde_json::Value,
|
||||||
|
solana_cli_output::OutputFormat,
|
||||||
|
solana_sdk::signature::write_keypair_file,
|
||||||
};
|
};
|
||||||
use serde_json::Value;
|
|
||||||
use solana_cli_output::OutputFormat;
|
|
||||||
use solana_sdk::signature::write_keypair_file;
|
|
||||||
|
|
||||||
fn make_tmp_path(name: &str) -> String {
|
fn make_tmp_path(name: &str) -> String {
|
||||||
let out_dir = std::env::var("FARF_DIR").unwrap_or_else(|_| "farf".to_string());
|
let out_dir = std::env::var("FARF_DIR").unwrap_or_else(|_| "farf".to_string());
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
use crate::{
|
use {
|
||||||
checks::{check_account_for_balance_with_commitment, get_fee_for_messages},
|
crate::{
|
||||||
cli::CliError,
|
checks::{check_account_for_balance_with_commitment, get_fee_for_messages},
|
||||||
};
|
cli::CliError,
|
||||||
use clap::ArgMatches;
|
},
|
||||||
use solana_clap_utils::{input_parsers::lamports_of_sol, offline::SIGN_ONLY_ARG};
|
clap::ArgMatches,
|
||||||
use solana_client::rpc_client::RpcClient;
|
solana_clap_utils::{input_parsers::lamports_of_sol, offline::SIGN_ONLY_ARG},
|
||||||
use solana_sdk::{
|
solana_client::rpc_client::RpcClient,
|
||||||
commitment_config::CommitmentConfig, hash::Hash, message::Message,
|
solana_sdk::{
|
||||||
native_token::lamports_to_sol, pubkey::Pubkey,
|
commitment_config::CommitmentConfig, hash::Hash, message::Message,
|
||||||
|
native_token::lamports_to_sol, pubkey::Pubkey,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Clone, Copy)]
|
||||||
|
114
cli/src/stake.rs
114
cli/src/stake.rs
@ -1,53 +1,55 @@
|
|||||||
use crate::{
|
use {
|
||||||
checks::{check_account_for_fee_with_commitment, check_unique_pubkeys},
|
crate::{
|
||||||
cli::{
|
checks::{check_account_for_fee_with_commitment, check_unique_pubkeys},
|
||||||
log_instruction_custom_error, CliCommand, CliCommandInfo, CliConfig, CliError,
|
cli::{
|
||||||
ProcessResult,
|
log_instruction_custom_error, CliCommand, CliCommandInfo, CliConfig, CliError,
|
||||||
|
ProcessResult,
|
||||||
|
},
|
||||||
|
memo::WithMemo,
|
||||||
|
nonce::check_nonce_account,
|
||||||
|
spend_utils::{resolve_spend_tx_and_check_account_balances, SpendAmount},
|
||||||
},
|
},
|
||||||
memo::WithMemo,
|
clap::{value_t, App, Arg, ArgGroup, ArgMatches, SubCommand},
|
||||||
nonce::check_nonce_account,
|
solana_clap_utils::{
|
||||||
spend_utils::{resolve_spend_tx_and_check_account_balances, SpendAmount},
|
fee_payer::{fee_payer_arg, FEE_PAYER_ARG},
|
||||||
};
|
input_parsers::*,
|
||||||
use clap::{value_t, App, Arg, ArgGroup, ArgMatches, SubCommand};
|
input_validators::*,
|
||||||
use solana_clap_utils::{
|
keypair::{DefaultSigner, SignerIndex},
|
||||||
fee_payer::{fee_payer_arg, FEE_PAYER_ARG},
|
memo::{memo_arg, MEMO_ARG},
|
||||||
input_parsers::*,
|
nonce::*,
|
||||||
input_validators::*,
|
offline::*,
|
||||||
keypair::{DefaultSigner, SignerIndex},
|
ArgConstant,
|
||||||
memo::{memo_arg, MEMO_ARG},
|
|
||||||
nonce::*,
|
|
||||||
offline::*,
|
|
||||||
ArgConstant,
|
|
||||||
};
|
|
||||||
use solana_cli_output::{
|
|
||||||
return_signers_with_config, CliEpochReward, CliStakeHistory, CliStakeHistoryEntry,
|
|
||||||
CliStakeState, CliStakeType, OutputFormat, ReturnSignersConfig,
|
|
||||||
};
|
|
||||||
use solana_client::{
|
|
||||||
blockhash_query::BlockhashQuery, nonce_utils, rpc_client::RpcClient,
|
|
||||||
rpc_request::DELINQUENT_VALIDATOR_SLOT_DISTANCE, rpc_response::RpcInflationReward,
|
|
||||||
};
|
|
||||||
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
|
||||||
use solana_sdk::{
|
|
||||||
account::from_account,
|
|
||||||
account_utils::StateMut,
|
|
||||||
clock::{Clock, UnixTimestamp, SECONDS_PER_DAY},
|
|
||||||
commitment_config::CommitmentConfig,
|
|
||||||
epoch_schedule::EpochSchedule,
|
|
||||||
message::Message,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
stake::{
|
|
||||||
self,
|
|
||||||
instruction::{self as stake_instruction, LockupArgs, StakeError},
|
|
||||||
state::{Authorized, Lockup, Meta, StakeActivationStatus, StakeAuthorize, StakeState},
|
|
||||||
},
|
},
|
||||||
stake_history::StakeHistory,
|
solana_cli_output::{
|
||||||
system_instruction::SystemError,
|
return_signers_with_config, CliEpochReward, CliStakeHistory, CliStakeHistoryEntry,
|
||||||
sysvar::{clock, stake_history},
|
CliStakeState, CliStakeType, OutputFormat, ReturnSignersConfig,
|
||||||
transaction::Transaction,
|
},
|
||||||
|
solana_client::{
|
||||||
|
blockhash_query::BlockhashQuery, nonce_utils, rpc_client::RpcClient,
|
||||||
|
rpc_request::DELINQUENT_VALIDATOR_SLOT_DISTANCE, rpc_response::RpcInflationReward,
|
||||||
|
},
|
||||||
|
solana_remote_wallet::remote_wallet::RemoteWalletManager,
|
||||||
|
solana_sdk::{
|
||||||
|
account::from_account,
|
||||||
|
account_utils::StateMut,
|
||||||
|
clock::{Clock, UnixTimestamp, SECONDS_PER_DAY},
|
||||||
|
commitment_config::CommitmentConfig,
|
||||||
|
epoch_schedule::EpochSchedule,
|
||||||
|
message::Message,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
stake::{
|
||||||
|
self,
|
||||||
|
instruction::{self as stake_instruction, LockupArgs, StakeError},
|
||||||
|
state::{Authorized, Lockup, Meta, StakeActivationStatus, StakeAuthorize, StakeState},
|
||||||
|
},
|
||||||
|
stake_history::StakeHistory,
|
||||||
|
system_instruction::SystemError,
|
||||||
|
sysvar::{clock, stake_history},
|
||||||
|
transaction::Transaction,
|
||||||
|
},
|
||||||
|
solana_vote_program::vote_state::VoteState,
|
||||||
|
std::{ops::Deref, sync::Arc},
|
||||||
};
|
};
|
||||||
use solana_vote_program::vote_state::VoteState;
|
|
||||||
use std::{ops::Deref, sync::Arc};
|
|
||||||
|
|
||||||
pub const STAKE_AUTHORITY_ARG: ArgConstant<'static> = ArgConstant {
|
pub const STAKE_AUTHORITY_ARG: ArgConstant<'static> = ArgConstant {
|
||||||
name: "stake_authority",
|
name: "stake_authority",
|
||||||
@ -2423,16 +2425,18 @@ pub fn process_delegate_stake(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use crate::{clap_app::get_clap_app, cli::parse_command};
|
super::*,
|
||||||
use solana_client::blockhash_query;
|
crate::{clap_app::get_clap_app, cli::parse_command},
|
||||||
use solana_sdk::{
|
solana_client::blockhash_query,
|
||||||
hash::Hash,
|
solana_sdk::{
|
||||||
signature::{
|
hash::Hash,
|
||||||
keypair_from_seed, read_keypair_file, write_keypair, Keypair, Presigner, Signer,
|
signature::{
|
||||||
|
keypair_from_seed, read_keypair_file, write_keypair, Keypair, Presigner, Signer,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
tempfile::NamedTempFile,
|
||||||
};
|
};
|
||||||
use tempfile::NamedTempFile;
|
|
||||||
|
|
||||||
fn make_tmp_file() -> (String, NamedTempFile) {
|
fn make_tmp_file() -> (String, NamedTempFile) {
|
||||||
let tmp_file = NamedTempFile::new().unwrap();
|
let tmp_file = NamedTempFile::new().unwrap();
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use solana_client::rpc_client::RpcClient;
|
use {
|
||||||
use solana_sdk::{clock::DEFAULT_MS_PER_SLOT, commitment_config::CommitmentConfig, pubkey::Pubkey};
|
solana_client::rpc_client::RpcClient,
|
||||||
use std::{thread::sleep, time::Duration};
|
solana_sdk::{clock::DEFAULT_MS_PER_SLOT, commitment_config::CommitmentConfig, pubkey::Pubkey},
|
||||||
|
std::{thread::sleep, time::Duration},
|
||||||
|
};
|
||||||
|
|
||||||
pub fn check_recent_balance(expected_balance: u64, client: &RpcClient, pubkey: &Pubkey) {
|
pub fn check_recent_balance(expected_balance: u64, client: &RpcClient, pubkey: &Pubkey) {
|
||||||
(0..5).for_each(|tries| {
|
(0..5).for_each(|tries| {
|
||||||
|
@ -1,31 +1,33 @@
|
|||||||
use crate::{
|
use {
|
||||||
cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult},
|
crate::{
|
||||||
spend_utils::{resolve_spend_tx_and_check_account_balance, SpendAmount},
|
cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult},
|
||||||
|
spend_utils::{resolve_spend_tx_and_check_account_balance, SpendAmount},
|
||||||
|
},
|
||||||
|
bincode::deserialize,
|
||||||
|
clap::{App, AppSettings, Arg, ArgMatches, SubCommand},
|
||||||
|
reqwest::blocking::Client,
|
||||||
|
serde_json::{Map, Value},
|
||||||
|
solana_account_decoder::validator_info::{
|
||||||
|
self, ValidatorInfo, MAX_LONG_FIELD_LENGTH, MAX_SHORT_FIELD_LENGTH,
|
||||||
|
},
|
||||||
|
solana_clap_utils::{
|
||||||
|
input_parsers::pubkey_of,
|
||||||
|
input_validators::{is_pubkey, is_url},
|
||||||
|
keypair::DefaultSigner,
|
||||||
|
},
|
||||||
|
solana_cli_output::{CliValidatorInfo, CliValidatorInfoVec},
|
||||||
|
solana_client::rpc_client::RpcClient,
|
||||||
|
solana_config_program::{config_instruction, get_config_data, ConfigKeys, ConfigState},
|
||||||
|
solana_remote_wallet::remote_wallet::RemoteWalletManager,
|
||||||
|
solana_sdk::{
|
||||||
|
account::Account,
|
||||||
|
message::Message,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
signature::{Keypair, Signer},
|
||||||
|
transaction::Transaction,
|
||||||
|
},
|
||||||
|
std::{error, sync::Arc},
|
||||||
};
|
};
|
||||||
use bincode::deserialize;
|
|
||||||
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
|
|
||||||
use reqwest::blocking::Client;
|
|
||||||
use serde_json::{Map, Value};
|
|
||||||
use solana_account_decoder::validator_info::{
|
|
||||||
self, ValidatorInfo, MAX_LONG_FIELD_LENGTH, MAX_SHORT_FIELD_LENGTH,
|
|
||||||
};
|
|
||||||
use solana_clap_utils::{
|
|
||||||
input_parsers::pubkey_of,
|
|
||||||
input_validators::{is_pubkey, is_url},
|
|
||||||
keypair::DefaultSigner,
|
|
||||||
};
|
|
||||||
use solana_cli_output::{CliValidatorInfo, CliValidatorInfoVec};
|
|
||||||
use solana_client::rpc_client::RpcClient;
|
|
||||||
use solana_config_program::{config_instruction, get_config_data, ConfigKeys, ConfigState};
|
|
||||||
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
|
||||||
use solana_sdk::{
|
|
||||||
account::Account,
|
|
||||||
message::Message,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
signature::{Keypair, Signer},
|
|
||||||
transaction::Transaction,
|
|
||||||
};
|
|
||||||
use std::{error, sync::Arc};
|
|
||||||
|
|
||||||
// Return an error if a validator details are longer than the max length.
|
// Return an error if a validator details are longer than the max length.
|
||||||
pub fn check_details_length(string: String) -> Result<(), String> {
|
pub fn check_details_length(string: String) -> Result<(), String> {
|
||||||
@ -407,10 +409,12 @@ pub fn process_get_validator_info(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use crate::clap_app::get_clap_app;
|
super::*,
|
||||||
use bincode::{serialize, serialized_size};
|
crate::clap_app::get_clap_app,
|
||||||
use serde_json::json;
|
bincode::{serialize, serialized_size},
|
||||||
|
serde_json::json,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_check_details_length() {
|
fn test_check_details_length() {
|
||||||
|
@ -1,33 +1,35 @@
|
|||||||
use crate::{
|
use {
|
||||||
checks::{check_account_for_fee_with_commitment, check_unique_pubkeys},
|
crate::{
|
||||||
cli::{
|
checks::{check_account_for_fee_with_commitment, check_unique_pubkeys},
|
||||||
log_instruction_custom_error, CliCommand, CliCommandInfo, CliConfig, CliError,
|
cli::{
|
||||||
ProcessResult,
|
log_instruction_custom_error, CliCommand, CliCommandInfo, CliConfig, CliError,
|
||||||
|
ProcessResult,
|
||||||
|
},
|
||||||
|
memo::WithMemo,
|
||||||
|
spend_utils::{resolve_spend_tx_and_check_account_balance, SpendAmount},
|
||||||
|
stake::check_current_authority,
|
||||||
},
|
},
|
||||||
memo::WithMemo,
|
clap::{value_t_or_exit, App, Arg, ArgMatches, SubCommand},
|
||||||
spend_utils::{resolve_spend_tx_and_check_account_balance, SpendAmount},
|
solana_clap_utils::{
|
||||||
stake::check_current_authority,
|
input_parsers::*,
|
||||||
|
input_validators::*,
|
||||||
|
keypair::{DefaultSigner, SignerIndex},
|
||||||
|
memo::{memo_arg, MEMO_ARG},
|
||||||
|
},
|
||||||
|
solana_cli_output::{CliEpochVotingHistory, CliLockout, CliVoteAccount},
|
||||||
|
solana_client::{rpc_client::RpcClient, rpc_config::RpcGetVoteAccountsConfig},
|
||||||
|
solana_remote_wallet::remote_wallet::RemoteWalletManager,
|
||||||
|
solana_sdk::{
|
||||||
|
account::Account, commitment_config::CommitmentConfig, message::Message,
|
||||||
|
native_token::lamports_to_sol, pubkey::Pubkey, system_instruction::SystemError,
|
||||||
|
transaction::Transaction,
|
||||||
|
},
|
||||||
|
solana_vote_program::{
|
||||||
|
vote_instruction::{self, withdraw, VoteError},
|
||||||
|
vote_state::{VoteAuthorize, VoteInit, VoteState},
|
||||||
|
},
|
||||||
|
std::sync::Arc,
|
||||||
};
|
};
|
||||||
use clap::{value_t_or_exit, App, Arg, ArgMatches, SubCommand};
|
|
||||||
use solana_clap_utils::{
|
|
||||||
input_parsers::*,
|
|
||||||
input_validators::*,
|
|
||||||
keypair::{DefaultSigner, SignerIndex},
|
|
||||||
memo::{memo_arg, MEMO_ARG},
|
|
||||||
};
|
|
||||||
use solana_cli_output::{CliEpochVotingHistory, CliLockout, CliVoteAccount};
|
|
||||||
use solana_client::{rpc_client::RpcClient, rpc_config::RpcGetVoteAccountsConfig};
|
|
||||||
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
|
||||||
use solana_sdk::{
|
|
||||||
account::Account, commitment_config::CommitmentConfig, message::Message,
|
|
||||||
native_token::lamports_to_sol, pubkey::Pubkey, system_instruction::SystemError,
|
|
||||||
transaction::Transaction,
|
|
||||||
};
|
|
||||||
use solana_vote_program::{
|
|
||||||
vote_instruction::{self, withdraw, VoteError},
|
|
||||||
vote_state::{VoteAuthorize, VoteInit, VoteState},
|
|
||||||
};
|
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
pub trait VoteSubCommands {
|
pub trait VoteSubCommands {
|
||||||
fn vote_subcommands(self) -> Self;
|
fn vote_subcommands(self) -> Self;
|
||||||
@ -1049,10 +1051,12 @@ pub fn process_close_vote_account(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use crate::{clap_app::get_clap_app, cli::parse_command};
|
super::*,
|
||||||
use solana_sdk::signature::{read_keypair_file, write_keypair, Keypair, Signer};
|
crate::{clap_app::get_clap_app, cli::parse_command},
|
||||||
use tempfile::NamedTempFile;
|
solana_sdk::signature::{read_keypair_file, write_keypair, Keypair, Signer},
|
||||||
|
tempfile::NamedTempFile,
|
||||||
|
};
|
||||||
|
|
||||||
fn make_tmp_file() -> (String, NamedTempFile) {
|
fn make_tmp_file() -> (String, NamedTempFile) {
|
||||||
let tmp_file = NamedTempFile::new().unwrap();
|
let tmp_file = NamedTempFile::new().unwrap();
|
||||||
|
@ -1,45 +1,47 @@
|
|||||||
use crate::{
|
use {
|
||||||
cli::{
|
crate::{
|
||||||
log_instruction_custom_error, request_and_confirm_airdrop, CliCommand, CliCommandInfo,
|
cli::{
|
||||||
CliConfig, CliError, ProcessResult,
|
log_instruction_custom_error, request_and_confirm_airdrop, CliCommand, CliCommandInfo,
|
||||||
|
CliConfig, CliError, ProcessResult,
|
||||||
|
},
|
||||||
|
memo::WithMemo,
|
||||||
|
nonce::check_nonce_account,
|
||||||
|
spend_utils::{resolve_spend_tx_and_check_account_balances, SpendAmount},
|
||||||
},
|
},
|
||||||
memo::WithMemo,
|
clap::{value_t_or_exit, App, Arg, ArgMatches, SubCommand},
|
||||||
nonce::check_nonce_account,
|
solana_account_decoder::{UiAccount, UiAccountEncoding},
|
||||||
spend_utils::{resolve_spend_tx_and_check_account_balances, SpendAmount},
|
solana_clap_utils::{
|
||||||
|
fee_payer::*,
|
||||||
|
input_parsers::*,
|
||||||
|
input_validators::*,
|
||||||
|
keypair::{DefaultSigner, SignerIndex},
|
||||||
|
memo::*,
|
||||||
|
nonce::*,
|
||||||
|
offline::*,
|
||||||
|
},
|
||||||
|
solana_cli_output::{
|
||||||
|
display::build_balance_message, return_signers_with_config, CliAccount,
|
||||||
|
CliSignatureVerificationStatus, CliTransaction, CliTransactionConfirmation, OutputFormat,
|
||||||
|
ReturnSignersConfig,
|
||||||
|
},
|
||||||
|
solana_client::{
|
||||||
|
blockhash_query::BlockhashQuery, nonce_utils, rpc_client::RpcClient,
|
||||||
|
rpc_config::RpcTransactionConfig, rpc_response::RpcKeyedAccount,
|
||||||
|
},
|
||||||
|
solana_remote_wallet::remote_wallet::RemoteWalletManager,
|
||||||
|
solana_sdk::{
|
||||||
|
commitment_config::CommitmentConfig,
|
||||||
|
message::Message,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
signature::Signature,
|
||||||
|
stake,
|
||||||
|
system_instruction::{self, SystemError},
|
||||||
|
system_program,
|
||||||
|
transaction::Transaction,
|
||||||
|
},
|
||||||
|
solana_transaction_status::{EncodedTransaction, UiTransactionEncoding},
|
||||||
|
std::{fmt::Write as FmtWrite, fs::File, io::Write, sync::Arc},
|
||||||
};
|
};
|
||||||
use clap::{value_t_or_exit, App, Arg, ArgMatches, SubCommand};
|
|
||||||
use solana_account_decoder::{UiAccount, UiAccountEncoding};
|
|
||||||
use solana_clap_utils::{
|
|
||||||
fee_payer::*,
|
|
||||||
input_parsers::*,
|
|
||||||
input_validators::*,
|
|
||||||
keypair::{DefaultSigner, SignerIndex},
|
|
||||||
memo::*,
|
|
||||||
nonce::*,
|
|
||||||
offline::*,
|
|
||||||
};
|
|
||||||
use solana_cli_output::{
|
|
||||||
display::build_balance_message, return_signers_with_config, CliAccount,
|
|
||||||
CliSignatureVerificationStatus, CliTransaction, CliTransactionConfirmation, OutputFormat,
|
|
||||||
ReturnSignersConfig,
|
|
||||||
};
|
|
||||||
use solana_client::{
|
|
||||||
blockhash_query::BlockhashQuery, nonce_utils, rpc_client::RpcClient,
|
|
||||||
rpc_config::RpcTransactionConfig, rpc_response::RpcKeyedAccount,
|
|
||||||
};
|
|
||||||
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
|
||||||
use solana_sdk::{
|
|
||||||
commitment_config::CommitmentConfig,
|
|
||||||
message::Message,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
signature::Signature,
|
|
||||||
stake,
|
|
||||||
system_instruction::{self, SystemError},
|
|
||||||
system_program,
|
|
||||||
transaction::Transaction,
|
|
||||||
};
|
|
||||||
use solana_transaction_status::{EncodedTransaction, UiTransactionEncoding};
|
|
||||||
use std::{fmt::Write as FmtWrite, fs::File, io::Write, sync::Arc};
|
|
||||||
|
|
||||||
pub trait WalletSubCommands {
|
pub trait WalletSubCommands {
|
||||||
fn wallet_subcommands(self) -> Self;
|
fn wallet_subcommands(self) -> Self;
|
||||||
|
@ -1,24 +1,26 @@
|
|||||||
use solana_cli::{
|
use {
|
||||||
cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig},
|
solana_cli::{
|
||||||
spend_utils::SpendAmount,
|
cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig},
|
||||||
test_utils::{check_ready, check_recent_balance},
|
spend_utils::SpendAmount,
|
||||||
|
test_utils::{check_ready, check_recent_balance},
|
||||||
|
},
|
||||||
|
solana_cli_output::{parse_sign_only_reply_string, OutputFormat},
|
||||||
|
solana_client::{
|
||||||
|
blockhash_query::{self, BlockhashQuery},
|
||||||
|
nonce_utils,
|
||||||
|
rpc_client::RpcClient,
|
||||||
|
},
|
||||||
|
solana_faucet::faucet::run_local_faucet,
|
||||||
|
solana_sdk::{
|
||||||
|
commitment_config::CommitmentConfig,
|
||||||
|
hash::Hash,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
signature::{keypair_from_seed, Keypair, Signer},
|
||||||
|
system_program,
|
||||||
|
},
|
||||||
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
|
solana_test_validator::TestValidator,
|
||||||
};
|
};
|
||||||
use solana_cli_output::{parse_sign_only_reply_string, OutputFormat};
|
|
||||||
use solana_client::{
|
|
||||||
blockhash_query::{self, BlockhashQuery},
|
|
||||||
nonce_utils,
|
|
||||||
rpc_client::RpcClient,
|
|
||||||
};
|
|
||||||
use solana_faucet::faucet::run_local_faucet;
|
|
||||||
use solana_sdk::{
|
|
||||||
commitment_config::CommitmentConfig,
|
|
||||||
hash::Hash,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
signature::{keypair_from_seed, Keypair, Signer},
|
|
||||||
system_program,
|
|
||||||
};
|
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
|
||||||
use solana_test_validator::TestValidator;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_nonce() {
|
fn test_nonce() {
|
||||||
|
@ -1,22 +1,24 @@
|
|||||||
use serde_json::Value;
|
use {
|
||||||
use solana_cli::{
|
serde_json::Value,
|
||||||
cli::{process_command, CliCommand, CliConfig},
|
solana_cli::{
|
||||||
program::ProgramCliCommand,
|
cli::{process_command, CliCommand, CliConfig},
|
||||||
|
program::ProgramCliCommand,
|
||||||
|
},
|
||||||
|
solana_cli_output::OutputFormat,
|
||||||
|
solana_client::rpc_client::RpcClient,
|
||||||
|
solana_faucet::faucet::run_local_faucet,
|
||||||
|
solana_sdk::{
|
||||||
|
account_utils::StateMut,
|
||||||
|
bpf_loader,
|
||||||
|
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
|
||||||
|
commitment_config::CommitmentConfig,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
signature::{Keypair, Signer},
|
||||||
|
},
|
||||||
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
|
solana_test_validator::TestValidator,
|
||||||
|
std::{env, fs::File, io::Read, path::PathBuf, str::FromStr},
|
||||||
};
|
};
|
||||||
use solana_cli_output::OutputFormat;
|
|
||||||
use solana_client::rpc_client::RpcClient;
|
|
||||||
use solana_faucet::faucet::run_local_faucet;
|
|
||||||
use solana_sdk::{
|
|
||||||
account_utils::StateMut,
|
|
||||||
bpf_loader,
|
|
||||||
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
|
|
||||||
commitment_config::CommitmentConfig,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
signature::{Keypair, Signer},
|
|
||||||
};
|
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
|
||||||
use solana_test_validator::TestValidator;
|
|
||||||
use std::{env, fs::File, io::Read, path::PathBuf, str::FromStr};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cli_program_deploy_non_upgradeable() {
|
fn test_cli_program_deploy_non_upgradeable() {
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
use solana_cli::cli::{process_command, CliCommand, CliConfig};
|
use {
|
||||||
use solana_client::rpc_client::RpcClient;
|
solana_cli::cli::{process_command, CliCommand, CliConfig},
|
||||||
use solana_faucet::faucet::run_local_faucet;
|
solana_client::rpc_client::RpcClient,
|
||||||
use solana_sdk::{
|
solana_faucet::faucet::run_local_faucet,
|
||||||
commitment_config::CommitmentConfig,
|
solana_sdk::{
|
||||||
signature::{Keypair, Signer},
|
commitment_config::CommitmentConfig,
|
||||||
|
signature::{Keypair, Signer},
|
||||||
|
},
|
||||||
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
|
solana_test_validator::TestValidator,
|
||||||
};
|
};
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
|
||||||
use solana_test_validator::TestValidator;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cli_request_airdrop() {
|
fn test_cli_request_airdrop() {
|
||||||
|
@ -1,31 +1,33 @@
|
|||||||
#![allow(clippy::redundant_closure)]
|
#![allow(clippy::redundant_closure)]
|
||||||
use solana_cli::{
|
use {
|
||||||
cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig},
|
solana_cli::{
|
||||||
spend_utils::SpendAmount,
|
cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig},
|
||||||
stake::StakeAuthorizationIndexed,
|
spend_utils::SpendAmount,
|
||||||
test_utils::{check_ready, check_recent_balance},
|
stake::StakeAuthorizationIndexed,
|
||||||
};
|
test_utils::{check_ready, check_recent_balance},
|
||||||
use solana_cli_output::{parse_sign_only_reply_string, OutputFormat};
|
|
||||||
use solana_client::{
|
|
||||||
blockhash_query::{self, BlockhashQuery},
|
|
||||||
nonce_utils,
|
|
||||||
rpc_client::RpcClient,
|
|
||||||
};
|
|
||||||
use solana_faucet::faucet::run_local_faucet;
|
|
||||||
use solana_sdk::{
|
|
||||||
account_utils::StateMut,
|
|
||||||
commitment_config::CommitmentConfig,
|
|
||||||
nonce::State as NonceState,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
signature::{keypair_from_seed, Keypair, Signer},
|
|
||||||
stake::{
|
|
||||||
self,
|
|
||||||
instruction::LockupArgs,
|
|
||||||
state::{Lockup, StakeAuthorize, StakeState},
|
|
||||||
},
|
},
|
||||||
|
solana_cli_output::{parse_sign_only_reply_string, OutputFormat},
|
||||||
|
solana_client::{
|
||||||
|
blockhash_query::{self, BlockhashQuery},
|
||||||
|
nonce_utils,
|
||||||
|
rpc_client::RpcClient,
|
||||||
|
},
|
||||||
|
solana_faucet::faucet::run_local_faucet,
|
||||||
|
solana_sdk::{
|
||||||
|
account_utils::StateMut,
|
||||||
|
commitment_config::CommitmentConfig,
|
||||||
|
nonce::State as NonceState,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
signature::{keypair_from_seed, Keypair, Signer},
|
||||||
|
stake::{
|
||||||
|
self,
|
||||||
|
instruction::LockupArgs,
|
||||||
|
state::{Lockup, StakeAuthorize, StakeState},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
|
solana_test_validator::TestValidator,
|
||||||
};
|
};
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
|
||||||
use solana_test_validator::TestValidator;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_stake_delegation_force() {
|
fn test_stake_delegation_force() {
|
||||||
|
@ -1,25 +1,27 @@
|
|||||||
#![allow(clippy::redundant_closure)]
|
#![allow(clippy::redundant_closure)]
|
||||||
use solana_cli::{
|
use {
|
||||||
cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig},
|
solana_cli::{
|
||||||
spend_utils::SpendAmount,
|
cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig},
|
||||||
test_utils::{check_ready, check_recent_balance},
|
spend_utils::SpendAmount,
|
||||||
|
test_utils::{check_ready, check_recent_balance},
|
||||||
|
},
|
||||||
|
solana_cli_output::{parse_sign_only_reply_string, OutputFormat},
|
||||||
|
solana_client::{
|
||||||
|
blockhash_query::{self, BlockhashQuery},
|
||||||
|
nonce_utils,
|
||||||
|
rpc_client::RpcClient,
|
||||||
|
},
|
||||||
|
solana_faucet::faucet::run_local_faucet,
|
||||||
|
solana_sdk::{
|
||||||
|
commitment_config::CommitmentConfig,
|
||||||
|
nonce::State as NonceState,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
signature::{keypair_from_seed, Keypair, NullSigner, Signer},
|
||||||
|
stake,
|
||||||
|
},
|
||||||
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
|
solana_test_validator::TestValidator,
|
||||||
};
|
};
|
||||||
use solana_cli_output::{parse_sign_only_reply_string, OutputFormat};
|
|
||||||
use solana_client::{
|
|
||||||
blockhash_query::{self, BlockhashQuery},
|
|
||||||
nonce_utils,
|
|
||||||
rpc_client::RpcClient,
|
|
||||||
};
|
|
||||||
use solana_faucet::faucet::run_local_faucet;
|
|
||||||
use solana_sdk::{
|
|
||||||
commitment_config::CommitmentConfig,
|
|
||||||
nonce::State as NonceState,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
signature::{keypair_from_seed, Keypair, NullSigner, Signer},
|
|
||||||
stake,
|
|
||||||
};
|
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
|
||||||
use solana_test_validator::TestValidator;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_transfer() {
|
fn test_transfer() {
|
||||||
|
@ -1,21 +1,23 @@
|
|||||||
use solana_cli::{
|
use {
|
||||||
cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig},
|
solana_cli::{
|
||||||
spend_utils::SpendAmount,
|
cli::{process_command, request_and_confirm_airdrop, CliCommand, CliConfig},
|
||||||
test_utils::check_recent_balance,
|
spend_utils::SpendAmount,
|
||||||
|
test_utils::check_recent_balance,
|
||||||
|
},
|
||||||
|
solana_client::{
|
||||||
|
blockhash_query::{self, BlockhashQuery},
|
||||||
|
rpc_client::RpcClient,
|
||||||
|
},
|
||||||
|
solana_faucet::faucet::run_local_faucet,
|
||||||
|
solana_sdk::{
|
||||||
|
account_utils::StateMut,
|
||||||
|
commitment_config::CommitmentConfig,
|
||||||
|
signature::{Keypair, Signer},
|
||||||
|
},
|
||||||
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
|
solana_test_validator::TestValidator,
|
||||||
|
solana_vote_program::vote_state::{VoteAuthorize, VoteState, VoteStateVersions},
|
||||||
};
|
};
|
||||||
use solana_client::{
|
|
||||||
blockhash_query::{self, BlockhashQuery},
|
|
||||||
rpc_client::RpcClient,
|
|
||||||
};
|
|
||||||
use solana_faucet::faucet::run_local_faucet;
|
|
||||||
use solana_sdk::{
|
|
||||||
account_utils::StateMut,
|
|
||||||
commitment_config::CommitmentConfig,
|
|
||||||
signature::{Keypair, Signer},
|
|
||||||
};
|
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
|
||||||
use solana_test_validator::TestValidator;
|
|
||||||
use solana_vote_program::vote_state::{VoteAuthorize, VoteState, VoteStateVersions};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_vote_authorize_and_withdraw() {
|
fn test_vote_authorize_and_withdraw() {
|
||||||
|
@ -1,44 +1,46 @@
|
|||||||
use serde_json::{json, Value};
|
use {
|
||||||
use serial_test::serial;
|
serde_json::{json, Value},
|
||||||
use solana_client::{
|
serial_test::serial,
|
||||||
pubsub_client::PubsubClient,
|
solana_client::{
|
||||||
rpc_client::RpcClient,
|
pubsub_client::PubsubClient,
|
||||||
rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig},
|
rpc_client::RpcClient,
|
||||||
rpc_response::SlotInfo,
|
rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig},
|
||||||
};
|
rpc_response::SlotInfo,
|
||||||
use solana_rpc::{
|
|
||||||
optimistically_confirmed_bank_tracker::OptimisticallyConfirmedBank,
|
|
||||||
rpc_pubsub_service::{PubSubConfig, PubSubService},
|
|
||||||
rpc_subscriptions::RpcSubscriptions,
|
|
||||||
};
|
|
||||||
use solana_runtime::{
|
|
||||||
bank::Bank,
|
|
||||||
bank_forks::BankForks,
|
|
||||||
commitment::{BlockCommitmentCache, CommitmentSlots},
|
|
||||||
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
|
||||||
};
|
|
||||||
use solana_sdk::{
|
|
||||||
clock::Slot,
|
|
||||||
commitment_config::CommitmentConfig,
|
|
||||||
native_token::sol_to_lamports,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
rpc_port,
|
|
||||||
signature::{Keypair, Signer},
|
|
||||||
system_program, system_transaction,
|
|
||||||
};
|
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
|
||||||
use solana_test_validator::TestValidator;
|
|
||||||
use std::{
|
|
||||||
collections::HashSet,
|
|
||||||
net::{IpAddr, SocketAddr},
|
|
||||||
sync::{
|
|
||||||
atomic::{AtomicBool, Ordering},
|
|
||||||
Arc, RwLock,
|
|
||||||
},
|
},
|
||||||
thread::sleep,
|
solana_rpc::{
|
||||||
time::{Duration, Instant},
|
optimistically_confirmed_bank_tracker::OptimisticallyConfirmedBank,
|
||||||
|
rpc_pubsub_service::{PubSubConfig, PubSubService},
|
||||||
|
rpc_subscriptions::RpcSubscriptions,
|
||||||
|
},
|
||||||
|
solana_runtime::{
|
||||||
|
bank::Bank,
|
||||||
|
bank_forks::BankForks,
|
||||||
|
commitment::{BlockCommitmentCache, CommitmentSlots},
|
||||||
|
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||||
|
},
|
||||||
|
solana_sdk::{
|
||||||
|
clock::Slot,
|
||||||
|
commitment_config::CommitmentConfig,
|
||||||
|
native_token::sol_to_lamports,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
rpc_port,
|
||||||
|
signature::{Keypair, Signer},
|
||||||
|
system_program, system_transaction,
|
||||||
|
},
|
||||||
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
|
solana_test_validator::TestValidator,
|
||||||
|
std::{
|
||||||
|
collections::HashSet,
|
||||||
|
net::{IpAddr, SocketAddr},
|
||||||
|
sync::{
|
||||||
|
atomic::{AtomicBool, Ordering},
|
||||||
|
Arc, RwLock,
|
||||||
|
},
|
||||||
|
thread::sleep,
|
||||||
|
time::{Duration, Instant},
|
||||||
|
},
|
||||||
|
systemstat::Ipv4Addr,
|
||||||
};
|
};
|
||||||
use systemstat::Ipv4Addr;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rpc_client() {
|
fn test_rpc_client() {
|
||||||
|
@ -183,17 +183,19 @@ impl Default for BlockhashQuery {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use crate::{
|
super::*,
|
||||||
blockhash_query,
|
crate::{
|
||||||
rpc_request::RpcRequest,
|
blockhash_query,
|
||||||
rpc_response::{Response, RpcFeeCalculator, RpcFees, RpcResponseContext},
|
rpc_request::RpcRequest,
|
||||||
|
rpc_response::{Response, RpcFeeCalculator, RpcFees, RpcResponseContext},
|
||||||
|
},
|
||||||
|
clap::App,
|
||||||
|
serde_json::{self, json},
|
||||||
|
solana_account_decoder::{UiAccount, UiAccountEncoding},
|
||||||
|
solana_sdk::{account::Account, hash::hash, nonce, system_program},
|
||||||
|
std::collections::HashMap,
|
||||||
};
|
};
|
||||||
use clap::App;
|
|
||||||
use serde_json::{self, json};
|
|
||||||
use solana_account_decoder::{UiAccount, UiAccountEncoding};
|
|
||||||
use solana_sdk::{account::Account, hash::hash, nonce, system_program};
|
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_blockhash_query_new_ok() {
|
fn test_blockhash_query_new_ok() {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
pub use reqwest;
|
||||||
use {
|
use {
|
||||||
crate::{rpc_request, rpc_response},
|
crate::{rpc_request, rpc_response},
|
||||||
solana_faucet::faucet::FaucetError,
|
solana_faucet::faucet::FaucetError,
|
||||||
@ -6,9 +7,7 @@ use {
|
|||||||
},
|
},
|
||||||
std::io,
|
std::io,
|
||||||
thiserror::Error,
|
thiserror::Error,
|
||||||
};
|
}; // export `reqwest` for clients
|
||||||
|
|
||||||
pub use reqwest; // export `reqwest` for clients
|
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum ClientErrorKind {
|
pub enum ClientErrorKind {
|
||||||
|
@ -16,8 +16,7 @@ use {
|
|||||||
client_error::{ClientError, ClientErrorKind, Result as ClientResult},
|
client_error::{ClientError, ClientErrorKind, Result as ClientResult},
|
||||||
http_sender::HttpSender,
|
http_sender::HttpSender,
|
||||||
mock_sender::{MockSender, Mocks},
|
mock_sender::{MockSender, Mocks},
|
||||||
rpc_config::RpcAccountInfoConfig,
|
rpc_config::{RpcAccountInfoConfig, *},
|
||||||
rpc_config::*,
|
|
||||||
rpc_request::{RpcError, RpcRequest, RpcResponseErrorData, TokenAccountsFilter},
|
rpc_request::{RpcError, RpcRequest, RpcResponseErrorData, TokenAccountsFilter},
|
||||||
rpc_response::*,
|
rpc_response::*,
|
||||||
rpc_sender::*,
|
rpc_sender::*,
|
||||||
@ -4937,19 +4936,21 @@ pub fn create_rpc_client_mocks() -> crate::mock_sender::Mocks {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use crate::{client_error::ClientErrorKind, mock_sender::PUBKEY};
|
super::*,
|
||||||
use assert_matches::assert_matches;
|
crate::{client_error::ClientErrorKind, mock_sender::PUBKEY},
|
||||||
use jsonrpc_core::{futures::prelude::*, Error, IoHandler, Params};
|
assert_matches::assert_matches,
|
||||||
use jsonrpc_http_server::{AccessControlAllowOrigin, DomainsValidation, ServerBuilder};
|
jsonrpc_core::{futures::prelude::*, Error, IoHandler, Params},
|
||||||
use serde_json::Number;
|
jsonrpc_http_server::{AccessControlAllowOrigin, DomainsValidation, ServerBuilder},
|
||||||
use solana_sdk::{
|
serde_json::Number,
|
||||||
instruction::InstructionError,
|
solana_sdk::{
|
||||||
signature::{Keypair, Signer},
|
instruction::InstructionError,
|
||||||
system_transaction,
|
signature::{Keypair, Signer},
|
||||||
transaction::TransactionError,
|
system_transaction,
|
||||||
|
transaction::TransactionError,
|
||||||
|
},
|
||||||
|
std::{io, sync::mpsc::channel, thread},
|
||||||
};
|
};
|
||||||
use std::{io, sync::mpsc::channel, thread};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_send() {
|
fn test_send() {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
//! Implementation defined RPC server errors
|
//! Implementation defined RPC server errors
|
||||||
use thiserror::Error;
|
|
||||||
use {
|
use {
|
||||||
crate::rpc_response::RpcSimulateTransactionResult,
|
crate::rpc_response::RpcSimulateTransactionResult,
|
||||||
jsonrpc_core::{Error, ErrorCode},
|
jsonrpc_core::{Error, ErrorCode},
|
||||||
solana_sdk::clock::Slot,
|
solana_sdk::clock::Slot,
|
||||||
|
thiserror::Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: i64 = -32001;
|
pub const JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: i64 = -32001;
|
||||||
|
@ -267,9 +267,11 @@ pub enum TokenAccountsFilter {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use crate::rpc_config::RpcTokenAccountsFilter;
|
super::*,
|
||||||
use solana_sdk::commitment_config::{CommitmentConfig, CommitmentLevel};
|
crate::rpc_config::RpcTokenAccountsFilter,
|
||||||
|
solana_sdk::commitment_config::{CommitmentConfig, CommitmentLevel},
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_build_request_json() {
|
fn test_build_request_json() {
|
||||||
|
@ -667,8 +667,7 @@ pub fn create_client_with_timeout(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {super::*, rayon::prelude::*};
|
||||||
use rayon::prelude::*;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_client_optimizer() {
|
fn test_client_optimizer() {
|
||||||
|
@ -1,34 +1,36 @@
|
|||||||
use crate::{
|
use {
|
||||||
client_error::ClientError,
|
crate::{
|
||||||
pubsub_client::{PubsubClient, PubsubClientError, PubsubClientSubscription},
|
client_error::ClientError,
|
||||||
rpc_client::RpcClient,
|
pubsub_client::{PubsubClient, PubsubClientError, PubsubClientSubscription},
|
||||||
rpc_request::MAX_GET_SIGNATURE_STATUSES_QUERY_ITEMS,
|
rpc_client::RpcClient,
|
||||||
rpc_response::SlotUpdate,
|
rpc_request::MAX_GET_SIGNATURE_STATUSES_QUERY_ITEMS,
|
||||||
spinner,
|
rpc_response::SlotUpdate,
|
||||||
};
|
spinner,
|
||||||
use bincode::serialize;
|
|
||||||
use log::*;
|
|
||||||
use solana_sdk::{
|
|
||||||
clock::Slot,
|
|
||||||
commitment_config::CommitmentConfig,
|
|
||||||
message::Message,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
signature::SignerError,
|
|
||||||
signers::Signers,
|
|
||||||
transaction::{Transaction, TransactionError},
|
|
||||||
};
|
|
||||||
use std::{
|
|
||||||
collections::{HashMap, HashSet, VecDeque},
|
|
||||||
net::{SocketAddr, UdpSocket},
|
|
||||||
str::FromStr,
|
|
||||||
sync::{
|
|
||||||
atomic::{AtomicBool, Ordering},
|
|
||||||
Arc, RwLock,
|
|
||||||
},
|
},
|
||||||
thread::{sleep, JoinHandle},
|
bincode::serialize,
|
||||||
time::{Duration, Instant},
|
log::*,
|
||||||
|
solana_sdk::{
|
||||||
|
clock::Slot,
|
||||||
|
commitment_config::CommitmentConfig,
|
||||||
|
message::Message,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
signature::SignerError,
|
||||||
|
signers::Signers,
|
||||||
|
transaction::{Transaction, TransactionError},
|
||||||
|
},
|
||||||
|
std::{
|
||||||
|
collections::{HashMap, HashSet, VecDeque},
|
||||||
|
net::{SocketAddr, UdpSocket},
|
||||||
|
str::FromStr,
|
||||||
|
sync::{
|
||||||
|
atomic::{AtomicBool, Ordering},
|
||||||
|
Arc, RwLock,
|
||||||
|
},
|
||||||
|
thread::{sleep, JoinHandle},
|
||||||
|
time::{Duration, Instant},
|
||||||
|
},
|
||||||
|
thiserror::Error,
|
||||||
};
|
};
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum TpuSenderError {
|
pub enum TpuSenderError {
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
#![allow(clippy::integer_arithmetic)]
|
#![allow(clippy::integer_arithmetic)]
|
||||||
use crate::rpc_client::RpcClient;
|
use {
|
||||||
use log::*;
|
crate::rpc_client::RpcClient,
|
||||||
use solana_measure::measure::Measure;
|
log::*,
|
||||||
use solana_sdk::{
|
solana_measure::measure::Measure,
|
||||||
commitment_config::CommitmentConfig, signature::Signature, timing::timestamp,
|
solana_sdk::{
|
||||||
transaction::Transaction,
|
commitment_config::CommitmentConfig, signature::Signature, timing::timestamp,
|
||||||
};
|
transaction::Transaction,
|
||||||
use std::{
|
},
|
||||||
net::SocketAddr,
|
std::{
|
||||||
sync::{
|
net::SocketAddr,
|
||||||
atomic::{AtomicBool, AtomicU64, Ordering},
|
sync::{
|
||||||
Arc, RwLock,
|
atomic::{AtomicBool, AtomicU64, Ordering},
|
||||||
|
Arc, RwLock,
|
||||||
|
},
|
||||||
|
thread::{sleep, Builder, JoinHandle},
|
||||||
|
time::{Duration, Instant},
|
||||||
},
|
},
|
||||||
thread::{sleep, Builder, JoinHandle},
|
|
||||||
time::{Duration, Instant},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// signature, timestamp, id
|
// signature, timestamp, id
|
||||||
|
@ -3,41 +3,44 @@
|
|||||||
|
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
use crossbeam_channel::unbounded;
|
use {
|
||||||
use log::*;
|
crossbeam_channel::unbounded,
|
||||||
use rand::{thread_rng, Rng};
|
log::*,
|
||||||
use rayon::prelude::*;
|
rand::{thread_rng, Rng},
|
||||||
use solana_core::banking_stage::{BankingStage, BankingStageStats};
|
rayon::prelude::*,
|
||||||
use solana_core::qos_service::QosService;
|
solana_core::{
|
||||||
use solana_entry::entry::{next_hash, Entry};
|
banking_stage::{BankingStage, BankingStageStats},
|
||||||
use solana_gossip::cluster_info::ClusterInfo;
|
qos_service::QosService,
|
||||||
use solana_gossip::cluster_info::Node;
|
},
|
||||||
use solana_ledger::blockstore_processor::process_entries_for_tests;
|
solana_entry::entry::{next_hash, Entry},
|
||||||
use solana_ledger::genesis_utils::{create_genesis_config, GenesisConfigInfo};
|
solana_gossip::cluster_info::{ClusterInfo, Node},
|
||||||
use solana_ledger::{blockstore::Blockstore, get_tmp_ledger_path};
|
solana_ledger::{
|
||||||
use solana_perf::packet::to_packets_chunked;
|
blockstore::Blockstore,
|
||||||
use solana_perf::test_tx::test_tx;
|
blockstore_processor::process_entries_for_tests,
|
||||||
use solana_poh::poh_recorder::{create_test_recorder, WorkingBankEntry};
|
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||||
use solana_runtime::bank::Bank;
|
get_tmp_ledger_path,
|
||||||
use solana_runtime::cost_model::CostModel;
|
},
|
||||||
use solana_sdk::genesis_config::GenesisConfig;
|
solana_perf::{packet::to_packets_chunked, test_tx::test_tx},
|
||||||
use solana_sdk::hash::Hash;
|
solana_poh::poh_recorder::{create_test_recorder, WorkingBankEntry},
|
||||||
use solana_sdk::message::Message;
|
solana_runtime::{bank::Bank, cost_model::CostModel},
|
||||||
use solana_sdk::pubkey;
|
solana_sdk::{
|
||||||
use solana_sdk::signature::Keypair;
|
genesis_config::GenesisConfig,
|
||||||
use solana_sdk::signature::Signature;
|
hash::Hash,
|
||||||
use solana_sdk::signature::Signer;
|
message::Message,
|
||||||
use solana_sdk::system_instruction;
|
pubkey,
|
||||||
use solana_sdk::system_transaction;
|
signature::{Keypair, Signature, Signer},
|
||||||
use solana_sdk::timing::{duration_as_us, timestamp};
|
system_instruction, system_transaction,
|
||||||
use solana_sdk::transaction::{Transaction, VersionedTransaction};
|
timing::{duration_as_us, timestamp},
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
transaction::{Transaction, VersionedTransaction},
|
||||||
use std::collections::VecDeque;
|
},
|
||||||
use std::sync::atomic::Ordering;
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
use std::sync::mpsc::Receiver;
|
std::{
|
||||||
use std::sync::{Arc, RwLock};
|
collections::VecDeque,
|
||||||
use std::time::{Duration, Instant};
|
sync::{atomic::Ordering, mpsc::Receiver, Arc, RwLock},
|
||||||
use test::Bencher;
|
time::{Duration, Instant},
|
||||||
|
},
|
||||||
|
test::Bencher,
|
||||||
|
};
|
||||||
|
|
||||||
fn check_txs(receiver: &Arc<Receiver<WorkingBankEntry>>, ref_tx_count: usize) {
|
fn check_txs(receiver: &Arc<Receiver<WorkingBankEntry>>, ref_tx_count: usize) {
|
||||||
let mut total = 0;
|
let mut total = 0;
|
||||||
|
@ -7,8 +7,7 @@ use {
|
|||||||
solana_core::{
|
solana_core::{
|
||||||
consensus::Tower, tower_storage::FileTowerStorage, vote_simulator::VoteSimulator,
|
consensus::Tower, tower_storage::FileTowerStorage, vote_simulator::VoteSimulator,
|
||||||
},
|
},
|
||||||
solana_runtime::bank::Bank,
|
solana_runtime::{bank::Bank, bank_forks::BankForks},
|
||||||
solana_runtime::bank_forks::BankForks,
|
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
pubkey::Pubkey,
|
pubkey::Pubkey,
|
||||||
signature::{Keypair, Signer},
|
signature::{Keypair, Signer},
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
use solana_core::gen_keys::GenKeys;
|
use {solana_core::gen_keys::GenKeys, test::Bencher};
|
||||||
use test::Bencher;
|
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_gen_keys(b: &mut Bencher) {
|
fn bench_gen_keys(b: &mut Bencher) {
|
||||||
|
@ -3,18 +3,19 @@
|
|||||||
|
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
use rand::seq::SliceRandom;
|
use {
|
||||||
use raptorq::{Decoder, Encoder};
|
rand::seq::SliceRandom,
|
||||||
use solana_entry::entry::{create_ticks, Entry};
|
raptorq::{Decoder, Encoder},
|
||||||
use solana_ledger::shred::{
|
solana_entry::entry::{create_ticks, Entry},
|
||||||
max_entries_per_n_shred, max_ticks_per_n_shreds, ProcessShredsStats, Shred, Shredder,
|
solana_ledger::shred::{
|
||||||
MAX_DATA_SHREDS_PER_FEC_BLOCK, SHRED_PAYLOAD_SIZE, SIZE_OF_CODING_SHRED_HEADERS,
|
max_entries_per_n_shred, max_ticks_per_n_shreds, ProcessShredsStats, Shred, Shredder,
|
||||||
SIZE_OF_DATA_SHRED_PAYLOAD,
|
MAX_DATA_SHREDS_PER_FEC_BLOCK, SHRED_PAYLOAD_SIZE, SIZE_OF_CODING_SHRED_HEADERS,
|
||||||
|
SIZE_OF_DATA_SHRED_PAYLOAD,
|
||||||
|
},
|
||||||
|
solana_perf::test_tx,
|
||||||
|
solana_sdk::{hash::Hash, signature::Keypair},
|
||||||
|
test::Bencher,
|
||||||
};
|
};
|
||||||
use solana_perf::test_tx;
|
|
||||||
use solana_sdk::hash::Hash;
|
|
||||||
use solana_sdk::signature::Keypair;
|
|
||||||
use test::Bencher;
|
|
||||||
|
|
||||||
fn make_test_entry(txs_per_entry: u64) -> Entry {
|
fn make_test_entry(txs_per_entry: u64) -> Entry {
|
||||||
Entry {
|
Entry {
|
||||||
|
@ -3,20 +3,24 @@
|
|||||||
extern crate solana_core;
|
extern crate solana_core;
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
use crossbeam_channel::unbounded;
|
use {
|
||||||
use log::*;
|
crossbeam_channel::unbounded,
|
||||||
use rand::{thread_rng, Rng};
|
log::*,
|
||||||
use solana_core::sigverify::TransactionSigVerifier;
|
rand::{thread_rng, Rng},
|
||||||
use solana_core::sigverify_stage::SigVerifyStage;
|
solana_core::{sigverify::TransactionSigVerifier, sigverify_stage::SigVerifyStage},
|
||||||
use solana_perf::packet::to_packets_chunked;
|
solana_perf::{packet::to_packets_chunked, test_tx::test_tx},
|
||||||
use solana_perf::test_tx::test_tx;
|
solana_sdk::{
|
||||||
use solana_sdk::hash::Hash;
|
hash::Hash,
|
||||||
use solana_sdk::signature::{Keypair, Signer};
|
signature::{Keypair, Signer},
|
||||||
use solana_sdk::system_transaction;
|
system_transaction,
|
||||||
use solana_sdk::timing::duration_as_ms;
|
timing::duration_as_ms,
|
||||||
use std::sync::mpsc::channel;
|
},
|
||||||
use std::time::{Duration, Instant};
|
std::{
|
||||||
use test::Bencher;
|
sync::mpsc::channel,
|
||||||
|
time::{Duration, Instant},
|
||||||
|
},
|
||||||
|
test::Bencher,
|
||||||
|
};
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_packet_discard(bencher: &mut Bencher) {
|
fn bench_packet_discard(bencher: &mut Bencher) {
|
||||||
|
@ -4,30 +4,32 @@
|
|||||||
// hash on gossip. Monitor gossip for messages from validators in the `--known-validator`s
|
// hash on gossip. Monitor gossip for messages from validators in the `--known-validator`s
|
||||||
// set and halt the node if a mismatch is detected.
|
// set and halt the node if a mismatch is detected.
|
||||||
|
|
||||||
use rayon::ThreadPool;
|
use {
|
||||||
use solana_gossip::cluster_info::{ClusterInfo, MAX_SNAPSHOT_HASHES};
|
rayon::ThreadPool,
|
||||||
use solana_measure::measure::Measure;
|
solana_gossip::cluster_info::{ClusterInfo, MAX_SNAPSHOT_HASHES},
|
||||||
use solana_runtime::{
|
solana_measure::measure::Measure,
|
||||||
accounts_db::{self, AccountsDb},
|
solana_runtime::{
|
||||||
accounts_hash::HashStats,
|
accounts_db::{self, AccountsDb},
|
||||||
snapshot_config::SnapshotConfig,
|
accounts_hash::HashStats,
|
||||||
snapshot_package::{
|
snapshot_config::SnapshotConfig,
|
||||||
AccountsPackage, AccountsPackageReceiver, PendingSnapshotPackage, SnapshotPackage,
|
snapshot_package::{
|
||||||
SnapshotType,
|
AccountsPackage, AccountsPackageReceiver, PendingSnapshotPackage, SnapshotPackage,
|
||||||
|
SnapshotType,
|
||||||
|
},
|
||||||
|
sorted_storages::SortedStorages,
|
||||||
},
|
},
|
||||||
sorted_storages::SortedStorages,
|
solana_sdk::{clock::Slot, hash::Hash, pubkey::Pubkey},
|
||||||
};
|
std::{
|
||||||
use solana_sdk::{clock::Slot, hash::Hash, pubkey::Pubkey};
|
collections::{HashMap, HashSet},
|
||||||
use std::collections::{HashMap, HashSet};
|
path::{Path, PathBuf},
|
||||||
use std::{
|
sync::{
|
||||||
path::{Path, PathBuf},
|
atomic::{AtomicBool, Ordering},
|
||||||
sync::{
|
mpsc::RecvTimeoutError,
|
||||||
atomic::{AtomicBool, Ordering},
|
Arc,
|
||||||
mpsc::RecvTimeoutError,
|
},
|
||||||
Arc,
|
thread::{self, Builder, JoinHandle},
|
||||||
|
time::Duration,
|
||||||
},
|
},
|
||||||
thread::{self, Builder, JoinHandle},
|
|
||||||
time::Duration,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct AccountsHashVerifier {
|
pub struct AccountsHashVerifier {
|
||||||
@ -163,8 +165,10 @@ impl AccountsHashVerifier {
|
|||||||
&& accounts_package.slot % fault_injection_rate_slots == 0
|
&& accounts_package.slot % fault_injection_rate_slots == 0
|
||||||
{
|
{
|
||||||
// For testing, publish an invalid hash to gossip.
|
// For testing, publish an invalid hash to gossip.
|
||||||
use rand::{thread_rng, Rng};
|
use {
|
||||||
use solana_sdk::hash::extend_and_hash;
|
rand::{thread_rng, Rng},
|
||||||
|
solana_sdk::hash::extend_and_hash,
|
||||||
|
};
|
||||||
warn!("inserting fault at slot: {}", accounts_package.slot);
|
warn!("inserting fault at slot: {}", accounts_package.slot);
|
||||||
let rand = thread_rng().gen_range(0, 10);
|
let rand = thread_rng().gen_range(0, 10);
|
||||||
let hash = extend_and_hash(&hash, &[rand]);
|
let hash = extend_and_hash(&hash, &[rand]);
|
||||||
@ -277,15 +281,17 @@ impl AccountsHashVerifier {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use solana_gossip::{cluster_info::make_accounts_hashes_message, contact_info::ContactInfo};
|
super::*,
|
||||||
use solana_runtime::snapshot_utils::{ArchiveFormat, SnapshotVersion};
|
solana_gossip::{cluster_info::make_accounts_hashes_message, contact_info::ContactInfo},
|
||||||
use solana_sdk::{
|
solana_runtime::snapshot_utils::{ArchiveFormat, SnapshotVersion},
|
||||||
genesis_config::ClusterType,
|
solana_sdk::{
|
||||||
hash::hash,
|
genesis_config::ClusterType,
|
||||||
signature::{Keypair, Signer},
|
hash::hash,
|
||||||
|
signature::{Keypair, Signer},
|
||||||
|
},
|
||||||
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
};
|
};
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
|
||||||
|
|
||||||
fn new_test_cluster_info(contact_info: ContactInfo) -> ClusterInfo {
|
fn new_test_cluster_info(contact_info: ContactInfo) -> ClusterInfo {
|
||||||
ClusterInfo::new(
|
ClusterInfo::new(
|
||||||
@ -331,8 +337,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_max_hashes() {
|
fn test_max_hashes() {
|
||||||
solana_logger::setup();
|
solana_logger::setup();
|
||||||
use std::path::PathBuf;
|
use {std::path::PathBuf, tempfile::TempDir};
|
||||||
use tempfile::TempDir;
|
|
||||||
let keypair = Keypair::new();
|
let keypair = Keypair::new();
|
||||||
|
|
||||||
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), 0);
|
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), 0);
|
||||||
|
@ -1,38 +1,40 @@
|
|||||||
use crate::{
|
use {
|
||||||
cluster_slots::ClusterSlots,
|
crate::{
|
||||||
duplicate_repair_status::{DeadSlotAncestorRequestStatus, DuplicateAncestorDecision},
|
cluster_slots::ClusterSlots,
|
||||||
outstanding_requests::OutstandingRequests,
|
duplicate_repair_status::{DeadSlotAncestorRequestStatus, DuplicateAncestorDecision},
|
||||||
repair_response::{self},
|
outstanding_requests::OutstandingRequests,
|
||||||
repair_service::{DuplicateSlotsResetSender, RepairInfo, RepairStatsGroup},
|
repair_response::{self},
|
||||||
replay_stage::DUPLICATE_THRESHOLD,
|
repair_service::{DuplicateSlotsResetSender, RepairInfo, RepairStatsGroup},
|
||||||
result::{Error, Result},
|
replay_stage::DUPLICATE_THRESHOLD,
|
||||||
serve_repair::{AncestorHashesRepairType, ServeRepair},
|
result::{Error, Result},
|
||||||
};
|
serve_repair::{AncestorHashesRepairType, ServeRepair},
|
||||||
use crossbeam_channel::{unbounded, Receiver, Sender};
|
},
|
||||||
use dashmap::{mapref::entry::Entry::Occupied, DashMap};
|
crossbeam_channel::{unbounded, Receiver, Sender},
|
||||||
use solana_ledger::{blockstore::Blockstore, shred::SIZE_OF_NONCE};
|
dashmap::{mapref::entry::Entry::Occupied, DashMap},
|
||||||
use solana_measure::measure::Measure;
|
solana_ledger::{blockstore::Blockstore, shred::SIZE_OF_NONCE},
|
||||||
use solana_perf::{
|
solana_measure::measure::Measure,
|
||||||
packet::{limited_deserialize, Packet, Packets},
|
solana_perf::{
|
||||||
recycler::Recycler,
|
packet::{limited_deserialize, Packet, Packets},
|
||||||
};
|
recycler::Recycler,
|
||||||
use solana_runtime::bank::Bank;
|
},
|
||||||
use solana_sdk::{
|
solana_runtime::bank::Bank,
|
||||||
clock::{Slot, SLOT_MS},
|
solana_sdk::{
|
||||||
pubkey::Pubkey,
|
clock::{Slot, SLOT_MS},
|
||||||
timing::timestamp,
|
pubkey::Pubkey,
|
||||||
};
|
timing::timestamp,
|
||||||
use solana_streamer::streamer::{self, PacketReceiver};
|
},
|
||||||
use std::{
|
solana_streamer::streamer::{self, PacketReceiver},
|
||||||
collections::HashSet,
|
std::{
|
||||||
net::UdpSocket,
|
collections::HashSet,
|
||||||
sync::{
|
net::UdpSocket,
|
||||||
atomic::{AtomicBool, Ordering},
|
sync::{
|
||||||
mpsc::channel,
|
atomic::{AtomicBool, Ordering},
|
||||||
{Arc, RwLock},
|
mpsc::channel,
|
||||||
|
Arc, RwLock,
|
||||||
|
},
|
||||||
|
thread::{self, sleep, Builder, JoinHandle},
|
||||||
|
time::{Duration, Instant},
|
||||||
},
|
},
|
||||||
thread::{self, sleep, Builder, JoinHandle},
|
|
||||||
time::{Duration, Instant},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
@ -681,27 +683,29 @@ impl AncestorHashesService {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use {
|
||||||
use crate::{
|
super::*,
|
||||||
cluster_slot_state_verifier::DuplicateSlotsToRepair,
|
crate::{
|
||||||
repair_service::DuplicateSlotsResetReceiver,
|
cluster_slot_state_verifier::DuplicateSlotsToRepair,
|
||||||
replay_stage::{
|
repair_service::DuplicateSlotsResetReceiver,
|
||||||
tests::{replay_blockstore_components, ReplayBlockstoreComponents},
|
replay_stage::{
|
||||||
ReplayStage,
|
tests::{replay_blockstore_components, ReplayBlockstoreComponents},
|
||||||
|
ReplayStage,
|
||||||
|
},
|
||||||
|
serve_repair::MAX_ANCESTOR_RESPONSES,
|
||||||
|
vote_simulator::VoteSimulator,
|
||||||
},
|
},
|
||||||
serve_repair::MAX_ANCESTOR_RESPONSES,
|
solana_gossip::{
|
||||||
vote_simulator::VoteSimulator,
|
cluster_info::{ClusterInfo, Node},
|
||||||
|
contact_info::ContactInfo,
|
||||||
|
},
|
||||||
|
solana_ledger::{blockstore::make_many_slot_entries, get_tmp_ledger_path},
|
||||||
|
solana_runtime::{accounts_background_service::AbsRequestSender, bank_forks::BankForks},
|
||||||
|
solana_sdk::{hash::Hash, signature::Keypair},
|
||||||
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
|
std::{collections::HashMap, sync::mpsc::channel},
|
||||||
|
trees::tr,
|
||||||
};
|
};
|
||||||
use solana_gossip::{
|
|
||||||
cluster_info::{ClusterInfo, Node},
|
|
||||||
contact_info::ContactInfo,
|
|
||||||
};
|
|
||||||
use solana_ledger::{blockstore::make_many_slot_entries, get_tmp_ledger_path};
|
|
||||||
use solana_runtime::{accounts_background_service::AbsRequestSender, bank_forks::BankForks};
|
|
||||||
use solana_sdk::{hash::Hash, signature::Keypair};
|
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
|
||||||
use std::{collections::HashMap, sync::mpsc::channel};
|
|
||||||
use trees::tr;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_ancestor_hashes_service_process_replay_updates() {
|
pub fn test_ancestor_hashes_service_process_replay_updates() {
|
||||||
|
@ -1,63 +1,66 @@
|
|||||||
//! The `banking_stage` processes Transaction messages. It is intended to be used
|
//! The `banking_stage` processes Transaction messages. It is intended to be used
|
||||||
//! to contruct a software pipeline. The stage uses all available CPU cores and
|
//! to contruct a software pipeline. The stage uses all available CPU cores and
|
||||||
//! can do its processing in parallel with signature verification on the GPU.
|
//! can do its processing in parallel with signature verification on the GPU.
|
||||||
use crate::{packet_hasher::PacketHasher, qos_service::QosService};
|
use {
|
||||||
use crossbeam_channel::{Receiver as CrossbeamReceiver, RecvTimeoutError};
|
crate::{packet_hasher::PacketHasher, qos_service::QosService},
|
||||||
use itertools::Itertools;
|
crossbeam_channel::{Receiver as CrossbeamReceiver, RecvTimeoutError},
|
||||||
use lru::LruCache;
|
itertools::Itertools,
|
||||||
use retain_mut::RetainMut;
|
lru::LruCache,
|
||||||
use solana_entry::entry::hash_transactions;
|
retain_mut::RetainMut,
|
||||||
use solana_gossip::{cluster_info::ClusterInfo, contact_info::ContactInfo};
|
solana_entry::entry::hash_transactions,
|
||||||
use solana_ledger::blockstore_processor::TransactionStatusSender;
|
solana_gossip::{cluster_info::ClusterInfo, contact_info::ContactInfo},
|
||||||
use solana_measure::measure::Measure;
|
solana_ledger::blockstore_processor::TransactionStatusSender,
|
||||||
use solana_metrics::{inc_new_counter_debug, inc_new_counter_info};
|
solana_measure::measure::Measure,
|
||||||
use solana_perf::{
|
solana_metrics::{inc_new_counter_debug, inc_new_counter_info},
|
||||||
cuda_runtime::PinnedVec,
|
solana_perf::{
|
||||||
data_budget::DataBudget,
|
cuda_runtime::PinnedVec,
|
||||||
packet::{limited_deserialize, Packet, Packets, PACKETS_PER_BATCH},
|
data_budget::DataBudget,
|
||||||
perf_libs,
|
packet::{limited_deserialize, Packet, Packets, PACKETS_PER_BATCH},
|
||||||
};
|
perf_libs,
|
||||||
use solana_poh::poh_recorder::{BankStart, PohRecorder, PohRecorderError, TransactionRecorder};
|
|
||||||
use solana_runtime::{
|
|
||||||
accounts_db::ErrorCounters,
|
|
||||||
bank::{
|
|
||||||
Bank, ExecuteTimings, TransactionBalancesSet, TransactionCheckResult,
|
|
||||||
TransactionExecutionResult,
|
|
||||||
},
|
},
|
||||||
bank_utils,
|
solana_poh::poh_recorder::{BankStart, PohRecorder, PohRecorderError, TransactionRecorder},
|
||||||
cost_model::CostModel,
|
solana_runtime::{
|
||||||
transaction_batch::TransactionBatch,
|
accounts_db::ErrorCounters,
|
||||||
vote_sender_types::ReplayVoteSender,
|
bank::{
|
||||||
};
|
Bank, ExecuteTimings, TransactionBalancesSet, TransactionCheckResult,
|
||||||
use solana_sdk::{
|
TransactionExecutionResult,
|
||||||
clock::{
|
},
|
||||||
Slot, DEFAULT_TICKS_PER_SLOT, MAX_PROCESSING_AGE, MAX_TRANSACTION_FORWARDING_DELAY,
|
bank_utils,
|
||||||
MAX_TRANSACTION_FORWARDING_DELAY_GPU,
|
cost_model::CostModel,
|
||||||
|
transaction_batch::TransactionBatch,
|
||||||
|
vote_sender_types::ReplayVoteSender,
|
||||||
|
},
|
||||||
|
solana_sdk::{
|
||||||
|
clock::{
|
||||||
|
Slot, DEFAULT_TICKS_PER_SLOT, MAX_PROCESSING_AGE, MAX_TRANSACTION_FORWARDING_DELAY,
|
||||||
|
MAX_TRANSACTION_FORWARDING_DELAY_GPU,
|
||||||
|
},
|
||||||
|
feature_set,
|
||||||
|
message::Message,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
short_vec::decode_shortu16_len,
|
||||||
|
signature::Signature,
|
||||||
|
timing::{duration_as_ms, timestamp, AtomicInterval},
|
||||||
|
transaction::{self, SanitizedTransaction, TransactionError, VersionedTransaction},
|
||||||
|
},
|
||||||
|
solana_streamer::sendmmsg::{batch_send, SendPktsError},
|
||||||
|
solana_transaction_status::token_balances::{
|
||||||
|
collect_token_balances, TransactionTokenBalancesSet,
|
||||||
|
},
|
||||||
|
std::{
|
||||||
|
cmp,
|
||||||
|
collections::{HashMap, VecDeque},
|
||||||
|
env,
|
||||||
|
mem::size_of,
|
||||||
|
net::{SocketAddr, UdpSocket},
|
||||||
|
ops::DerefMut,
|
||||||
|
sync::{
|
||||||
|
atomic::{AtomicU64, AtomicUsize, Ordering},
|
||||||
|
Arc, Mutex, RwLock,
|
||||||
|
},
|
||||||
|
thread::{self, Builder, JoinHandle},
|
||||||
|
time::{Duration, Instant},
|
||||||
},
|
},
|
||||||
feature_set,
|
|
||||||
message::Message,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
short_vec::decode_shortu16_len,
|
|
||||||
signature::Signature,
|
|
||||||
timing::{duration_as_ms, timestamp, AtomicInterval},
|
|
||||||
transaction::{self, SanitizedTransaction, TransactionError, VersionedTransaction},
|
|
||||||
};
|
|
||||||
use solana_streamer::sendmmsg::{batch_send, SendPktsError};
|
|
||||||
use solana_transaction_status::token_balances::{
|
|
||||||
collect_token_balances, TransactionTokenBalancesSet,
|
|
||||||
};
|
|
||||||
use std::{
|
|
||||||
cmp,
|
|
||||||
collections::{HashMap, VecDeque},
|
|
||||||
env,
|
|
||||||
mem::size_of,
|
|
||||||
net::{SocketAddr, UdpSocket},
|
|
||||||
ops::DerefMut,
|
|
||||||
sync::atomic::{AtomicU64, AtomicUsize, Ordering},
|
|
||||||
sync::{Arc, Mutex, RwLock},
|
|
||||||
thread::{self, Builder, JoinHandle},
|
|
||||||
time::Duration,
|
|
||||||
time::Instant,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// (packets, valid_indexes, forwarded)
|
/// (packets, valid_indexes, forwarded)
|
||||||
@ -1545,43 +1548,45 @@ where
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use crossbeam_channel::unbounded;
|
super::*,
|
||||||
use itertools::Itertools;
|
crossbeam_channel::unbounded,
|
||||||
use solana_entry::entry::{next_entry, Entry, EntrySlice};
|
itertools::Itertools,
|
||||||
use solana_gossip::{cluster_info::Node, contact_info::ContactInfo};
|
solana_entry::entry::{next_entry, Entry, EntrySlice},
|
||||||
use solana_ledger::{
|
solana_gossip::{cluster_info::Node, contact_info::ContactInfo},
|
||||||
blockstore::{entries_to_test_shreds, Blockstore},
|
solana_ledger::{
|
||||||
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
blockstore::{entries_to_test_shreds, Blockstore},
|
||||||
get_tmp_ledger_path,
|
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||||
leader_schedule_cache::LeaderScheduleCache,
|
get_tmp_ledger_path,
|
||||||
};
|
leader_schedule_cache::LeaderScheduleCache,
|
||||||
use solana_perf::packet::to_packets_chunked;
|
},
|
||||||
use solana_poh::{
|
solana_perf::packet::to_packets_chunked,
|
||||||
poh_recorder::{create_test_recorder, Record, WorkingBankEntry},
|
solana_poh::{
|
||||||
poh_service::PohService,
|
poh_recorder::{create_test_recorder, Record, WorkingBankEntry},
|
||||||
};
|
poh_service::PohService,
|
||||||
use solana_rpc::transaction_status_service::TransactionStatusService;
|
},
|
||||||
use solana_sdk::{
|
solana_rpc::transaction_status_service::TransactionStatusService,
|
||||||
hash::Hash,
|
solana_sdk::{
|
||||||
instruction::InstructionError,
|
hash::Hash,
|
||||||
poh_config::PohConfig,
|
instruction::InstructionError,
|
||||||
signature::{Keypair, Signer},
|
poh_config::PohConfig,
|
||||||
system_instruction::SystemError,
|
signature::{Keypair, Signer},
|
||||||
system_transaction,
|
system_instruction::SystemError,
|
||||||
transaction::{Transaction, TransactionError},
|
system_transaction,
|
||||||
};
|
transaction::{Transaction, TransactionError},
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
},
|
||||||
use solana_transaction_status::TransactionWithStatusMeta;
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
use solana_vote_program::vote_transaction;
|
solana_transaction_status::TransactionWithStatusMeta,
|
||||||
use std::{
|
solana_vote_program::vote_transaction,
|
||||||
net::SocketAddr,
|
std::{
|
||||||
path::Path,
|
net::SocketAddr,
|
||||||
sync::{
|
path::Path,
|
||||||
atomic::{AtomicBool, Ordering},
|
sync::{
|
||||||
mpsc::Receiver,
|
atomic::{AtomicBool, Ordering},
|
||||||
|
mpsc::Receiver,
|
||||||
|
},
|
||||||
|
thread::sleep,
|
||||||
},
|
},
|
||||||
thread::sleep,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fn new_test_cluster_info(contact_info: ContactInfo) -> ClusterInfo {
|
fn new_test_cluster_info(contact_info: ContactInfo) -> ClusterInfo {
|
||||||
|
@ -24,8 +24,10 @@ use {
|
|||||||
solana_poh::poh_recorder::WorkingBankEntry,
|
solana_poh::poh_recorder::WorkingBankEntry,
|
||||||
solana_runtime::{bank::Bank, bank_forks::BankForks},
|
solana_runtime::{bank::Bank, bank_forks::BankForks},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
|
clock::Slot,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
signature::Keypair,
|
||||||
timing::{timestamp, AtomicInterval},
|
timing::{timestamp, AtomicInterval},
|
||||||
{clock::Slot, pubkey::Pubkey, signature::Keypair},
|
|
||||||
},
|
},
|
||||||
solana_streamer::{
|
solana_streamer::{
|
||||||
sendmmsg::{batch_send, SendPktsError},
|
sendmmsg::{batch_send, SendPktsError},
|
||||||
@ -452,24 +454,28 @@ pub fn broadcast_shreds(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod test {
|
pub mod test {
|
||||||
use super::*;
|
use {
|
||||||
use crossbeam_channel::unbounded;
|
super::*,
|
||||||
use solana_entry::entry::create_ticks;
|
crossbeam_channel::unbounded,
|
||||||
use solana_gossip::cluster_info::{ClusterInfo, Node};
|
solana_entry::entry::create_ticks,
|
||||||
use solana_ledger::{
|
solana_gossip::cluster_info::{ClusterInfo, Node},
|
||||||
blockstore::{make_slot_entries, Blockstore},
|
solana_ledger::{
|
||||||
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
blockstore::{make_slot_entries, Blockstore},
|
||||||
get_tmp_ledger_path,
|
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||||
shred::{max_ticks_per_n_shreds, ProcessShredsStats, Shredder},
|
get_tmp_ledger_path,
|
||||||
};
|
shred::{max_ticks_per_n_shreds, ProcessShredsStats, Shredder},
|
||||||
use solana_runtime::bank::Bank;
|
},
|
||||||
use solana_sdk::{
|
solana_runtime::bank::Bank,
|
||||||
hash::Hash,
|
solana_sdk::{
|
||||||
pubkey::Pubkey,
|
hash::Hash,
|
||||||
signature::{Keypair, Signer},
|
pubkey::Pubkey,
|
||||||
};
|
signature::{Keypair, Signer},
|
||||||
use std::{
|
},
|
||||||
path::Path, sync::atomic::AtomicBool, sync::mpsc::channel, sync::Arc, thread::sleep,
|
std::{
|
||||||
|
path::Path,
|
||||||
|
sync::{atomic::AtomicBool, mpsc::channel, Arc},
|
||||||
|
thread::sleep,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[allow(clippy::implicit_hasher)]
|
#[allow(clippy::implicit_hasher)]
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
use super::*;
|
use {
|
||||||
use solana_entry::entry::Entry;
|
super::*,
|
||||||
use solana_ledger::shred::Shredder;
|
solana_entry::entry::Entry,
|
||||||
use solana_sdk::hash::Hash;
|
solana_ledger::shred::Shredder,
|
||||||
use solana_sdk::signature::Keypair;
|
solana_sdk::{hash::Hash, signature::Keypair},
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub(super) struct BroadcastFakeShredsRun {
|
pub(super) struct BroadcastFakeShredsRun {
|
||||||
@ -139,10 +140,12 @@ impl BroadcastRun for BroadcastFakeShredsRun {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use solana_gossip::contact_info::ContactInfo;
|
super::*,
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
solana_gossip::contact_info::ContactInfo,
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
|
std::net::{IpAddr, Ipv4Addr, SocketAddr},
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_tvu_peers_ordering() {
|
fn test_tvu_peers_ordering() {
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
use crate::result::Result;
|
use {
|
||||||
use solana_entry::entry::Entry;
|
crate::result::Result,
|
||||||
use solana_ledger::shred::Shred;
|
solana_entry::entry::Entry,
|
||||||
use solana_poh::poh_recorder::WorkingBankEntry;
|
solana_ledger::shred::Shred,
|
||||||
use solana_runtime::bank::Bank;
|
solana_poh::poh_recorder::WorkingBankEntry,
|
||||||
use solana_sdk::clock::Slot;
|
solana_runtime::bank::Bank,
|
||||||
use std::{
|
solana_sdk::clock::Slot,
|
||||||
sync::mpsc::Receiver,
|
std::{
|
||||||
sync::Arc,
|
sync::{mpsc::Receiver, Arc},
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(super) struct ReceiveResults {
|
pub(super) struct ReceiveResults {
|
||||||
@ -80,13 +81,15 @@ pub(super) fn recv_slot_entries(receiver: &Receiver<WorkingBankEntry>) -> Result
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use solana_ledger::genesis_utils::{create_genesis_config, GenesisConfigInfo};
|
super::*,
|
||||||
use solana_sdk::genesis_config::GenesisConfig;
|
solana_ledger::genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||||
use solana_sdk::pubkey::Pubkey;
|
solana_sdk::{
|
||||||
use solana_sdk::system_transaction;
|
genesis_config::GenesisConfig, pubkey::Pubkey, system_transaction,
|
||||||
use solana_sdk::transaction::Transaction;
|
transaction::Transaction,
|
||||||
use std::sync::mpsc::channel;
|
},
|
||||||
|
std::sync::mpsc::channel,
|
||||||
|
};
|
||||||
|
|
||||||
fn setup_test() -> (GenesisConfig, Arc<Bank>, Transaction) {
|
fn setup_test() -> (GenesisConfig, Arc<Bank>, Transaction) {
|
||||||
let GenesisConfigInfo {
|
let GenesisConfigInfo {
|
||||||
|
@ -508,22 +508,22 @@ impl BroadcastRun for StandardBroadcastRun {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use {
|
||||||
use solana_entry::entry::create_ticks;
|
super::*,
|
||||||
use solana_gossip::cluster_info::{ClusterInfo, Node};
|
solana_entry::entry::create_ticks,
|
||||||
use solana_ledger::genesis_utils::create_genesis_config;
|
solana_gossip::cluster_info::{ClusterInfo, Node},
|
||||||
use solana_ledger::{
|
solana_ledger::{
|
||||||
blockstore::Blockstore, get_tmp_ledger_path, shred::max_ticks_per_n_shreds,
|
blockstore::Blockstore, genesis_utils::create_genesis_config, get_tmp_ledger_path,
|
||||||
|
shred::max_ticks_per_n_shreds,
|
||||||
|
},
|
||||||
|
solana_runtime::bank::Bank,
|
||||||
|
solana_sdk::{
|
||||||
|
genesis_config::GenesisConfig,
|
||||||
|
signature::{Keypair, Signer},
|
||||||
|
},
|
||||||
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
|
std::{ops::Deref, sync::Arc, time::Duration},
|
||||||
};
|
};
|
||||||
use solana_runtime::bank::Bank;
|
|
||||||
use solana_sdk::{
|
|
||||||
genesis_config::GenesisConfig,
|
|
||||||
signature::{Keypair, Signer},
|
|
||||||
};
|
|
||||||
use solana_streamer::socket::SocketAddrSpace;
|
|
||||||
use std::ops::Deref;
|
|
||||||
use std::sync::Arc;
|
|
||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
fn setup(
|
fn setup(
|
||||||
|
@ -1,56 +1,59 @@
|
|||||||
use crate::{
|
use {
|
||||||
optimistic_confirmation_verifier::OptimisticConfirmationVerifier,
|
crate::{
|
||||||
replay_stage::DUPLICATE_THRESHOLD,
|
optimistic_confirmation_verifier::OptimisticConfirmationVerifier,
|
||||||
result::{Error, Result},
|
replay_stage::DUPLICATE_THRESHOLD,
|
||||||
sigverify,
|
result::{Error, Result},
|
||||||
verified_vote_packets::{
|
sigverify,
|
||||||
ValidatorGossipVotesIterator, VerifiedVoteMetadata, VerifiedVotePackets,
|
verified_vote_packets::{
|
||||||
|
ValidatorGossipVotesIterator, VerifiedVoteMetadata, VerifiedVotePackets,
|
||||||
|
},
|
||||||
|
vote_stake_tracker::VoteStakeTracker,
|
||||||
},
|
},
|
||||||
vote_stake_tracker::VoteStakeTracker,
|
crossbeam_channel::{
|
||||||
};
|
unbounded, Receiver as CrossbeamReceiver, RecvTimeoutError, Select,
|
||||||
use crossbeam_channel::{
|
Sender as CrossbeamSender,
|
||||||
unbounded, Receiver as CrossbeamReceiver, RecvTimeoutError, Select, Sender as CrossbeamSender,
|
},
|
||||||
};
|
itertools::izip,
|
||||||
use itertools::izip;
|
log::*,
|
||||||
use log::*;
|
solana_gossip::{
|
||||||
use solana_gossip::{
|
cluster_info::{ClusterInfo, GOSSIP_SLEEP_MILLIS},
|
||||||
cluster_info::{ClusterInfo, GOSSIP_SLEEP_MILLIS},
|
crds::Cursor,
|
||||||
crds::Cursor,
|
},
|
||||||
};
|
solana_ledger::blockstore::Blockstore,
|
||||||
use solana_ledger::blockstore::Blockstore;
|
solana_measure::measure::Measure,
|
||||||
use solana_measure::measure::Measure;
|
solana_metrics::inc_new_counter_debug,
|
||||||
use solana_metrics::inc_new_counter_debug;
|
solana_perf::packet::{self, Packets},
|
||||||
use solana_perf::packet::{self, Packets};
|
solana_poh::poh_recorder::PohRecorder,
|
||||||
use solana_poh::poh_recorder::PohRecorder;
|
solana_rpc::{
|
||||||
use solana_rpc::{
|
optimistically_confirmed_bank_tracker::{BankNotification, BankNotificationSender},
|
||||||
optimistically_confirmed_bank_tracker::{BankNotification, BankNotificationSender},
|
rpc_subscriptions::RpcSubscriptions,
|
||||||
rpc_subscriptions::RpcSubscriptions,
|
},
|
||||||
};
|
solana_runtime::{
|
||||||
use solana_runtime::{
|
bank::Bank,
|
||||||
bank::Bank,
|
bank_forks::BankForks,
|
||||||
bank_forks::BankForks,
|
commitment::VOTE_THRESHOLD_SIZE,
|
||||||
commitment::VOTE_THRESHOLD_SIZE,
|
epoch_stakes::{EpochAuthorizedVoters, EpochStakes},
|
||||||
epoch_stakes::{EpochAuthorizedVoters, EpochStakes},
|
vote_sender_types::{ReplayVoteReceiver, ReplayedVote},
|
||||||
vote_sender_types::{ReplayVoteReceiver, ReplayedVote},
|
},
|
||||||
};
|
solana_sdk::{
|
||||||
use solana_sdk::{
|
clock::{Epoch, Slot, DEFAULT_MS_PER_SLOT, DEFAULT_TICKS_PER_SLOT},
|
||||||
clock::{Epoch, Slot, DEFAULT_MS_PER_SLOT, DEFAULT_TICKS_PER_SLOT},
|
epoch_schedule::EpochSchedule,
|
||||||
epoch_schedule::EpochSchedule,
|
hash::Hash,
|
||||||
hash::Hash,
|
pubkey::Pubkey,
|
||||||
pubkey::Pubkey,
|
signature::Signature,
|
||||||
signature::Signature,
|
slot_hashes,
|
||||||
slot_hashes,
|
transaction::Transaction,
|
||||||
transaction::Transaction,
|
},
|
||||||
};
|
solana_vote_program::{self, vote_state::Vote, vote_transaction},
|
||||||
use solana_vote_program::{self, vote_state::Vote, vote_transaction};
|
std::{
|
||||||
use std::{
|
collections::{HashMap, HashSet},
|
||||||
collections::{HashMap, HashSet},
|
sync::{
|
||||||
sync::{
|
atomic::{AtomicBool, Ordering},
|
||||||
atomic::{AtomicBool, Ordering},
|
Arc, Mutex, RwLock,
|
||||||
{Arc, Mutex, RwLock},
|
},
|
||||||
|
thread::{self, sleep, Builder, JoinHandle},
|
||||||
|
time::{Duration, Instant},
|
||||||
},
|
},
|
||||||
thread::{self, sleep, Builder, JoinHandle},
|
|
||||||
time::{Duration, Instant},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Map from a vote account to the authorized voter for an epoch
|
// Map from a vote account to the authorized voter for an epoch
|
||||||
@ -939,23 +942,26 @@ impl ClusterInfoVoteListener {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use solana_perf::packet;
|
super::*,
|
||||||
use solana_rpc::optimistically_confirmed_bank_tracker::OptimisticallyConfirmedBank;
|
solana_perf::packet,
|
||||||
use solana_runtime::{
|
solana_rpc::optimistically_confirmed_bank_tracker::OptimisticallyConfirmedBank,
|
||||||
bank::Bank,
|
solana_runtime::{
|
||||||
commitment::BlockCommitmentCache,
|
bank::Bank,
|
||||||
genesis_utils::{self, create_genesis_config, GenesisConfigInfo, ValidatorVoteKeypairs},
|
commitment::BlockCommitmentCache,
|
||||||
vote_sender_types::ReplayVoteSender,
|
genesis_utils::{
|
||||||
|
self, create_genesis_config, GenesisConfigInfo, ValidatorVoteKeypairs,
|
||||||
|
},
|
||||||
|
vote_sender_types::ReplayVoteSender,
|
||||||
|
},
|
||||||
|
solana_sdk::{
|
||||||
|
hash::Hash,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
signature::{Keypair, Signature, Signer},
|
||||||
|
},
|
||||||
|
solana_vote_program::vote_state::Vote,
|
||||||
|
std::{collections::BTreeSet, sync::Arc},
|
||||||
};
|
};
|
||||||
use solana_sdk::{
|
|
||||||
hash::Hash,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
signature::{Keypair, Signature, Signer},
|
|
||||||
};
|
|
||||||
use solana_vote_program::vote_state::Vote;
|
|
||||||
use std::collections::BTreeSet;
|
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_max_vote_tx_fits() {
|
fn test_max_vote_tx_fits() {
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
use crate::{
|
use {
|
||||||
ancestor_hashes_service::{AncestorHashesReplayUpdate, AncestorHashesReplayUpdateSender},
|
crate::{
|
||||||
fork_choice::ForkChoice,
|
ancestor_hashes_service::{AncestorHashesReplayUpdate, AncestorHashesReplayUpdateSender},
|
||||||
heaviest_subtree_fork_choice::HeaviestSubtreeForkChoice,
|
fork_choice::ForkChoice,
|
||||||
|
heaviest_subtree_fork_choice::HeaviestSubtreeForkChoice,
|
||||||
|
},
|
||||||
|
solana_ledger::blockstore::Blockstore,
|
||||||
|
solana_sdk::{clock::Slot, hash::Hash},
|
||||||
|
std::collections::{BTreeMap, BTreeSet, HashMap},
|
||||||
};
|
};
|
||||||
use solana_ledger::blockstore::Blockstore;
|
|
||||||
use solana_sdk::{clock::Slot, hash::Hash};
|
|
||||||
use std::collections::{BTreeMap, BTreeSet, HashMap};
|
|
||||||
|
|
||||||
pub(crate) type DuplicateSlotsTracker = BTreeSet<Slot>;
|
pub(crate) type DuplicateSlotsTracker = BTreeSet<Slot>;
|
||||||
pub(crate) type DuplicateSlotsToRepair = HashMap<Slot, Hash>;
|
pub(crate) type DuplicateSlotsToRepair = HashMap<Slot, Hash>;
|
||||||
@ -805,15 +807,17 @@ pub(crate) fn check_slot_agrees_with_cluster(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use {
|
||||||
use crate::{progress_map::ProgressMap, replay_stage::tests::setup_forks_from_tree};
|
super::*,
|
||||||
use crossbeam_channel::unbounded;
|
crate::{progress_map::ProgressMap, replay_stage::tests::setup_forks_from_tree},
|
||||||
use solana_runtime::bank_forks::BankForks;
|
crossbeam_channel::unbounded,
|
||||||
use std::{
|
solana_runtime::bank_forks::BankForks,
|
||||||
collections::{HashMap, HashSet},
|
std::{
|
||||||
sync::{Arc, RwLock},
|
collections::{HashMap, HashSet},
|
||||||
|
sync::{Arc, RwLock},
|
||||||
|
},
|
||||||
|
trees::tr,
|
||||||
};
|
};
|
||||||
use trees::tr;
|
|
||||||
|
|
||||||
macro_rules! state_update_tests {
|
macro_rules! state_update_tests {
|
||||||
($($name:ident: $value:expr,)*) => {
|
($($name:ident: $value:expr,)*) => {
|
||||||
|
@ -218,8 +218,7 @@ impl ClusterSlots {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {super::*, solana_runtime::epoch_stakes::NodeVoteAccounts};
|
||||||
use solana_runtime::epoch_stakes::NodeVoteAccounts;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_default() {
|
fn test_default() {
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
use crate::cluster_slots::ClusterSlots;
|
use {
|
||||||
use crossbeam_channel::{Receiver, RecvTimeoutError, Sender};
|
crate::cluster_slots::ClusterSlots,
|
||||||
use solana_gossip::cluster_info::ClusterInfo;
|
crossbeam_channel::{Receiver, RecvTimeoutError, Sender},
|
||||||
use solana_ledger::blockstore::Blockstore;
|
solana_gossip::cluster_info::ClusterInfo,
|
||||||
use solana_measure::measure::Measure;
|
solana_ledger::blockstore::Blockstore,
|
||||||
use solana_runtime::bank_forks::BankForks;
|
solana_measure::measure::Measure,
|
||||||
use solana_sdk::clock::Slot;
|
solana_runtime::bank_forks::BankForks,
|
||||||
use std::{
|
solana_sdk::clock::Slot,
|
||||||
sync::{
|
std::{
|
||||||
atomic::{AtomicBool, Ordering},
|
sync::{
|
||||||
{Arc, RwLock},
|
atomic::{AtomicBool, Ordering},
|
||||||
|
Arc, RwLock,
|
||||||
|
},
|
||||||
|
thread::{self, Builder, JoinHandle},
|
||||||
|
time::{Duration, Instant},
|
||||||
},
|
},
|
||||||
thread::{self, Builder, JoinHandle},
|
|
||||||
time::{Duration, Instant},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub type ClusterSlotsUpdateReceiver = Receiver<Vec<Slot>>;
|
pub type ClusterSlotsUpdateReceiver = Receiver<Vec<Slot>>;
|
||||||
|
@ -1,21 +1,25 @@
|
|||||||
use crate::consensus::Stake;
|
use {
|
||||||
use solana_measure::measure::Measure;
|
crate::consensus::Stake,
|
||||||
use solana_metrics::datapoint_info;
|
solana_measure::measure::Measure,
|
||||||
use solana_rpc::rpc_subscriptions::RpcSubscriptions;
|
solana_metrics::datapoint_info,
|
||||||
use solana_runtime::{
|
solana_rpc::rpc_subscriptions::RpcSubscriptions,
|
||||||
bank::Bank,
|
solana_runtime::{
|
||||||
commitment::{BlockCommitment, BlockCommitmentCache, CommitmentSlots, VOTE_THRESHOLD_SIZE},
|
bank::Bank,
|
||||||
};
|
commitment::{BlockCommitment, BlockCommitmentCache, CommitmentSlots, VOTE_THRESHOLD_SIZE},
|
||||||
use solana_sdk::clock::Slot;
|
},
|
||||||
use solana_vote_program::vote_state::VoteState;
|
solana_sdk::clock::Slot,
|
||||||
use std::{
|
solana_vote_program::vote_state::VoteState,
|
||||||
cmp::max,
|
std::{
|
||||||
collections::HashMap,
|
cmp::max,
|
||||||
sync::atomic::{AtomicBool, Ordering},
|
collections::HashMap,
|
||||||
sync::mpsc::{channel, Receiver, RecvTimeoutError, Sender},
|
sync::{
|
||||||
sync::{Arc, RwLock},
|
atomic::{AtomicBool, Ordering},
|
||||||
thread::{self, Builder, JoinHandle},
|
mpsc::{channel, Receiver, RecvTimeoutError, Sender},
|
||||||
time::Duration,
|
Arc, RwLock,
|
||||||
|
},
|
||||||
|
thread::{self, Builder, JoinHandle},
|
||||||
|
time::Duration,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct CommitmentAggregationData {
|
pub struct CommitmentAggregationData {
|
||||||
@ -247,18 +251,20 @@ impl AggregateCommitmentService {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use solana_ledger::genesis_utils::{create_genesis_config, GenesisConfigInfo};
|
super::*,
|
||||||
use solana_runtime::{
|
solana_ledger::genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||||
accounts_background_service::AbsRequestSender,
|
solana_runtime::{
|
||||||
bank_forks::BankForks,
|
accounts_background_service::AbsRequestSender,
|
||||||
genesis_utils::{create_genesis_config_with_vote_accounts, ValidatorVoteKeypairs},
|
bank_forks::BankForks,
|
||||||
};
|
genesis_utils::{create_genesis_config_with_vote_accounts, ValidatorVoteKeypairs},
|
||||||
use solana_sdk::{account::Account, pubkey::Pubkey, signature::Signer};
|
},
|
||||||
use solana_stake_program::stake_state;
|
solana_sdk::{account::Account, pubkey::Pubkey, signature::Signer},
|
||||||
use solana_vote_program::{
|
solana_stake_program::stake_state,
|
||||||
vote_state::{self, VoteStateVersions},
|
solana_vote_program::{
|
||||||
vote_transaction,
|
vote_state::{self, VoteStateVersions},
|
||||||
|
vote_transaction,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
use crossbeam_channel::{Receiver, RecvTimeoutError, Sender};
|
use {
|
||||||
use solana_entry::entry::Entry;
|
crossbeam_channel::{Receiver, RecvTimeoutError, Sender},
|
||||||
use solana_ledger::blockstore::{Blockstore, CompletedDataSetInfo};
|
solana_entry::entry::Entry,
|
||||||
use solana_rpc::{max_slots::MaxSlots, rpc_subscriptions::RpcSubscriptions};
|
solana_ledger::blockstore::{Blockstore, CompletedDataSetInfo},
|
||||||
use solana_sdk::signature::Signature;
|
solana_rpc::{max_slots::MaxSlots, rpc_subscriptions::RpcSubscriptions},
|
||||||
use std::{
|
solana_sdk::signature::Signature,
|
||||||
sync::{
|
std::{
|
||||||
atomic::{AtomicBool, Ordering},
|
sync::{
|
||||||
Arc,
|
atomic::{AtomicBool, Ordering},
|
||||||
|
Arc,
|
||||||
|
},
|
||||||
|
thread::{self, Builder, JoinHandle},
|
||||||
|
time::Duration,
|
||||||
},
|
},
|
||||||
thread::{self, Builder, JoinHandle},
|
|
||||||
time::Duration,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub type CompletedDataSetsReceiver = Receiver<Vec<CompletedDataSetInfo>>;
|
pub type CompletedDataSetsReceiver = Receiver<Vec<CompletedDataSetInfo>>;
|
||||||
@ -100,10 +102,14 @@ impl CompletedDataSetsService {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod test {
|
pub mod test {
|
||||||
use super::*;
|
use {
|
||||||
use solana_sdk::hash::Hash;
|
super::*,
|
||||||
use solana_sdk::signature::{Keypair, Signer};
|
solana_sdk::{
|
||||||
use solana_sdk::transaction::Transaction;
|
hash::Hash,
|
||||||
|
signature::{Keypair, Signer},
|
||||||
|
transaction::Transaction,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_zero_signatures() {
|
fn test_zero_signatures() {
|
||||||
|
@ -3,18 +3,23 @@
|
|||||||
//! packing transactions into block; it also triggers persisting cost
|
//! packing transactions into block; it also triggers persisting cost
|
||||||
//! table to blockstore.
|
//! table to blockstore.
|
||||||
|
|
||||||
use solana_ledger::blockstore::Blockstore;
|
use {
|
||||||
use solana_measure::measure::Measure;
|
solana_ledger::blockstore::Blockstore,
|
||||||
use solana_runtime::{bank::Bank, bank::ExecuteTimings, cost_model::CostModel};
|
solana_measure::measure::Measure,
|
||||||
use solana_sdk::timing::timestamp;
|
solana_runtime::{
|
||||||
use std::{
|
bank::{Bank, ExecuteTimings},
|
||||||
sync::{
|
cost_model::CostModel,
|
||||||
atomic::{AtomicBool, Ordering},
|
},
|
||||||
mpsc::Receiver,
|
solana_sdk::timing::timestamp,
|
||||||
Arc, RwLock,
|
std::{
|
||||||
|
sync::{
|
||||||
|
atomic::{AtomicBool, Ordering},
|
||||||
|
mpsc::Receiver,
|
||||||
|
Arc, RwLock,
|
||||||
|
},
|
||||||
|
thread::{self, Builder, JoinHandle},
|
||||||
|
time::Duration,
|
||||||
},
|
},
|
||||||
thread::{self, Builder, JoinHandle},
|
|
||||||
time::Duration,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
@ -203,9 +208,7 @@ impl CostUpdateService {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {super::*, solana_program_runtime::timings::ProgramTiming, solana_sdk::pubkey::Pubkey};
|
||||||
use solana_program_runtime::timings::ProgramTiming;
|
|
||||||
use solana_sdk::pubkey::Pubkey;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_update_cost_model_with_empty_execute_timings() {
|
fn test_update_cost_model_with_empty_execute_timings() {
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
use solana_measure::measure::Measure;
|
use {
|
||||||
use solana_runtime::bank::Bank;
|
solana_measure::measure::Measure,
|
||||||
use std::{
|
solana_runtime::bank::Bank,
|
||||||
sync::{mpsc::Receiver, Arc},
|
std::{
|
||||||
thread::{self, Builder, JoinHandle},
|
sync::{mpsc::Receiver, Arc},
|
||||||
|
thread::{self, Builder, JoinHandle},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct DropBankService {
|
pub struct DropBankService {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use solana_ledger::blockstore::Blockstore;
|
use {
|
||||||
use solana_sdk::{clock::Slot, hash::Hash, pubkey::Pubkey, timing::timestamp};
|
solana_ledger::blockstore::Blockstore,
|
||||||
use std::{collections::HashMap, net::SocketAddr};
|
solana_sdk::{clock::Slot, hash::Hash, pubkey::Pubkey, timing::timestamp},
|
||||||
|
std::{collections::HashMap, net::SocketAddr},
|
||||||
|
};
|
||||||
|
|
||||||
// Number of validators to sample for the ancestor repair
|
// Number of validators to sample for the ancestor repair
|
||||||
pub const ANCESTOR_HASH_REPAIR_SAMPLE_SIZE: usize = 21;
|
pub const ANCESTOR_HASH_REPAIR_SAMPLE_SIZE: usize = 21;
|
||||||
@ -350,11 +352,13 @@ impl DeadSlotAncestorRequestStatus {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod tests {
|
pub mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use rand::{self, seq::SliceRandom, thread_rng};
|
super::*,
|
||||||
use solana_ledger::get_tmp_ledger_path_auto_delete;
|
rand::{self, seq::SliceRandom, thread_rng},
|
||||||
use std::{collections::BTreeMap, net::IpAddr};
|
solana_ledger::get_tmp_ledger_path_auto_delete,
|
||||||
use tempfile::TempDir;
|
std::{collections::BTreeMap, net::IpAddr},
|
||||||
|
tempfile::TempDir,
|
||||||
|
};
|
||||||
|
|
||||||
struct TestSetup {
|
struct TestSetup {
|
||||||
sampled_addresses: Vec<SocketAddr>,
|
sampled_addresses: Vec<SocketAddr>,
|
||||||
|
@ -1,18 +1,25 @@
|
|||||||
//! The `fetch_stage` batches input from a UDP socket and sends it to a channel.
|
//! The `fetch_stage` batches input from a UDP socket and sends it to a channel.
|
||||||
|
|
||||||
use crate::banking_stage::HOLD_TRANSACTIONS_SLOT_OFFSET;
|
use {
|
||||||
use crate::result::{Error, Result};
|
crate::{
|
||||||
use solana_metrics::{inc_new_counter_debug, inc_new_counter_info};
|
banking_stage::HOLD_TRANSACTIONS_SLOT_OFFSET,
|
||||||
use solana_perf::packet::PacketsRecycler;
|
result::{Error, Result},
|
||||||
use solana_perf::recycler::Recycler;
|
},
|
||||||
use solana_poh::poh_recorder::PohRecorder;
|
solana_metrics::{inc_new_counter_debug, inc_new_counter_info},
|
||||||
use solana_sdk::clock::DEFAULT_TICKS_PER_SLOT;
|
solana_perf::{packet::PacketsRecycler, recycler::Recycler},
|
||||||
use solana_streamer::streamer::{self, PacketReceiver, PacketSender};
|
solana_poh::poh_recorder::PohRecorder,
|
||||||
use std::net::UdpSocket;
|
solana_sdk::clock::DEFAULT_TICKS_PER_SLOT,
|
||||||
use std::sync::atomic::AtomicBool;
|
solana_streamer::streamer::{self, PacketReceiver, PacketSender},
|
||||||
use std::sync::mpsc::{channel, RecvTimeoutError};
|
std::{
|
||||||
use std::sync::{Arc, Mutex};
|
net::UdpSocket,
|
||||||
use std::thread::{self, Builder, JoinHandle};
|
sync::{
|
||||||
|
atomic::AtomicBool,
|
||||||
|
mpsc::{channel, RecvTimeoutError},
|
||||||
|
Arc, Mutex,
|
||||||
|
},
|
||||||
|
thread::{self, Builder, JoinHandle},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
pub struct FetchStage {
|
pub struct FetchStage {
|
||||||
thread_hdls: Vec<JoinHandle<()>>,
|
thread_hdls: Vec<JoinHandle<()>>,
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
use crate::{
|
use {
|
||||||
consensus::{SwitchForkDecision, Tower},
|
crate::{
|
||||||
latest_validator_votes_for_frozen_banks::LatestValidatorVotesForFrozenBanks,
|
consensus::{SwitchForkDecision, Tower},
|
||||||
progress_map::ProgressMap,
|
latest_validator_votes_for_frozen_banks::LatestValidatorVotesForFrozenBanks,
|
||||||
replay_stage::HeaviestForkFailures,
|
progress_map::ProgressMap,
|
||||||
};
|
replay_stage::HeaviestForkFailures,
|
||||||
use solana_runtime::{bank::Bank, bank_forks::BankForks};
|
},
|
||||||
use std::{
|
solana_runtime::{bank::Bank, bank_forks::BankForks},
|
||||||
collections::{HashMap, HashSet},
|
std::{
|
||||||
sync::{Arc, RwLock},
|
collections::{HashMap, HashSet},
|
||||||
|
sync::{Arc, RwLock},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct SelectVoteAndResetForkResult {
|
pub struct SelectVoteAndResetForkResult {
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
//! The `gen_keys` module makes lots of keypairs
|
//! The `gen_keys` module makes lots of keypairs
|
||||||
|
|
||||||
use rand::{Rng, SeedableRng};
|
use {
|
||||||
use rand_chacha::ChaChaRng;
|
rand::{Rng, SeedableRng},
|
||||||
use rayon::prelude::*;
|
rand_chacha::ChaChaRng,
|
||||||
use solana_sdk::signature::Keypair;
|
rayon::prelude::*,
|
||||||
|
solana_sdk::signature::Keypair,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct GenKeys {
|
pub struct GenKeys {
|
||||||
generator: ChaChaRng,
|
generator: ChaChaRng,
|
||||||
@ -39,10 +41,8 @@ impl GenKeys {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
|
||||||
pub use solana_sdk::pubkey::Pubkey;
|
pub use solana_sdk::pubkey::Pubkey;
|
||||||
use solana_sdk::signature::Signer;
|
use {super::*, solana_sdk::signature::Signer, std::collections::HashSet};
|
||||||
use std::collections::HashSet;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_new_key_is_deterministic() {
|
fn test_new_key_is_deterministic() {
|
||||||
|
@ -1,24 +1,26 @@
|
|||||||
use crate::{
|
|
||||||
consensus::Tower, fork_choice::ForkChoice,
|
|
||||||
latest_validator_votes_for_frozen_banks::LatestValidatorVotesForFrozenBanks,
|
|
||||||
progress_map::ProgressMap, tree_diff::TreeDiff,
|
|
||||||
};
|
|
||||||
use solana_measure::measure::Measure;
|
|
||||||
use solana_runtime::{bank::Bank, bank_forks::BankForks, epoch_stakes::EpochStakes};
|
|
||||||
use solana_sdk::{
|
|
||||||
clock::{Epoch, Slot},
|
|
||||||
epoch_schedule::EpochSchedule,
|
|
||||||
hash::Hash,
|
|
||||||
pubkey::Pubkey,
|
|
||||||
};
|
|
||||||
use std::{
|
|
||||||
borrow::Borrow,
|
|
||||||
collections::{hash_map::Entry, BTreeMap, HashMap, HashSet, VecDeque},
|
|
||||||
sync::{Arc, RwLock},
|
|
||||||
time::Instant,
|
|
||||||
};
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use trees::{Tree, TreeWalk};
|
use trees::{Tree, TreeWalk};
|
||||||
|
use {
|
||||||
|
crate::{
|
||||||
|
consensus::Tower, fork_choice::ForkChoice,
|
||||||
|
latest_validator_votes_for_frozen_banks::LatestValidatorVotesForFrozenBanks,
|
||||||
|
progress_map::ProgressMap, tree_diff::TreeDiff,
|
||||||
|
},
|
||||||
|
solana_measure::measure::Measure,
|
||||||
|
solana_runtime::{bank::Bank, bank_forks::BankForks, epoch_stakes::EpochStakes},
|
||||||
|
solana_sdk::{
|
||||||
|
clock::{Epoch, Slot},
|
||||||
|
epoch_schedule::EpochSchedule,
|
||||||
|
hash::Hash,
|
||||||
|
pubkey::Pubkey,
|
||||||
|
},
|
||||||
|
std::{
|
||||||
|
borrow::Borrow,
|
||||||
|
collections::{hash_map::Entry, BTreeMap, HashMap, HashSet, VecDeque},
|
||||||
|
sync::{Arc, RwLock},
|
||||||
|
time::Instant,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
pub type ForkWeight = u64;
|
pub type ForkWeight = u64;
|
||||||
pub type SlotHashKey = (Slot, Hash);
|
pub type SlotHashKey = (Slot, Hash);
|
||||||
@ -1076,12 +1078,14 @@ impl<'a> Iterator for AncestorIterator<'a> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use {
|
||||||
use crate::vote_simulator::VoteSimulator;
|
super::*,
|
||||||
use solana_runtime::{bank::Bank, bank_utils};
|
crate::vote_simulator::VoteSimulator,
|
||||||
use solana_sdk::{hash::Hash, slot_history::SlotHistory};
|
solana_runtime::{bank::Bank, bank_utils},
|
||||||
use std::{collections::HashSet, ops::Range};
|
solana_sdk::{hash::Hash, slot_history::SlotHistory},
|
||||||
use trees::tr;
|
std::{collections::HashSet, ops::Range},
|
||||||
|
trees::tr,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_max_by_weight() {
|
fn test_max_by_weight() {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use crate::heaviest_subtree_fork_choice::SlotHashKey;
|
use {
|
||||||
use solana_sdk::{clock::Slot, hash::Hash, pubkey::Pubkey};
|
crate::heaviest_subtree_fork_choice::SlotHashKey,
|
||||||
use std::collections::{hash_map::Entry, HashMap};
|
solana_sdk::{clock::Slot, hash::Hash, pubkey::Pubkey},
|
||||||
|
std::collections::{hash_map::Entry, HashMap},
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct LatestValidatorVotesForFrozenBanks {
|
pub struct LatestValidatorVotesForFrozenBanks {
|
||||||
|
@ -1,17 +1,24 @@
|
|||||||
//! The `ledger_cleanup_service` drops older ledger data to limit disk space usage
|
//! The `ledger_cleanup_service` drops older ledger data to limit disk space usage
|
||||||
|
|
||||||
use rand::{thread_rng, Rng};
|
use {
|
||||||
use solana_ledger::blockstore::{Blockstore, PurgeType};
|
rand::{thread_rng, Rng},
|
||||||
use solana_ledger::blockstore_db::Result as BlockstoreResult;
|
solana_ledger::{
|
||||||
use solana_measure::measure::Measure;
|
blockstore::{Blockstore, PurgeType},
|
||||||
use solana_sdk::clock::{Slot, DEFAULT_TICKS_PER_SLOT, TICKS_PER_DAY};
|
blockstore_db::Result as BlockstoreResult,
|
||||||
use std::string::ToString;
|
},
|
||||||
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
|
solana_measure::measure::Measure,
|
||||||
use std::sync::mpsc::{Receiver, RecvTimeoutError};
|
solana_sdk::clock::{Slot, DEFAULT_TICKS_PER_SLOT, TICKS_PER_DAY},
|
||||||
use std::sync::Arc;
|
std::{
|
||||||
use std::thread;
|
string::ToString,
|
||||||
use std::thread::{sleep, Builder, JoinHandle};
|
sync::{
|
||||||
use std::time::Duration;
|
atomic::{AtomicBool, AtomicU64, Ordering},
|
||||||
|
mpsc::{Receiver, RecvTimeoutError},
|
||||||
|
Arc,
|
||||||
|
},
|
||||||
|
thread::{self, sleep, Builder, JoinHandle},
|
||||||
|
time::Duration,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
// - To try and keep the RocksDB size under 400GB:
|
// - To try and keep the RocksDB size under 400GB:
|
||||||
// Seeing about 1600b/shred, using 2000b/shred for margin, so 200m shreds can be stored in 400gb.
|
// Seeing about 1600b/shred, using 2000b/shred for margin, so 200m shreds can be stored in 400gb.
|
||||||
@ -306,10 +313,11 @@ impl LedgerCleanupService {
|
|||||||
}
|
}
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use solana_ledger::blockstore::make_many_slot_entries;
|
super::*,
|
||||||
use solana_ledger::get_tmp_ledger_path;
|
solana_ledger::{blockstore::make_many_slot_entries, get_tmp_ledger_path},
|
||||||
use std::sync::mpsc::channel;
|
std::sync::mpsc::channel,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cleanup1() {
|
fn test_cleanup1() {
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
use crate::cluster_info_vote_listener::VoteTracker;
|
use {
|
||||||
use solana_ledger::blockstore::Blockstore;
|
crate::cluster_info_vote_listener::VoteTracker,
|
||||||
use solana_runtime::bank::Bank;
|
solana_ledger::blockstore::Blockstore,
|
||||||
use solana_sdk::{clock::Slot, hash::Hash};
|
solana_runtime::bank::Bank,
|
||||||
use std::{collections::BTreeSet, time::Instant};
|
solana_sdk::{clock::Slot, hash::Hash},
|
||||||
|
std::{collections::BTreeSet, time::Instant},
|
||||||
|
};
|
||||||
|
|
||||||
pub struct OptimisticConfirmationVerifier {
|
pub struct OptimisticConfirmationVerifier {
|
||||||
snapshot_start_slot: Slot,
|
snapshot_start_slot: Slot,
|
||||||
@ -139,13 +141,11 @@ impl OptimisticConfirmationVerifier {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use {
|
||||||
use crate::vote_simulator::VoteSimulator;
|
super::*, crate::vote_simulator::VoteSimulator, solana_ledger::get_tmp_ledger_path,
|
||||||
use solana_ledger::get_tmp_ledger_path;
|
solana_runtime::bank::Bank, solana_sdk::pubkey::Pubkey, std::collections::HashMap,
|
||||||
use solana_runtime::bank::Bank;
|
trees::tr,
|
||||||
use solana_sdk::pubkey::Pubkey;
|
};
|
||||||
use std::collections::HashMap;
|
|
||||||
use trees::tr;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_add_new_optimistic_confirmed_slots() {
|
fn test_add_new_optimistic_confirmed_slots() {
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use crate::request_response::RequestResponse;
|
use {
|
||||||
use lru::LruCache;
|
crate::request_response::RequestResponse,
|
||||||
use rand::{thread_rng, Rng};
|
lru::LruCache,
|
||||||
use solana_ledger::shred::Nonce;
|
rand::{thread_rng, Rng},
|
||||||
|
solana_ledger::shred::Nonce,
|
||||||
|
};
|
||||||
|
|
||||||
pub const DEFAULT_REQUEST_EXPIRATION_MS: u64 = 60_000;
|
pub const DEFAULT_REQUEST_EXPIRATION_MS: u64 = 60_000;
|
||||||
|
|
||||||
@ -82,10 +84,10 @@ pub struct RequestStatus<T> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) mod tests {
|
pub(crate) mod tests {
|
||||||
use super::*;
|
use {
|
||||||
use crate::serve_repair::ShredRepairType;
|
super::*, crate::serve_repair::ShredRepairType, solana_ledger::shred::Shred,
|
||||||
use solana_ledger::shred::Shred;
|
solana_sdk::timing::timestamp,
|
||||||
use solana_sdk::timing::timestamp;
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_add_request() {
|
fn test_add_request() {
|
||||||
|
@ -2,8 +2,8 @@ use {
|
|||||||
crate::{
|
crate::{
|
||||||
cluster_info_vote_listener::SlotVoteTracker,
|
cluster_info_vote_listener::SlotVoteTracker,
|
||||||
cluster_slots::SlotPubkeys,
|
cluster_slots::SlotPubkeys,
|
||||||
|
consensus::{Stake, VotedStakes},
|
||||||
replay_stage::SUPERMINORITY_THRESHOLD,
|
replay_stage::SUPERMINORITY_THRESHOLD,
|
||||||
{consensus::Stake, consensus::VotedStakes},
|
|
||||||
},
|
},
|
||||||
solana_ledger::blockstore_processor::{ConfirmationProgress, ConfirmationTiming},
|
solana_ledger::blockstore_processor::{ConfirmationProgress, ConfirmationTiming},
|
||||||
solana_runtime::{bank::Bank, bank_forks::BankForks, vote_account::VoteAccount},
|
solana_runtime::{bank::Bank, bank_forks::BankForks, vote_account::VoteAccount},
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
use crate::{
|
use {
|
||||||
heaviest_subtree_fork_choice::HeaviestSubtreeForkChoice, repair_service::RepairService,
|
crate::{
|
||||||
serve_repair::ShredRepairType, tree_diff::TreeDiff,
|
heaviest_subtree_fork_choice::HeaviestSubtreeForkChoice, repair_service::RepairService,
|
||||||
|
serve_repair::ShredRepairType, tree_diff::TreeDiff,
|
||||||
|
},
|
||||||
|
solana_ledger::{blockstore::Blockstore, blockstore_meta::SlotMeta},
|
||||||
|
solana_sdk::{clock::Slot, hash::Hash},
|
||||||
|
std::collections::{HashMap, HashSet},
|
||||||
};
|
};
|
||||||
use solana_ledger::{blockstore::Blockstore, blockstore_meta::SlotMeta};
|
|
||||||
use solana_sdk::{clock::Slot, hash::Hash};
|
|
||||||
use std::collections::{HashMap, HashSet};
|
|
||||||
|
|
||||||
struct GenericTraversal<'a> {
|
struct GenericTraversal<'a> {
|
||||||
tree: &'a HeaviestSubtreeForkChoice,
|
tree: &'a HeaviestSubtreeForkChoice,
|
||||||
@ -164,14 +166,16 @@ pub fn get_closest_completion(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod test {
|
pub mod test {
|
||||||
use super::*;
|
use {
|
||||||
use solana_ledger::{
|
super::*,
|
||||||
blockstore::{Blockstore, MAX_TURBINE_PROPAGATION_IN_MS},
|
solana_ledger::{
|
||||||
get_tmp_ledger_path,
|
blockstore::{Blockstore, MAX_TURBINE_PROPAGATION_IN_MS},
|
||||||
|
get_tmp_ledger_path,
|
||||||
|
},
|
||||||
|
solana_sdk::hash::Hash,
|
||||||
|
std::{thread::sleep, time::Duration},
|
||||||
|
trees::{tr, Tree, TreeWalk},
|
||||||
};
|
};
|
||||||
use solana_sdk::hash::Hash;
|
|
||||||
use std::{thread::sleep, time::Duration};
|
|
||||||
use trees::{tr, Tree, TreeWalk};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_get_unknown_last_index() {
|
fn test_get_unknown_last_index() {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user