Skip to content

Commit 2a30ec4

Browse files
wemeetagainclaude
andcommitted
feat: add StructContainerTreeView, model Validator as StructContainerType
Add StructContainerTreeView — a tree view for fixed-size containers that stores the value as a flat Zig struct. Fields are read and written in O(1) via direct struct access. Dirty fields are tracked with a StaticBitSet. On commit, only changed fields are spliced into the merkle tree via setNodesAtDepth. The pool has no special node types — this is purely a view-level optimization. - Add StructContainerTreeView with StaticBitSet dirty tracking - Parameterize FixedContainerType with TreeViewType enum - StructContainerType selects StructContainerTreeView via the enum - Model phase0 Validator as StructContainerType - set() skips write and dirty-marking when value is unchanged - serializeIntoBytes/toValue read from the struct directly (no commit needed) - commit has clear ownership phases with correct errdefer cleanup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ce6370e commit 2a30ec4

File tree

5 files changed

+456
-1
lines changed

5 files changed

+456
-1
lines changed

src/ssz/root.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub const VariableVectorType = types.VariableVectorType;
3333

3434
pub const FixedContainerType = types.FixedContainerType;
3535
pub const VariableContainerType = types.VariableContainerType;
36+
pub const StructContainerType = types.StructContainerType;
3637

3738
pub const getPathGindex = types.getPathGindex;
3839

@@ -42,6 +43,7 @@ pub const HasherData = hasher.HasherData;
4243

4344
const tree_view = @import("tree_view/root.zig");
4445
pub const ContainerTreeView = tree_view.ContainerTreeView;
46+
pub const StructContainerTreeView = tree_view.StructContainerTreeView;
4547
pub const ArrayBasicTreeView = tree_view.ArrayBasicTreeView;
4648
pub const ArrayCompositeTreeView = tree_view.ArrayCompositeTreeView;
4749
pub const ListBasicTreeView = tree_view.ListBasicTreeView;

0 commit comments

Comments
 (0)