chore(trie): add MerkleValue method and functions#2602
Merged
qdm12 merged 5 commits intodevelopmentfrom Aug 11, 2022
Merged
Conversation
acc0652 to
74ef462
Compare
EclesioMeloJunior
requested changes
Jun 14, 2022
qdm12
commented
Jun 14, 2022
EclesioMeloJunior
approved these changes
Jun 14, 2022
9d55d9c to
9691124
Compare
MerkleValue method and functionMerkleValue method and functions
timwu20
reviewed
Jul 4, 2022
6a35c63 to
f46e4b4
Compare
dddcea6 to
9982267
Compare
Contributor
|
@qdm12 can you resolve the conflicts on this. |
ef713c4 to
74dffdf
Compare
Contributor
Author
|
Conflicts resolved 😉 |
noot
reviewed
Aug 10, 2022
noot
approved these changes
Aug 10, 2022
Contributor
noot
left a comment
There was a problem hiding this comment.
basically looks fine, just one comment about removing duplicate code
- Add `CalculateMerkleValue` node method - Add `MerkleValue` function - Add `MerkleValueRoot` function - Use pool of hashers in Merkle value functions - Use `EncodeAndHash` method in branch child encoding `scaleEncodeHash` function - Add TODO comment about using io.Writer to use sync.Pool buffers
…otMerkleValue` to satisfy DeepSource
74dffdf to
6d7881b
Compare
|
🎉 This PR is included in version 0.7.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Changes
ℹ️ this is needed for the proof code in #2604 so we use the same functions to get the Merkle value for nodes.
MerkleValuefunction to produce the Merkle value for non-root nodes from the node encodingMerkleValueRootfunction to produce the Merkle value for root nodes from the node encodingCalculateMerkleValuemethod tonode.Nodeto return the Merkle valueCalculateRootMerkleValuemethod tonode.Nodeto return the root node Merkle valuehashNodeEncodeAndHashRootonly uses cached Merkle value if it's 32 bytesCalculateMerkleValueinstead ofEncodeAndHashwhen appropriateCalculateRootMerkleValueinstead ofEncodeAndHashRootwhen appropriateMerkleValuebuildTrieusesMerkleValueRootTests
go test ./internal/trie/... ./lib/trie/...Issues
Related to #2418
Primary Reviewer
@timwu20