-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(trie): add MerkleValue
method and functions
#2602
Merged
Merged
Conversation
This file contains 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
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
@qdm12 can you resolve the conflicts on this. |
ef713c4
to
74dffdf
Compare
Conflicts resolved 😉 |
noot
reviewed
Aug 10, 2022
noot
approved these changes
Aug 10, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 📦🚀 |
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.
MerkleValue
function to produce the Merkle value for non-root nodes from the node encodingMerkleValueRoot
function to produce the Merkle value for root nodes from the node encodingCalculateMerkleValue
method tonode.Node
to return the Merkle valueCalculateRootMerkleValue
method tonode.Node
to return the root node Merkle valuehashNode
EncodeAndHashRoot
only uses cached Merkle value if it's 32 bytesCalculateMerkleValue
instead ofEncodeAndHash
when appropriateCalculateRootMerkleValue
instead ofEncodeAndHashRoot
when appropriateMerkleValue
buildTrie
usesMerkleValueRoot
Tests
go test ./internal/trie/... ./lib/trie/...
Issues
Related to #2418
Primary Reviewer
@timwu20