From b549a70980af6936eaa15a49a6f37ae8584b8340 Mon Sep 17 00:00:00 2001 From: Justin Traglia <95511699+jtraglia@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:11:52 -0500 Subject: [PATCH] Invert validatorActiveLongEnough check to be more clear (#8196) --- .../versions/electra/block/BlockProcessorElectra.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java index 9e1c1975434..9e0b73da420 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java @@ -158,7 +158,7 @@ public void processExecutionLayerExits( final Validator validator = state.getValidators().get(validatorIndex); // Check if validator has eth1 credentials - boolean isExecutionAddress = predicates.hasEth1WithdrawalCredential(validator); + final boolean isExecutionAddress = predicates.hasEth1WithdrawalCredential(validator); if (!isExecutionAddress) { return; } @@ -166,7 +166,7 @@ public void processExecutionLayerExits( // Check exit source_address matches validator eth1 withdrawal credentials final Bytes20 executionAddress = new Bytes20(validator.getWithdrawalCredentials().slice(12)); - boolean isCorrectSourceAddress = executionAddress.equals(exit.getSourceAddress()); + final boolean isCorrectSourceAddress = executionAddress.equals(exit.getSourceAddress()); if (!isCorrectSourceAddress) { return; } @@ -178,16 +178,16 @@ public void processExecutionLayerExits( } // Check if validator has already initiated exit - boolean hasInitiatedExit = !validator.getExitEpoch().equals(FAR_FUTURE_EPOCH); + final boolean hasInitiatedExit = !validator.getExitEpoch().equals(FAR_FUTURE_EPOCH); if (hasInitiatedExit) { return; } // Check if validator has been active long enough final boolean validatorActiveLongEnough = - currentEpoch.isLessThan( + currentEpoch.isGreaterThanOrEqualTo( validator.getActivationEpoch().plus(specConfig.getShardCommitteePeriod())); - if (validatorActiveLongEnough) { + if (!validatorActiveLongEnough) { return; }