mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-25 21:17:17 +00:00
fixup: remove some unused variables
This commit is contained in:
parent
beacf42aaf
commit
83456c6894
@ -23,7 +23,7 @@ pub fn get_genesis_beacon_state<T: EthSpec>(
|
|||||||
process_deposits(&mut state, genesis_validator_deposits, spec)?;
|
process_deposits(&mut state, genesis_validator_deposits, spec)?;
|
||||||
|
|
||||||
// Process genesis activations.
|
// Process genesis activations.
|
||||||
for (i, validator) in state.validator_registry.iter_mut().enumerate() {
|
for validator in &mut state.validator_registry {
|
||||||
if validator.effective_balance >= spec.max_effective_balance {
|
if validator.effective_balance >= spec.max_effective_balance {
|
||||||
validator.activation_eligibility_epoch = spec.genesis_epoch;
|
validator.activation_eligibility_epoch = spec.genesis_epoch;
|
||||||
validator.activation_epoch = spec.genesis_epoch;
|
validator.activation_epoch = spec.genesis_epoch;
|
||||||
|
@ -286,8 +286,8 @@ pub fn process_attester_slashings<T: EthSpec>(
|
|||||||
)
|
)
|
||||||
.map_err(|e| e.into_with_index(i))?;
|
.map_err(|e| e.into_with_index(i))?;
|
||||||
|
|
||||||
let slashable_indices = get_slashable_indices(&state, &attester_slashing, spec)
|
let slashable_indices =
|
||||||
.map_err(|e| e.into_with_index(i))?;
|
get_slashable_indices(&state, &attester_slashing).map_err(|e| e.into_with_index(i))?;
|
||||||
|
|
||||||
for i in slashable_indices {
|
for i in slashable_indices {
|
||||||
slash_validator(state, i as usize, None, spec)?;
|
slash_validator(state, i as usize, None, spec)?;
|
||||||
|
@ -77,7 +77,7 @@ fn validate_attestation_parametric<T: EthSpec>(
|
|||||||
|
|
||||||
// Verify the Casper FFG vote.
|
// Verify the Casper FFG vote.
|
||||||
if !time_independent_only {
|
if !time_independent_only {
|
||||||
verify_casper_ffg_vote(attestation, state, spec)?;
|
verify_casper_ffg_vote(attestation, state)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crosslink data root is zero (to be removed in phase 1).
|
// Crosslink data root is zero (to be removed in phase 1).
|
||||||
@ -103,7 +103,6 @@ fn validate_attestation_parametric<T: EthSpec>(
|
|||||||
fn verify_casper_ffg_vote<T: EthSpec>(
|
fn verify_casper_ffg_vote<T: EthSpec>(
|
||||||
attestation: &Attestation,
|
attestation: &Attestation,
|
||||||
state: &BeaconState<T>,
|
state: &BeaconState<T>,
|
||||||
spec: &ChainSpec,
|
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let data = &attestation.data;
|
let data = &attestation.data;
|
||||||
if data.target_epoch == state.current_epoch() {
|
if data.target_epoch == state.current_epoch() {
|
||||||
|
@ -35,7 +35,7 @@ pub fn verify_attester_slashing<T: EthSpec>(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For a given attester slashing, return the indices able to be slashed.
|
/// For a given attester slashing, return the indices able to be slashed in ascending order.
|
||||||
///
|
///
|
||||||
/// Returns Ok(indices) if `indices.len() > 0`.
|
/// Returns Ok(indices) if `indices.len() > 0`.
|
||||||
///
|
///
|
||||||
@ -43,14 +43,10 @@ pub fn verify_attester_slashing<T: EthSpec>(
|
|||||||
pub fn get_slashable_indices<T: EthSpec>(
|
pub fn get_slashable_indices<T: EthSpec>(
|
||||||
state: &BeaconState<T>,
|
state: &BeaconState<T>,
|
||||||
attester_slashing: &AttesterSlashing,
|
attester_slashing: &AttesterSlashing,
|
||||||
spec: &ChainSpec,
|
|
||||||
) -> Result<Vec<u64>, Error> {
|
) -> Result<Vec<u64>, Error> {
|
||||||
get_slashable_indices_modular(
|
get_slashable_indices_modular(state, attester_slashing, |_, validator| {
|
||||||
state,
|
validator.is_slashable_at(state.current_epoch())
|
||||||
attester_slashing,
|
})
|
||||||
|_, validator| validator.is_slashable_at(state.current_epoch()),
|
|
||||||
spec,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Same as `gather_attester_slashing_indices` but allows the caller to specify the criteria
|
/// Same as `gather_attester_slashing_indices` but allows the caller to specify the criteria
|
||||||
@ -59,7 +55,6 @@ pub fn get_slashable_indices_modular<F, T: EthSpec>(
|
|||||||
state: &BeaconState<T>,
|
state: &BeaconState<T>,
|
||||||
attester_slashing: &AttesterSlashing,
|
attester_slashing: &AttesterSlashing,
|
||||||
is_slashable: F,
|
is_slashable: F,
|
||||||
spec: &ChainSpec,
|
|
||||||
) -> Result<Vec<u64>, Error>
|
) -> Result<Vec<u64>, Error>
|
||||||
where
|
where
|
||||||
F: Fn(u64, &Validator) -> bool,
|
F: Fn(u64, &Validator) -> bool,
|
||||||
|
Loading…
Reference in New Issue
Block a user