diff --git a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/sanity/SanityBlocksTestExecutor.java b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/sanity/SanityBlocksTestExecutor.java index b3879d84cae..0c9027b3da9 100644 --- a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/sanity/SanityBlocksTestExecutor.java +++ b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/sanity/SanityBlocksTestExecutor.java @@ -41,12 +41,7 @@ public class SanityBlocksTestExecutor implements TestExecutor { private static final String STATE_ROOT_MISMATCH_ERROR_MESSAGE = "Block state root does NOT match the calculated state root"; - // TODO re-enable tests as part of https://github.com/Consensys/teku/issues/8680 - private static final List IGNORED_TEST_NAMES = - List.of( - "basic_el_withdrawal_request", - "basic_btec_and_el_withdrawal_request_in_same_block", - "cl_exit_and_el_withdrawal_request_in_same_block"); + private static final List IGNORED_TEST_NAMES = List.of(); @Override public void runTest(final TestDefinition testDefinition) throws Exception { diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/AbstractBlockProcessor.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/AbstractBlockProcessor.java index bffd0c461fc..89f38f02d82 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/AbstractBlockProcessor.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/AbstractBlockProcessor.java @@ -340,7 +340,13 @@ protected void processBlock( processBlockHeader(state, block); processRandaoNoValidation(state, block.getBody()); processEth1Data(state, block.getBody()); - processOperationsNoValidation(state, block.getBody(), indexedAttestationCache); + processOperationsNoValidation( + state, block.getBody(), indexedAttestationCache, getValidatorExitContextSupplier(state)); + } + + protected Supplier getValidatorExitContextSupplier( + final MutableBeaconState state) { + return beaconStateMutators.createValidatorExitContextSupplier(state); } @Override @@ -431,15 +437,13 @@ public long getVoteCount(final BeaconState state, final Eth1Data eth1Data) { protected void processOperationsNoValidation( final MutableBeaconState state, final BeaconBlockBody body, - final IndexedAttestationCache indexedAttestationCache) + final IndexedAttestationCache indexedAttestationCache, + final Supplier validatorExitContextSupplier) throws BlockProcessingException { safelyProcess( () -> { verifyOutstandingDepositsAreProcessed(state, body); - final Supplier validatorExitContextSupplier = - beaconStateMutators.createValidatorExitContextSupplier(state); - processProposerSlashingsNoValidation( state, body.getProposerSlashings(), validatorExitContextSupplier); processAttesterSlashings( @@ -448,7 +452,6 @@ protected void processOperationsNoValidation( processDeposits(state, body.getDeposits()); processVoluntaryExitsNoValidation( state, body.getVoluntaryExits(), validatorExitContextSupplier); - processWithdrawalRequests(state, body, validatorExitContextSupplier); }); } @@ -471,7 +474,7 @@ public void processProposerSlashings( final BLSSignatureVerifier signatureVerifier) throws BlockProcessingException { final Supplier validatorExitContextSupplier = - beaconStateMutators.createValidatorExitContextSupplier(state); + getValidatorExitContextSupplier(state); processProposerSlashingsNoValidation(state, proposerSlashings, validatorExitContextSupplier); final BlockValidationResult validationResult = verifyProposerSlashings(state, proposerSlashings, signatureVerifier); @@ -530,7 +533,7 @@ public void processAttesterSlashings( safelyProcess( () -> { final Supplier validatorExitContextSupplier = - beaconStateMutators.createValidatorExitContextSupplier(state); + getValidatorExitContextSupplier(state); processAttesterSlashings(state, attesterSlashings, validatorExitContextSupplier); }); } @@ -851,7 +854,7 @@ public void processVoluntaryExits( final BLSSignatureVerifier signatureVerifier) throws BlockProcessingException { final Supplier validatorExitContextSupplier = - beaconStateMutators.createValidatorExitContextSupplier(state); + getValidatorExitContextSupplier(state); processVoluntaryExitsNoValidation(state, exits, validatorExitContextSupplier); BlockValidationResult signaturesValid = verifyVoluntaryExits(state, exits, signatureVerifier); if (!signaturesValid.isValid()) { diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/bellatrix/block/BlockProcessorBellatrix.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/bellatrix/block/BlockProcessorBellatrix.java index d5b0c3f1a29..1998fc8292e 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/bellatrix/block/BlockProcessorBellatrix.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/bellatrix/block/BlockProcessorBellatrix.java @@ -101,7 +101,8 @@ public void processBlock( } processRandaoNoValidation(state, block.getBody()); processEth1Data(state, block.getBody()); - processOperationsNoValidation(state, block.getBody(), indexedAttestationCache); + processOperationsNoValidation( + state, block.getBody(), indexedAttestationCache, getValidatorExitContextSupplier(state)); processSyncAggregate( state, blockBody.getOptionalSyncAggregate().orElseThrow(), signatureVerifier); } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/capella/block/BlockProcessorCapella.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/capella/block/BlockProcessorCapella.java index 7a5d88f95de..d0f713654db 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/capella/block/BlockProcessorCapella.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/capella/block/BlockProcessorCapella.java @@ -19,6 +19,7 @@ import java.util.HashSet; import java.util.Optional; import java.util.Set; +import java.util.function.Supplier; import javax.annotation.CheckReturnValue; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; @@ -130,9 +131,11 @@ protected BlockValidationResult validateBlockPreProcessing( protected void processOperationsNoValidation( final MutableBeaconState state, final BeaconBlockBody body, - final IndexedAttestationCache indexedAttestationCache) + final IndexedAttestationCache indexedAttestationCache, + final Supplier validatorExitContextSupplier) throws BlockProcessingException { - super.processOperationsNoValidation(state, body, indexedAttestationCache); + super.processOperationsNoValidation( + state, body, indexedAttestationCache, validatorExitContextSupplier); safelyProcess( () -> 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 f23d9709d80..3223e6cca36 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 @@ -153,15 +153,20 @@ public NewPayloadRequest computeNewPayloadRequest( protected void processOperationsNoValidation( final MutableBeaconState state, final BeaconBlockBody body, - final IndexedAttestationCache indexedAttestationCache) + final IndexedAttestationCache indexedAttestationCache, + final Supplier validatorExitContextSupplier) throws BlockProcessingException { - super.processOperationsNoValidation(state, body, indexedAttestationCache); + super.processOperationsNoValidation( + state, body, indexedAttestationCache, validatorExitContextSupplier); safelyProcess( () -> { final ExecutionRequests executionRequests = BeaconBlockBodyElectra.required(body).getExecutionRequests(); + this.processDepositRequests(state, executionRequests.getDeposits()); + this.processWithdrawalRequests( + state, executionRequests.getWithdrawals(), validatorExitContextSupplier); this.processConsolidationRequests(state, executionRequests.getConsolidations()); }); }