diff --git a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/GetPayloadV2Response.java b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/GetPayloadV2Response.java index 600783c2fd8..1bdbdad99f7 100644 --- a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/GetPayloadV2Response.java +++ b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/GetPayloadV2Response.java @@ -21,6 +21,8 @@ import org.apache.tuweni.units.bigints.UInt256; import tech.pegasys.teku.ethereum.executionclient.serialization.UInt256AsHexDeserializer; import tech.pegasys.teku.ethereum.executionclient.serialization.UInt256AsHexSerializer; +import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSchema; +import tech.pegasys.teku.spec.datastructures.execution.GetPayloadResponse; public class GetPayloadV2Response { public final ExecutionPayloadV2 executionPayload; @@ -37,4 +39,10 @@ public GetPayloadV2Response( this.executionPayload = executionPayload; this.blockValue = blockValue; } + + public GetPayloadResponse asInternalGetPayloadResponse( + final ExecutionPayloadSchema executionPayloadSchema) { + return new GetPayloadResponse( + executionPayload.asInternalExecutionPayload(executionPayloadSchema), blockValue); + } } diff --git a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/GetPayloadV3Response.java b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/GetPayloadV3Response.java index 4869aa33478..3e7dbd3b4ee 100644 --- a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/GetPayloadV3Response.java +++ b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/GetPayloadV3Response.java @@ -21,6 +21,9 @@ import org.apache.tuweni.units.bigints.UInt256; import tech.pegasys.teku.ethereum.executionclient.serialization.UInt256AsHexDeserializer; import tech.pegasys.teku.ethereum.executionclient.serialization.UInt256AsHexSerializer; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSchema; +import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSchema; +import tech.pegasys.teku.spec.datastructures.execution.GetPayloadResponse; public class GetPayloadV3Response { public final ExecutionPayloadV3 executionPayload; @@ -46,4 +49,13 @@ public GetPayloadV3Response( this.blobsBundle = blobsBundle; this.shouldOverrideBuilder = shouldOverrideBuilder; } + + public GetPayloadResponse asInternalGetPayloadResponse( + final ExecutionPayloadSchema executionPayloadSchema, final BlobSchema blobSchema) { + return new GetPayloadResponse( + executionPayload.asInternalExecutionPayload(executionPayloadSchema), + blockValue, + blobsBundle.asInternalBlobsBundle(blobSchema), + shouldOverrideBuilder); + } } 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 e9bb45ed743..e414321626b 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 @@ -21,6 +21,9 @@ import org.apache.tuweni.units.bigints.UInt256; import tech.pegasys.teku.ethereum.executionclient.serialization.UInt256AsHexDeserializer; import tech.pegasys.teku.ethereum.executionclient.serialization.UInt256AsHexSerializer; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSchema; +import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSchema; +import tech.pegasys.teku.spec.datastructures.execution.GetPayloadResponse; public class GetPayloadV4Response { public final ExecutionPayloadV3 executionPayload; @@ -46,4 +49,13 @@ public GetPayloadV4Response( this.blobsBundle = blobsBundle; this.shouldOverrideBuilder = shouldOverrideBuilder; } + + public GetPayloadResponse asInternalGetPayloadResponse( + final ExecutionPayloadSchema executionPayloadSchema, final BlobSchema blobSchema) { + return new GetPayloadResponse( + executionPayload.asInternalExecutionPayload(executionPayloadSchema), + blockValue, + blobsBundle.asInternalBlobsBundle(blobSchema), + shouldOverrideBuilder); + } } diff --git a/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/CapellaExecutionClientHandlerTest.java b/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/CapellaExecutionClientHandlerTest.java index 82605955280..a8ef2d41953 100644 --- a/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/CapellaExecutionClientHandlerTest.java +++ b/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/CapellaExecutionClientHandlerTest.java @@ -75,13 +75,10 @@ void engineGetPayload_shouldCallGetPayloadV2() { verify(executionEngineClient).getPayloadV2(context.getPayloadId()); final SchemaDefinitionsCapella schemaDefinitionCapella = spec.atSlot(slot).getSchemaDefinitions().toVersionCapella().orElseThrow(); - final ExecutionPayloadSchema payloadSchema = + final ExecutionPayloadSchema executionPayloadSchema = schemaDefinitionCapella.getExecutionPayloadSchema(); assertThat(future) - .isCompletedWithValue( - new GetPayloadResponse( - responseData.executionPayload.asInternalExecutionPayload(payloadSchema), - responseData.blockValue)); + .isCompletedWithValue(responseData.asInternalGetPayloadResponse(executionPayloadSchema)); } @Test diff --git a/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/DenebExecutionClientHandlerTest.java b/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/DenebExecutionClientHandlerTest.java index cdd2cb5e247..df49c8a7d42 100644 --- a/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/DenebExecutionClientHandlerTest.java +++ b/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/DenebExecutionClientHandlerTest.java @@ -79,16 +79,12 @@ void engineGetPayload_shouldCallGetPayloadV3() { verify(executionEngineClient).getPayloadV3(context.getPayloadId()); final SchemaDefinitionsDeneb schemaDefinitionDeneb = spec.atSlot(slot).getSchemaDefinitions().toVersionDeneb().orElseThrow(); - final ExecutionPayloadSchema payloadSchema = + final ExecutionPayloadSchema executionPayloadSchema = schemaDefinitionDeneb.getExecutionPayloadSchema(); final BlobSchema blobSchema = schemaDefinitionDeneb.getBlobSchema(); assertThat(future) .isCompletedWithValue( - new GetPayloadResponse( - responseData.executionPayload.asInternalExecutionPayload(payloadSchema), - responseData.blockValue, - responseData.blobsBundle.asInternalBlobsBundle(blobSchema), - responseData.shouldOverrideBuilder)); + responseData.asInternalGetPayloadResponse(executionPayloadSchema, blobSchema)); } @Test 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 345946f0b96..a0b10002bd7 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 @@ -80,16 +80,12 @@ void engineGetPayload_shouldCallGetPayloadV4() { verify(executionEngineClient).getPayloadV4(context.getPayloadId()); final SchemaDefinitionsElectra schemaDefinitionElectra = spec.atSlot(slot).getSchemaDefinitions().toVersionElectra().orElseThrow(); - final ExecutionPayloadSchema payloadSchema = + final ExecutionPayloadSchema executionPayloadSchema = schemaDefinitionElectra.getExecutionPayloadSchema(); final BlobSchema blobSchema = schemaDefinitionElectra.getBlobSchema(); assertThat(future) .isCompletedWithValue( - new GetPayloadResponse( - responseData.executionPayload.asInternalExecutionPayload(payloadSchema), - responseData.blockValue, - responseData.blobsBundle.asInternalBlobsBundle(blobSchema), - responseData.shouldOverrideBuilder)); + responseData.asInternalGetPayloadResponse(executionPayloadSchema, blobSchema)); } @Test