Skip to content
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

[Enhancement] Add MerkleRoot type alias for []byte with Sum method #37

Merged
merged 3 commits into from
Jan 9, 2024

Conversation

h5law
Copy link
Collaborator

@h5law h5law commented Jan 9, 2024

Summary

Human Summary

  • Add MerkleRoot []byte alias
  • Add Sum(bool) method to the type to get the sum from the trie

AI Summary

Summary generated by Reviewpad on 09 Jan 24 20:24 UTC

This pull request includes changes to the documentation files merkle-sum-trie.md and smt.md, as well as the test file root_test.go, the code file smst.go, and the types file types.go.

The changes to the documentation files add a new section called "Roots" that explains the root of the tree and provides helper functions for interacting with the root.

The changes to the test file add tests for the MerkleRoot type and the Sum() function.

The changes to the code file add a new method Root() that returns the root hash of the trie as a MerkleRoot type.

The changes to the types file add a new type MerkleRoot that is a byte slice representing the root hash, and a Sum() method for computing the sum of the root hash.

Issue

N/A

Type of change

Please mark the relevant option(s):

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Documentation
  • Other (specify)

Testing

  • Run all unit tests: make test_all
  • Run all/relevant benchmarks (if optimising): make benchmark_{all | suite name}

Required Checklist

If Applicable Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have updated any relevant README(s)/documentation and left TODOs throughout the codebase
  • Add or update any relevant or supporting mermaid diagrams

@h5law h5law added the enhancement New feature or request label Jan 9, 2024
@h5law h5law requested a review from Olshansk January 9, 2024 17:42
@h5law h5law self-assigned this Jan 9, 2024
@reviewpad reviewpad bot added small Pull request is small waiting-for-review This PR is currently waiting to be reviewed labels Jan 9, 2024
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional suggestion. Approving to get things going.

docs/merkle-sum-trie.md Outdated Show resolved Hide resolved
types.go Outdated Show resolved Hide resolved
@reviewpad reviewpad bot added medium Pull request is medium and removed small Pull request is small labels Jan 9, 2024
@h5law h5law merged commit d16ac8d into main Jan 9, 2024
3 checks passed
@h5law h5law deleted the feat/merkle-root branch January 9, 2024 20:25

This library also implements a Sparse Merkle Sum Trie (SMST), the documentation
for which can be found [here](./merkle-sum-trie.md).
This l
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was accidentally deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request medium Pull request is medium waiting-for-review This PR is currently waiting to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants