Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed blob sidecars directly under blob_sidecars property in BlockContents #7145

Merged
merged 6 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"$ref" : "#/components/schemas/BeaconBlockDeneb"
},
"blinded_blob_sidecars" : {
"$ref" : "#/components/schemas/BlindedBlobSidecars"
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/BlindedBlobSidecar"
}
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{
"title" : "BlockContents",
"type" : "object",
"required" : [ "beacon_block", "blob_sidecars" ],
"required" : [ "block", "blob_sidecars" ],
"properties" : {
"beacon_block" : {
"block" : {
"$ref" : "#/components/schemas/BeaconBlockDeneb"
},
"blob_sidecars" : {
"$ref" : "#/components/schemas/BlobSidecars"
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/BlobSidecar"
}
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@
package tech.pegasys.teku.api.schema.deneb;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.stream.Collectors;
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecarSchema;
import tech.pegasys.teku.spec.datastructures.blocks.versions.deneb.BlockContentsSchema;

public class BlockContents {

@JsonProperty("beacon_block")
@JsonProperty("block")
private final BeaconBlockDeneb beaconBlock;

@JsonProperty("blob_sidecars")
private final BlobSidecars blobSidecars;
private final List<BlobSidecar> blobSidecars;

public BlockContents(
@JsonProperty("beacon_block") final BeaconBlockDeneb beaconBlock,
mehdi-aouadi marked this conversation as resolved.
Show resolved Hide resolved
@JsonProperty("blob_sidecars") final BlobSidecars blobSidecars) {
@JsonProperty("blob_sidecars") final List<BlobSidecar> blobSidecars) {
this.beaconBlock = beaconBlock;
this.blobSidecars = blobSidecars;
}
Expand All @@ -36,7 +39,8 @@ public BlockContents(
final tech.pegasys.teku.spec.datastructures.blocks.versions.deneb.BlockContents
blockContents) {
this.beaconBlock = new BeaconBlockDeneb(blockContents.getBeaconBlock());
this.blobSidecars = new BlobSidecars(blockContents.getBlobSidecars());
this.blobSidecars =
blockContents.getBlobSidecars().stream().map(BlobSidecar::new).collect(Collectors.toList());
}

public static BlockContents create(
Expand All @@ -46,9 +50,14 @@ public static BlockContents create(
}

public tech.pegasys.teku.spec.datastructures.blocks.versions.deneb.BlockContents
asInternalBlockContents(final BlockContentsSchema blockContentsSchema, final Spec spec) {
asInternalBlockContents(
final BlockContentsSchema blockContentsSchema,
final BlobSidecarSchema blobSidecarSchema,
final Spec spec) {
return blockContentsSchema.create(
beaconBlock.asInternalBeaconBlock(spec),
blobSidecars.asInternalBlobSidecars(blockContentsSchema.getBlobSidecarsSchema()));
blobSidecars.stream()
.map(blobSidecar -> blobSidecar.asInternalBlobSidecar(blobSidecarSchema))
.collect(Collectors.toList()));
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@
package tech.pegasys.teku.api.schema.deneb;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecarSchema;
import tech.pegasys.teku.spec.datastructures.blocks.versions.deneb.SignedBlockContentsSchema;

public class SignedBlockContents implements BlockContainer {
@JsonProperty("signed_beacon_block")
@JsonProperty("signed_block")
private SignedBeaconBlockDeneb signedBeaconBlockDeneb;

@JsonProperty("signed_blob_sidecars")
private SignedBlobSidecars signedBlobSidecars;
private List<SignedBlobSidecar> signedBlobSidecars;

public SignedBlockContents(
@JsonProperty("signed_beacon_block") final SignedBeaconBlockDeneb signedBeaconBlockDeneb,
mehdi-aouadi marked this conversation as resolved.
Show resolved Hide resolved
@JsonProperty("signed_blob_sidecars") final SignedBlobSidecars signedBlobSidecars) {
@JsonProperty("signed_blob_sidecars") final List<SignedBlobSidecar> signedBlobSidecars) {
this.signedBeaconBlockDeneb = signedBeaconBlockDeneb;
this.signedBlobSidecars = signedBlobSidecars;
}
Expand All @@ -38,7 +41,9 @@ public SignedBlockContents(
this.signedBeaconBlockDeneb =
new SignedBeaconBlockDeneb(signedBlockContents.getSignedBeaconBlock().orElseThrow());
this.signedBlobSidecars =
new SignedBlobSidecars(signedBlockContents.getSignedBlobSidecars().orElseThrow());
signedBlockContents.getSignedBlobSidecars().orElseThrow().stream()
.map(SignedBlobSidecar::new)
.collect(Collectors.toList());
}

public SignedBlockContents() {}
Expand All @@ -51,11 +56,16 @@ public static BlockContents create(

public tech.pegasys.teku.spec.datastructures.blocks.versions.deneb.SignedBlockContents
asInternalSignedBlockContents(
final SignedBlockContentsSchema signedBlockContentsSchema, final Spec spec) {
final SignedBlockContentsSchema signedBlockContentsSchema,
final SignedBlobSidecarSchema signedBlobSidecarSchema,
final Spec spec) {
return signedBlockContentsSchema.create(
signedBeaconBlockDeneb.asInternalSignedBeaconBlock(spec),
signedBlobSidecars.asInternalSignedBlobSidecars(
signedBlockContentsSchema.getSignedBlobSidecarsSchema()));
signedBlobSidecars.stream()
.map(
signedBlobSidecar ->
signedBlobSidecar.asInternalSignedBlobSidecar(signedBlobSidecarSchema))
.collect(Collectors.toList()));
}

public static Predicate<BlockContainer> isInstance =
Expand Down

This file was deleted.

This file was deleted.

Loading