Closed h5law closed 1 year ago
Patch coverage: 83.82%
and project coverage change: -0.20%
:warning:
Comparison is base (
f5ef955
) 86.93% compared to head (4784998
) 86.73%. Report is 1 commits behind head on main.:exclamation: Current head 4784998 differs from pull request most recent head 95e930f. Consider uploading reports for the commit 95e930f to get more accurate results
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Closing this as the MultiStore is not longer a priority.
For future reference this should be rescoped to allow the SMT to preform silimar functions to the IAVL+ tree in the context of the CommitMultiStore
etc used in the cosmos-sdk
[1]. Enabling the correct features for this to be plugged in place of the IAVL+ tree will be a win.
[1] https://docs.cosmos.network/v0.45/core/store.html#commitmultistore
Description
This PR introduces the new
MultiStore
SMT manager. This enables the management of numerous SMTs under a single overarching tree.The
MultiStore
acts as a wrapper around an SMT that includes the name and root hash of the trees it manages. TheStore
interface is a wrapper around a single SMT which tracks theMultiStore
it is a part of and overwrites the SMT'sCommit
method to not only commit theStore
's changes to the database but also update theMultiStore
with the name and root hash of theStore
's tree.This is useful in areas where a single tree / root hash is needed but different SMT's are desired: for example in a blockchain setting this could replace the root tree and each of the trees it manages could track the transactions, accounts etc. It would also be useful for an implementation of the IBC specification where the
MultiStore
would represent the IBC store as a whole with eachStore
representing a single ICS component such as the ICS-02 store or the ICS-03 store.Summary generated by Reviewpad on 31 Jul 23 12:52 UTC
This pull request introduces significant changes to several files related to the
MultiStore
functionality. Here is a summary of the changes:multi_test.go
: The file now includes test functions and helper functions for testing theMultiStore
functionality. The test functions cover various operations such as adding a store, inserting a pre-existing store, getting a store, removing a store, performing store operations, committing changes, and generating proofs. Additionally, a helper functioncustomStoreCreator
is added.multi.go
: This file implements theMultiStore
interface and its associated functions. Themulti
struct represents a collection of multiple stores and implements methods such asAddStore
,InsertStore
,GetStore
,RemoveStore
,Commit
,Root
,Prove
, andSpec
. Thestore
struct represents an individual store within theMultiStore
, maintaining a reference to the parentMultiStore
and implementing aCommit
method that updates the multi-store with the latest root hash.MultiStore.md
: The Markdown file provides an overview of theMultiStore
interface and its functionalities. It explains how theMultiStore
manages multiple stores and describes the operations available for managing stores and trees. It also introduces theStore
type, which is a wrapper around anSMT
and includes aCommit
method to update the multi-store with the root hash of the store. Additionally, it discusses theTreeSpec
type, which specifies the hashing functions and maximum depth of the tree.These changes significantly enhance the functionality and usage of the
MultiStore
concept, allowing for better management and manipulation of multiple stores within the system.Type of change
Please mark the relevant option(s):
List of changes
MultiStore
andStore
interfacesmulti
andstore
structs to implement the interfacesTesting
go test ...
go test ...
go test -v
Required Checklist
godoc
format comments on touched members (see: tip.golang.org/doc/comment)If Applicable Checklist