Skip to content

Commit

Permalink
rename BlockContents and SignedBlockContents block propertie
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-aouadi committed May 15, 2023
1 parent 61d4eec commit 8b42a49
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
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;

import java.util.List;
import java.util.stream.Collectors;

public class BlockContents {

@JsonProperty("beacon_block")
Expand All @@ -40,7 +39,8 @@ public BlockContents(
final tech.pegasys.teku.spec.datastructures.blocks.versions.deneb.BlockContents
blockContents) {
this.beaconBlock = new BeaconBlockDeneb(blockContents.getBeaconBlock());
this.blobSidecars = blockContents.getBlobSidecars().stream().map(BlobSidecar::new).collect(Collectors.toList());
this.blobSidecars =
blockContents.getBlobSidecars().stream().map(BlobSidecar::new).collect(Collectors.toList());
}

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

public tech.pegasys.teku.spec.datastructures.blocks.versions.deneb.BlockContents
asInternalBlockContents(final BlockContentsSchema blockContentsSchema, final BlobSidecarSchema blobSidecarSchema, final Spec spec) {
asInternalBlockContents(
final BlockContentsSchema blockContentsSchema,
final BlobSidecarSchema blobSidecarSchema,
final Spec spec) {
return blockContentsSchema.create(
beaconBlock.asInternalBeaconBlock(spec),
blobSidecars.stream().map(blobSidecar -> blobSidecar.asInternalBlobSidecar(blobSidecarSchema)).collect(Collectors.toList()));
blobSidecars.stream()
.map(blobSidecar -> blobSidecar.asInternalBlobSidecar(blobSidecarSchema))
.collect(Collectors.toList()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
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;
Expand All @@ -43,7 +41,9 @@ public SignedBlockContents(
this.signedBeaconBlockDeneb =
new SignedBeaconBlockDeneb(signedBlockContents.getSignedBeaconBlock().orElseThrow());
this.signedBlobSidecars =
signedBlockContents.getSignedBlobSidecars().orElseThrow().stream().map(SignedBlobSidecar::new).collect(Collectors.toList());
signedBlockContents.getSignedBlobSidecars().orElseThrow().stream()
.map(SignedBlobSidecar::new)
.collect(Collectors.toList());
}

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

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

public static Predicate<BlockContainer> isInstance =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class BlockContentsSchema
final BlobSidecarSchema blobSidecarSchema) {
super(
"BlockContents",
namedSchema("beacon_block", beaconBlockSchema),
namedSchema("block", beaconBlockSchema),
namedSchema(
FIELD_BLOB_SIDECARS,
SszListSchema.create(blobSidecarSchema, specConfig.getMaxBlobsPerBlock())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class SignedBlockContentsSchema
final SignedBeaconBlockSchema signedBeaconBlockSchema) {
super(
"SignedBlockContents",
namedSchema("signed_block_contents", signedBeaconBlockSchema),
namedSchema("signed_block", signedBeaconBlockSchema),
namedSchema(
FIELD_SIGNED_BLOB_SIDECARS,
SszListSchema.create(signedBlobSidecarSchema, specConfig.getMaxBlobsPerBlock())));
Expand Down

0 comments on commit 8b42a49

Please sign in to comment.