From dd9cbbc95aad0544e0bbe7be24ab86683e9485a7 Mon Sep 17 00:00:00 2001 From: Mehdi AOUADI Date: Tue, 16 May 2023 16:32:34 +0200 Subject: [PATCH] Embed blob sidecars directly under blob_sidecars property in BlockContents (#7145) * remove unused BlobSidecars container --- .../beacon/schema/BlindedBlobSidecars.json | 13 ---- .../beacon/schema/BlindedBlockContents.json | 5 +- .../beacon/schema/BlobSidecars.json | 13 ---- .../beacon/schema/BlockContents.json | 9 ++- .../teku/api/schema/deneb/BlobSidecars.java | 52 --------------- .../teku/api/schema/deneb/BlockContents.java | 21 ++++-- .../api/schema/deneb/SignedBlobSidecars.java | 59 ----------------- .../api/schema/deneb/SignedBlockContents.java | 24 +++++-- .../versions/deneb/BlindedBlobSidecars.java | 36 ---------- .../deneb/BlindedBlobSidecarsSchema.java | 61 ----------------- .../blobs/versions/deneb/BlobSidecars.java | 34 ---------- .../versions/deneb/BlobSidecarsSchema.java | 58 ---------------- .../deneb/SignedBlindedBlobSidecars.java | 39 ----------- .../SignedBlindedBlobSidecarsSchema.java | 66 ------------------- .../versions/deneb/SignedBlobSidecars.java | 35 ---------- .../deneb/SignedBlobSidecarsSchema.java | 61 ----------------- .../datastructures/blocks/BlockContainer.java | 5 +- .../versions/deneb/BlindedBlockContents.java | 17 +++-- .../deneb/BlindedBlockContentsSchema.java | 33 +++++++--- .../blocks/versions/deneb/BlockContents.java | 14 ++-- .../versions/deneb/BlockContentsSchema.java | 36 ++++++---- .../deneb/SignedBlindedBlockContents.java | 18 +++-- .../SignedBlindedBlockContentsSchema.java | 33 +++++++--- .../versions/deneb/SignedBlockContents.java | 21 +++--- .../deneb/SignedBlockContentsSchema.java | 40 +++++++---- .../spec/schemas/SchemaDefinitionsDeneb.java | 41 ++---------- .../BlindedBlobSidecarsPropertyTest.java | 41 ------------ .../deneb/BlobSidecarsPropertyTest.java | 38 ----------- ...SignedBlindedBlobSidecarsPropertyTest.java | 41 ------------ .../deneb/SignedBlobSidecarsPropertyTest.java | 41 ------------ .../deneb/BlindedBlobSidecarsSupplier.java | 26 -------- .../versions/deneb/BlobSidecarsSupplier.java | 26 -------- .../SignedBlindedBlobSidecarsSupplier.java | 27 -------- .../deneb/SignedBlobSidecarsSupplier.java | 26 -------- .../teku/spec/util/DataStructureUtil.java | 44 +------------ 35 files changed, 194 insertions(+), 960 deletions(-) delete mode 100644 data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlindedBlobSidecars.json delete mode 100644 data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlobSidecars.json delete mode 100644 data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlobSidecars.java delete mode 100644 data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBlobSidecars.java delete mode 100644 ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlindedBlobSidecars.java delete mode 100644 ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlindedBlobSidecarsSchema.java delete mode 100644 ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecars.java delete mode 100644 ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecarsSchema.java delete mode 100644 ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlindedBlobSidecars.java delete mode 100644 ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlindedBlobSidecarsSchema.java delete mode 100644 ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlobSidecars.java delete mode 100644 ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlobSidecarsSchema.java delete mode 100644 ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlindedBlobSidecarsPropertyTest.java delete mode 100644 ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecarsPropertyTest.java delete mode 100644 ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlindedBlobSidecarsPropertyTest.java delete mode 100644 ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlobSidecarsPropertyTest.java delete mode 100644 ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/BlindedBlobSidecarsSupplier.java delete mode 100644 ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/BlobSidecarsSupplier.java delete mode 100644 ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/SignedBlindedBlobSidecarsSupplier.java delete mode 100644 ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/SignedBlobSidecarsSupplier.java diff --git a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlindedBlobSidecars.json b/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlindedBlobSidecars.json deleted file mode 100644 index 99b5a3405f8..00000000000 --- a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlindedBlobSidecars.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "title" : "BlindedBlobSidecars", - "type" : "object", - "required" : [ "blinded_blob_sidecars" ], - "properties" : { - "blinded_blob_sidecars" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/BlindedBlobSidecar" - } - } - } -} \ No newline at end of file diff --git a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlindedBlockContents.json b/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlindedBlockContents.json index b44377dcf7c..1dd0b09afd2 100644 --- a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlindedBlockContents.json +++ b/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlindedBlockContents.json @@ -7,7 +7,10 @@ "$ref" : "#/components/schemas/BeaconBlockDeneb" }, "blinded_blob_sidecars" : { - "$ref" : "#/components/schemas/BlindedBlobSidecars" + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/BlindedBlobSidecar" + } } } } \ No newline at end of file diff --git a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlobSidecars.json b/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlobSidecars.json deleted file mode 100644 index 965d9c33a17..00000000000 --- a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlobSidecars.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "title" : "BlobSidecars", - "type" : "object", - "required" : [ "blob_sidecars" ], - "properties" : { - "blob_sidecars" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/BlobSidecar" - } - } - } -} \ No newline at end of file diff --git a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlockContents.json b/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlockContents.json index ad1360b81fd..afabf061fcb 100644 --- a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlockContents.json +++ b/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/BlockContents.json @@ -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" + } } } } \ No newline at end of file diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlobSidecars.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlobSidecars.java deleted file mode 100644 index 83ad6ece86a..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlobSidecars.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.api.schema.deneb; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import java.util.stream.Collectors; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecarsSchema; - -public class BlobSidecars { - - @ArraySchema(schema = @Schema(type = "string", format = "byte")) - public final List blobSidecars; - - public BlobSidecars(@JsonProperty("blob_sidecars") final List blobSidecars) { - this.blobSidecars = blobSidecars; - } - - public BlobSidecars( - final tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecars blobSidecars) { - this.blobSidecars = - blobSidecars.getBlobSidecars().stream().map(BlobSidecar::new).collect(Collectors.toList()); - } - - public static BlobSidecars create( - final tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecars blobSidecars) { - return new BlobSidecars(blobSidecars); - } - - public tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecars - asInternalBlobSidecars(final BlobSidecarsSchema blobSidecarsSchema) { - return blobSidecarsSchema.create( - blobSidecars.stream() - .map( - blobSidecar -> - blobSidecar.asInternalBlobSidecar(blobSidecarsSchema.getBlobSidecarSchema())) - .collect(Collectors.toList())); - } -} 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 f87b46efb94..707f18737a0 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,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 blobSidecars; public BlockContents( @JsonProperty("beacon_block") final BeaconBlockDeneb beaconBlock, - @JsonProperty("blob_sidecars") final BlobSidecars blobSidecars) { + @JsonProperty("blob_sidecars") final List blobSidecars) { this.beaconBlock = beaconBlock; this.blobSidecars = blobSidecars; } @@ -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( @@ -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())); } } diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBlobSidecars.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBlobSidecars.java deleted file mode 100644 index 74392952d46..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBlobSidecars.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.api.schema.deneb; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import java.util.stream.Collectors; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecarsSchema; - -public class SignedBlobSidecars { - - @ArraySchema(schema = @Schema(type = "string", format = "byte")) - public final List signedBlobSidecars; - - public SignedBlobSidecars( - @JsonProperty("signed_blob_sidecars") final List signedBlobSidecars) { - this.signedBlobSidecars = signedBlobSidecars; - } - - public SignedBlobSidecars( - final tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecars - signedBlobSidecars) { - this.signedBlobSidecars = - signedBlobSidecars.getBlobSidecars().stream() - .map(SignedBlobSidecar::new) - .collect(Collectors.toList()); - } - - public static SignedBlobSidecars create( - final List - signedBlobSidecars) { - return new SignedBlobSidecars( - signedBlobSidecars.stream().map(SignedBlobSidecar::new).collect(Collectors.toList())); - } - - public tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecars - asInternalSignedBlobSidecars(final SignedBlobSidecarsSchema schema) { - return schema.create( - signedBlobSidecars.stream() - .map( - signedBlobSidecar -> - signedBlobSidecar.asInternalSignedBlobSidecar( - schema.getSignedBlobSidecarSchema())) - .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 c40fb177efd..2c48381b58d 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,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 signedBlobSidecars; public SignedBlockContents( @JsonProperty("signed_beacon_block") final SignedBeaconBlockDeneb signedBeaconBlockDeneb, - @JsonProperty("signed_blob_sidecars") final SignedBlobSidecars signedBlobSidecars) { + @JsonProperty("signed_blob_sidecars") final List signedBlobSidecars) { this.signedBeaconBlockDeneb = signedBeaconBlockDeneb; this.signedBlobSidecars = signedBlobSidecars; } @@ -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() {} @@ -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 isInstance = diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlindedBlobSidecars.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlindedBlobSidecars.java deleted file mode 100644 index d982fdf23a1..00000000000 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlindedBlobSidecars.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.datastructures.blobs.versions.deneb; - -import java.util.List; -import tech.pegasys.teku.infrastructure.ssz.SszList; -import tech.pegasys.teku.infrastructure.ssz.containers.Container1; -import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; - -public class BlindedBlobSidecars - extends Container1> { - - BlindedBlobSidecars(final BlindedBlobSidecarsSchema type, final TreeNode backingNode) { - super(type, backingNode); - } - - public BlindedBlobSidecars( - final BlindedBlobSidecarsSchema schema, final List blindedBlobSidecars) { - super(schema, schema.getBlindedBlobSidecarsSchema().createFromElements(blindedBlobSidecars)); - } - - public List getBlindedBlobSidecars() { - return getField0().asList(); - } -} diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlindedBlobSidecarsSchema.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlindedBlobSidecarsSchema.java deleted file mode 100644 index c6b598b7c19..00000000000 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlindedBlobSidecarsSchema.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.datastructures.blobs.versions.deneb; - -import java.util.List; -import tech.pegasys.teku.infrastructure.ssz.SszList; -import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema1; -import tech.pegasys.teku.infrastructure.ssz.schema.SszFieldName; -import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; -import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; -import tech.pegasys.teku.spec.config.SpecConfigDeneb; - -public class BlindedBlobSidecarsSchema - extends ContainerSchema1> { - - static final SszFieldName FIELD_BLINDED_BLOB_SIDECARS = () -> "blinded_blob_sidecars"; - - BlindedBlobSidecarsSchema( - final SpecConfigDeneb specConfig, final BlindedBlobSidecarSchema blindedBlobSidecarSchema) { - super( - "BlindedBlobSidecars", - namedSchema( - FIELD_BLINDED_BLOB_SIDECARS, - SszListSchema.create(blindedBlobSidecarSchema, specConfig.getMaxBlobsPerBlock()))); - } - - public static BlindedBlobSidecarsSchema create( - final SpecConfigDeneb specConfig, final BlindedBlobSidecarSchema blindedBlobSidecarSchema) { - return new BlindedBlobSidecarsSchema(specConfig, blindedBlobSidecarSchema); - } - - @SuppressWarnings("unchecked") - public SszListSchema getBlindedBlobSidecarsSchema() { - return (SszListSchema) - getChildSchema(getFieldIndex(FIELD_BLINDED_BLOB_SIDECARS)); - } - - public BlindedBlobSidecarSchema getBlindedBlobSidecarSchema() { - return (BlindedBlobSidecarSchema) getBlindedBlobSidecarsSchema().getElementSchema(); - } - - public BlindedBlobSidecars create(final List blindedBlobSidecars) { - return new BlindedBlobSidecars(this, blindedBlobSidecars); - } - - @Override - public BlindedBlobSidecars createFromBackingNode(final TreeNode node) { - return new BlindedBlobSidecars(this, node); - } -} diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecars.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecars.java deleted file mode 100644 index 28019774b6e..00000000000 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecars.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.datastructures.blobs.versions.deneb; - -import java.util.List; -import tech.pegasys.teku.infrastructure.ssz.SszList; -import tech.pegasys.teku.infrastructure.ssz.containers.Container1; -import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; - -public class BlobSidecars extends Container1> { - - BlobSidecars(final BlobSidecarsSchema type, final TreeNode backingNode) { - super(type, backingNode); - } - - public BlobSidecars(final BlobSidecarsSchema schema, final List blobSidecars) { - super(schema, schema.getBlobSidecarsSchema().createFromElements(blobSidecars)); - } - - public List getBlobSidecars() { - return getField0().asList(); - } -} diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecarsSchema.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecarsSchema.java deleted file mode 100644 index a8104b44244..00000000000 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecarsSchema.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.datastructures.blobs.versions.deneb; - -import java.util.List; -import tech.pegasys.teku.infrastructure.ssz.SszList; -import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema1; -import tech.pegasys.teku.infrastructure.ssz.schema.SszFieldName; -import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; -import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; -import tech.pegasys.teku.spec.config.SpecConfigDeneb; - -public class BlobSidecarsSchema extends ContainerSchema1> { - - static final SszFieldName FIELD_BLOB_SIDECARS = () -> "blob_sidecars"; - - BlobSidecarsSchema(final SpecConfigDeneb specConfig, final BlobSidecarSchema blobSidecarSchema) { - super( - "BlobSidecars", - namedSchema( - FIELD_BLOB_SIDECARS, - SszListSchema.create(blobSidecarSchema, specConfig.getMaxBlobsPerBlock()))); - } - - public static BlobSidecarsSchema create( - final SpecConfigDeneb specConfig, final BlobSidecarSchema blobSidecarSchema) { - return new BlobSidecarsSchema(specConfig, blobSidecarSchema); - } - - @SuppressWarnings("unchecked") - public SszListSchema getBlobSidecarsSchema() { - return (SszListSchema) getChildSchema(getFieldIndex(FIELD_BLOB_SIDECARS)); - } - - public BlobSidecarSchema getBlobSidecarSchema() { - return (BlobSidecarSchema) getBlobSidecarsSchema().getElementSchema(); - } - - public BlobSidecars create(final List blobSidecars) { - return new BlobSidecars(this, blobSidecars); - } - - @Override - public BlobSidecars createFromBackingNode(final TreeNode node) { - return new BlobSidecars(this, node); - } -} diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlindedBlobSidecars.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlindedBlobSidecars.java deleted file mode 100644 index 2d77a137779..00000000000 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlindedBlobSidecars.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.datastructures.blobs.versions.deneb; - -import java.util.List; -import tech.pegasys.teku.infrastructure.ssz.SszList; -import tech.pegasys.teku.infrastructure.ssz.containers.Container1; -import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; - -public class SignedBlindedBlobSidecars - extends Container1> { - - SignedBlindedBlobSidecars( - final SignedBlindedBlobSidecarsSchema type, final TreeNode backingNode) { - super(type, backingNode); - } - - public SignedBlindedBlobSidecars( - final SignedBlindedBlobSidecarsSchema schema, - final List signedBlobSidecars) { - super( - schema, schema.getSignedBlindedBlobSidecarsSchema().createFromElements(signedBlobSidecars)); - } - - public List getSignedBlindedBlobSidecars() { - return getField0().asList(); - } -} diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlindedBlobSidecarsSchema.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlindedBlobSidecarsSchema.java deleted file mode 100644 index 2a33ddc427c..00000000000 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlindedBlobSidecarsSchema.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.datastructures.blobs.versions.deneb; - -import java.util.List; -import tech.pegasys.teku.infrastructure.ssz.SszList; -import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema1; -import tech.pegasys.teku.infrastructure.ssz.schema.SszFieldName; -import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; -import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; -import tech.pegasys.teku.spec.config.SpecConfigDeneb; - -public class SignedBlindedBlobSidecarsSchema - extends ContainerSchema1> { - - static final SszFieldName FIELD_SIGNED_BLINDED_BLOB_SIDECARS = - () -> "signed_blinded_blob_sidecars"; - - SignedBlindedBlobSidecarsSchema( - final SpecConfigDeneb specConfig, - final SignedBlindedBlobSidecarSchema signedBlindedBlobSidecarSchema) { - super( - "SignedBlobSidecarsSchema", - namedSchema( - FIELD_SIGNED_BLINDED_BLOB_SIDECARS, - SszListSchema.create( - signedBlindedBlobSidecarSchema, specConfig.getMaxBlobsPerBlock()))); - } - - public static SignedBlindedBlobSidecarsSchema create( - final SpecConfigDeneb specConfig, - final SignedBlindedBlobSidecarSchema signedBlindedBlobSidecarSchema) { - return new SignedBlindedBlobSidecarsSchema(specConfig, signedBlindedBlobSidecarSchema); - } - - @SuppressWarnings("unchecked") - public SszListSchema getSignedBlindedBlobSidecarsSchema() { - return (SszListSchema) - getChildSchema(getFieldIndex(FIELD_SIGNED_BLINDED_BLOB_SIDECARS)); - } - - public SignedBlindedBlobSidecarSchema getSignedBlindedBlobSidecarSchema() { - return (SignedBlindedBlobSidecarSchema) getSignedBlindedBlobSidecarsSchema().getElementSchema(); - } - - public SignedBlindedBlobSidecars create( - final List signedBlindedBlobSidecars) { - return new SignedBlindedBlobSidecars(this, signedBlindedBlobSidecars); - } - - @Override - public SignedBlindedBlobSidecars createFromBackingNode(final TreeNode node) { - return new SignedBlindedBlobSidecars(this, node); - } -} diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlobSidecars.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlobSidecars.java deleted file mode 100644 index 3aac989a5c2..00000000000 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlobSidecars.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.datastructures.blobs.versions.deneb; - -import java.util.List; -import tech.pegasys.teku.infrastructure.ssz.SszList; -import tech.pegasys.teku.infrastructure.ssz.containers.Container1; -import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; - -public class SignedBlobSidecars extends Container1> { - - SignedBlobSidecars(final SignedBlobSidecarsSchema type, final TreeNode backingNode) { - super(type, backingNode); - } - - public SignedBlobSidecars( - final SignedBlobSidecarsSchema schema, final List signedBlobSidecars) { - super(schema, schema.getSignedBlobSidecarsSchema().createFromElements(signedBlobSidecars)); - } - - public List getBlobSidecars() { - return getField0().asList(); - } -} diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlobSidecarsSchema.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlobSidecarsSchema.java deleted file mode 100644 index e3f71329fdd..00000000000 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlobSidecarsSchema.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.datastructures.blobs.versions.deneb; - -import java.util.List; -import tech.pegasys.teku.infrastructure.ssz.SszList; -import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema1; -import tech.pegasys.teku.infrastructure.ssz.schema.SszFieldName; -import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; -import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; -import tech.pegasys.teku.spec.config.SpecConfigDeneb; - -public class SignedBlobSidecarsSchema - extends ContainerSchema1> { - - static final SszFieldName FIELD_SIGNED_BLOB_SIDECARS = () -> "signed_blob_sidecars"; - - SignedBlobSidecarsSchema( - final SpecConfigDeneb specConfig, final SignedBlobSidecarSchema signedBlobSidecarSchema) { - super( - "SignedBlobSidecarsSchema", - namedSchema( - FIELD_SIGNED_BLOB_SIDECARS, - SszListSchema.create(signedBlobSidecarSchema, specConfig.getMaxBlobsPerBlock()))); - } - - public static SignedBlobSidecarsSchema create( - final SpecConfigDeneb specConfig, final SignedBlobSidecarSchema signedBlobSidecarSchema) { - return new SignedBlobSidecarsSchema(specConfig, signedBlobSidecarSchema); - } - - @SuppressWarnings("unchecked") - public SszListSchema getSignedBlobSidecarsSchema() { - return (SszListSchema) - getChildSchema(getFieldIndex(FIELD_SIGNED_BLOB_SIDECARS)); - } - - public SignedBlobSidecarSchema getSignedBlobSidecarSchema() { - return (SignedBlobSidecarSchema) getSignedBlobSidecarsSchema().getElementSchema(); - } - - public SignedBlobSidecars create(final List signedBlobSidecars) { - return new SignedBlobSidecars(this, signedBlobSidecars); - } - - @Override - public SignedBlobSidecars createFromBackingNode(final TreeNode node) { - return new SignedBlobSidecars(this, node); - } -} diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/BlockContainer.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/BlockContainer.java index c615b6e3768..4044d1dcbb4 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/BlockContainer.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/BlockContainer.java @@ -13,8 +13,9 @@ package tech.pegasys.teku.spec.datastructures.blocks; +import java.util.List; import java.util.Optional; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecars; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecar; public interface BlockContainer { @@ -22,7 +23,7 @@ default Optional getSignedBeaconBlock() { return Optional.empty(); } - default Optional getSignedBlobSidecars() { + default Optional> getSignedBlobSidecars() { return Optional.empty(); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlindedBlockContents.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlindedBlockContents.java index 0df37b040a4..93bf2a402ab 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlindedBlockContents.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlindedBlockContents.java @@ -13,14 +13,16 @@ package tech.pegasys.teku.spec.datastructures.blocks.versions.deneb; +import java.util.List; +import tech.pegasys.teku.infrastructure.ssz.SszList; import tech.pegasys.teku.infrastructure.ssz.containers.Container2; import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecars; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecar; import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; import tech.pegasys.teku.spec.datastructures.blocks.BlockContainer; public class BlindedBlockContents - extends Container2 + extends Container2> implements BlockContainer { BlindedBlockContents(final BlindedBlockContentsSchema type, final TreeNode backingNode) { @@ -30,8 +32,11 @@ public class BlindedBlockContents public BlindedBlockContents( final BlindedBlockContentsSchema schema, final BeaconBlock beaconBlock, - final BlindedBlobSidecars blindedBlobSidecars) { - super(schema, beaconBlock, blindedBlobSidecars); + final List blindedBlobSidecars) { + super( + schema, + beaconBlock, + schema.getBlindedBlobSidecarsSchema().createFromElements(blindedBlobSidecars)); } // We only need a Blinded BeaconBlock @@ -39,7 +44,7 @@ public BeaconBlock getBlindedBeaconBlock() { return getField0(); } - public BlindedBlobSidecars getBlindedBlobSidecars() { - return getField1(); + public List getBlindedBlobSidecars() { + return getField1().asList(); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlindedBlockContentsSchema.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlindedBlockContentsSchema.java index b242a1d2d5d..7847f1a5611 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlindedBlockContentsSchema.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlindedBlockContentsSchema.java @@ -13,33 +13,44 @@ package tech.pegasys.teku.spec.datastructures.blocks.versions.deneb; +import java.util.List; +import tech.pegasys.teku.infrastructure.ssz.SszList; import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema2; +import tech.pegasys.teku.infrastructure.ssz.schema.SszFieldName; +import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecars; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecarsSchema; +import tech.pegasys.teku.spec.config.SpecConfigDeneb; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecar; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecarSchema; import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSchema; public class BlindedBlockContentsSchema - extends ContainerSchema2 { + extends ContainerSchema2> { + + static final SszFieldName FIELD_BLINDED_BLOB_SIDECARS = () -> "blinded_blob_sidecars"; BlindedBlockContentsSchema( + final SpecConfigDeneb specConfig, final BeaconBlockSchema beaconBlockSchema, - final BlindedBlobSidecarsSchema blindedBlobSidecarsSchema) { + final BlindedBlobSidecarSchema blindedBlobSidecarSchema) { super( "BlindedBlockContents", namedSchema("blinded_block", beaconBlockSchema), - namedSchema("blinded_blob_sidecars", blindedBlobSidecarsSchema)); + namedSchema( + FIELD_BLINDED_BLOB_SIDECARS, + SszListSchema.create(blindedBlobSidecarSchema, specConfig.getMaxBlobsPerBlock()))); } public static BlindedBlockContentsSchema create( + final SpecConfigDeneb specConfig, final BeaconBlockSchema beaconBlockSchema, - final BlindedBlobSidecarsSchema blindedBlobSidecarsSchema) { - return new BlindedBlockContentsSchema(beaconBlockSchema, blindedBlobSidecarsSchema); + final BlindedBlobSidecarSchema blindedBlobSidecarSchema) { + return new BlindedBlockContentsSchema(specConfig, beaconBlockSchema, blindedBlobSidecarSchema); } public BlindedBlockContents create( - final BeaconBlock beaconBlock, final BlindedBlobSidecars blindedBlobSidecars) { + final BeaconBlock beaconBlock, final List blindedBlobSidecars) { return new BlindedBlockContents(this, beaconBlock, blindedBlobSidecars); } @@ -48,7 +59,9 @@ public BlindedBlockContents createFromBackingNode(final TreeNode node) { return new BlindedBlockContents(this, node); } - public BlindedBlobSidecarsSchema getBlindedBlobSidecarsSchema() { - return (BlindedBlobSidecarsSchema) getFieldSchema1(); + @SuppressWarnings("unchecked") + public SszListSchema getBlindedBlobSidecarsSchema() { + return (SszListSchema) + getChildSchema(getFieldIndex(FIELD_BLINDED_BLOB_SIDECARS)); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlockContents.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlockContents.java index d8df25bd2e6..9780144db25 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlockContents.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/BlockContents.java @@ -13,13 +13,15 @@ package tech.pegasys.teku.spec.datastructures.blocks.versions.deneb; +import java.util.List; +import tech.pegasys.teku.infrastructure.ssz.SszList; import tech.pegasys.teku.infrastructure.ssz.containers.Container2; import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecars; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar; import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; import tech.pegasys.teku.spec.datastructures.blocks.BlockContainer; -public class BlockContents extends Container2 +public class BlockContents extends Container2> implements BlockContainer { BlockContents(final BlockContentsSchema type, final TreeNode backingNode) { @@ -29,15 +31,15 @@ public class BlockContents extends Container2 blobSidecars) { + super(schema, beaconBlock, schema.getBlobSidecarsSchema().createFromElements(blobSidecars)); } public BeaconBlock getBeaconBlock() { return getField0(); } - public BlobSidecars getBlobSidecars() { - return getField1(); + public List getBlobSidecars() { + return getField1().asList(); } } 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 2636c95c497..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 @@ -13,30 +13,43 @@ package tech.pegasys.teku.spec.datastructures.blocks.versions.deneb; +import java.util.List; +import tech.pegasys.teku.infrastructure.ssz.SszList; import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema2; +import tech.pegasys.teku.infrastructure.ssz.schema.SszFieldName; +import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecars; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecarsSchema; +import tech.pegasys.teku.spec.config.SpecConfigDeneb; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecarSchema; import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSchema; public class BlockContentsSchema - extends ContainerSchema2 { + extends ContainerSchema2> { + + static final SszFieldName FIELD_BLOB_SIDECARS = () -> "blob_sidecars"; BlockContentsSchema( - final BeaconBlockSchema beaconBlockSchema, final BlobSidecarsSchema blobSidecarsSchema) { + final SpecConfigDeneb specConfig, + final BeaconBlockSchema beaconBlockSchema, + final BlobSidecarSchema blobSidecarSchema) { super( "BlockContents", - namedSchema("beacon_block", beaconBlockSchema), - namedSchema("blob_sidecars", blobSidecarsSchema)); + namedSchema("block", beaconBlockSchema), + namedSchema( + FIELD_BLOB_SIDECARS, + SszListSchema.create(blobSidecarSchema, specConfig.getMaxBlobsPerBlock()))); } public static BlockContentsSchema create( - final BeaconBlockSchema beaconBlockSchema, final BlobSidecarsSchema blobSidecarsSchema) { - return new BlockContentsSchema(beaconBlockSchema, blobSidecarsSchema); + final SpecConfigDeneb specConfig, + final BeaconBlockSchema beaconBlockSchema, + final BlobSidecarSchema blobSidecarSchema) { + return new BlockContentsSchema(specConfig, beaconBlockSchema, blobSidecarSchema); } - public BlockContents create(final BeaconBlock beaconBlock, final BlobSidecars blobSidecars) { + public BlockContents create(final BeaconBlock beaconBlock, final List blobSidecars) { return new BlockContents(this, beaconBlock, blobSidecars); } @@ -45,7 +58,8 @@ public BlockContents createFromBackingNode(final TreeNode node) { return new BlockContents(this, node); } - public BlobSidecarsSchema getBlobSidecarsSchema() { - return (BlobSidecarsSchema) getFieldSchema1(); + @SuppressWarnings("unchecked") + public SszListSchema getBlobSidecarsSchema() { + return (SszListSchema) getChildSchema(getFieldIndex(FIELD_BLOB_SIDECARS)); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlindedBlockContents.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlindedBlockContents.java index ab71552a565..55589c798a8 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlindedBlockContents.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlindedBlockContents.java @@ -13,15 +13,18 @@ package tech.pegasys.teku.spec.datastructures.blocks.versions.deneb; +import java.util.List; import java.util.Optional; +import tech.pegasys.teku.infrastructure.ssz.SszList; import tech.pegasys.teku.infrastructure.ssz.containers.Container2; import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlindedBlobSidecars; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlindedBlobSidecar; import tech.pegasys.teku.spec.datastructures.blocks.BlockContainer; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock; public class SignedBlindedBlockContents - extends Container2 + extends Container2< + SignedBlindedBlockContents, SignedBeaconBlock, SszList> implements BlockContainer { SignedBlindedBlockContents( @@ -32,8 +35,11 @@ public class SignedBlindedBlockContents public SignedBlindedBlockContents( final SignedBlindedBlockContentsSchema schema, final SignedBeaconBlock signedBeaconBlock, - final SignedBlindedBlobSidecars signedBlindedBlobSidecars) { - super(schema, signedBeaconBlock, signedBlindedBlobSidecars); + final List signedBlindedBlobSidecars) { + super( + schema, + signedBeaconBlock, + schema.getSignedBlindedBlobSidecarsSchema().createFromElements(signedBlindedBlobSidecars)); } @Override @@ -41,7 +47,7 @@ public Optional getSignedBeaconBlock() { return Optional.of(getField0()); } - public SignedBlindedBlobSidecars getSignedBlindedBlobSidecars() { - return getField1(); + public List getSignedBlindedBlobSidecars() { + return getField1().asList(); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlindedBlockContentsSchema.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlindedBlockContentsSchema.java index 2c219e5fd51..d6859b3b0de 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlindedBlockContentsSchema.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlindedBlockContentsSchema.java @@ -13,36 +13,48 @@ package tech.pegasys.teku.spec.datastructures.blocks.versions.deneb; +import java.util.List; +import tech.pegasys.teku.infrastructure.ssz.SszList; import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema2; +import tech.pegasys.teku.infrastructure.ssz.schema.SszFieldName; +import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlindedBlobSidecars; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlindedBlobSidecarsSchema; +import tech.pegasys.teku.spec.config.SpecConfigDeneb; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlindedBlobSidecar; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlindedBlobSidecarSchema; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockSchema; public class SignedBlindedBlockContentsSchema extends ContainerSchema2< - SignedBlindedBlockContents, SignedBeaconBlock, SignedBlindedBlobSidecars> { + SignedBlindedBlockContents, SignedBeaconBlock, SszList> { + + static final SszFieldName FIELD_BLOB_SIDECARS = () -> "signed_blinded_blob_sidecars"; SignedBlindedBlockContentsSchema( + final SpecConfigDeneb specConfig, final SignedBeaconBlockSchema signedBeaconBlockSchema, - final SignedBlindedBlobSidecarsSchema signedBlindedBlobSidecarsSchema) { + final SignedBlindedBlobSidecarSchema signedBlindedBlobSidecarSchema) { super( "SignedBlindedBlockContents", namedSchema("signed_blinded_block", signedBeaconBlockSchema), - namedSchema("signed_blinded_blob_sidecars", signedBlindedBlobSidecarsSchema)); + namedSchema( + FIELD_BLOB_SIDECARS, + SszListSchema.create( + signedBlindedBlobSidecarSchema, specConfig.getMaxBlobsPerBlock()))); } public static SignedBlindedBlockContentsSchema create( + final SpecConfigDeneb specConfig, final SignedBeaconBlockSchema signedBeaconBlockSchema, - final SignedBlindedBlobSidecarsSchema signedBlindedBlobSidecarsSchema) { + final SignedBlindedBlobSidecarSchema signedBlindedBlobSidecarSchema) { return new SignedBlindedBlockContentsSchema( - signedBeaconBlockSchema, signedBlindedBlobSidecarsSchema); + specConfig, signedBeaconBlockSchema, signedBlindedBlobSidecarSchema); } public SignedBlindedBlockContents create( final SignedBeaconBlock signedBeaconBlock, - final SignedBlindedBlobSidecars signedBlindedBlobSidecars) { + final List signedBlindedBlobSidecars) { return new SignedBlindedBlockContents(this, signedBeaconBlock, signedBlindedBlobSidecars); } @@ -51,7 +63,8 @@ public SignedBlindedBlockContents createFromBackingNode(final TreeNode node) { return new SignedBlindedBlockContents(this, node); } - public SignedBlindedBlobSidecarsSchema getSignedBlindedBlobSidecarsSchema() { - return (SignedBlindedBlobSidecarsSchema) getFieldSchema1(); + @SuppressWarnings("unchecked") + public SszListSchema getSignedBlindedBlobSidecarsSchema() { + return (SszListSchema) getFieldSchema1(); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlockContents.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlockContents.java index 676f2977228..066df3622ff 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlockContents.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/versions/deneb/SignedBlockContents.java @@ -13,16 +13,17 @@ package tech.pegasys.teku.spec.datastructures.blocks.versions.deneb; +import java.util.List; import java.util.Optional; -import java.util.function.Predicate; +import tech.pegasys.teku.infrastructure.ssz.SszList; import tech.pegasys.teku.infrastructure.ssz.containers.Container2; import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecars; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecar; import tech.pegasys.teku.spec.datastructures.blocks.BlockContainer; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock; public class SignedBlockContents - extends Container2 + extends Container2> implements BlockContainer { SignedBlockContents(final SignedBlockContentsSchema type, final TreeNode backingNode) { @@ -32,8 +33,11 @@ public class SignedBlockContents public SignedBlockContents( final SignedBlockContentsSchema schema, final SignedBeaconBlock signedBeaconBlock, - final SignedBlobSidecars signedBlobSidecars) { - super(schema, signedBeaconBlock, signedBlobSidecars); + final List signedBlobSidecars) { + super( + schema, + signedBeaconBlock, + schema.getSignedBlobSidecarsSchema().createFromElements(signedBlobSidecars)); } @Override @@ -42,10 +46,7 @@ public Optional getSignedBeaconBlock() { } @Override - public Optional getSignedBlobSidecars() { - return Optional.of(getField1()); + public Optional> getSignedBlobSidecars() { + return Optional.of(getField1().asList()); } - - public static Predicate isInstance = - signedBlockContents -> signedBlockContents instanceof SignedBlockContents; } 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 b0aee2a3d8f..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 @@ -13,33 +13,45 @@ package tech.pegasys.teku.spec.datastructures.blocks.versions.deneb; +import java.util.List; +import tech.pegasys.teku.infrastructure.ssz.SszList; import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema2; +import tech.pegasys.teku.infrastructure.ssz.schema.SszFieldName; +import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecars; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecarsSchema; +import tech.pegasys.teku.spec.config.SpecConfigDeneb; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecar; +import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecarSchema; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockSchema; public class SignedBlockContentsSchema - extends ContainerSchema2 { + extends ContainerSchema2> { + + static final SszFieldName FIELD_SIGNED_BLOB_SIDECARS = () -> "signed_blob_sidecars"; SignedBlockContentsSchema( - final SignedBeaconBlockSchema signedBeaconBlockSchema, - final SignedBlobSidecarsSchema signedBlobSidecarsSchema) { + final SpecConfigDeneb specConfig, + final SignedBlobSidecarSchema signedBlobSidecarSchema, + final SignedBeaconBlockSchema signedBeaconBlockSchema) { super( "SignedBlockContents", - namedSchema("signed_block_contents", signedBeaconBlockSchema), - namedSchema("signed_blob_sidecars", signedBlobSidecarsSchema)); + namedSchema("signed_block", signedBeaconBlockSchema), + namedSchema( + FIELD_SIGNED_BLOB_SIDECARS, + SszListSchema.create(signedBlobSidecarSchema, specConfig.getMaxBlobsPerBlock()))); } public static SignedBlockContentsSchema create( - final SignedBeaconBlockSchema signedBeaconBlockSchema, - final SignedBlobSidecarsSchema signedBlobSidecarsSchema) { - return new SignedBlockContentsSchema(signedBeaconBlockSchema, signedBlobSidecarsSchema); + final SpecConfigDeneb specConfig, + final SignedBlobSidecarSchema signedBlobSidecarSchema, + final SignedBeaconBlockSchema signedBeaconBlockSchema) { + return new SignedBlockContentsSchema( + specConfig, signedBlobSidecarSchema, signedBeaconBlockSchema); } public SignedBlockContents create( - final SignedBeaconBlock signedBeaconBlock, final SignedBlobSidecars signedBlobSidecars) { + final SignedBeaconBlock signedBeaconBlock, final List signedBlobSidecars) { return new SignedBlockContents(this, signedBeaconBlock, signedBlobSidecars); } @@ -52,7 +64,9 @@ public SignedBeaconBlockSchema getSignedBeaconBlockSchema() { return (SignedBeaconBlockSchema) getFieldSchema0(); } - public SignedBlobSidecarsSchema getSignedBlobSidecarsSchema() { - return (SignedBlobSidecarsSchema) getFieldSchema1(); + @SuppressWarnings("unchecked") + public SszListSchema getSignedBlobSidecarsSchema() { + return (SszListSchema) + getChildSchema(getFieldIndex(FIELD_SIGNED_BLOB_SIDECARS)); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsDeneb.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsDeneb.java index 510b3c88f17..5b4574c2837 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsDeneb.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsDeneb.java @@ -18,14 +18,10 @@ import java.util.Optional; import tech.pegasys.teku.spec.config.SpecConfigDeneb; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecarSchema; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecarsSchema; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSchema; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecarSchema; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecarsSchema; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlindedBlobSidecarSchema; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlindedBlobSidecarsSchema; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecarSchema; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecarsSchema; import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSchema; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockSchema; import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBodySchema; @@ -70,12 +66,8 @@ public class SchemaDefinitionsDeneb extends SchemaDefinitionsCapella { private final BlobSchema blobSchema; private final BlobSidecarSchema blobSidecarSchema; private final SignedBlobSidecarSchema signedBlobSidecarSchema; - private final BlobSidecarsSchema blobSidecarsSchema; - private final SignedBlobSidecarsSchema signedBlobSidecarsSchema; private final BlindedBlobSidecarSchema blindedBlobSidecarSchema; - private final BlindedBlobSidecarsSchema blindedBlobSidecarsSchema; private final SignedBlindedBlobSidecarSchema signedBlindedBlobSidecarSchema; - private final SignedBlindedBlobSidecarsSchema signedBlindedBlobSidecarsSchema; private final BlockContentsSchema blockContentsSchema; private final SignedBlockContentsSchema signedBlockContentsSchema; private final BlindedBlockContentsSchema blindedBlockContentsSchema; @@ -117,24 +109,19 @@ public SchemaDefinitionsDeneb(final SpecConfigDeneb specConfig) { this.blobSchema = new BlobSchema(specConfig); this.blobSidecarSchema = BlobSidecarSchema.create(blobSchema); this.signedBlobSidecarSchema = SignedBlobSidecarSchema.create(blobSidecarSchema); - this.signedBlobSidecarsSchema = - SignedBlobSidecarsSchema.create(specConfig, signedBlobSidecarSchema); - this.blobSidecarsSchema = BlobSidecarsSchema.create(specConfig, blobSidecarSchema); this.blindedBlobSidecarSchema = BlindedBlobSidecarSchema.create(); - this.blindedBlobSidecarsSchema = - BlindedBlobSidecarsSchema.create(specConfig, blindedBlobSidecarSchema); this.signedBlindedBlobSidecarSchema = SignedBlindedBlobSidecarSchema.create(blindedBlobSidecarSchema); - this.signedBlindedBlobSidecarsSchema = - SignedBlindedBlobSidecarsSchema.create(specConfig, signedBlindedBlobSidecarSchema); - this.blockContentsSchema = BlockContentsSchema.create(beaconBlockSchema, blobSidecarsSchema); + this.blockContentsSchema = + BlockContentsSchema.create(specConfig, beaconBlockSchema, blobSidecarSchema); this.signedBlockContentsSchema = - SignedBlockContentsSchema.create(signedBeaconBlockSchema, signedBlobSidecarsSchema); + SignedBlockContentsSchema.create( + specConfig, signedBlobSidecarSchema, signedBeaconBlockSchema); this.blindedBlockContentsSchema = - BlindedBlockContentsSchema.create(beaconBlockSchema, blindedBlobSidecarsSchema); + BlindedBlockContentsSchema.create(specConfig, beaconBlockSchema, blindedBlobSidecarSchema); this.signedBlindedBlockContentsSchema = SignedBlindedBlockContentsSchema.create( - signedBeaconBlockSchema, signedBlindedBlobSidecarsSchema); + specConfig, signedBeaconBlockSchema, signedBlindedBlobSidecarSchema); } public static SchemaDefinitionsDeneb required(final SchemaDefinitions schemaDefinitions) { @@ -214,30 +201,14 @@ public SignedBlobSidecarSchema getSignedBlobSidecarSchema() { return signedBlobSidecarSchema; } - public BlobSidecarsSchema getBlobSidecarsSchema() { - return blobSidecarsSchema; - } - - public SignedBlobSidecarsSchema getSignedBlobSidecarsSchema() { - return signedBlobSidecarsSchema; - } - public BlindedBlobSidecarSchema getBlindedBlobSidecarSchema() { return blindedBlobSidecarSchema; } - public BlindedBlobSidecarsSchema getBlindedBlobSidecarsSchema() { - return blindedBlobSidecarsSchema; - } - public SignedBlindedBlobSidecarSchema getSignedBlindedBlobSidecarSchema() { return signedBlindedBlobSidecarSchema; } - public SignedBlindedBlobSidecarsSchema getSignedBlindedBlobSidecarsSchema() { - return signedBlindedBlobSidecarsSchema; - } - public BlockContentsSchema getBlockContentsSchema() { return blockContentsSchema; } diff --git a/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlindedBlobSidecarsPropertyTest.java b/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlindedBlobSidecarsPropertyTest.java deleted file mode 100644 index d3be26b8f08..00000000000 --- a/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlindedBlobSidecarsPropertyTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.datastructures.blobs.versions.deneb; - -import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertDeserializeMutatedThrowsExpected; -import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertRoundTrip; - -import com.fasterxml.jackson.core.JsonProcessingException; -import net.jqwik.api.ForAll; -import net.jqwik.api.Property; -import tech.pegasys.teku.spec.propertytest.suppliers.blobs.versions.deneb.BlindedBlobSidecarsSupplier; - -public class BlindedBlobSidecarsPropertyTest { - - @Property - void roundTrip( - @ForAll(supplier = BlindedBlobSidecarsSupplier.class) - final BlindedBlobSidecars blindedBlobSidecars) - throws JsonProcessingException { - assertRoundTrip(blindedBlobSidecars); - } - - @Property - void deserializeMutated( - @ForAll(supplier = BlindedBlobSidecarsSupplier.class) - final BlindedBlobSidecars blindedBlobSidecars, - @ForAll final int seed) { - assertDeserializeMutatedThrowsExpected(blindedBlobSidecars, seed); - } -} diff --git a/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecarsPropertyTest.java b/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecarsPropertyTest.java deleted file mode 100644 index 58fd878a229..00000000000 --- a/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/BlobSidecarsPropertyTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.datastructures.blobs.versions.deneb; - -import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertDeserializeMutatedThrowsExpected; -import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertRoundTrip; - -import com.fasterxml.jackson.core.JsonProcessingException; -import net.jqwik.api.ForAll; -import net.jqwik.api.Property; -import tech.pegasys.teku.spec.propertytest.suppliers.blobs.versions.deneb.BlobSidecarsSupplier; - -public class BlobSidecarsPropertyTest { - - @Property - void roundTrip(@ForAll(supplier = BlobSidecarsSupplier.class) final BlobSidecars blobSidecars) - throws JsonProcessingException { - assertRoundTrip(blobSidecars); - } - - @Property - void deserializeMutated( - @ForAll(supplier = BlobSidecarsSupplier.class) final BlobSidecars blobSidecars, - @ForAll final int seed) { - assertDeserializeMutatedThrowsExpected(blobSidecars, seed); - } -} diff --git a/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlindedBlobSidecarsPropertyTest.java b/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlindedBlobSidecarsPropertyTest.java deleted file mode 100644 index 5c5445a25fd..00000000000 --- a/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlindedBlobSidecarsPropertyTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.datastructures.blobs.versions.deneb; - -import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertDeserializeMutatedThrowsExpected; -import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertRoundTrip; - -import com.fasterxml.jackson.core.JsonProcessingException; -import net.jqwik.api.ForAll; -import net.jqwik.api.Property; -import tech.pegasys.teku.spec.propertytest.suppliers.blobs.versions.deneb.SignedBlindedBlobSidecarsSupplier; - -public class SignedBlindedBlobSidecarsPropertyTest { - - @Property - void roundTrip( - @ForAll(supplier = SignedBlindedBlobSidecarsSupplier.class) - final SignedBlindedBlobSidecars signedBlindedBlobSidecars) - throws JsonProcessingException { - assertRoundTrip(signedBlindedBlobSidecars); - } - - @Property - void deserializeMutated( - @ForAll(supplier = SignedBlindedBlobSidecarsSupplier.class) - final SignedBlindedBlobSidecars signedBlindedBlobSidecars, - @ForAll final int seed) { - assertDeserializeMutatedThrowsExpected(signedBlindedBlobSidecars, seed); - } -} diff --git a/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlobSidecarsPropertyTest.java b/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlobSidecarsPropertyTest.java deleted file mode 100644 index f9257dd2141..00000000000 --- a/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/blobs/versions/deneb/SignedBlobSidecarsPropertyTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.datastructures.blobs.versions.deneb; - -import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertDeserializeMutatedThrowsExpected; -import static tech.pegasys.teku.spec.propertytest.util.PropertyTestHelper.assertRoundTrip; - -import com.fasterxml.jackson.core.JsonProcessingException; -import net.jqwik.api.ForAll; -import net.jqwik.api.Property; -import tech.pegasys.teku.spec.propertytest.suppliers.blobs.versions.deneb.SignedBlobSidecarsSupplier; - -public class SignedBlobSidecarsPropertyTest { - - @Property - void roundTrip( - @ForAll(supplier = SignedBlobSidecarsSupplier.class) - final SignedBlobSidecars signedBlobSidecars) - throws JsonProcessingException { - assertRoundTrip(signedBlobSidecars); - } - - @Property - void deserializeMutated( - @ForAll(supplier = SignedBlobSidecarsSupplier.class) - final SignedBlobSidecars signedBlobSidecars, - @ForAll final int seed) { - assertDeserializeMutatedThrowsExpected(signedBlobSidecars, seed); - } -} diff --git a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/BlindedBlobSidecarsSupplier.java b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/BlindedBlobSidecarsSupplier.java deleted file mode 100644 index f8d0f25546c..00000000000 --- a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/BlindedBlobSidecarsSupplier.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.propertytest.suppliers.blobs.versions.deneb; - -import tech.pegasys.teku.spec.SpecMilestone; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecars; -import tech.pegasys.teku.spec.propertytest.suppliers.DataStructureUtilSupplier; -import tech.pegasys.teku.spec.util.DataStructureUtil; - -public class BlindedBlobSidecarsSupplier extends DataStructureUtilSupplier { - - public BlindedBlobSidecarsSupplier() { - super(DataStructureUtil::randomBlindedBlobSidecars, SpecMilestone.DENEB); - } -} diff --git a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/BlobSidecarsSupplier.java b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/BlobSidecarsSupplier.java deleted file mode 100644 index 2a90775cdcb..00000000000 --- a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/BlobSidecarsSupplier.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.propertytest.suppliers.blobs.versions.deneb; - -import tech.pegasys.teku.spec.SpecMilestone; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecars; -import tech.pegasys.teku.spec.propertytest.suppliers.DataStructureUtilSupplier; -import tech.pegasys.teku.spec.util.DataStructureUtil; - -public class BlobSidecarsSupplier extends DataStructureUtilSupplier { - - public BlobSidecarsSupplier() { - super(DataStructureUtil::randomBlobSidecars, SpecMilestone.DENEB); - } -} diff --git a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/SignedBlindedBlobSidecarsSupplier.java b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/SignedBlindedBlobSidecarsSupplier.java deleted file mode 100644 index 07a829996a8..00000000000 --- a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/SignedBlindedBlobSidecarsSupplier.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.propertytest.suppliers.blobs.versions.deneb; - -import tech.pegasys.teku.spec.SpecMilestone; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlindedBlobSidecars; -import tech.pegasys.teku.spec.propertytest.suppliers.DataStructureUtilSupplier; -import tech.pegasys.teku.spec.util.DataStructureUtil; - -public class SignedBlindedBlobSidecarsSupplier - extends DataStructureUtilSupplier { - - public SignedBlindedBlobSidecarsSupplier() { - super(DataStructureUtil::randomSignedBlindedBlobSidecars, SpecMilestone.DENEB); - } -} diff --git a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/SignedBlobSidecarsSupplier.java b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/SignedBlobSidecarsSupplier.java deleted file mode 100644 index 2d7afc8bfc8..00000000000 --- a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/blobs/versions/deneb/SignedBlobSidecarsSupplier.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2023 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.spec.propertytest.suppliers.blobs.versions.deneb; - -import tech.pegasys.teku.spec.SpecMilestone; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecars; -import tech.pegasys.teku.spec.propertytest.suppliers.DataStructureUtilSupplier; -import tech.pegasys.teku.spec.util.DataStructureUtil; - -public class SignedBlobSidecarsSupplier extends DataStructureUtilSupplier { - - public SignedBlobSidecarsSupplier() { - super(DataStructureUtil::randomSignedBlobSidecars, SpecMilestone.DENEB); - } -} diff --git a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java index a8910c7779c..f7ad07c9fe8 100644 --- a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java +++ b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java @@ -85,19 +85,15 @@ import tech.pegasys.teku.spec.constants.Domain; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecar; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecarSchema; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecars; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.Blob; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSchema; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecarSchema; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecars; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobsBundle; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlindedBlobSidecar; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlindedBlobSidecarSchema; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlindedBlobSidecars; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecar; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecarSchema; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.SignedBlobSidecars; import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockAndState; import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockHeader; @@ -2168,41 +2164,14 @@ public List randomSignedBlindedBlobSidecars(int count) return signedBlindedBlobSidecars; } - public BlobSidecars randomBlobSidecars() { - final List blobSidecarList = randomBlobSidecars(4); - return new BlobSidecars(getSchemaDefinitionDeneb().getBlobSidecarsSchema(), blobSidecarList); - } - - public SignedBlobSidecars randomSignedBlobSidecars() { - final List signedBlobSidecarsList = randomSignedBlobSidecars(4); - return new SignedBlobSidecars( - getSchemaDefinitionDeneb().getSignedBlobSidecarsSchema(), signedBlobSidecarsList); - } - - public BlindedBlobSidecars randomBlindedBlobSidecars() { - final List blindedBlobSidecarList = randomBlindedBlobSidecars(4); - return new BlindedBlobSidecars( - getSchemaDefinitionDeneb().getBlindedBlobSidecarsSchema(), blindedBlobSidecarList); - } - - public SignedBlindedBlobSidecars randomSignedBlindedBlobSidecars() { - final List signedBlindedBlobSidecarList = - randomSignedBlindedBlobSidecars(spec.getMaxBlobsPerBlock().orElseThrow()); - return new SignedBlindedBlobSidecars( - getSchemaDefinitionDeneb().getSignedBlindedBlobSidecarsSchema(), - signedBlindedBlobSidecarList); - } - public BlockContents randomBlockContents() { return randomBlockContents(randomUInt64()); } public BlockContents randomBlockContents(UInt64 slot) { final List blobSidecarList = randomBlobSidecars(4); - final BlobSidecars blobSidecars = - new BlobSidecars(getSchemaDefinitionDeneb().getBlobSidecarsSchema(), blobSidecarList); final BeaconBlock beaconBlock = randomBeaconBlock(slot); - return getSchemaDefinitionDeneb().getBlockContentsSchema().create(beaconBlock, blobSidecars); + return getSchemaDefinitionDeneb().getBlockContentsSchema().create(beaconBlock, blobSidecarList); } public BlindedBlockContents randomBlindedBlockContents() { @@ -2210,10 +2179,7 @@ public BlindedBlockContents randomBlindedBlockContents() { } public BlindedBlockContents randomBlindedBlockContents(UInt64 slot) { - final List blindedBlobSidecarList = randomBlindedBlobSidecars(4); - final BlindedBlobSidecars blindedBlobSidecars = - new BlindedBlobSidecars( - getSchemaDefinitionDeneb().getBlindedBlobSidecarsSchema(), blindedBlobSidecarList); + final List blindedBlobSidecars = randomBlindedBlobSidecars(4); final BeaconBlock beaconBlock = randomBeaconBlock(slot); return getSchemaDefinitionDeneb() .getBlindedBlockContentsSchema() @@ -2221,12 +2187,8 @@ public BlindedBlockContents randomBlindedBlockContents(UInt64 slot) { } public SignedBlindedBlockContents randomSignedBlindedBlockContents() { - final List signedBlindedBlobSidecarList = + final List signedBlindedBlobSidecars = randomSignedBlindedBlobSidecars(4); - final SignedBlindedBlobSidecars signedBlindedBlobSidecars = - new SignedBlindedBlobSidecars( - getSchemaDefinitionDeneb().getSignedBlindedBlobSidecarsSchema(), - signedBlindedBlobSidecarList); final SignedBeaconBlock signedBeaconBlock = randomSignedBeaconBlock(); return getSchemaDefinitionDeneb() .getSignedBlindedBlockContentsSchema()