Eip 7916 progressive list - #68
Open
omerfirmak wants to merge 2 commits into
Open
Conversation
Add merkleizeProgressive() to lib.zig: a 0-terminated sequence of binary subtrees with leaf counts 1, 4, 16, 64, ..., reusing merkleize() for each fixed subtree. Refactor List/Bitlist into ListImpl/BitlistImpl taking a `limit: ?usize`, where null means progressive. List(T, N) and Bitlist(N) become thin wrappers, so their behaviour is unchanged. New public types: ProgressiveList(T), ProgressiveByteList and ProgressiveBitlist. Serialization is byte-identical to the bounded variants. Differences are confined to the capacity checks, which become no-ops, and merkleization: - maxInLength() returns error.NoMaxInLengthAvailable, since there is no static bound to check a payload against. This also changes Bitlist(N).maxInLength() from usize to !usize. - chunkCountLimit() is a @CompileError, as a progressive tree has no fixed depth and so cannot be wrapped in TreeHasher. - ProgressiveBitlist does not trim trailing zero bytes before hashing. Bitlist(N) can, because zero chunks are padding in a fixed-depth tree, but dropping a chunk shifts the progressive subtree layout. Expected roots in the tests were generated by an independent Python transcription of the EIP pseudocode, covering chunk counts that straddle every subtree boundary plus deep cases at 1250 chunks and 20000 bits. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A struct opts in by declaring `pub const ssz_progressive_container = true`. Serialization is untouched; hashTreeRoot becomes hash(merkleize_progressive(field_roots), pack_bits(active_fields)) Only the all-active form EIP-7688 mandates is supported: active_fields is derived from the field count, so a field cannot be marked inactive. Expected roots in the tests come from eth-remerkleable, the reference implementation execution-specs uses. The ProgressiveList vectors added in the previous commit were also cross-checked against it and all match. Co-Authored-By: Claude Opus 5 (1M context) <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.
No description provided.