-
Notifications
You must be signed in to change notification settings - Fork 383
Adding DataColumnsByRootIdentifier container #9399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lucassaldanha
merged 5 commits into
Consensys:master
from
lucassaldanha:data-columns-by-root-id
May 8, 2025
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
39b3df8
Adding DataColumnsByRootIdentifier container
lucassaldanha bccab1b
PR comments
lucassaldanha 40e7839
need more coffee...
lucassaldanha 3b22d9f
Rename
lucassaldanha b812261
Merge branch 'master' into data-columns-by-root-id
lucassaldanha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 0 additions & 65 deletions
65
...ava/tech/pegasys/teku/spec/datastructures/networking/libp2p/rpc/DataColumnIdentifier.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...h/pegasys/teku/spec/datastructures/networking/libp2p/rpc/DataColumnsByRootIdentifier.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /* | ||
| * Copyright Consensys Software Inc., 2023 | ||
|
lucassaldanha marked this conversation as resolved.
Outdated
|
||
| * | ||
| * 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(); | ||
| } | ||
| } | ||
53 changes: 53 additions & 0 deletions
53
...sys/teku/spec/datastructures/networking/libp2p/rpc/DataColumnsByRootIdentifierSchema.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
...m/spec/src/main/java/tech/pegasys/teku/spec/datastructures/util/DataColumnIdentifier.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 columnId) { | ||
|
lucassaldanha marked this conversation as resolved.
Outdated
|
||
| public static DataColumnIdentifier createFromSidecar(final DataColumnSidecar sidecar) { | ||
| return new DataColumnIdentifier(sidecar.getBlockRoot(), sidecar.getIndex()); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.