Implement ProgressiveMerkleHasher for EIP-7916#42
Conversation
Co-authored-by: michaelsproul <4452260+michaelsproul@users.noreply.github.com>
Co-authored-by: michaelsproul <4452260+michaelsproul@users.noreply.github.com>
Co-authored-by: michaelsproul <4452260+michaelsproul@users.noreply.github.com>
Co-authored-by: michaelsproul <4452260+michaelsproul@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #42 +/- ##
==========================================
+ Coverage 87.75% 88.02% +0.26%
==========================================
Files 6 7 +1
Lines 294 334 +40
==========================================
+ Hits 258 294 +36
- Misses 36 40 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@copilot This implementation is inefficient, I want the |
… stream in Co-authored-by: michaelsproul <4452260+michaelsproul@users.noreply.github.com>
Refactored to hash chunks as they stream in (commit 0746652). The hasher now:
This follows the same efficient folding pattern as MerkleHasher. |
…er method Co-authored-by: michaelsproul <4452260+michaelsproul@users.noreply.github.com>
|
@copilot This is getting closer to being correct. Can you refactor the |
…inary tree hashing Co-authored-by: michaelsproul <4452260+michaelsproul@users.noreply.github.com>
Refactored to use
|
Implementation Plan for ProgressiveMerkleHasher
progressive_merkle_hasher.rswith the ProgressiveMerkleHasher structProgressiveMerkleHasherstruct that follows similar API design toMerkleHasherwith_leavesconstructorwritemethod to add bytes/chunks to the hasherfinishmethod to compute the final root using progressive merkleization semanticsMerkleHasherinstances for handling binary tree sub-portions (via merkle_root)Final Implementation
The efficient
ProgressiveMerkleHasherimplementation now:MerkleHasherinstance for computing binary tree rootsMerkleHasherwithwith_leaves(),write(),finish()methodsAll 59 tests pass across the package.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.