diff --git a/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/ExecutionLayerManagerImplTest.java b/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/ExecutionLayerManagerImplTest.java index 6104c88d512..e6fd00930a9 100644 --- a/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/ExecutionLayerManagerImplTest.java +++ b/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/ExecutionLayerManagerImplTest.java @@ -44,9 +44,11 @@ import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.Spec; import tech.pegasys.teku.spec.TestSpecFactory; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock; import tech.pegasys.teku.spec.datastructures.builder.BuilderBid; import tech.pegasys.teku.spec.datastructures.builder.SignedBuilderBid; +import tech.pegasys.teku.spec.datastructures.execution.BlobAndProof; import tech.pegasys.teku.spec.datastructures.execution.BlobsBundle; import tech.pegasys.teku.spec.datastructures.execution.BuilderBidOrFallbackData; import tech.pegasys.teku.spec.datastructures.execution.BuilderPayloadOrFallbackData; @@ -58,6 +60,7 @@ import tech.pegasys.teku.spec.datastructures.execution.FallbackReason; import tech.pegasys.teku.spec.datastructures.execution.GetPayloadResponse; import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; +import tech.pegasys.teku.spec.logic.versions.deneb.types.VersionedHash; import tech.pegasys.teku.spec.util.DataStructureUtil; class ExecutionLayerManagerImplTest { @@ -656,6 +659,18 @@ void onSlot_shouldCleanUpFallbackCache() { verifyNoMoreInteractions(executionClientHandler); } + @Test + public void engineGetBlobs_shouldReturnGetBlobsResponseViaEngine() { + setupDeneb(); + final List versionedHashes = + dataStructureUtil.randomVersionedHashes(spec.getMaxBlobsPerBlock().orElseThrow()); + final UInt64 slot = dataStructureUtil.randomSlot(); + final List getBlobsResponse = + prepareEngineGetBlobsResponse(versionedHashes, slot); + assertThat(executionLayerManager.engineGetBlobs(versionedHashes, slot)) + .isCompletedWithValue(getBlobsResponse.stream().map(Optional::ofNullable).toList()); + } + private void setupDeneb() { spec = TestSpecFactory.createMinimalDeneb(); dataStructureUtil = new DataStructureUtil(spec); @@ -786,6 +801,19 @@ private GetPayloadResponse prepareEngineGetPayloadResponseWithBlobs( return getPayloadResponse; } + private List prepareEngineGetBlobsResponse( + final List blobVersionedHashes, final UInt64 slot) { + final List blobSidecars = + dataStructureUtil.randomBlobSidecars(spec.getMaxBlobsPerBlock().orElseThrow()); + final List getBlobsResponse = + blobSidecars.stream() + .map(blobSidecar -> new BlobAndProof(blobSidecar.getBlob(), blobSidecar.getKZGProof())) + .toList(); + when(executionClientHandler.engineGetBlobs(blobVersionedHashes, slot)) + .thenReturn(SafeFuture.completedFuture(getBlobsResponse)); + return getBlobsResponse; + } + private ExecutionLayerManagerImpl createExecutionLayerChannelImpl( final boolean builderEnabled, final boolean builderValidatorEnabled) { return createExecutionLayerChannelImpl(