Skip to content
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

Optimize SSZ collection tree creation #9088

Closed
wants to merge 17 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update SszOptionalSchemaImpl.java
  • Loading branch information
VolodymyrBg authored Feb 11, 2025
commit b4dd55b50d047711ddc634deedc528dcb71ce037
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class SszOptionalSchemaImpl<ElementDataT extends SszData>
private static final LeafNode EMPTY_OPTIONAL_LEAF = LeafNode.create(Bytes.of(0));
private static final LeafNode PRESENT_OPTIONAL_LEAF =
LeafNode.create(Bytes.of(IS_PRESENT_PREFIX));
private static final TreeNode DEFAULT_TREE = createTreeNode(LeafNode.EMPTY_LEAF, false);
private static final TreeNode DEFAULT_TREE = createTreeNode(TreeUtil.ZERO_TREES[0], false);

private static LeafNode createOptionalNode(final boolean isPresent) {
return isPresent ? PRESENT_OPTIONAL_LEAF : EMPTY_OPTIONAL_LEAF;
Expand Down Expand Up @@ -244,7 +244,7 @@ public TreeNode loadBackingNodes(

final TreeNode optionalNode =
nodeSource.loadLeafNode(optionalHash, GIndexUtil.gIdxRightGIndex(rootGIndex));
final int isPresent = optionalNode.get(0, ByteOrder.LITTLE_ENDIAN);
final int isPresent = optionalNode.getData().get(0) & 0xFF;
checkState(isPresent <= IS_PRESENT_PREFIX, "Selector is out of bounds");

if (isPresent == 0) {
Expand Down