From d2b27d9111cd34e68e840957a819bf1177260695 Mon Sep 17 00:00:00 2001 From: Gabriel Fukushima Date: Fri, 11 Oct 2024 12:58:59 +1000 Subject: [PATCH 1/5] remove test fixed from the list of ignored tests Signed-off-by: Gabriel Fukushima --- .../reference/phase0/sanity/SanityBlocksTestExecutor.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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..ae0cd6ae95c 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 @@ -42,11 +42,7 @@ public class SanityBlocksTestExecutor implements TestExecutor { "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 { From 9b121c3e0d47d4db8ad9cde76f34d532c7d20a85 Mon Sep 17 00:00:00 2001 From: Gabriel Fukushima Date: Fri, 11 Oct 2024 12:59:40 +1000 Subject: [PATCH 2/5] move processWithdrawalRequests to BlockProcessorElectra Signed-off-by: Gabriel Fukushima --- .../logic/versions/electra/block/BlockProcessorElectra.java | 3 +++ 1 file changed, 3 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 ed5a8a7b684..2c6f56b185a 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 @@ -161,7 +161,10 @@ protected void processOperationsNoValidation( () -> { final ExecutionRequests executionRequests = BeaconBlockBodyElectra.required(body).getExecutionRequests(); + this.processDepositRequests(state, executionRequests.getDeposits()); + this.processWithdrawalRequests( + state, executionRequests.getWithdrawals(), validatorExitContextSupplier); this.processConsolidationRequests(state, executionRequests.getConsolidations()); }); } From 6dbb083e6d39d07e58056ff68b2672f3b387925f Mon Sep 17 00:00:00 2001 From: Gabriel Fukushima Date: Fri, 11 Oct 2024 13:01:07 +1000 Subject: [PATCH 3/5] expose supplier so it can be accessed from ElectraBLockProcessor Signed-off-by: Gabriel Fukushima --- .../teku/spec/logic/common/block/AbstractBlockProcessor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 aabdc8bacdc..fc3347e6798 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 @@ -107,6 +107,8 @@ public abstract class AbstractBlockProcessor implements BlockProcessor { protected final ValidatorsUtil validatorsUtil; protected final OperationValidator operationValidator; + protected Supplier validatorExitContextSupplier; + protected AbstractBlockProcessor( final SpecConfig specConfig, final Predicates predicates, @@ -437,7 +439,7 @@ protected void processOperationsNoValidation( () -> { verifyOutstandingDepositsAreProcessed(state, body); - final Supplier validatorExitContextSupplier = + validatorExitContextSupplier = beaconStateMutators.createValidatorExitContextSupplier(state); processProposerSlashingsNoValidation( @@ -448,7 +450,6 @@ protected void processOperationsNoValidation( processDeposits(state, body.getDeposits()); processVoluntaryExitsNoValidation( state, body.getVoluntaryExits(), validatorExitContextSupplier); - processWithdrawalRequests(state, body, validatorExitContextSupplier); }); } From c092c24186c17ed2a3fbfc3fca0dafb5449a340d Mon Sep 17 00:00:00 2001 From: Gabriel Fukushima Date: Mon, 14 Oct 2024 13:17:18 +1000 Subject: [PATCH 4/5] remove suppliers as variable and add getter to get Signed-off-by: Gabriel Fukushima --- .../common/block/AbstractBlockProcessor.java | 22 ++++++++++--------- .../block/BlockProcessorBellatrix.java | 3 ++- .../capella/block/BlockProcessorCapella.java | 7 ++++-- .../electra/block/BlockProcessorElectra.java | 6 +++-- 4 files changed, 23 insertions(+), 15 deletions(-) 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 fc3347e6798..068d8c97302 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 @@ -107,8 +107,6 @@ public abstract class AbstractBlockProcessor implements BlockProcessor { protected final ValidatorsUtil validatorsUtil; protected final OperationValidator operationValidator; - protected Supplier validatorExitContextSupplier; - protected AbstractBlockProcessor( final SpecConfig specConfig, final Predicates predicates, @@ -342,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 @@ -433,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); - validatorExitContextSupplier = - beaconStateMutators.createValidatorExitContextSupplier(state); - processProposerSlashingsNoValidation( state, body.getProposerSlashings(), validatorExitContextSupplier); processAttesterSlashings( @@ -472,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); @@ -531,7 +533,7 @@ public void processAttesterSlashings( safelyProcess( () -> { final Supplier validatorExitContextSupplier = - beaconStateMutators.createValidatorExitContextSupplier(state); + getValidatorExitContextSupplier(state); processAttesterSlashings(state, attesterSlashings, validatorExitContextSupplier); }); } @@ -852,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 665af038fa0..af5413778c6 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,9 +153,11 @@ 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( () -> { From 3b4ccec628c5bc58b0e460ab20cff3aff5e96953 Mon Sep 17 00:00:00 2001 From: Gabriel Fukushima Date: Tue, 15 Oct 2024 09:17:45 +1000 Subject: [PATCH 5/5] remove todo Signed-off-by: Gabriel Fukushima --- .../teku/reference/phase0/sanity/SanityBlocksTestExecutor.java | 1 - 1 file changed, 1 deletion(-) 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 ae0cd6ae95c..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,7 +41,6 @@ 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(); @Override