clippy
This commit is contained in:
committed by
mergify[bot]
parent
01262cda3f
commit
eefcf484cb
@ -179,19 +179,13 @@ where
|
|||||||
|
|
||||||
info!("Generating {:?} account keys", total_keys);
|
info!("Generating {:?} account keys", total_keys);
|
||||||
let mut account_keypairs = generate_keypairs(total_keys);
|
let mut account_keypairs = generate_keypairs(total_keys);
|
||||||
let src_keypairs: Vec<_> = account_keypairs
|
let src_keypairs: Vec<_> = account_keypairs.drain(0..accounts_in_groups).collect();
|
||||||
.drain(0..accounts_in_groups)
|
|
||||||
.map(|keypair| keypair)
|
|
||||||
.collect();
|
|
||||||
let src_pubkeys: Vec<Pubkey> = src_keypairs
|
let src_pubkeys: Vec<Pubkey> = src_keypairs
|
||||||
.iter()
|
.iter()
|
||||||
.map(|keypair| keypair.pubkey())
|
.map(|keypair| keypair.pubkey())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let profit_keypairs: Vec<_> = account_keypairs
|
let profit_keypairs: Vec<_> = account_keypairs.drain(0..accounts_in_groups).collect();
|
||||||
.drain(0..accounts_in_groups)
|
|
||||||
.map(|keypair| keypair)
|
|
||||||
.collect();
|
|
||||||
let profit_pubkeys: Vec<Pubkey> = profit_keypairs
|
let profit_pubkeys: Vec<Pubkey> = profit_keypairs
|
||||||
.iter()
|
.iter()
|
||||||
.map(|keypair| keypair.pubkey())
|
.map(|keypair| keypair.pubkey())
|
||||||
|
@ -780,7 +780,7 @@ impl ClusterInfo {
|
|||||||
.crds
|
.crds
|
||||||
.table
|
.table
|
||||||
.values()
|
.values()
|
||||||
.filter_map(|x| x.value.snapshot_hash().map(|v| v))
|
.filter_map(|x| x.value.snapshot_hash())
|
||||||
.filter_map(|x| {
|
.filter_map(|x| {
|
||||||
for (table_slot, hash) in &x.hashes {
|
for (table_slot, hash) in &x.hashes {
|
||||||
if *table_slot == slot {
|
if *table_slot == slot {
|
||||||
|
@ -160,7 +160,6 @@ pub fn get_multi_client(nodes: &[ContactInfo]) -> (ThinClient, usize) {
|
|||||||
let addrs: Vec<_> = nodes
|
let addrs: Vec<_> = nodes
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(ContactInfo::valid_client_facing_addr)
|
.filter_map(ContactInfo::valid_client_facing_addr)
|
||||||
.map(|addrs| addrs)
|
|
||||||
.collect();
|
.collect();
|
||||||
let rpc_addrs: Vec<_> = addrs.iter().map(|addr| addr.0).collect();
|
let rpc_addrs: Vec<_> = addrs.iter().map(|addr| addr.0).collect();
|
||||||
let tpu_addrs: Vec<_> = addrs.iter().map(|addr| addr.1).collect();
|
let tpu_addrs: Vec<_> = addrs.iter().map(|addr| addr.1).collect();
|
||||||
|
@ -202,7 +202,7 @@ fn run_simulation(stakes: &[u64], fanout: usize) {
|
|||||||
#[test]
|
#[test]
|
||||||
#[serial]
|
#[serial]
|
||||||
fn test_retransmit_small() {
|
fn test_retransmit_small() {
|
||||||
let stakes: Vec<_> = (0..200).map(|i| i).collect();
|
let stakes: Vec<_> = (0..200).collect();
|
||||||
run_simulation(&stakes, 200);
|
run_simulation(&stakes, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ fn test_retransmit_small() {
|
|||||||
#[serial]
|
#[serial]
|
||||||
fn test_retransmit_medium() {
|
fn test_retransmit_medium() {
|
||||||
let num_nodes = 2000;
|
let num_nodes = 2000;
|
||||||
let stakes: Vec<_> = (0..num_nodes).map(|i| i).collect();
|
let stakes: Vec<_> = (0..num_nodes).collect();
|
||||||
run_simulation(&stakes, 200);
|
run_simulation(&stakes, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,6 +229,6 @@ fn test_retransmit_medium_equal_stakes() {
|
|||||||
#[serial]
|
#[serial]
|
||||||
fn test_retransmit_large() {
|
fn test_retransmit_large() {
|
||||||
let num_nodes = 4000;
|
let num_nodes = 4000;
|
||||||
let stakes: Vec<_> = (0..num_nodes).map(|i| i).collect();
|
let stakes: Vec<_> = (0..num_nodes).collect();
|
||||||
run_simulation(&stakes, 2);
|
run_simulation(&stakes, 2);
|
||||||
}
|
}
|
||||||
|
@ -2170,11 +2170,7 @@ impl Blockstore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_root(&self, slot: Slot) -> bool {
|
pub fn is_root(&self, slot: Slot) -> bool {
|
||||||
if let Ok(Some(true)) = self.db.get::<cf::Root>(slot) {
|
matches!(self.db.get::<cf::Root>(slot), Ok(Some(true)))
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_roots(&self, rooted_slots: &[u64]) -> Result<()> {
|
pub fn set_roots(&self, rooted_slots: &[u64]) -> Result<()> {
|
||||||
@ -2194,15 +2190,12 @@ impl Blockstore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_dead(&self, slot: Slot) -> bool {
|
pub fn is_dead(&self, slot: Slot) -> bool {
|
||||||
if let Some(true) = self
|
matches!(
|
||||||
.db
|
self.db
|
||||||
.get::<cf::DeadSlots>(slot)
|
.get::<cf::DeadSlots>(slot)
|
||||||
.expect("fetch from DeadSlots column family failed")
|
.expect("fetch from DeadSlots column family failed"),
|
||||||
{
|
Some(true)
|
||||||
true
|
)
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_dead_slot(&self, slot: Slot) -> Result<()> {
|
pub fn set_dead_slot(&self, slot: Slot) -> Result<()> {
|
||||||
|
@ -58,10 +58,7 @@ impl<'a> Proof<'a> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
match result {
|
matches!(result, Some(_))
|
||||||
Some(_) => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1519,11 +1519,7 @@ impl AccountsDB {
|
|||||||
hashes = new_hashes.chunks(fanout).map(|x| x.to_vec()).collect();
|
hashes = new_hashes.chunks(fanout).map(|x| x.to_vec()).collect();
|
||||||
}
|
}
|
||||||
let mut hasher = Hasher::default();
|
let mut hasher = Hasher::default();
|
||||||
hashes
|
hashes.into_iter().flatten().for_each(|hash| {
|
||||||
.into_iter()
|
|
||||||
.flatten()
|
|
||||||
.map(|hash| hash)
|
|
||||||
.for_each(|hash| {
|
|
||||||
hasher.hash(hash.as_ref());
|
hasher.hash(hash.as_ref());
|
||||||
});
|
});
|
||||||
hasher.result()
|
hasher.result()
|
||||||
|
@ -198,10 +198,7 @@ pub enum HashAgeKind {
|
|||||||
|
|
||||||
impl HashAgeKind {
|
impl HashAgeKind {
|
||||||
pub fn is_durable_nonce(&self) -> bool {
|
pub fn is_durable_nonce(&self) -> bool {
|
||||||
match self {
|
matches!(self, HashAgeKind::DurableNonce(_, _))
|
||||||
HashAgeKind::DurableNonce(_, _) => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,10 +23,8 @@ pub fn transaction_uses_durable_nonce(tx: &Transaction) -> Option<&CompiledInstr
|
|||||||
Some(program_id) => system_program::check_id(&program_id),
|
Some(program_id) => system_program::check_id(&program_id),
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
} && match limited_deserialize(&maybe_ix.data) {
|
} && matches!(limited_deserialize(&maybe_ix.data), Ok(SystemInstruction::AdvanceNonceAccount))
|
||||||
Ok(SystemInstruction::AdvanceNonceAccount) => true,
|
)
|
||||||
_ => false,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_nonce_pubkey_from_instruction<'a>(
|
pub fn get_nonce_pubkey_from_instruction<'a>(
|
||||||
|
Reference in New Issue
Block a user