chore: cargo fmt

This commit is contained in:
Alexander Meißner
2021-06-18 15:34:58 +02:00
committed by Michael Vines
parent 6514096a67
commit 789f33e8db
11 changed files with 24 additions and 83 deletions

View File

@@ -1889,13 +1889,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
pubkey, pubkey,
output_file, output_file,
use_lamports_unit, use_lamports_unit,
} => process_show_account( } => process_show_account(&rpc_client, config, pubkey, output_file, *use_lamports_unit),
&rpc_client,
config,
pubkey,
output_file,
*use_lamports_unit,
),
CliCommand::Transfer { CliCommand::Transfer {
amount, amount,
to, to,

View File

@@ -218,13 +218,7 @@ impl Tower {
) )
.clone(); .clone();
Self::new( Self::new(my_pubkey, vote_account, root, &heaviest_bank, ledger_path)
my_pubkey,
vote_account,
root,
&heaviest_bank,
ledger_path,
)
} }
pub(crate) fn collect_vote_lockouts<F>( pub(crate) fn collect_vote_lockouts<F>(

View File

@@ -754,12 +754,7 @@ impl ReplayStage {
) )
}; };
Self::initialize_progress_and_fork_choice( Self::initialize_progress_and_fork_choice(&root_bank, frozen_banks, my_pubkey, vote_account)
&root_bank,
frozen_banks,
my_pubkey,
vote_account,
)
} }
pub(crate) fn initialize_progress_and_fork_choice( pub(crate) fn initialize_progress_and_fork_choice(
@@ -777,14 +772,7 @@ impl ReplayStage {
let prev_leader_slot = progress.get_bank_prev_leader_slot(bank); let prev_leader_slot = progress.get_bank_prev_leader_slot(bank);
progress.insert( progress.insert(
bank.slot(), bank.slot(),
ForkProgress::new_from_bank( ForkProgress::new_from_bank(bank, my_pubkey, vote_account, prev_leader_slot, 0, 0),
bank,
my_pubkey,
vote_account,
prev_leader_slot,
0,
0,
),
); );
} }
let root = root_bank.slot(); let root = root_bank.slot();
@@ -3107,8 +3095,7 @@ mod tests {
let mut entries = let mut entries =
entry::create_ticks(bank.ticks_per_slot(), hashes_per_tick, blockhash); entry::create_ticks(bank.ticks_per_slot(), hashes_per_tick, blockhash);
let last_entry_hash = entries.last().unwrap().hash; let last_entry_hash = entries.last().unwrap().hash;
let tx = let tx = system_transaction::transfer(genesis_keypair, &keypair.pubkey(), 2, blockhash);
system_transaction::transfer(genesis_keypair, &keypair.pubkey(), 2, blockhash);
let trailing_entry = entry::next_entry(&last_entry_hash, 1, vec![tx]); let trailing_entry = entry::next_entry(&last_entry_hash, 1, vec![tx]);
entries.push(trailing_entry); entries.push(trailing_entry);
entries_to_test_shreds(entries, slot, slot.saturating_sub(1), true, 0) entries_to_test_shreds(entries, slot, slot.saturating_sub(1), true, 0)

View File

@@ -275,13 +275,7 @@ impl CrdsGossipPush {
let need = Self::compute_need(self.num_active, self.active_set.len(), ratio); let need = Self::compute_need(self.num_active, self.active_set.len(), ratio);
let mut new_items = HashMap::new(); let mut new_items = HashMap::new();
let (weights, peers): (Vec<_>, Vec<_>) = self let (weights, peers): (Vec<_>, Vec<_>) = self
.push_options( .push_options(crds, self_id, self_shred_version, stakes, gossip_validators)
crds,
self_id,
self_shred_version,
stakes,
gossip_validators,
)
.into_iter() .into_iter()
.unzip(); .unzip();
if peers.is_empty() { if peers.is_empty() {

View File

@@ -448,8 +448,7 @@ impl LocalCluster {
let (blockhash, _fee_calculator, _last_valid_slot) = client let (blockhash, _fee_calculator, _last_valid_slot) = client
.get_recent_blockhash_with_commitment(CommitmentConfig::processed()) .get_recent_blockhash_with_commitment(CommitmentConfig::processed())
.unwrap(); .unwrap();
let mut tx = let mut tx = system_transaction::transfer(source_keypair, dest_pubkey, lamports, blockhash);
system_transaction::transfer(source_keypair, dest_pubkey, lamports, blockhash);
info!( info!(
"executing transfer of {} from {} to {}", "executing transfer of {} from {} to {}",
lamports, lamports,

View File

@@ -2844,10 +2844,7 @@ fn test_hard_fork_invalidates_tower() {
thread.join().unwrap(); thread.join().unwrap();
// new slots should be rooted after hard-fork cluster relaunch // new slots should be rooted after hard-fork cluster relaunch
cluster cluster.lock().unwrap().check_for_new_roots(16, "hard fork");
.lock()
.unwrap()
.check_for_new_roots(16, "hard fork");
} }
#[test] #[test]

View File

@@ -311,9 +311,8 @@ impl ExchangeProcessor {
Self::is_account_unallocated(keyed_accounts[ORDER_INDEX].try_account_ref()?.data())?; Self::is_account_unallocated(keyed_accounts[ORDER_INDEX].try_account_ref()?.data())?;
let mut account = Self::deserialize_account( let mut account =
keyed_accounts[ACCOUNT_INDEX].try_account_ref_mut()?.data(), Self::deserialize_account(keyed_accounts[ACCOUNT_INDEX].try_account_ref_mut()?.data())?;
)?;
if &account.owner != keyed_accounts[OWNER_INDEX].unsigned_key() { if &account.owner != keyed_accounts[OWNER_INDEX].unsigned_key() {
error!("Signer does not own account"); error!("Signer does not own account");
@@ -367,8 +366,7 @@ impl ExchangeProcessor {
return Err(InstructionError::InvalidArgument); return Err(InstructionError::InvalidArgument);
} }
let order = let order = Self::deserialize_order(keyed_accounts[ORDER_INDEX].try_account_ref()?.data())?;
Self::deserialize_order(keyed_accounts[ORDER_INDEX].try_account_ref()?.data())?;
if &order.owner != keyed_accounts[OWNER_INDEX].unsigned_key() { if &order.owner != keyed_accounts[OWNER_INDEX].unsigned_key() {
error!("Signer does not own order"); error!("Signer does not own order");

View File

@@ -1495,11 +1495,8 @@ impl AccountsDb {
.map(|pubkeys: &[Pubkey]| { .map(|pubkeys: &[Pubkey]| {
let mut reclaims = Vec::new(); let mut reclaims = Vec::new();
for pubkey in pubkeys { for pubkey in pubkeys {
self.accounts_index.clean_rooted_entries( self.accounts_index
pubkey, .clean_rooted_entries(pubkey, &mut reclaims, max_clean_root);
&mut reclaims,
max_clean_root,
);
} }
reclaims reclaims
}); });
@@ -9517,10 +9514,7 @@ pub mod tests {
let dummy_id1 = 22; let dummy_id1 = 22;
let entry1 = Arc::new(AccountStorageEntry::new( let entry1 = Arc::new(AccountStorageEntry::new(
dummy_path, dummy_path, dummy_slot, dummy_id1, dummy_size,
dummy_slot,
dummy_id1,
dummy_size,
)); ));
entry1.alive_bytes.store(8000, Ordering::Relaxed); entry1.alive_bytes.store(8000, Ordering::Relaxed);
@@ -9531,10 +9525,7 @@ pub mod tests {
let dummy_id2 = 44; let dummy_id2 = 44;
let entry2 = Arc::new(AccountStorageEntry::new( let entry2 = Arc::new(AccountStorageEntry::new(
dummy_path, dummy_path, dummy_slot, dummy_id2, dummy_size,
dummy_slot,
dummy_id2,
dummy_size,
)); ));
entry2.alive_bytes.store(3000, Ordering::Relaxed); entry2.alive_bytes.store(3000, Ordering::Relaxed);
candidates candidates
@@ -9553,10 +9544,7 @@ pub mod tests {
let dummy_size = 4 * PAGE_SIZE; let dummy_size = 4 * PAGE_SIZE;
let dummy_id1 = 22; let dummy_id1 = 22;
let entry1 = Arc::new(AccountStorageEntry::new( let entry1 = Arc::new(AccountStorageEntry::new(
dummy_path, dummy_path, dummy_slot, dummy_id1, dummy_size,
dummy_slot,
dummy_id1,
dummy_size,
)); ));
entry1.alive_bytes.store(3500, Ordering::Relaxed); entry1.alive_bytes.store(3500, Ordering::Relaxed);
@@ -11037,18 +11025,12 @@ pub mod tests {
let dummy_id1 = 22; let dummy_id1 = 22;
let entry1 = Arc::new(AccountStorageEntry::new( let entry1 = Arc::new(AccountStorageEntry::new(
dummy_path, dummy_path, dummy_slot, dummy_id1, dummy_size,
dummy_slot,
dummy_id1,
dummy_size,
)); ));
let dummy_id2 = 44; let dummy_id2 = 44;
let entry2 = Arc::new(AccountStorageEntry::new( let entry2 = Arc::new(AccountStorageEntry::new(
dummy_path, dummy_path, dummy_slot, dummy_id2, dummy_size,
dummy_slot,
dummy_id2,
dummy_size,
)); ));
let mut recycle_stores = RecycleStores::default(); let mut recycle_stores = RecycleStores::default();

View File

@@ -7320,8 +7320,7 @@ pub(crate) mod tests {
.map(move |(_stake_pubkey, stake_account)| (stake_account, vote_account)) .map(move |(_stake_pubkey, stake_account)| (stake_account, vote_account))
}) })
.map(|(stake_account, vote_account)| { .map(|(stake_account, vote_account)| {
stake_state::calculate_points(stake_account, vote_account, None, true) stake_state::calculate_points(stake_account, vote_account, None, true).unwrap_or(0)
.unwrap_or(0)
}) })
.sum(); .sum();

View File

@@ -308,10 +308,8 @@ impl Message {
nonce_account_pubkey: &Pubkey, nonce_account_pubkey: &Pubkey,
nonce_authority_pubkey: &Pubkey, nonce_authority_pubkey: &Pubkey,
) -> Self { ) -> Self {
let nonce_ix = system_instruction::advance_nonce_account( let nonce_ix =
nonce_account_pubkey, system_instruction::advance_nonce_account(nonce_account_pubkey, nonce_authority_pubkey);
nonce_authority_pubkey,
);
instructions.insert(0, nonce_ix); instructions.insert(0, nonce_ix);
Self::new(&instructions, payer) Self::new(&instructions, payer)
} }

View File

@@ -76,10 +76,9 @@ fn main() {
*/ */
} }
let last_median = get_last_metrics(&"median".to_string(), &db, &name, branch) let last_median =
.unwrap_or_default(); get_last_metrics(&"median".to_string(), &db, &name, branch).unwrap_or_default();
let last_deviation = let last_deviation = get_last_metrics(&"deviation".to_string(), &db, &name, branch)
get_last_metrics(&"deviation".to_string(), &db, &name, branch)
.unwrap_or_default(); .unwrap_or_default();
results.insert(name, (median, deviation, last_median, last_deviation)); results.insert(name, (median, deviation, last_median, last_deviation));