Conversation
- Add special handling for TypeVector with TypeContainer elements - Generate code that calls HashTreeRootWith() for each composite element - Fixes panic when using composite types with ssz_size annotations
potuz
reviewed
Oct 23, 2025
| // Test struct for composite types | ||
| type TestComposite struct { | ||
| Field1 uint64 | ||
| Field2 []byte `ssz-size:"32"` |
There was a problem hiding this comment.
Don't we need also a test with a vector of variable size composites?
Author
There was a problem hiding this comment.
Hm, i could. But fixed vector size composites was what failed. (ie builder_pending_payments)
potuz
reviewed
Oct 23, 2025
Comment on lines
+21
to
+27
| func (t *TestComposite) HashTreeRootWith(hh *ssz.Hasher) (err error) { | ||
| indx := hh.Index() | ||
| hh.PutUint64(t.Field1) | ||
| hh.PutBytes(t.Field2) | ||
| hh.Merkleize(indx) | ||
| return | ||
| } |
There was a problem hiding this comment.
is this correct? a container with an uint64 x and a 32 byte vector y inside is hashed as
hash( [0x00]x24 | x | y)
This seems to be hashing hash(x|y|[0x00]x24)?
kasey
approved these changes
Nov 3, 2025
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 ensures a vector of composite type does not panic, example when running
https://github.com/OffchainLabs/prysm/blob/develop/hack/update-go-ssz.sh