pokt-network / smt

A Go library that implements a Sparse Merkle Trie for a key-value map.
https://pkg.go.dev/github.com/pokt-network/smt
Other
16 stars 4 forks source link

[Enhancement] Reintroduce the `MapStore` interface and `SimpleMap` and make the `Badger` a submodules #33

Closed h5law closed 10 months ago

h5law commented 10 months ago

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):

Testing

Required Checklist

If Applicable Checklist

codecov[bot] commented 10 months ago

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.

:exclamation: 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 :warning:
Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

h5law commented 10 months ago

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

h5law commented 10 months ago

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

Olshansk commented 10 months ago

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

codecov-commenter commented 10 months ago

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 :warning:

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

Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.