mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 11:41:51 +00:00
Fix clippy lints
This commit is contained in:
@@ -71,7 +71,7 @@ impl BeaconBlock {
|
||||
/// Note: performs a full tree-hash of `self.body`.
|
||||
///
|
||||
/// Spec v0.5.0
|
||||
pub fn into_header(&self) -> BeaconBlockHeader {
|
||||
pub fn block_header(&self) -> BeaconBlockHeader {
|
||||
BeaconBlockHeader {
|
||||
slot: self.slot,
|
||||
previous_block_root: self.previous_block_root,
|
||||
@@ -84,11 +84,11 @@ impl BeaconBlock {
|
||||
/// Returns a "temporary" header, where the `state_root` is `spec.zero_hash`.
|
||||
///
|
||||
/// Spec v0.5.0
|
||||
pub fn into_temporary_header(&self, spec: &ChainSpec) -> BeaconBlockHeader {
|
||||
pub fn temporary_block_header(&self, spec: &ChainSpec) -> BeaconBlockHeader {
|
||||
BeaconBlockHeader {
|
||||
state_root: spec.zero_hash,
|
||||
signature: spec.empty_signature.clone(),
|
||||
..self.into_header()
|
||||
..self.block_header()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ impl BeaconState {
|
||||
latest_state_roots: vec![spec.zero_hash; spec.slots_per_historical_root],
|
||||
latest_active_index_roots: vec![spec.zero_hash; spec.latest_active_index_roots_length],
|
||||
latest_slashed_balances: vec![0; spec.latest_slashed_exit_length],
|
||||
latest_block_header: BeaconBlock::empty(spec).into_temporary_header(spec),
|
||||
latest_block_header: BeaconBlock::empty(spec).temporary_block_header(spec),
|
||||
historical_roots: vec![],
|
||||
|
||||
/*
|
||||
@@ -386,7 +386,8 @@ impl BeaconState {
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), BeaconStateError> {
|
||||
let i = self.get_latest_block_roots_index(slot, spec)?;
|
||||
Ok(self.latest_block_roots[i] = block_root)
|
||||
self.latest_block_roots[i] = block_root;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Safely obtains the index for `latest_randao_mixes`
|
||||
@@ -449,7 +450,8 @@ impl BeaconState {
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), Error> {
|
||||
let i = self.get_randao_mix_index(epoch, spec)?;
|
||||
Ok(self.latest_randao_mixes[i] = mix)
|
||||
self.latest_randao_mixes[i] = mix;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Safely obtains the index for `latest_active_index_roots`, given some `epoch`.
|
||||
@@ -492,7 +494,8 @@ impl BeaconState {
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), Error> {
|
||||
let i = self.get_active_index_root_index(epoch, spec)?;
|
||||
Ok(self.latest_active_index_roots[i] = index_root)
|
||||
self.latest_active_index_roots[i] = index_root;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Replace `active_index_roots` with clones of `index_root`.
|
||||
@@ -537,7 +540,8 @@ impl BeaconState {
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), Error> {
|
||||
let i = self.get_latest_state_roots_index(slot, spec)?;
|
||||
Ok(self.latest_state_roots[i] = state_root)
|
||||
self.latest_state_roots[i] = state_root;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Safely obtains the index for `latest_slashed_balances`, given some `epoch`.
|
||||
@@ -573,7 +577,8 @@ impl BeaconState {
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), Error> {
|
||||
let i = self.get_slashed_balance_index(epoch, spec)?;
|
||||
Ok(self.latest_slashed_balances[i] = balance)
|
||||
self.latest_slashed_balances[i] = balance;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Generate a seed for the given `epoch`.
|
||||
|
||||
@@ -304,7 +304,6 @@ impl EpochCrosslinkCommitteesBuilder {
|
||||
|
||||
for (i, slot) in self.epoch.slot_iter(spec.slots_per_epoch).enumerate() {
|
||||
for j in (0..committees.len())
|
||||
.into_iter()
|
||||
.skip(i * committees_per_slot)
|
||||
.take(committees_per_slot)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ impl RelativeEpoch {
|
||||
/// Returns the `epoch` that `self` refers to, with respect to the `base` epoch.
|
||||
///
|
||||
/// Spec v0.5.0
|
||||
pub fn into_epoch(&self, base: Epoch) -> Epoch {
|
||||
pub fn into_epoch(self, base: Epoch) -> Epoch {
|
||||
match self {
|
||||
RelativeEpoch::Previous => base - 1,
|
||||
RelativeEpoch::Current => base,
|
||||
|
||||
@@ -214,7 +214,7 @@ impl TestingBeaconStateBuilder {
|
||||
- spec.min_attestation_inclusion_delay;
|
||||
let last_slot = std::cmp::min(state.slot.as_u64(), last_slot);
|
||||
|
||||
for slot in first_slot..last_slot + 1 {
|
||||
for slot in first_slot..=last_slot {
|
||||
let slot = Slot::from(slot);
|
||||
|
||||
let committees = state
|
||||
|
||||
@@ -47,7 +47,7 @@ impl TestingDepositBuilder {
|
||||
self.deposit
|
||||
.deposit_data
|
||||
.deposit_input
|
||||
.withdrawal_credentials = withdrawal_credentials.clone();
|
||||
.withdrawal_credentials = withdrawal_credentials;
|
||||
|
||||
self.deposit.deposit_data.deposit_input.proof_of_possession = self
|
||||
.deposit
|
||||
|
||||
Reference in New Issue
Block a user