Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockHeader;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.BeaconBlockBodySchemaAltair;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.BlobIdentifier;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.DataColumnIdentifier;
import tech.pegasys.teku.spec.datastructures.operations.AttestationData;
import tech.pegasys.teku.spec.datastructures.operations.Deposit;
import tech.pegasys.teku.spec.datastructures.operations.DepositData;
Expand Down Expand Up @@ -139,8 +138,6 @@ public class SszTestExecutor<T extends SszData> implements TestExecutor {
schemas ->
SchemaDefinitionsAltair.required(schemas)
.getSyncAggregatorSelectionDataSchema()))
// TODO-fulu remove ignore after we add DataColumnsByRootIdentifier container
.put("ssz_static/DataColumnsByRootIdentifier", IGNORE_TESTS)
.put("ssz_static/LightClientBootstrap", IGNORE_TESTS)
.put("ssz_static/LightClientFinalityUpdate", IGNORE_TESTS)
.put("ssz_static/LightClientHeader", IGNORE_TESTS)
Expand Down Expand Up @@ -232,8 +229,11 @@ public class SszTestExecutor<T extends SszData> implements TestExecutor {

// Fulu types
.put(
"ssz_static/DataColumnIdentifier",
new SszTestExecutor<>(schemas -> DataColumnIdentifier.SSZ_SCHEMA))
"ssz_static/DataColumnsByRootIdentifier",
new SszTestExecutor<>(
schemas ->
SchemaDefinitionsFulu.required(schemas)
.getDataColumnsByRootIdentifierSchema()))
.put(
"ssz_static/DataColumnSidecar",
new SszTestExecutor<>(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
import tech.pegasys.teku.infrastructure.ssz.impl.SszListImpl;
import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode;

public class DataColumnSidecarsByRootRequestMessage extends SszListImpl<DataColumnIdentifier>
implements SszList<DataColumnIdentifier>, RpcRequest {
public class DataColumnSidecarsByRootRequestMessage extends SszListImpl<DataColumnsByRootIdentifier>
implements SszList<DataColumnsByRootIdentifier>, RpcRequest {

public DataColumnSidecarsByRootRequestMessage(
final DataColumnSidecarsByRootRequestMessageSchema schema,
final List<DataColumnIdentifier> dataColumnIdentifiers) {
super(schema, schema.createTreeFromElements(dataColumnIdentifiers));
final List<DataColumnsByRootIdentifier> dataColumnsByRootIdentifiers) {
super(schema, schema.createTreeFromElements(dataColumnsByRootIdentifiers));
}

DataColumnSidecarsByRootRequestMessage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
import tech.pegasys.teku.spec.config.SpecConfigFulu;

public class DataColumnSidecarsByRootRequestMessageSchema
extends AbstractSszListSchema<DataColumnIdentifier, DataColumnSidecarsByRootRequestMessage> {
extends AbstractSszListSchema<
DataColumnsByRootIdentifier, DataColumnSidecarsByRootRequestMessage> {

public DataColumnSidecarsByRootRequestMessageSchema(final SpecConfigFulu specConfig) {
super(DataColumnIdentifier.SSZ_SCHEMA, specConfig.getMaxRequestDataColumnSidecars());
public DataColumnSidecarsByRootRequestMessageSchema(
final SpecConfigFulu specConfig,
final DataColumnsByRootIdentifierSchema byRootIdentifierSchema) {
super(byRootIdentifierSchema, specConfig.getMaxRequestDataColumnSidecars());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright Consensys Software Inc., 2025
*
* 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.networking.libp2p.rpc;

import java.util.List;
import org.apache.tuweni.bytes.Bytes32;
import tech.pegasys.teku.infrastructure.ssz.collections.SszUInt64List;
import tech.pegasys.teku.infrastructure.ssz.containers.Container2;
import tech.pegasys.teku.infrastructure.ssz.primitive.SszBytes32;
import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64;
import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.datastructures.blobs.versions.fulu.DataColumnSidecar;

public class DataColumnsByRootIdentifier
extends Container2<DataColumnsByRootIdentifier, SszBytes32, SszUInt64List> {

public static DataColumnsByRootIdentifier createFromSidecar(
final DataColumnSidecar sidecar, final DataColumnsByRootIdentifierSchema schema) {
return new DataColumnsByRootIdentifier(
sidecar.getBlockRoot(), List.of(sidecar.getIndex()), schema);
}

DataColumnsByRootIdentifier(final TreeNode node, final DataColumnsByRootIdentifierSchema schema) {
super(schema, node);
}

public DataColumnsByRootIdentifier(
final Bytes32 root, final UInt64 index, final DataColumnsByRootIdentifierSchema schema) {
this(root, List.of(index), schema);
}

public DataColumnsByRootIdentifier(
final Bytes32 root,
final List<UInt64> indices,
final DataColumnsByRootIdentifierSchema schema) {
super(
schema,
SszBytes32.of(root),
schema.getColumnsSchema().createFromElements(indices.stream().map(SszUInt64::of).toList()));
}

public Bytes32 getBlockRoot() {
return getField0().get();
}

public List<UInt64> getColumns() {
return getField1().asListUnboxed();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright Consensys Software Inc., 2025
*
* 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.networking.libp2p.rpc;

import java.util.List;
import org.apache.tuweni.bytes.Bytes32;
import tech.pegasys.teku.infrastructure.ssz.collections.SszUInt64List;
import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema2;
import tech.pegasys.teku.infrastructure.ssz.primitive.SszBytes32;
import tech.pegasys.teku.infrastructure.ssz.schema.SszPrimitiveSchemas;
import tech.pegasys.teku.infrastructure.ssz.schema.collections.SszUInt64ListSchema;
import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.config.SpecConfigFulu;

public class DataColumnsByRootIdentifierSchema
extends ContainerSchema2<DataColumnsByRootIdentifier, SszBytes32, SszUInt64List> {

public DataColumnsByRootIdentifierSchema(final SpecConfigFulu specConfig) {
super(
"DataColumnIdentifier",
namedSchema("block_root", SszPrimitiveSchemas.BYTES32_SCHEMA),
namedSchema("columns", SszUInt64ListSchema.create(specConfig.getNumberOfColumns())));
}

public DataColumnsByRootIdentifier create(final Bytes32 root, final UInt64 index) {
return create(root, List.of(index));
}

public DataColumnsByRootIdentifier create(final Bytes32 root, final List<UInt64> indices) {
return new DataColumnsByRootIdentifier(root, indices, this);
}

@Override
public DataColumnsByRootIdentifier createFromBackingNode(final TreeNode node) {
return new DataColumnsByRootIdentifier(node, this);
}

public SszUInt64ListSchema<SszUInt64List> getColumnsSchema() {
return (SszUInt64ListSchema<SszUInt64List>) getFieldSchema1();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright Consensys Software Inc., 2025
*
* 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.util;

import org.apache.tuweni.bytes.Bytes32;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.datastructures.blobs.versions.fulu.DataColumnSidecar;

public record DataColumnIdentifier(Bytes32 blockRoot, UInt64 columnIndex) {
public static DataColumnIdentifier createFromSidecar(final DataColumnSidecar sidecar) {
return new DataColumnIdentifier(sidecar.getBlockRoot(), sidecar.getIndex());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright Consensys Software Inc., 2025
* Copyright Consensys Software Inc., 2024
*
* 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
Expand All @@ -19,14 +19,13 @@
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.datastructures.blobs.versions.fulu.DataColumnSidecar;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.DataColumnIdentifier;

public record DataColumnSlotAndIdentifier(UInt64 slot, Bytes32 blockRoot, UInt64 columnIndex)
implements Comparable<DataColumnSlotAndIdentifier> {

public DataColumnSlotAndIdentifier(
final UInt64 slot, final DataColumnIdentifier dataColumnIdentifier) {
this(slot, dataColumnIdentifier.getBlockRoot(), dataColumnIdentifier.getIndex());
this(slot, dataColumnIdentifier.blockRoot(), dataColumnIdentifier.columnIndex());
}

public static DataColumnSlotAndIdentifier fromDataColumn(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright Consensys Software Inc., 2025
* Copyright Consensys Software Inc., 2024
*
* 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
Expand All @@ -15,6 +15,7 @@

import static com.google.common.base.Preconditions.checkArgument;
import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.CELL_SCHEMA;
import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.DATA_COLUMNS_BY_ROOT_IDENTIFIER_SCHEMA;
import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.DATA_COLUMN_SCHEMA;
import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.DATA_COLUMN_SIDECARS_BY_RANGE_REQUEST_MESSAGE_SCHEMA;
import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.DATA_COLUMN_SIDECARS_BY_ROOT_REQUEST_MESSAGE_SCHEMA;
Expand All @@ -28,14 +29,17 @@
import tech.pegasys.teku.spec.datastructures.blobs.versions.fulu.MatrixEntrySchema;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.DataColumnSidecarsByRangeRequestMessage;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.DataColumnSidecarsByRootRequestMessageSchema;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.DataColumnsByRootIdentifierSchema;
import tech.pegasys.teku.spec.schemas.registry.SchemaRegistry;

public class SchemaDefinitionsFulu extends SchemaDefinitionsElectra {

private final CellSchema cellSchema;
private final DataColumnSchema dataColumnSchema;
private final DataColumnSidecarSchema dataColumnSidecarSchema;
private final DataColumnsByRootIdentifierSchema dataColumnsByRootIdentifierSchema;
private final MatrixEntrySchema matrixEntrySchema;

private final DataColumnSidecarsByRootRequestMessageSchema
dataColumnSidecarsByRootRequestMessageSchema;
private final DataColumnSidecarsByRangeRequestMessage
Expand All @@ -47,6 +51,8 @@ public SchemaDefinitionsFulu(final SchemaRegistry schemaRegistry) {
this.cellSchema = schemaRegistry.get(CELL_SCHEMA);
this.dataColumnSchema = schemaRegistry.get(DATA_COLUMN_SCHEMA);
this.dataColumnSidecarSchema = schemaRegistry.get(DATA_COLUMN_SIDECAR_SCHEMA);
this.dataColumnsByRootIdentifierSchema =
schemaRegistry.get(DATA_COLUMNS_BY_ROOT_IDENTIFIER_SCHEMA);
this.matrixEntrySchema = schemaRegistry.get(MATRIX_ENTRY_SCHEMA);
this.dataColumnSidecarsByRootRequestMessageSchema =
schemaRegistry.get(DATA_COLUMN_SIDECARS_BY_ROOT_REQUEST_MESSAGE_SCHEMA);
Expand Down Expand Up @@ -75,6 +81,10 @@ public DataColumnSidecarSchema getDataColumnSidecarSchema() {
return dataColumnSidecarSchema;
}

public DataColumnsByRootIdentifierSchema getDataColumnsByRootIdentifierSchema() {
return dataColumnsByRootIdentifierSchema;
}

public MatrixEntrySchema getMatrixEntrySchema() {
return matrixEntrySchema;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.BUILDER_BID_SCHEMA;
import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.CELL_SCHEMA;
import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.CONSOLIDATION_REQUEST_SCHEMA;
import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.DATA_COLUMNS_BY_ROOT_IDENTIFIER_SCHEMA;
import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.DATA_COLUMN_SCHEMA;
import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.DATA_COLUMN_SIDECARS_BY_RANGE_REQUEST_MESSAGE_SCHEMA;
import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.DATA_COLUMN_SIDECARS_BY_ROOT_REQUEST_MESSAGE_SCHEMA;
Expand Down Expand Up @@ -127,6 +128,7 @@
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.BlobSidecarsByRootRequestMessageSchema;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.DataColumnSidecarsByRangeRequestMessage;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.DataColumnSidecarsByRootRequestMessageSchema;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.DataColumnsByRootIdentifierSchema;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.metadata.versions.altair.MetadataMessageSchemaAltair;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.metadata.versions.fulu.MetadataMessageSchemaFulu;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.metadata.versions.phase0.MetadataMessageSchemaPhase0;
Expand Down Expand Up @@ -216,6 +218,7 @@ public static SchemaRegistryBuilder create() {
.addProvider(createCellSchemaProvider())
.addProvider(createDataColumnSchemaProvider())
.addProvider(createDataColumnSidecarSchemaProvider())
.addProvider(createDataColumnsByRootIdentifierSchemaProvider())
.addProvider(createMatrixEntrySchemaProvider())
.addProvider(createDataColumnSidecarsByRootRequestMessageSchemaProvider())
.addProvider(createDataColumnSidecarsByRangeRequestMessageSchemaProvider());
Expand Down Expand Up @@ -721,6 +724,15 @@ private static SchemaProvider<?> createDataColumnSidecarSchemaProvider() {
.build();
}

private static SchemaProvider<?> createDataColumnsByRootIdentifierSchemaProvider() {
return providerBuilder(DATA_COLUMNS_BY_ROOT_IDENTIFIER_SCHEMA)
.withCreator(
FULU,
(registry, specConfig, schemaName) ->
new DataColumnsByRootIdentifierSchema(SpecConfigFulu.required(specConfig)))
.build();
}

private static SchemaProvider<?> createMatrixEntrySchemaProvider() {
return providerBuilder(MATRIX_ENTRY_SCHEMA)
.withCreator(
Expand All @@ -736,7 +748,8 @@ private static SchemaProvider<?> createDataColumnSidecarsByRootRequestMessageSch
FULU,
(registry, specConfig, schemaName) ->
new DataColumnSidecarsByRootRequestMessageSchema(
SpecConfigFulu.required(specConfig)))
SpecConfigFulu.required(specConfig),
registry.get(DATA_COLUMNS_BY_ROOT_IDENTIFIER_SCHEMA)))
.build();
}

Expand Down
Loading