Skip to content

Commit

Permalink
Embed blob sidecars directly under blob_sidecars property in BlockCon…
Browse files Browse the repository at this point in the history
…tents (#7145)

* remove unused BlobSidecars container
  • Loading branch information
mehdi-aouadi authored May 16, 2023
1 parent e0addad commit dd9cbbc
Show file tree
Hide file tree
Showing 35 changed files with 194 additions and 960 deletions.

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,
@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,
@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

0 comments on commit dd9cbbc

Please sign in to comment.