cl/merkle_tree: add EIP-7495 active fields mix-in#22528
Conversation
There was a problem hiding this comment.
Pull request overview
Adds the EIP-7495 “active-fields mix-in” helper to the CL merkle tree utilities, enabling future ProgressiveContainer support (notably for EIP-7807 ExecutionPayload-style containers) by hashing root || pack_bits(active_fields).
Changes:
- Implement
MixInActiveFields(root, activeFields)that packs up to 256 active-field bits into a zero-padded 32-byte SSZ chunk using little-endian bit order. - Add pinned reference-vector tests covering EIP-7807’s 18-field configuration, sparse bit patterns, the 256-bit boundary, and invalid input length.
- Add a sanity check that the produced hash matches a direct
sha256(root||packed)computation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cl/merkle_tree/progressive.go | Adds MixInActiveFields implementation and length validation (max 256 bits). |
| cl/merkle_tree/progressive_test.go | Adds reference-vector and validation tests for the new mix-in helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Adversarial review found one blocking issue: [P1] cl/merkle_tree/progressive.go:47 does not compile. It calls utils.Sha256, but the merge brought in #22489, which moved SHA-256 from cl/utils to common/crypto; this file now imports only common/crypto. Reproduced at HEAD a14b0cf: The call should be: After applying only that correction locally, the full cl/merkle_tree package tests, the focused race test, and an additional length 0-256 boundary test all pass. Two non-blocking notes:
The EIP-7495 packing semantics, zero padding, 256-bit limit, and EIP-7807 18-field vector otherwise look correct. |
Thanks for the detailed review! I fixed the SHA-256 call after the package move, replaced the vacuous root immutability test with an Validated with:
Could you please take another look when you have time? Thanks! |
|
@JackCC703 could you check the CI failure? Thank you |
Sure! The root failing job is The logs show repeated The same zkEVM witness job is also failing in another unrelated PR run, so this appears to be a shared EEST/BAL or base-branch issue rather than something caused by the active-fields change. Please let me know if you would like me to investigate anything else. |
Summary
add
MixInActiveFieldsfollowing the EIP-7495 active-fields mix-in definitionpack up to 256 active-field bits into one zero-padded SSZ chunk using little-endian bit order
add pinned reference vectors covering the EIP-7807 18-field configuration, sparse bits, the 256-bit boundary, invalid input, and input immutability
Motivation
This is a follow-up to #22446 and provides the active-fields mix-in primitive needed for future EIP-7495
ProgressiveContainersupport, including EIP-7807 execution payloads.The helper computes:
Specification references
Testing
go test ./cl/merkle_tree -run '^TestMixInActiveFields' -count=1go test ./cl/merkle_tree -count=1make lintmake erigon integration