From aea5014b0aada8a880ec59933b8da9b025267883 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Fri, 29 Nov 2024 10:05:21 +0000 Subject: [PATCH] EIP-7251 Add missed exit checks to consolidation processing --- .../electra/block/BlockProcessorElectra.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 49493302242..09fe4b3af4b 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 @@ -519,6 +519,19 @@ private void processConsolidationRequest( "process_consolidation_request: target validator {} is exiting", targetValidatorIndex); return; } + // Verify the source has been active long enough + if (currentEpoch.isLessThan( + sourceValidator.getActivationEpoch().plus(specConfig.getShardCommitteePeriod()))) { + LOG.debug("process_consolidation_request: source has not been active long enough"); + return; + } + // Verify the source has no pending withdrawals in the queue + if (beaconStateAccessorsElectra + .getPendingBalanceToWithdraw(state, sourceValidatorIndex) + .isGreaterThan(ZERO)) { + LOG.debug("process_consolidation_request: source has pending withdrawals in the queue"); + return; + } // Initiate source validator exit and append pending consolidation final UInt64 exitEpoch =