-
Notifications
You must be signed in to change notification settings - Fork 111
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
feat(pkg/mmr): Add basic MMR support #4154
Conversation
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.
LGTM! Would like to see more tests over getElement, also can the storage be generic over MMRElement
?
I'm gonna add more, thanks for the review 👍
You mean to use a generic instead of using |
4c2bcb2
to
ce2d724
Compare
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.
Really nice work! I already looked over it, but if you could do a once over of the GP appendix E to make sure it seems compatible before merging that would be great.
I've been checking, and if I'm not mistaken, it aligns well with the JAM GP. The Regarding the encoding function, it essentially describes the process of bagging the peaks and calculating the final MMR root so we are ok with that too. This is all based on my interpretation of the functions described in the GP, but in the future, we can compare our implementation with Parity’s to ensure we have the same behavior 😄 |
5d902bc
to
286c878
Compare
// MergeFunc defines a function type used to merge two elements in the MMR. | ||
// It takes two elements, `left` and `right`, and returns a pointer to the | ||
// merged result or an error if the merge operation fails. |
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.
I think this comment is not needed, the func signature is self-explanatory imo, maybe you can use it to explain how the merge is implemented.
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.
Agree, but I wanted to add a comment since it is an exported type
Closed in favor of https://github.com/ChainSafe/go-jam/pull/38 |
Changes
Add basic MMR support following the 1st iteration implementation proposed here
Features
Tests
go test ./pkg/mmr
Issues
Closes: #4152