diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadBuilder.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadBuilder.java index d95ccb49a89..056e3f8052a 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadBuilder.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadBuilder.java @@ -21,9 +21,6 @@ import tech.pegasys.teku.infrastructure.bytes.Bytes20; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.datastructures.execution.versions.capella.Withdrawal; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequest; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest; public interface ExecutionPayloadBuilder { ExecutionPayloadBuilder parentHash(Bytes32 parentHash); @@ -60,13 +57,5 @@ public interface ExecutionPayloadBuilder { ExecutionPayloadBuilder excessBlobGas(Supplier excessBlobGasSupplier); - ExecutionPayloadBuilder depositRequests(Supplier> depositRequestsSupplier); - - ExecutionPayloadBuilder withdrawalRequests( - Supplier> withdrawalRequestsSupplier); - - ExecutionPayloadBuilder consolidationRequests( - Supplier> consolidationRequestsSupplier); - ExecutionPayload build(); } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/bellatrix/ExecutionPayloadBuilderBellatrix.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/bellatrix/ExecutionPayloadBuilderBellatrix.java index 22520bd9924..58999ccbd8b 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/bellatrix/ExecutionPayloadBuilderBellatrix.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/bellatrix/ExecutionPayloadBuilderBellatrix.java @@ -29,9 +29,6 @@ import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload; import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadBuilder; import tech.pegasys.teku.spec.datastructures.execution.versions.capella.Withdrawal; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequest; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest; public class ExecutionPayloadBuilderBellatrix implements ExecutionPayloadBuilder { private ExecutionPayloadSchemaBellatrix schema; @@ -155,24 +152,6 @@ public ExecutionPayloadBuilder excessBlobGas(final Supplier excessBlobGa return this; } - @Override - public ExecutionPayloadBuilder depositRequests( - final Supplier> depositRequestsSupplier) { - return this; - } - - @Override - public ExecutionPayloadBuilder withdrawalRequests( - final Supplier> withdrawalRequestsSupplier) { - return this; - } - - @Override - public ExecutionPayloadBuilder consolidationRequests( - final Supplier> consolidationRequestsSupplier) { - return this; - } - protected void validateSchema() { checkNotNull(schema, "schema must be specified"); } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/util/DepositRequestsUtil.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/util/DepositRequestsUtil.java deleted file mode 100644 index 9cf17a73d57..00000000000 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/util/DepositRequestsUtil.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright Consensys Software Inc., 2024 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.datastructures.util; - -import java.security.SecureRandom; -import java.util.List; -import java.util.stream.IntStream; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.bls.BLS; -import tech.pegasys.teku.bls.BLSKeyPair; -import tech.pegasys.teku.bls.BLSPublicKey; -import tech.pegasys.teku.bls.BLSSignature; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.constants.Domain; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest; -import tech.pegasys.teku.spec.datastructures.operations.DepositMessage; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; -import tech.pegasys.teku.spec.logic.common.helpers.MiscHelpers; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsElectra; - -public class DepositRequestsUtil { - - private static final int MAX_NUMBER_OF_DEPOSITS_PER_BLOCK = 3; - - private final Spec spec; - - @SuppressWarnings("DoNotCreateSecureRandomDirectly") - private final SecureRandom random = new SecureRandom(); - - public DepositRequestsUtil(final Spec spec) { - this.spec = spec; - } - - public List generateDepositRequests(final BeaconState state) { - final UInt64 nextDepositRequestIndex = UInt64.valueOf(state.getValidators().size()); - return IntStream.range(0, getNumberOfDepositRequestsToGenerate()) - .mapToObj(i -> createDepositRequest(state.getSlot(), nextDepositRequestIndex.plus(i))) - .toList(); - } - - private int getNumberOfDepositRequestsToGenerate() { - return random.nextInt(MAX_NUMBER_OF_DEPOSITS_PER_BLOCK + 1); - } - - private DepositRequest createDepositRequest(final UInt64 slot, final UInt64 index) { - final BLSKeyPair validatorKeyPair = BLSKeyPair.random(random); - final BLSPublicKey publicKey = validatorKeyPair.getPublicKey(); - final UInt64 depositAmount = UInt64.THIRTY_TWO_ETH; - final DepositMessage depositMessage = - new DepositMessage(publicKey, Bytes32.ZERO, depositAmount); - final MiscHelpers miscHelpers = spec.atSlot(slot).miscHelpers(); - final Bytes32 depositDomain = miscHelpers.computeDomain(Domain.DEPOSIT); - final BLSSignature signature = - BLS.sign( - validatorKeyPair.getSecretKey(), - miscHelpers.computeSigningRoot(depositMessage, depositDomain)); - return SchemaDefinitionsElectra.required(spec.atSlot(slot).getSchemaDefinitions()) - .getDepositRequestSchema() - .create(publicKey, Bytes32.ZERO, depositAmount, signature, index); - } -} diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/executionlayer/ExecutionLayerChannelStub.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/executionlayer/ExecutionLayerChannelStub.java index dabacf4d8c5..8c62c6ddf6d 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/executionlayer/ExecutionLayerChannelStub.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/executionlayer/ExecutionLayerChannelStub.java @@ -65,11 +65,9 @@ import tech.pegasys.teku.spec.datastructures.execution.GetPayloadResponse; import tech.pegasys.teku.spec.datastructures.execution.NewPayloadRequest; import tech.pegasys.teku.spec.datastructures.execution.PowBlock; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest; import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; import tech.pegasys.teku.spec.datastructures.type.SszKZGCommitment; import tech.pegasys.teku.spec.datastructures.util.BlobsUtil; -import tech.pegasys.teku.spec.datastructures.util.DepositRequestsUtil; import tech.pegasys.teku.spec.logic.versions.deneb.types.VersionedHash; import tech.pegasys.teku.spec.schemas.SchemaDefinitions; import tech.pegasys.teku.spec.schemas.SchemaDefinitionsBellatrix; @@ -80,8 +78,6 @@ public class ExecutionLayerChannelStub implements ExecutionLayerChannel { private static final ClientVersion STUB_CLIENT_VERSION = new ClientVersion("SB", ExecutionLayerChannel.STUB_ENDPOINT_PREFIX, "0.0.0", Bytes4.ZERO); - private static final boolean GENERATE_DEPOSIT_REQUESTS = false; - private final TimeProvider timeProvider; private final Map knownBlocks = new ConcurrentHashMap<>(); private final Map knownPosBlocks = new ConcurrentHashMap<>(); @@ -90,7 +86,6 @@ public class ExecutionLayerChannelStub implements ExecutionLayerChannel { private final Set requestedPowBlocks = new HashSet<>(); private final Spec spec; private final BlobsUtil blobsUtil; - private final DepositRequestsUtil depositRequestsUtil; private final Random random = new Random(); private PayloadStatus payloadStatus = PayloadStatus.VALID; @@ -134,7 +129,6 @@ public ExecutionLayerChannelStub( kzg = KZG.NOOP; } this.blobsUtil = new BlobsUtil(spec, kzg); - this.depositRequestsUtil = new DepositRequestsUtil(spec); } public ExecutionLayerChannelStub( @@ -290,10 +284,7 @@ public SafeFuture engineGetPayload( .transactions(transactions) .withdrawals(() -> payloadAttributes.getWithdrawals().orElse(List.of())) .blobGasUsed(() -> UInt64.ZERO) - .excessBlobGas(() -> UInt64.ZERO) - .depositRequests(() -> generateDepositRequests(state)) - .withdrawalRequests(List::of) - .consolidationRequests(List::of)); + .excessBlobGas(() -> UInt64.ZERO)); // we assume all blocks are produced locally lastValidBlock = @@ -612,18 +603,4 @@ private Bytes generateBlobsAndTransaction( return blobsUtil.generateRawBlobTransactionFromKzgCommitments(commitments); } - - private List generateDepositRequests(final BeaconState state) { - return spec.atSlot(state.getSlot()) - .getConfig() - .toVersionElectra() - .map( - __ -> { - if (GENERATE_DEPOSIT_REQUESTS) { - return depositRequestsUtil.generateDepositRequests(state); - } - return List.of(); - }) - .orElse(List.of()); - } } diff --git a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/generator/BlockProposalTestUtil.java b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/generator/BlockProposalTestUtil.java index c6689b689cc..e7cd6850ac3 100644 --- a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/generator/BlockProposalTestUtil.java +++ b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/generator/BlockProposalTestUtil.java @@ -272,10 +272,7 @@ private ExecutionPayload createExecutionPayload( .transactions(transactions.orElse(Collections.emptyList())) .withdrawals(List::of) .blobGasUsed(() -> UInt64.ZERO) - .excessBlobGas(() -> UInt64.ZERO) - .depositRequests(List::of) - .withdrawalRequests(List::of) - .consolidationRequests(List::of)); + .excessBlobGas(() -> UInt64.ZERO)); } private Boolean isMergeTransitionComplete(final BeaconState state) { diff --git a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java index 5bcd653e928..eb36f99fe43 100644 --- a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java +++ b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java @@ -697,10 +697,7 @@ public ExecutionPayload randomExecutionPayload( .transactions(randomExecutionPayloadTransactions()) .withdrawals(this::randomExecutionPayloadWithdrawals) .blobGasUsed(this::randomUInt64) - .excessBlobGas(this::randomUInt64) - .depositRequests(this::randomDepositRequests) - .withdrawalRequests(this::randomWithdrawalRequests) - .consolidationRequests(this::randomConsolidationRequests); + .excessBlobGas(this::randomUInt64); builderModifier.accept(executionPayloadBuilder); }); }