mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-30 19:23:50 +00:00
Fix clippy lints
This commit is contained in:
@@ -8,7 +8,7 @@ pub fn genesis_beacon_block(state_root: Hash256, spec: &ChainSpec) -> BeaconBloc
|
||||
BeaconBlock {
|
||||
slot: spec.initial_slot_number,
|
||||
parent_root: spec.zero_hash,
|
||||
state_root: state_root,
|
||||
state_root,
|
||||
randao_reveal: spec.zero_hash,
|
||||
candidate_pow_receipt_root: spec.zero_hash,
|
||||
signature: genesis_signature(),
|
||||
|
||||
@@ -15,8 +15,8 @@ pub enum ForkChoiceError {
|
||||
}
|
||||
|
||||
pub fn naive_fork_choice<T>(
|
||||
head_block_hashes: &Vec<Hash256>,
|
||||
block_store: Arc<BeaconBlockStore<T>>,
|
||||
head_block_hashes: &[Hash256],
|
||||
block_store: &Arc<BeaconBlockStore<T>>,
|
||||
) -> Result<Option<usize>, ForkChoiceError>
|
||||
where
|
||||
T: ClientDB + Sized,
|
||||
@@ -28,7 +28,7 @@ where
|
||||
*/
|
||||
for (index, block_hash) in head_block_hashes.iter().enumerate() {
|
||||
let ssz = block_store
|
||||
.get(&block_hash.to_vec()[..])?
|
||||
.get(&block_hash)?
|
||||
.ok_or(ForkChoiceError::MissingBlock)?;
|
||||
let (block, _) = BeaconBlock::ssz_decode(&ssz, 0)?;
|
||||
head_blocks.push((index, block));
|
||||
|
||||
@@ -64,7 +64,7 @@ impl ChainSpec {
|
||||
* Intialization parameters
|
||||
*/
|
||||
initial_validators: initial_validators_for_testing(),
|
||||
genesis_time: 1544672897,
|
||||
genesis_time: 1_544_672_897,
|
||||
processed_pow_receipt_root: Hash256::from("pow_root".as_bytes()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ use rand::RngCore;
|
||||
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||
use std::convert;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
||||
pub enum ValidatorStatus {
|
||||
PendingActivation,
|
||||
Active,
|
||||
@@ -87,7 +87,7 @@ impl<T: RngCore> TestRandom<T> for ValidatorStatus {
|
||||
ValidatorStatus::Withdrawn,
|
||||
ValidatorStatus::Penalized,
|
||||
];
|
||||
options[(rng.next_u32() as usize) % options.len()].clone()
|
||||
options[(rng.next_u32() as usize) % options.len()]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use bls_aggregates::AggregateSignature as RawAggregateSignature;
|
||||
///
|
||||
/// This struct is a wrapper upon a base type and provides helper functions (e.g., SSZ
|
||||
/// serialization).
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
#[derive(Debug, PartialEq, Clone, Default)]
|
||||
pub struct AggregateSignature(RawAggregateSignature);
|
||||
|
||||
impl AggregateSignature {
|
||||
|
||||
@@ -26,7 +26,7 @@ impl SystemTimeSlotClock {
|
||||
if slot_duration_seconds == 0 {
|
||||
Err(Error::SlotDurationIsZero)
|
||||
} else {
|
||||
Ok(SystemTimeSlotClock {
|
||||
Ok(Self {
|
||||
genesis_seconds,
|
||||
slot_duration_seconds,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user