From 6b65b6f3bd3af4ce6430062634eee041ec9aef60 Mon Sep 17 00:00:00 2001 From: ethDreamer Date: Mon, 30 Aug 2021 06:41:30 +0000 Subject: [PATCH] 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` --- .../src/per_block_processing.rs | 2 +- .../src/per_block_processing/verify_exit.rs | 27 +------------------ 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/consensus/state_processing/src/per_block_processing.rs b/consensus/state_processing/src/per_block_processing.rs index a38382d26..937d04794 100644 --- a/consensus/state_processing/src/per_block_processing.rs +++ b/consensus/state_processing/src/per_block_processing.rs @@ -20,7 +20,7 @@ pub use verify_attestation::{ pub use verify_deposit::{ 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 block_signature_verifier; diff --git a/consensus/state_processing/src/per_block_processing/verify_exit.rs b/consensus/state_processing/src/per_block_processing/verify_exit.rs index efaf57f6d..f17e5fcd2 100644 --- a/consensus/state_processing/src/per_block_processing/verify_exit.rs +++ b/consensus/state_processing/src/per_block_processing/verify_exit.rs @@ -19,35 +19,10 @@ fn error(reason: ExitInvalid) -> BlockOperationError { /// /// Spec v0.12.1 pub fn verify_exit( - state: &BeaconState, - 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( - state: &BeaconState, - 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( state: &BeaconState, signed_exit: &SignedVoluntaryExit, verify_signatures: VerifySignatures, spec: &ChainSpec, - time_independent_only: bool, ) -> Result<()> { let exit = &signed_exit.message; @@ -70,7 +45,7 @@ fn verify_exit_parametric( // Exits must specify an epoch when they become valid; they are not valid before then. verify!( - time_independent_only || state.current_epoch() >= exit.epoch, + state.current_epoch() >= exit.epoch, ExitInvalid::FutureEpoch { state: state.current_epoch(), exit: exit.epoch