mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-20 14:28:37 +00:00
Fix clippy warnings (#1385)
## Issue Addressed NA ## Proposed Changes Fixes most clippy warnings and ignores the rest of them, see issue #1388.
This commit is contained in:
@@ -1073,7 +1073,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
genesis_time: self.genesis_time,
|
||||
genesis_validators_root: self.genesis_validators_root,
|
||||
slot: self.slot,
|
||||
fork: self.fork.clone(),
|
||||
fork: self.fork,
|
||||
latest_block_header: self.latest_block_header.clone(),
|
||||
block_roots: self.block_roots.clone(),
|
||||
state_roots: self.state_roots.clone(),
|
||||
@@ -1088,9 +1088,9 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
previous_epoch_attestations: self.previous_epoch_attestations.clone(),
|
||||
current_epoch_attestations: self.current_epoch_attestations.clone(),
|
||||
justification_bits: self.justification_bits.clone(),
|
||||
previous_justified_checkpoint: self.previous_justified_checkpoint.clone(),
|
||||
current_justified_checkpoint: self.current_justified_checkpoint.clone(),
|
||||
finalized_checkpoint: self.finalized_checkpoint.clone(),
|
||||
previous_justified_checkpoint: self.previous_justified_checkpoint,
|
||||
current_justified_checkpoint: self.current_justified_checkpoint,
|
||||
finalized_checkpoint: self.finalized_checkpoint,
|
||||
committee_caches: if config.committee_caches {
|
||||
self.committee_caches.clone()
|
||||
} else {
|
||||
|
||||
@@ -5,6 +5,7 @@ use crate::{BeaconState, EthSpec, Hash256, Unsigned, Validator};
|
||||
use cached_tree_hash::{int_log, CacheArena, CachedTreeHash, TreeHashCache};
|
||||
use rayon::prelude::*;
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use std::cmp::Ordering;
|
||||
use tree_hash::{mix_in_length, MerkleHasher, TreeHash};
|
||||
|
||||
/// The number of fields on a beacon state.
|
||||
@@ -270,8 +271,8 @@ impl ParallelValidatorTreeHash {
|
||||
/// This function makes assumptions that the `validators` list will only change in accordance
|
||||
/// with valid per-block/per-slot state transitions.
|
||||
fn leaves(&mut self, validators: &[Validator]) -> Result<Vec<Vec<Hash256>>, Error> {
|
||||
if self.len() < validators.len() {
|
||||
validators.iter().skip(self.len()).for_each(|v| {
|
||||
match self.len().cmp(&validators.len()) {
|
||||
Ordering::Less => validators.iter().skip(self.len()).for_each(|v| {
|
||||
if self
|
||||
.arenas
|
||||
.last()
|
||||
@@ -287,9 +288,11 @@ impl ParallelValidatorTreeHash {
|
||||
.expect("Cannot reach this block if arenas is empty.");
|
||||
caches.push(v.new_tree_hash_cache(arena))
|
||||
}
|
||||
})
|
||||
} else if validators.len() < self.len() {
|
||||
return Err(Error::ValidatorRegistryShrunk);
|
||||
}),
|
||||
Ordering::Greater => {
|
||||
return Err(Error::ValidatorRegistryShrunk);
|
||||
}
|
||||
Ordering::Equal => (),
|
||||
}
|
||||
|
||||
self.arenas
|
||||
|
||||
@@ -24,9 +24,9 @@ impl TestingAttestationDataBuilder {
|
||||
let is_previous_epoch = slot.epoch(T::slots_per_epoch()) != current_epoch;
|
||||
|
||||
let mut source = if is_previous_epoch {
|
||||
state.previous_justified_checkpoint.clone()
|
||||
state.previous_justified_checkpoint
|
||||
} else {
|
||||
state.current_justified_checkpoint.clone()
|
||||
state.current_justified_checkpoint
|
||||
};
|
||||
|
||||
let mut target = if is_previous_epoch {
|
||||
|
||||
@@ -42,7 +42,7 @@ impl TestingAttesterSlashingBuilder {
|
||||
slot,
|
||||
index,
|
||||
beacon_block_root: hash_1,
|
||||
source: checkpoint_1.clone(),
|
||||
source: checkpoint_1,
|
||||
target: checkpoint_1,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user