Closed calbera closed 1 week ago
[!WARNING]
Review failed
The pull request is closed.
The recent changes across several files within the mod/primitives/pkg/merkle
and mod/primitives/pkg/crypto
packages involve a comprehensive refactor of hashing and Merkle tree functionalities. This includes restructuring types and functions, migrating functionality between packages, adding new structures like RootHasher
, and optimizing hashing via parallel processing and hardware acceleration. Moreover, the changes also feature updating dependencies and improving testing with mock implementations for better verification.
Files (Grouped) | Change Summary |
---|---|
mod/primitives/pkg/merkle/hasher.go |
Refactored hashing functions and types, added RootHasher and RootHashFn for efficient leaf hashing. |
mod/primitives/pkg/crypto/hasher.go |
Moved and refactored hashing functionality from merkle to crypto , with interface adjustments. |
mod/primitives/pkg/crypto/sha256.go |
Renamed Sum256 to Sha256 for SHA-256 checksum calculation in the crypto package. |
mod/primitives/pkg/eip4844/kzg_commitment.go |
Updated crypto imports and sha256 usage to crypto.Sha256 in the ToVersionedHash method. |
mod/primitives/pkg/ssz/merkleizer/merkleizer.go |
Refactored to use crypto.NewHasher and updated Merkle tree functions to utilize rootHasher . |
mod/primitives/pkg/merkle/root.go |
Added new root construction functions and optimized parallel hashing functionalities. |
mod/primitives/pkg/merkle/hasher_test.go |
Updated imports and initialization of hashers to use the new crypto package within test functions. |
mod/primitives/pkg/merkle/proof.go |
Updated imports to use crypto package and adjusted hash function assignments in RootFromBranch . |
mod/primitives/pkg/ssz/index.go |
Replaced sha256 functions with crypto functions for Merkle root calculations. |
mod/primitives/pkg/crypto/mocks/hash_fn.mock.go |
Introduced mocked implementation for HashFn type for improved test verification. |
mod/primitives/pkg/crypto/mocks/hasher.mock.go |
Added mock implementation for Hasher type with functions for Combi , Hash , and MixIn . |
mod/primitives/pkg/merkle/zero/zero.go |
Modified to import crypto and use crypto.Hash in InitZeroHashes . |
mod/primitives/pkg/storage/go.mod |
Added new indirect dependencies cpuid/v2 and sha256-simd . |
mod/state-transition/pkg/core/state_processor_randao.go |
Updated sha256 usage to crypto.Sha256 for calculating revealHash . |
In the land of code, a shift was made,
Hashers and Merkle trees got an upgrade,
Withcrypto
at heart, new roots will sprout,
Leaves and branches, never a doubt.
Mockers came to test and play,
Ensuring every bit was in place to stay.
Cheers to the changes, oh code so grand,
Built by the rabbit's clever hand. ππ
Attention: Patch coverage is 71.87500%
with 9 lines
in your changes missing coverage. Please review.
Project coverage is 22.27%. Comparing base (
00feff1
) to head (011214b
).:exclamation: Current head 011214b differs from pull request most recent head 6d6a3d0
Please upload reports for the commit 6d6a3d0 to get more accurate results.
despite this making sense, it feels weird how the function needs to take two "hasher things"
@itsdevbear i can put the functions on the Hasher but it feels like coupling two things that are not related
did you sync against Bartio? all gucci?
Summary by CodeRabbit
Refactor
crypto
package.New Features
RootHasher
struct andRootHashFn
type for optimized Merkle tree operations.Bug Fixes
sha256
functions with updatedcrypto
functions for better performance.Tests
Chores