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

feat: add VersionedSMT for historical queries #20

Closed
wants to merge 16 commits into from
Closed

Conversation

h5law
Copy link
Collaborator

@h5law h5law commented Sep 1, 2023

Description

Summary generated by Reviewpad on 03 Sep 23 16:34 UTC

This pull request includes changes in multiple files:

  1. The go.mod file was updated to change the Go version to 1.20 and add a new dependency on golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 while removing the dependency on github.com/google/go-cmp v0.5.8.

  2. The file immutable.go introduces a new type ImmutableTree that wraps the SMT struct. It also implements various methods related to the immutable behavior of the tree, such as Update, Delete, Commit, and SetInitialVersion. Additionally, it provides methods for versions and retrieval of data based on versions.

  3. The file diff introduces a new interface called VersionedSMT, which extends the SparseMerkleTree interface and adds methods for versioning and managing previous versions of the tree. It also introduces the TreeSpec struct with a helper function for custom hashers.

  4. The file .github/workflows/test.yml was modified to update the TARGET_GOLANG_VERSION environment variable and the go version in both jobs.

  5. The file diff for badgerKVStore.go includes the addition of the bytes package import, a new method called Clone in the badgerKVStore struct, and updates to comments and existing code.

  6. The file diff introduces a new file encoding.go with functions related to encoding and decoding of stored trees using gob encoding.

  7. The file Versioned.md includes changes related to the introduction and implementation details of the VersionedSMT interface, the VersionedTree and ImmutableTree types, and database lifecycle details.

  8. The file diff for the test file includes test functions for an immutable tree, covering various scenarios and functionalities.

  9. The file diff for utils.go includes new functions and imports related to numeric directory handling and directory existence checks.

  10. The file diff introduces a new test file versioned_test.go with multiple test functions for a versioned tree.

  11. The file diff for smt_utils_test.go includes changes related to introducing hashing capabilities in the code.

  12. The file README.md includes changes in the required Go version and additional subsections.

  13. The file encoding_test.go contains test functions for encoding and decoding a stored tree.

  14. The file go.sum contains changes to the dependencies.

  15. The file hasher.go includes changes related to the PathHasher, ValueHasher, treeHasher, pathHasher, and valueHasher types.

Please review these changes carefully.

Issue

Fixes N/A

Type of change

Please mark the relevant option(s):

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Major breaking change
  • Documentation
  • Other

List of changes

  • Add VersionedSMT interface and ImmutableTree and VersionedTree implementations to wrap the SMT
  • Allow for historical queries of a versioned SMT

Testing

  • Task specific tests or benchmarks: go test ...
  • New tests or benchmarks: go test ...
  • All tests: go test -v

Required Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added, or updated, godoc format comments on touched members (see: tip.golang.org/doc/comment)
  • I have tested my changes using the available tooling

If Applicable Checklist

  • Update any relevant README(s)
  • Add or update any relevant or supporting mermaid diagrams
  • I have added tests that prove my fix is effective or that my feature works

@h5law h5law added the enhancement New feature or request label Sep 1, 2023
@h5law h5law self-assigned this Sep 1, 2023
@reviewpad reviewpad bot added the large Pull request is large label Sep 1, 2023
@h5law h5law changed the title feat: add initial versioned trees feat: add VersionedSMT for historical queries Sep 1, 2023
@reviewpad reviewpad bot added the waiting-for-review This PR is currently waiting to be reviewed label Sep 1, 2023
@codecov
Copy link

codecov bot commented Sep 2, 2023

Codecov Report

Patch coverage: 58.22% and project coverage change: -5.78% ⚠️

Comparison is base (2876295) 84.89% compared to head (24f7db0) 79.11%.

Additional details and impacted files
@@             Coverage Diff             @@
##           kvstore      #20      +/-   ##
===========================================
- Coverage    84.89%   79.11%   -5.78%     
===========================================
  Files            8       11       +3     
  Lines         1092     1408     +316     
===========================================
+ Hits           927     1114     +187     
- Misses         122      219      +97     
- Partials        43       75      +32     
Files Changed Coverage Δ
types.go 87.91% <0.00%> (-5.12%) ⬇️
kvstore.go 67.17% <30.76%> (-1.47%) ⬇️
versioned.go 50.00% <50.00%> (ø)
hasher.go 99.07% <66.66%> (-0.93%) ⬇️
encoding.go 70.00% <70.00%> (ø)
utils.go 92.50% <86.95%> (-1.32%) ⬇️
immutable.go 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Olshansk
Copy link
Member

Olshansk commented Sep 5, 2023

@h5law Is this still a high priority?

@h5law
Copy link
Collaborator Author

h5law commented Sep 5, 2023

@Olshansk No this is not priority anymore afaik

@Olshansk
Copy link
Member

Let's close this out if its no longer relevant

@h5law
Copy link
Collaborator Author

h5law commented Sep 25, 2023

This PR is no longer needed closing

@h5law h5law closed this Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request large Pull request is large waiting-for-review This PR is currently waiting to be reviewed
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants