From 8b42a49c52e34c14c6165946df174c5a236259da Mon Sep 17 00:00:00 2001 From: Mehdi AOUADI Date: Mon, 15 May 2023 09:49:44 +0200 Subject: [PATCH] rename BlockContents and SignedBlockContents block propertie --- .../teku/api/schema/deneb/BlockContents.java | 17 +++++++++++------ .../api/schema/deneb/SignedBlockContents.java | 16 +++++++++++----- .../versions/deneb/BlockContentsSchema.java | 2 +- .../deneb/SignedBlockContentsSchema.java | 2 +- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlockContents.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlockContents.java index 6e3cbd8f0a1..8f2add21f46 100644 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlockContents.java +++ b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlockContents.java @@ -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") @@ -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( @@ -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())); } } diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBlockContents.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBlockContents.java index 85456045017..597a3fc43df 100644 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBlockContents.java +++ b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBlockContents.java @@ -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; @@ -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() {} @@ -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 isInstance = diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlockContentsSchema.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlockContentsSchema.java index ae19834555a..dbb63cbeecc 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlockContentsSchema.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlockContentsSchema.java @@ -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()))); diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlockContentsSchema.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlockContentsSchema.java index 2ca756d3066..fd484acb642 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlockContentsSchema.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlockContentsSchema.java @@ -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())));