-
Notifications
You must be signed in to change notification settings - Fork 4
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: Replace MapStore and SimpleMap with KVStore and BadgerDB #19
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #19 +/- ##
==========================================
- Coverage 86.93% 84.69% -2.25%
==========================================
Files 8 8
Lines 995 1117 +122
==========================================
+ Hits 865 946 +81
- Misses 94 126 +32
- Partials 36 45 +9
☔ View full report in Codecov by Sentry. |
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.
Just a few NITS but LGTM!
@@ -0,0 +1,104 @@ | |||
# KVStore <!-- omit in toc --> |
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 did not review the README, assuming its just a copy & paste.
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.
No this is a new README.md
there wasnt one before (or I missed it) however its pretty basic
|
||
#### Len | ||
|
||
The `Len` method returns the number of keys in the database, similarly to how the `len` function can return the length of a map. |
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.
great docs!
@Olshansk I accidentlly merged the proof serialisation into this branch but have addressed the readme comments, should be good to go with a review now. |
Description
Summary generated by Reviewpad on 09 Sep 23 09:27 UTC
This pull request includes changes to multiple files. Here is a summary of the overall diff:
The file
smst.go
has updates related to changing thenodes
parameter type in two functions (NewSparseMerkleSumTree
andImportSparseMerkleSumTree
) fromMapStore
toKVStore
.The file
smst_utils_test.go
has changes to theSMSTWithStorage
struct and its methods. Thepreimages
field type has been changed fromMapStore
toKVStore
. TheUpdate
method now adds values to thepreimages
KVStore
, and theGetValueSum
method retrieves hashed values from thepreimages
KVStore
.The file
smt.go
has modifications to theSMT
struct. Thenodes
field type has been changed fromMapStore
toKVStore
. TheNewSparseMerkleTree
andImportSparseMerkleTree
functions now accept aKVStore
parameter instead of aMapStore
.The file
kvstore.go
introduces a new file that defines theKVStore
interface and implements it using Badger as the key-value database.The file
bench_test.go
has updates related to benchmarking theSparseMerkleTree
and includes changes to variable declarations and initialization usingNewKVStore
.The file
smt_test.go
has changes to test cases, including updating variable types from*SimpleMap
toKVStore
(smn
andsmv
). There are also modifications to function calls related to initialization and error handling when usingNewKVStore
.The file
smst_proofs_test.go
has changes to variable types from*SimpleMap
toKVStore
(smn
andsmv
). There are also updates to error handling during initialization usingNewKVStore
and additional cleanup code.The file
mapstore_test.go
has been deleted, removing its entire contents.The file
KVStore.md
introduces a new file that contains documentation for theKVStore
interface, its methods, and usage.The file
mapstore.go
has been deleted, removing its entire contents.The file
smst_utils_test.go
has updates related to changing error handling usingerrors.Is
andbadger.ErrKeyNotFound
.The file
smt_proofs_test.go
has updates related to error handling and stopping key-value store instances.Please review these changes carefully and let me know if you need more information or assistance with any specific part.
Issue
Fixes N/A
Type of change
Please mark the relevant option(s):
List of changes
MapStore
interface andSimpleMap
implementationKVStore
interface with a BadgerDB backed implementationKVStore
Testing
go test ...
go test ...
go test -v
Required Checklist
godoc
format comments on touched members (see: tip.golang.org/doc/comment)If Applicable Checklist