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] Reintroduce the MapStore interface and SimpleMap and make the Badger a submodules #33

Merged
merged 33 commits into from
Jan 3, 2024

Conversation

h5law
Copy link
Collaborator

@h5law h5law commented Dec 22, 2023

Summary

Human Summary

This PR reintroduces the MapStore interface and SimpleMap implementation of a basic in-memory key-value store and makes the badger BadgerStore interface and tests a submodule, in the case where people do not want this dependency.

It also updates the Makefile targets and workflows to account for this change in project structure.

AI Summary

Summary generated by Reviewpad on 03 Jan 24 22:49 UTC

This pull request includes several changes across multiple files:

  1. Modifications to the bulk_test.go file:

    • Importing a new package simplemap.
    • Modifying the creation of variables smn and smv using simplemap.NewSimpleMap() function instead of NewKVStore.
    • Updating error handling in the bulkOperations function.
  2. Addition of a new file interfaces.go in the kvstore package:

    • Defines the MapStore interface for key-value store functionalities.
  3. Addition of a new test file smt_example_test.go demonstrating the usage of Sparse Merkle Trie (SMT).

  4. Changes to the fuzz_test.go file:

    • Adding an import statement for github.com/pokt-network/smt/kvstore/simplemap.
    • Fixing typos in comments and error messages.
    • Updating error comparisons and messages.
    • Relocating the smn.Stop() statement.
  5. Modifications to the README.md file:

    • Addition of a new section about testing the 'badger' submodule.
  6. Changes to the smt.md file:

    • Addition of subsections under the Database section.
    • Updates to descriptions and explanations for the MapStore and KVStore interfaces.
    • Addition of details about the SimpleMap and Badger submodules.
    • Removal of the Example section.
  7. Addition of the mapstore.md file:

    • Introduction to the MapStore interface and its implementations (SimpleMap and BadgerV4).
  8. Renaming and restructuring of packages and test names in various files.

  9. Renaming and updating the kvstore.md file to badger-store.md.

  10. Changes to smt_proofs_test.go:

    • Imports and type modifications related to the kvstore and simplemap packages.
  11. Changes to proofs.go:

    • Removal of the init() function.
    • Declaration of the SparseMerkleProof struct.
  12. Addition of the godoc.go file to the kvstore directory.

  13. Changes to the Makefile:

    • Modifications to targets, including removal, addition, and updates to descriptions.
  14. Addition of a new test case in the smst_example_test.go file demonstrating the usage of the simplemap package.

  15. Addition of a new file simplemap.go implementing the simplemap package.

  16. Changes to the smst_utils_test.go file:

    • Modifications to import statements and variable types.
    • Improvements in comments and function explanations.
  17. Changes to the godoc.go file in the smt package:

    • Updates to package description and optimizations mentioned.
  18. Changes to the smst_proofs_test.go file:

    • Modifications to imports, variable types, and function calls.
  19. Changes to the godoc.go file:

    • Updates to package documentation, optimizations, and features mentioned.
  20. Modifications to the godoc.go file:

    • Addition of import statements and replacements of variable types.

Please review these changes in detail and provide any necessary feedback.

Issue

Fixes 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 enhancement New feature or request dependencies Relates to package dependencies large Pull request is large code health Related to code cleanup and health of the repo labels Dec 22, 2023
@h5law h5law self-assigned this Dec 22, 2023
@reviewpad reviewpad bot added waiting-for-review This PR is currently waiting to be reviewed and removed dependencies Relates to package dependencies labels Dec 22, 2023
Copy link

codecov bot commented Dec 22, 2023

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (db06038) 83.28% compared to head (fee3061) 83.24%.
Report is 1 commits behind head on main.

❗ Current head fee3061 differs from pull request most recent head a7c793c. Consider uploading reports for the commit a7c793c to get more accurate results

Files Patch % Lines
kvstore/badger/kvstore.go 62.50% 12 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #33      +/-   ##
==========================================
- Coverage   83.28%   83.24%   -0.05%     
==========================================
  Files           8        9       +1     
  Lines        1406     1456      +50     
==========================================
+ Hits         1171     1212      +41     
- Misses        178      184       +6     
- Partials       57       60       +3     

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

@h5law h5law force-pushed the feat/badger-submodule branch from 1af3995 to 24f0def Compare December 22, 2023 15:22
@h5law
Copy link
Collaborator Author

h5law commented Dec 22, 2023

@muXxer Let me know if this is what you were looking for from your PR

@h5law h5law force-pushed the feat/badger-submodule branch 8 times, most recently from 5d03b62 to 2e04107 Compare December 23, 2023 14:24
@h5law h5law changed the base branch from main to feat/doc-changes December 23, 2023 14:25
@h5law h5law force-pushed the feat/badger-submodule branch 2 times, most recently from 26bfd24 to ebd5586 Compare January 1, 2024 20:32
@h5law h5law force-pushed the feat/doc-changes branch from ae6db39 to 2d215eb Compare January 1, 2024 21:18
@h5law h5law changed the title [Enhancement] Reintroduce the MapStore interface and SimpleMap and make Badger a submodule [Enhancement] Reintroduce the MapStore interface and SimpleMap and Badger a submodules Jan 3, 2024
@h5law h5law changed the title [Enhancement] Reintroduce the MapStore interface and SimpleMap and Badger a submodules [Enhancement] Reintroduce the MapStore interface and SimpleMap and make the Badger a submodules Jan 3, 2024
@h5law h5law requested a review from Olshansk January 3, 2024 16:07
@h5law
Copy link
Collaborator Author

h5law commented Jan 3, 2024

@Olshansk what do you think of the new structure re: simplemap making it a submodule and separating the MapStore interface from any implementations

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.

A couple small nits and outstanding comments from the previous review, but should be g2g after

Makefile Outdated Show resolved Hide resolved
smt_example_test.go Show resolved Hide resolved
smst_example_test.go Show resolved Hide resolved
@h5law h5law requested a review from Olshansk January 3, 2024 18:22
Makefile Outdated Show resolved Hide resolved
benchmarks/bench_smt_test.go Outdated Show resolved Hide resolved
benchmarks/proof_sizes_test.go Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
benchmarks/bench_smt_test.go Outdated Show resolved Hide resolved
Base automatically changed from feat/doc-changes to main January 3, 2024 20:18
@h5law h5law requested a review from Olshansk January 3, 2024 20:24
Olshansk
Olshansk previously approved these changes Jan 3, 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.

Left two more comments, but approving so we can get this in.

Makefile Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
@Olshansk
Copy link
Member

Olshansk commented Jan 3, 2024

@h5law Make sure to resolve conflicts with main and fix the indents.

@codecov-commenter
Copy link

codecov-commenter commented Jan 3, 2024

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (883d100) 83.28% compared to head (538dcb5) 83.24%.

Files Patch % Lines
kvstore/badger/kvstore.go 62.50% 12 Missing and 3 partials ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #33      +/-   ##
==========================================
- Coverage   83.28%   83.24%   -0.05%     
==========================================
  Files           8        9       +1     
  Lines        1406     1456      +50     
==========================================
+ Hits         1171     1212      +41     
- Misses        178      184       +6     
- Partials       57       60       +3     

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

@h5law h5law requested review from Olshansk and removed request for bryanchriswhite January 3, 2024 22:19
Olshansk
Olshansk previously approved these changes Jan 3, 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.

Made some doc improvements. Please review before merging.

docs/smt.md Outdated Show resolved Hide resolved
docs/kvstore.md Outdated Show resolved Hide resolved
docs/kvstore.md Outdated Show resolved Hide resolved
docs/kvstore.md Outdated Show resolved Hide resolved
docs/kvstore.md Outdated Show resolved Hide resolved
docs/kvstore.md Outdated Show resolved Hide resolved
@h5law h5law merged commit 6778485 into main Jan 3, 2024
3 checks passed
@h5law h5law deleted the feat/badger-submodule branch January 3, 2024 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Related to code cleanup and health of the repo 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.

3 participants