removed verify_exit_time_independent_only function (#2509)

## Issue Addressed

Closes #1676 

## Proposed Changes

Removed unneeded functions `verify_exit_parametric` and `verify_exit_time_independent_only`
This commit is contained in:
ethDreamer 2021-08-30 06:41:30 +00:00
parent bc14d1d73d
commit 6b65b6f3bd
2 changed files with 2 additions and 27 deletions

View File

@ -20,7 +20,7 @@ pub use verify_attestation::{
pub use verify_deposit::{ pub use verify_deposit::{
get_existing_validator_index, verify_deposit_merkle_proof, verify_deposit_signature, get_existing_validator_index, verify_deposit_merkle_proof, verify_deposit_signature,
}; };
pub use verify_exit::{verify_exit, verify_exit_time_independent_only}; pub use verify_exit::verify_exit;
pub mod altair; pub mod altair;
pub mod block_signature_verifier; pub mod block_signature_verifier;

View File

@ -19,35 +19,10 @@ fn error(reason: ExitInvalid) -> BlockOperationError<ExitInvalid> {
/// ///
/// Spec v0.12.1 /// Spec v0.12.1
pub fn verify_exit<T: EthSpec>( pub fn verify_exit<T: EthSpec>(
state: &BeaconState<T>,
exit: &SignedVoluntaryExit,
verify_signatures: VerifySignatures,
spec: &ChainSpec,
) -> Result<()> {
verify_exit_parametric(state, exit, verify_signatures, spec, false)
}
/// Like `verify_exit` but doesn't run checks which may become true in future states.
///
/// Spec v0.12.1
pub fn verify_exit_time_independent_only<T: EthSpec>(
state: &BeaconState<T>,
exit: &SignedVoluntaryExit,
verify_signatures: VerifySignatures,
spec: &ChainSpec,
) -> Result<()> {
verify_exit_parametric(state, exit, verify_signatures, spec, true)
}
/// Parametric version of `verify_exit` that skips some checks if `time_independent_only` is true.
///
/// Spec v0.12.1
fn verify_exit_parametric<T: EthSpec>(
state: &BeaconState<T>, state: &BeaconState<T>,
signed_exit: &SignedVoluntaryExit, signed_exit: &SignedVoluntaryExit,
verify_signatures: VerifySignatures, verify_signatures: VerifySignatures,
spec: &ChainSpec, spec: &ChainSpec,
time_independent_only: bool,
) -> Result<()> { ) -> Result<()> {
let exit = &signed_exit.message; let exit = &signed_exit.message;
@ -70,7 +45,7 @@ fn verify_exit_parametric<T: EthSpec>(
// Exits must specify an epoch when they become valid; they are not valid before then. // Exits must specify an epoch when they become valid; they are not valid before then.
verify!( verify!(
time_independent_only || state.current_epoch() >= exit.epoch, state.current_epoch() >= exit.epoch,
ExitInvalid::FutureEpoch { ExitInvalid::FutureEpoch {
state: state.current_epoch(), state: state.current_epoch(),
exit: exit.epoch exit: exit.epoch