Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion beacon_node/beacon_chain/src/validator_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1893,7 +1893,7 @@ impl<E: EthSpec> ValidatorMonitor<E> {
epoch - 2
};

for (_, validator) in self.validators.iter() {
for validator in self.validators.values() {
let id = &validator.id;
let summaries = validator.summaries.read();

Expand Down
2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/src/peer_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2236,7 +2236,7 @@ mod tests {
// Make sure a peer on the same subnet has been removed
println!(
"Check against: {}, {}",
alternative_index, &peers[alternative_index]
alternative_index, peers[alternative_index]
);
assert!(!connected_peers.contains(&peers[alternative_index]));
}
Expand Down
4 changes: 2 additions & 2 deletions beacon_node/lighthouse_network/src/peer_manager/peerdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ mod tests {
}
assert_eq!(pdb.disconnected_peers, 0);

for (_, p) in peer_list.iter() {
for p in peer_list.values() {
pdb.inject_disconnect(p);
// Allow the timing to update correctly
}
Expand Down Expand Up @@ -1600,7 +1600,7 @@ mod tests {
peer_list.insert(id, new_peer);
}
assert_eq!(pdb.disconnected_peers, pdb.disconnected_peers().count());
for (_, p) in peer_list.iter() {
for p in peer_list.values() {
pdb.inject_disconnect(p);
}
assert_eq!(pdb.disconnected_peers, pdb.disconnected_peers().count());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ impl GossipCache {
// Get the registered messages for this topic.
pub fn retrieve(&mut self, topic: &GossipTopic) -> Option<impl Iterator<Item = Vec<u8>> + '_> {
if let Some(msgs) = self.topic_msgs.remove(topic) {
for (_, key) in msgs.iter() {
for key in msgs.values() {
self.expirations.remove(key);
}
Some(msgs.into_keys())
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/operation_pool/src/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl<'a, E: EthSpec> AttMaxCover<'a, E> {
}
}

Some((index, proposer_reward_numerator)).filter(|_| proposer_reward_numerator != 0)
(proposer_reward_numerator != 0).then_some((index, proposer_reward_numerator))
})
.collect();

Expand Down
2 changes: 1 addition & 1 deletion consensus/proto_array/src/proto_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,7 @@ impl ProtoArray {
}

// Adjust the indices map.
for (_root, index) in self.indices.iter_mut() {
for index in self.indices.values_mut() {
*index = index
.checked_sub(finalized_index)
.ok_or(Error::IndexOverflow("indices"))?;
Expand Down
2 changes: 1 addition & 1 deletion crypto/eth2_keystore/src/keystore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl Keystore {

/// Returns the pubkey for the keystore, parsed as a `PublicKey` if it parses.
pub fn public_key(&self) -> Option<PublicKey> {
serde_json::from_str(&format!("\"0x{}\"", &self.json.pubkey)).ok()
serde_json::from_str(&format!("\"0x{}\"", self.json.pubkey)).ok()
}

/// Returns the key derivation function for the keystore.
Expand Down
9 changes: 3 additions & 6 deletions validator_client/lighthouse_validator_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,12 +942,9 @@ impl<T: SlotClock + 'static, E: EthSpec> ValidatorStore for LighthouseValidatorS
}
})
})
.and_then(|factor| {
// If builder boost factor is set to 100 it should be treated
// as None to prevent unnecessary calculations that could
// lead to loss of information.
if factor == 100 { None } else { Some(factor) }
})
// If builder boost factor is set to 100 it should be treated as None
// to prevent unnecessary calculations that could lead to loss of information.
.filter(|&factor| factor != 100)
}

async fn randao_reveal(
Expand Down
2 changes: 1 addition & 1 deletion validator_client/slashing_protection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl SigningRoot {
}

fn to_hash256(self) -> Option<Hash256> {
Some(self.0).filter(|_| !self.is_null())
(!self.is_null()).then_some(self.0)
}
}

Expand Down
2 changes: 1 addition & 1 deletion validator_manager/src/create_validators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ impl ValidatorsAndDeposits {
.await
{
Ok(Some(_)) => {
return Err(format!(
Err(format!(
"Validator {:?} at derivation index {} already exists in the beacon chain. \
This indicates a slashing risk, be sure to never run the same validator on two \
different validator clients. If you understand the risks and are certain you \
Expand Down
Loading