Pacify clippy
This commit is contained in:
@ -592,7 +592,7 @@ impl BankingStage {
|
||||
processed_transactions_indexes,
|
||||
);
|
||||
}
|
||||
Err(e) => panic!(format!("Poh recorder returned unexpected error: {:?}", e)),
|
||||
Err(e) => panic!("Poh recorder returned unexpected error: {:?}", e),
|
||||
}
|
||||
poh_record.stop();
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ pub fn broadcast_shreds(
|
||||
match send_mmsg(s, &packets[sent..]) {
|
||||
Ok(n) => sent += n,
|
||||
Err(e) => {
|
||||
return Err(Error::IO(e));
|
||||
return Err(Error::Io(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1507,7 +1507,7 @@ impl ClusterInfo {
|
||||
1
|
||||
);
|
||||
error!("retransmit result {:?}", e);
|
||||
return Err(Error::IO(e));
|
||||
return Err(Error::Io(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ mod tests {
|
||||
use super::*;
|
||||
use solana_ledger::genesis_utils::{create_genesis_config, GenesisConfigInfo};
|
||||
use solana_runtime::{
|
||||
accounts_background_service::ABSRequestSender,
|
||||
accounts_background_service::AbsRequestSender,
|
||||
bank_forks::BankForks,
|
||||
genesis_utils::{create_genesis_config_with_vote_accounts, ValidatorVoteKeypairs},
|
||||
};
|
||||
@ -534,7 +534,7 @@ mod tests {
|
||||
&working_bank,
|
||||
);
|
||||
for x in 0..root {
|
||||
bank_forks.set_root(x, &ABSRequestSender::default(), None);
|
||||
bank_forks.set_root(x, &AbsRequestSender::default(), None);
|
||||
}
|
||||
|
||||
// Add an additional bank/vote that will root slot 2
|
||||
@ -573,7 +573,7 @@ mod tests {
|
||||
.highest_confirmed_root();
|
||||
bank_forks.set_root(
|
||||
root,
|
||||
&ABSRequestSender::default(),
|
||||
&AbsRequestSender::default(),
|
||||
Some(highest_confirmed_root),
|
||||
);
|
||||
let highest_confirmed_root_bank = bank_forks.get(highest_confirmed_root);
|
||||
@ -642,7 +642,7 @@ mod tests {
|
||||
.highest_confirmed_root();
|
||||
bank_forks.set_root(
|
||||
root,
|
||||
&ABSRequestSender::default(),
|
||||
&AbsRequestSender::default(),
|
||||
Some(highest_confirmed_root),
|
||||
);
|
||||
let highest_confirmed_root_bank = bank_forks.get(highest_confirmed_root);
|
||||
|
@ -845,10 +845,9 @@ impl Tower {
|
||||
assert!(
|
||||
self.last_vote == Vote::default() && self.lockouts.votes.is_empty()
|
||||
|| self.last_vote != Vote::default() && !self.lockouts.votes.is_empty(),
|
||||
format!(
|
||||
"last vote: {:?} lockouts.votes: {:?}",
|
||||
self.last_vote, self.lockouts.votes
|
||||
)
|
||||
"last vote: {:?} lockouts.votes: {:?}",
|
||||
self.last_vote,
|
||||
self.lockouts.votes
|
||||
);
|
||||
|
||||
if let Some(last_voted_slot) = self.last_voted_slot() {
|
||||
@ -1131,7 +1130,7 @@ impl Tower {
|
||||
#[derive(Error, Debug)]
|
||||
pub enum TowerError {
|
||||
#[error("IO Error: {0}")]
|
||||
IOError(#[from] std::io::Error),
|
||||
IoError(#[from] std::io::Error),
|
||||
|
||||
#[error("Serialization Error: {0}")]
|
||||
SerializeError(#[from] bincode::Error),
|
||||
@ -1157,7 +1156,7 @@ pub enum TowerError {
|
||||
|
||||
impl TowerError {
|
||||
pub fn is_file_missing(&self) -> bool {
|
||||
if let TowerError::IOError(io_err) = &self {
|
||||
if let TowerError::IoError(io_err) = &self {
|
||||
io_err.kind() == std::io::ErrorKind::NotFound
|
||||
} else {
|
||||
false
|
||||
@ -1246,7 +1245,7 @@ pub mod test {
|
||||
};
|
||||
use solana_ledger::{blockstore::make_slot_entries, get_tmp_ledger_path};
|
||||
use solana_runtime::{
|
||||
accounts_background_service::ABSRequestSender,
|
||||
accounts_background_service::AbsRequestSender,
|
||||
bank::Bank,
|
||||
bank_forks::BankForks,
|
||||
genesis_utils::{
|
||||
@ -1417,7 +1416,7 @@ pub mod test {
|
||||
new_root,
|
||||
&self.bank_forks,
|
||||
&mut self.progress,
|
||||
&ABSRequestSender::default(),
|
||||
&AbsRequestSender::default(),
|
||||
None,
|
||||
&mut self.heaviest_subtree_fork_choice,
|
||||
)
|
||||
@ -2704,7 +2703,7 @@ pub mod test {
|
||||
remove_file(path).unwrap();
|
||||
},
|
||||
);
|
||||
assert_matches!(loaded, Err(TowerError::IOError(_)))
|
||||
assert_matches!(loaded, Err(TowerError::IoError(_)))
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -31,7 +31,7 @@ pub fn calculate_non_circulating_supply(bank: &Arc<Bank>) -> NonCirculatingSuppl
|
||||
bank.get_filtered_indexed_accounts(
|
||||
&IndexKey::ProgramId(solana_stake_program::id()),
|
||||
// The program-id account index checks for Account owner on inclusion. However, due to
|
||||
// the current AccountsDB implementation, an account may remain in storage as a
|
||||
// the current AccountsDb implementation, an account may remain in storage as a
|
||||
// zero-lamport Account::Default() after being wiped and reinitialized in later
|
||||
// updates. We include the redundant filter here to avoid returning these accounts.
|
||||
|account| account.owner == solana_stake_program::id(),
|
||||
|
@ -168,7 +168,7 @@ mod tests {
|
||||
use super::*;
|
||||
use solana_ledger::genesis_utils::{create_genesis_config, GenesisConfigInfo};
|
||||
use solana_runtime::{
|
||||
accounts_background_service::ABSRequestSender, commitment::BlockCommitmentCache,
|
||||
accounts_background_service::AbsRequestSender, commitment::BlockCommitmentCache,
|
||||
};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
|
||||
@ -284,7 +284,7 @@ mod tests {
|
||||
bank_forks
|
||||
.write()
|
||||
.unwrap()
|
||||
.set_root(7, &ABSRequestSender::default(), None);
|
||||
.set_root(7, &AbsRequestSender::default(), None);
|
||||
OptimisticallyConfirmedBankTracker::process_notification(
|
||||
BankNotification::OptimisticallyConfirmed(6),
|
||||
&bank_forks,
|
||||
|
@ -248,11 +248,9 @@ mod tests {
|
||||
if entry.is_tick() {
|
||||
assert!(
|
||||
entry.num_hashes <= poh_config.hashes_per_tick.unwrap(),
|
||||
format!(
|
||||
"{} <= {}",
|
||||
entry.num_hashes,
|
||||
poh_config.hashes_per_tick.unwrap()
|
||||
)
|
||||
"{} <= {}",
|
||||
entry.num_hashes,
|
||||
poh_config.hashes_per_tick.unwrap()
|
||||
);
|
||||
|
||||
if entry.num_hashes == poh_config.hashes_per_tick.unwrap() {
|
||||
|
@ -28,7 +28,7 @@ use solana_ledger::{
|
||||
use solana_measure::{measure::Measure, thread_mem_usage};
|
||||
use solana_metrics::inc_new_counter_info;
|
||||
use solana_runtime::{
|
||||
accounts_background_service::ABSRequestSender, bank::Bank, bank_forks::BankForks,
|
||||
accounts_background_service::AbsRequestSender, bank::Bank, bank_forks::BankForks,
|
||||
commitment::BlockCommitmentCache, vote_sender_types::ReplayVoteSender,
|
||||
};
|
||||
use solana_sdk::{
|
||||
@ -98,7 +98,7 @@ pub struct ReplayStageConfig {
|
||||
pub subscriptions: Arc<RpcSubscriptions>,
|
||||
pub leader_schedule_cache: Arc<LeaderScheduleCache>,
|
||||
pub latest_root_senders: Vec<Sender<Slot>>,
|
||||
pub accounts_background_request_sender: ABSRequestSender,
|
||||
pub accounts_background_request_sender: AbsRequestSender,
|
||||
pub block_commitment_cache: Arc<RwLock<BlockCommitmentCache>>,
|
||||
pub transaction_status_sender: Option<TransactionStatusSender>,
|
||||
pub rewards_recorder_sender: Option<RewardsRecorderSender>,
|
||||
@ -1070,7 +1070,7 @@ impl ReplayStage {
|
||||
blockstore: &Arc<Blockstore>,
|
||||
leader_schedule_cache: &Arc<LeaderScheduleCache>,
|
||||
lockouts_sender: &Sender<CommitmentAggregationData>,
|
||||
accounts_background_request_sender: &ABSRequestSender,
|
||||
accounts_background_request_sender: &AbsRequestSender,
|
||||
latest_root_senders: &[Sender<Slot>],
|
||||
subscriptions: &Arc<RpcSubscriptions>,
|
||||
block_commitment_cache: &Arc<RwLock<BlockCommitmentCache>>,
|
||||
@ -1835,7 +1835,7 @@ impl ReplayStage {
|
||||
new_root: Slot,
|
||||
bank_forks: &RwLock<BankForks>,
|
||||
progress: &mut ProgressMap,
|
||||
accounts_background_request_sender: &ABSRequestSender,
|
||||
accounts_background_request_sender: &AbsRequestSender,
|
||||
highest_confirmed_root: Option<Slot>,
|
||||
heaviest_subtree_fork_choice: &mut HeaviestSubtreeForkChoice,
|
||||
) {
|
||||
@ -2013,7 +2013,7 @@ pub(crate) mod tests {
|
||||
},
|
||||
};
|
||||
use solana_runtime::{
|
||||
accounts_background_service::ABSRequestSender,
|
||||
accounts_background_service::AbsRequestSender,
|
||||
commitment::BlockCommitment,
|
||||
genesis_utils::{self, GenesisConfigInfo, ValidatorVoteKeypairs},
|
||||
};
|
||||
@ -2249,7 +2249,7 @@ pub(crate) mod tests {
|
||||
root,
|
||||
&bank_forks,
|
||||
&mut progress,
|
||||
&ABSRequestSender::default(),
|
||||
&AbsRequestSender::default(),
|
||||
None,
|
||||
&mut heaviest_subtree_fork_choice,
|
||||
);
|
||||
@ -2293,7 +2293,7 @@ pub(crate) mod tests {
|
||||
root,
|
||||
&bank_forks,
|
||||
&mut progress,
|
||||
&ABSRequestSender::default(),
|
||||
&AbsRequestSender::default(),
|
||||
Some(confirmed_root),
|
||||
&mut heaviest_subtree_fork_choice,
|
||||
);
|
||||
@ -3245,7 +3245,7 @@ pub(crate) mod tests {
|
||||
bank_forks.insert(Bank::new_from_parent(&bank0, &Pubkey::default(), 9));
|
||||
let bank9 = bank_forks.get(9).unwrap().clone();
|
||||
bank_forks.insert(Bank::new_from_parent(&bank9, &Pubkey::default(), 10));
|
||||
bank_forks.set_root(9, &ABSRequestSender::default(), None);
|
||||
bank_forks.set_root(9, &AbsRequestSender::default(), None);
|
||||
let total_epoch_stake = bank0.total_epoch_stake();
|
||||
|
||||
// Insert new ForkProgress for slot 10 and its
|
||||
@ -3336,7 +3336,7 @@ pub(crate) mod tests {
|
||||
.get_propagated_stats_mut(0)
|
||||
.unwrap()
|
||||
.is_leader_slot = true;
|
||||
bank_forks.set_root(0, &ABSRequestSender::default(), None);
|
||||
bank_forks.set_root(0, &AbsRequestSender::default(), None);
|
||||
let total_epoch_stake = bank_forks.root_bank().total_epoch_stake();
|
||||
|
||||
// Insert new ForkProgress representing a slot for all slots 1..=num_banks. Only
|
||||
@ -3416,7 +3416,7 @@ pub(crate) mod tests {
|
||||
.get_propagated_stats_mut(0)
|
||||
.unwrap()
|
||||
.is_leader_slot = true;
|
||||
bank_forks.set_root(0, &ABSRequestSender::default(), None);
|
||||
bank_forks.set_root(0, &AbsRequestSender::default(), None);
|
||||
|
||||
let total_epoch_stake = num_validators as u64 * stake_per_validator;
|
||||
|
||||
@ -3761,7 +3761,7 @@ pub(crate) mod tests {
|
||||
bank_forks
|
||||
.write()
|
||||
.unwrap()
|
||||
.set_root(3, &ABSRequestSender::default(), None);
|
||||
.set_root(3, &AbsRequestSender::default(), None);
|
||||
let mut descendants = bank_forks.read().unwrap().descendants().clone();
|
||||
let mut ancestors = bank_forks.read().unwrap().ancestors();
|
||||
let slot_3_descendants = descendants.get(&3).unwrap().clone();
|
||||
|
@ -10,8 +10,8 @@ use std::any::Any;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
IO(std::io::Error),
|
||||
JSON(serde_json::Error),
|
||||
Io(std::io::Error),
|
||||
Json(serde_json::Error),
|
||||
AddrParse(std::net::AddrParseError),
|
||||
JoinError(Box<dyn Any + Send + 'static>),
|
||||
RecvError(std::sync::mpsc::RecvError),
|
||||
@ -108,7 +108,7 @@ impl std::convert::From<Box<dyn Any + Send + 'static>> for Error {
|
||||
}
|
||||
impl std::convert::From<std::io::Error> for Error {
|
||||
fn from(e: std::io::Error) -> Error {
|
||||
Error::IO(e)
|
||||
Error::Io(e)
|
||||
}
|
||||
}
|
||||
impl std::convert::From<fs_extra::error::Error> for Error {
|
||||
@ -118,7 +118,7 @@ impl std::convert::From<fs_extra::error::Error> for Error {
|
||||
}
|
||||
impl std::convert::From<serde_json::Error> for Error {
|
||||
fn from(e: serde_json::Error) -> Error {
|
||||
Error::JSON(e)
|
||||
Error::Json(e)
|
||||
}
|
||||
}
|
||||
impl std::convert::From<std::net::AddrParseError> for Error {
|
||||
@ -199,7 +199,7 @@ mod tests {
|
||||
assert_matches!(send_error(), Err(Error::SendError));
|
||||
assert_matches!(join_error(), Err(Error::JoinError(_)));
|
||||
let ioe = io::Error::new(io::ErrorKind::NotFound, "hi");
|
||||
assert_matches!(Error::from(ioe), Error::IO(_));
|
||||
assert_matches!(Error::from(ioe), Error::Io(_));
|
||||
}
|
||||
#[test]
|
||||
fn fmt_test() {
|
||||
|
@ -1402,7 +1402,7 @@ impl JsonRpcRequestProcessor {
|
||||
{
|
||||
bank.get_filtered_indexed_accounts(&IndexKey::ProgramId(*program_id), |account| {
|
||||
// The program-id account index checks for Account owner on inclusion. However, due
|
||||
// to the current AccountsDB implementation, an account may remain in storage as a
|
||||
// to the current AccountsDb implementation, an account may remain in storage as a
|
||||
// zero-lamport Account::Default() after being wiped and reinitialized in later
|
||||
// updates. We include the redundant filters here to avoid returning these
|
||||
// accounts.
|
||||
@ -1421,7 +1421,7 @@ impl JsonRpcRequestProcessor {
|
||||
mut filters: Vec<RpcFilterType>,
|
||||
) -> Vec<(Pubkey, Account)> {
|
||||
// The by-owner accounts index checks for Token Account state and Owner address on
|
||||
// inclusion. However, due to the current AccountsDB implementation, an account may remain
|
||||
// inclusion. However, due to the current AccountsDb implementation, an account may remain
|
||||
// in storage as a zero-lamport Account::Default() after being wiped and reinitialized in
|
||||
// later updates. We include the redundant filters here to avoid returning these accounts.
|
||||
//
|
||||
@ -1461,7 +1461,7 @@ impl JsonRpcRequestProcessor {
|
||||
mut filters: Vec<RpcFilterType>,
|
||||
) -> Vec<(Pubkey, Account)> {
|
||||
// The by-mint accounts index checks for Token Account state and Mint address on inclusion.
|
||||
// However, due to the current AccountsDB implementation, an account may remain in storage
|
||||
// However, due to the current AccountsDb implementation, an account may remain in storage
|
||||
// as be zero-lamport Account::Default() after being wiped and reinitialized in later
|
||||
// updates. We include the redundant filters here to avoid returning these accounts.
|
||||
//
|
||||
@ -3035,7 +3035,7 @@ pub mod tests {
|
||||
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||
};
|
||||
use solana_runtime::{
|
||||
accounts_background_service::ABSRequestSender, commitment::BlockCommitment,
|
||||
accounts_background_service::AbsRequestSender, commitment::BlockCommitment,
|
||||
};
|
||||
use solana_sdk::{
|
||||
clock::MAX_RECENT_BLOCKHASHES,
|
||||
@ -3152,7 +3152,7 @@ pub mod tests {
|
||||
bank_forks
|
||||
.write()
|
||||
.unwrap()
|
||||
.set_root(*root, &ABSRequestSender::default(), Some(0));
|
||||
.set_root(*root, &AbsRequestSender::default(), Some(0));
|
||||
let mut stakes = HashMap::new();
|
||||
stakes.insert(leader_vote_keypair.pubkey(), (1, Account::default()));
|
||||
let block_time = bank_forks
|
||||
|
@ -30,7 +30,7 @@ use solana_ledger::{
|
||||
};
|
||||
use solana_runtime::{
|
||||
accounts_background_service::{
|
||||
ABSRequestHandler, ABSRequestSender, AccountsBackgroundService, SendDroppedBankCallback,
|
||||
AbsRequestHandler, AbsRequestSender, AccountsBackgroundService, SendDroppedBankCallback,
|
||||
SnapshotRequestHandler,
|
||||
},
|
||||
bank_forks::{BankForks, SnapshotConfig},
|
||||
@ -228,9 +228,9 @@ impl Tvu {
|
||||
))));
|
||||
}
|
||||
|
||||
let accounts_background_request_sender = ABSRequestSender::new(snapshot_request_sender);
|
||||
let accounts_background_request_sender = AbsRequestSender::new(snapshot_request_sender);
|
||||
|
||||
let accounts_background_request_handler = ABSRequestHandler {
|
||||
let accounts_background_request_handler = AbsRequestHandler {
|
||||
snapshot_request_handler,
|
||||
pruned_banks_receiver,
|
||||
};
|
||||
|
@ -1048,7 +1048,7 @@ fn new_banks_from_ledger(
|
||||
));
|
||||
bank_forks.set_root(
|
||||
warp_slot,
|
||||
&solana_runtime::accounts_background_service::ABSRequestSender::default(),
|
||||
&solana_runtime::accounts_background_service::AbsRequestSender::default(),
|
||||
Some(warp_slot),
|
||||
);
|
||||
leader_schedule_cache.set_root(&bank_forks.root_bank());
|
||||
|
Reference in New Issue
Block a user