From 270ef44f3f1fd6f5b0b32b79bebb105f63356f44 Mon Sep 17 00:00:00 2001 From: Lucas Saldanha Date: Wed, 2 Oct 2024 14:50:03 +1300 Subject: [PATCH] Removing ExecutionPayloadV4 --- .../schema/ExecutionPayloadV4.java | 88 ------------------- .../schema/GetPayloadV4Response.java | 4 +- .../methods/EngineGetPayloadV4Test.java | 4 +- .../ElectraExecutionClientHandlerTest.java | 3 +- 4 files changed, 5 insertions(+), 94 deletions(-) delete mode 100644 ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/ExecutionPayloadV4.java diff --git a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/ExecutionPayloadV4.java b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/ExecutionPayloadV4.java deleted file mode 100644 index 13ae45ddb26..00000000000 --- a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/ExecutionPayloadV4.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright Consensys Software Inc., 2022 - * - * 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.ethereum.executionclient.schema; - -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt256; -import tech.pegasys.teku.infrastructure.bytes.Bytes20; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload; -import tech.pegasys.teku.spec.datastructures.execution.versions.capella.ExecutionPayloadCapella; -import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.ExecutionPayloadDeneb; - -public class ExecutionPayloadV4 extends ExecutionPayloadV3 { - - public ExecutionPayloadV4( - final @JsonProperty("parentHash") Bytes32 parentHash, - final @JsonProperty("feeRecipient") Bytes20 feeRecipient, - final @JsonProperty("stateRoot") Bytes32 stateRoot, - final @JsonProperty("receiptsRoot") Bytes32 receiptsRoot, - final @JsonProperty("logsBloom") Bytes logsBloom, - final @JsonProperty("prevRandao") Bytes32 prevRandao, - final @JsonProperty("blockNumber") UInt64 blockNumber, - final @JsonProperty("gasLimit") UInt64 gasLimit, - final @JsonProperty("gasUsed") UInt64 gasUsed, - final @JsonProperty("timestamp") UInt64 timestamp, - final @JsonProperty("extraData") Bytes extraData, - final @JsonProperty("baseFeePerGas") UInt256 baseFeePerGas, - final @JsonProperty("blockHash") Bytes32 blockHash, - final @JsonProperty("transactions") List transactions, - final @JsonProperty("withdrawals") List withdrawals, - final @JsonProperty("blobGasUsed") UInt64 blobGasUsed, - final @JsonProperty("excessBlobGas") UInt64 excessBlobGas) { - super( - parentHash, - feeRecipient, - stateRoot, - receiptsRoot, - logsBloom, - prevRandao, - blockNumber, - gasLimit, - gasUsed, - timestamp, - extraData, - baseFeePerGas, - blockHash, - transactions, - withdrawals, - blobGasUsed, - excessBlobGas); - } - - public static ExecutionPayloadV4 fromInternalExecutionPayload( - final ExecutionPayload executionPayload) { - return new ExecutionPayloadV4( - executionPayload.getParentHash(), - executionPayload.getFeeRecipient(), - executionPayload.getStateRoot(), - executionPayload.getReceiptsRoot(), - executionPayload.getLogsBloom(), - executionPayload.getPrevRandao(), - executionPayload.getBlockNumber(), - executionPayload.getGasLimit(), - executionPayload.getGasUsed(), - executionPayload.getTimestamp(), - executionPayload.getExtraData(), - executionPayload.getBaseFeePerGas(), - executionPayload.getBlockHash(), - getTransactions(executionPayload), - getWithdrawals(ExecutionPayloadCapella.required(executionPayload).getWithdrawals()), - ExecutionPayloadDeneb.required(executionPayload).getBlobGasUsed(), - ExecutionPayloadDeneb.required(executionPayload).getExcessBlobGas()); - } -} diff --git a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/GetPayloadV4Response.java b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/GetPayloadV4Response.java index a21cf137685..e9bb45ed743 100644 --- a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/GetPayloadV4Response.java +++ b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/GetPayloadV4Response.java @@ -23,7 +23,7 @@ import tech.pegasys.teku.ethereum.executionclient.serialization.UInt256AsHexSerializer; public class GetPayloadV4Response { - public final ExecutionPayloadV4 executionPayload; + public final ExecutionPayloadV3 executionPayload; @JsonSerialize(using = UInt256AsHexSerializer.class) @JsonDeserialize(using = UInt256AsHexDeserializer.class) @@ -34,7 +34,7 @@ public class GetPayloadV4Response { public final boolean shouldOverrideBuilder; public GetPayloadV4Response( - final @JsonProperty("executionPayload") ExecutionPayloadV4 executionPayload, + final @JsonProperty("executionPayload") ExecutionPayloadV3 executionPayload, final @JsonProperty("blockValue") UInt256 blockValue, final @JsonProperty("blobsBundle") BlobsBundleV1 blobsBundle, final @JsonProperty("shouldOverrideBuilder") boolean shouldOverrideBuilder) { diff --git a/ethereum/executionclient/src/test/java/tech/pegasys/teku/ethereum/executionclient/methods/EngineGetPayloadV4Test.java b/ethereum/executionclient/src/test/java/tech/pegasys/teku/ethereum/executionclient/methods/EngineGetPayloadV4Test.java index 5e9c11f2d26..160f7ba0d49 100644 --- a/ethereum/executionclient/src/test/java/tech/pegasys/teku/ethereum/executionclient/methods/EngineGetPayloadV4Test.java +++ b/ethereum/executionclient/src/test/java/tech/pegasys/teku/ethereum/executionclient/methods/EngineGetPayloadV4Test.java @@ -31,7 +31,7 @@ import tech.pegasys.teku.ethereum.executionclient.ExecutionEngineClient; import tech.pegasys.teku.ethereum.executionclient.response.InvalidRemoteResponseException; import tech.pegasys.teku.ethereum.executionclient.schema.BlobsBundleV1; -import tech.pegasys.teku.ethereum.executionclient.schema.ExecutionPayloadV4; +import tech.pegasys.teku.ethereum.executionclient.schema.ExecutionPayloadV3; import tech.pegasys.teku.ethereum.executionclient.schema.GetPayloadV4Response; import tech.pegasys.teku.ethereum.executionclient.schema.Response; import tech.pegasys.teku.infrastructure.async.SafeFuture; @@ -142,7 +142,7 @@ private SafeFuture> dummySuccessfulResponse( return SafeFuture.completedFuture( new Response<>( new GetPayloadV4Response( - ExecutionPayloadV4.fromInternalExecutionPayload(executionPayload), + ExecutionPayloadV3.fromInternalExecutionPayload(executionPayload), blockValue, BlobsBundleV1.fromInternalBlobsBundle(blobsBundle), false))); diff --git a/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/ElectraExecutionClientHandlerTest.java b/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/ElectraExecutionClientHandlerTest.java index 31058fbf262..f0502db539b 100644 --- a/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/ElectraExecutionClientHandlerTest.java +++ b/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/ElectraExecutionClientHandlerTest.java @@ -27,7 +27,6 @@ import org.junit.jupiter.api.Test; import tech.pegasys.teku.ethereum.executionclient.schema.BlobsBundleV1; import tech.pegasys.teku.ethereum.executionclient.schema.ExecutionPayloadV3; -import tech.pegasys.teku.ethereum.executionclient.schema.ExecutionPayloadV4; import tech.pegasys.teku.ethereum.executionclient.schema.ForkChoiceStateV1; import tech.pegasys.teku.ethereum.executionclient.schema.ForkChoiceUpdatedResult; import tech.pegasys.teku.ethereum.executionclient.schema.GetPayloadV4Response; @@ -65,7 +64,7 @@ void engineGetPayload_shouldCallGetPayloadV4() throws ExecutionException, Interr SafeFuture.completedFuture( new Response<>( new GetPayloadV4Response( - ExecutionPayloadV4.fromInternalExecutionPayload( + ExecutionPayloadV3.fromInternalExecutionPayload( dataStructureUtil.randomExecutionPayload()), UInt256.MAX_VALUE, BlobsBundleV1.fromInternalBlobsBundle(dataStructureUtil.randomBlobsBundle()),