From afe7063ae89e0d9bd526c19e838a36ecb5759591 Mon Sep 17 00:00:00 2001 From: Lucas Saldanha Date: Fri, 6 Dec 2024 12:22:38 +1300 Subject: [PATCH] Add missed exit checks to consolidation processing --- .../electra/block/BlockProcessorElectra.java | 14 ++++++++++++++ 1 file changed, 14 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..9bfe1da33b4 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 @@ -520,6 +520,20 @@ private void processConsolidationRequest( 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 = beaconStateMutatorsElectra.computeConsolidationEpochAndUpdateChurn(