Merged
Conversation
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
Signed-off-by: Chen Kai <281165273grape@gmail.com>
twoeths
reviewed
Jan 16, 2026
twoeths
reviewed
Jan 16, 2026
GrapeBaBa
reviewed
Jan 16, 2026
GrapeBaBa
reviewed
Jan 16, 2026
GrapeBaBa
reviewed
Jan 16, 2026
GrapeBaBa
reviewed
Jan 16, 2026
GrapeBaBa
reviewed
Jan 16, 2026
Co-authored-by: Chen Kai <281165273grape@gmail.com>
Comment on lines
+188
to
+189
| var s = state; | ||
| const slot = try s.slot(); |
Collaborator
There was a problem hiding this comment.
i guess this was changed during testing?
Comment on lines
+472
to
+479
| pub fn hasField(comptime name: []const u8) bool { | ||
| inline for (fields) |field| { | ||
| if (std.mem.eql(u8, name, field.name)) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } |
Collaborator
There was a problem hiding this comment.
does @hasField not work for VariableContainerType and FixedContainerTypes?
This seems to work running zig build test:state_transition:
➜ jj diff --git
diff --git a/src/state_transition/types/beacon_state.zig b/src/state_transition/types/beacon_state.zig
index de8370ff5a..07adb91aff 100644
--- a/src/state_transition/types/beacon_state.zig
+++ b/src/state_transition/types/beacon_state.zig
@@ -776,7 +776,7 @@
inline for (F.fields) |f| {
// const field_name: []const u8 = comptime f.name[0..f.name.len];
- if (comptime T.hasField(f.name)) {
+ if (comptime @hasField(T, f.name)) {
Member
Author
There was a problem hiding this comment.
should be @hasField(T.Fields, f.name) but imo this shows that its a little confusing and why not just add a comptime method here that is harder to screw up
Signed-off-by: Chen Kai <281165273grape@gmail.com>
GrapeBaBa
approved these changes
Jan 19, 2026
twoeths
pushed a commit
that referenced
this pull request
Mar 2, 2026
This PR implements a major architectural change to migrate the beacon state from a value-based representation to a tree view representation using persistent merkle trees. This enables efficient state management with structural sharing and copy-on-write semantics for Ethereum consensus state transitions. Changes: - Migrated BeaconStateAllForks to BeaconState using tree view representation with persistent merkle trees - Updated all state access patterns from direct field access to getter/setter methods - Refactored execution payload types to use values instead of pointers - Added Node.Pool initialization throughout the test suite for merkle tree node management --------- Signed-off-by: Chen Kai <281165273grape@gmail.com> Co-authored-by: Chen Kai <281165273grape@gmail.com>
twoeths
added a commit
that referenced
this pull request
Mar 2, 2026
After cherry-picking "feat: tree view state (#168)", SSZ tree view conflicts were resolved by keeping "ours", which lost new API functions the state_transition code depends on. This commit adds back the missing APIs and fixes all callers. Key changes: - Add missing tree view APIs: hashTreeRoot, fromValue, toValue, getReadonly, getValue, setValue, getFieldRoot, iteratorReadonly across container, array_basic, array_composite, list_basic, list_composite, bit_vector - Fix CompositeChunks.get() to always mark changed (fixes attester_slashing failures where getReadonly cached a child without tracking, then get() returned the cached entry without marking it changed) - Fix CompositeChunks.getAllValuesInto() to initialize variable-type values before toValue (fixes segfault from uninitialized BitList fields) - Fix pointer type mismatches (*TreeView vs **TreeView) across callers - Fix beacon_state field name bugs and return type mismatches - Add @setEvalBranchQuota(20000) for comptime iteration over BeaconState Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR implements a major architectural change to migrate the beacon state from a value-based representation to a tree view representation using persistent merkle trees. This enables efficient state management with structural sharing and copy-on-write semantics for Ethereum consensus state transitions.
Changes: