celestiaorg / smt

A Go library that implements a Sparse Merkle tree for a key-value map.
https://godoc.org/github.com/celestiaorg/smt
MIT License
138 stars 53 forks source link

SMT v0.4 potential wishlist #71

Closed musalbas closed 2 years ago

musalbas commented 2 years ago

Storage

Versioning and pruning

Note: this would allow for O(1) reading of keys from the latest tree, but O(log(n)) for historical trees where n is the keys in the tree, unless versioning is also implemented for the value store. Note that IAVL's reads are always O(log(n)) anyway. Furthermore, rollbacks would be O(o) where o is the number of operations being rolled back (this is the same as Ethereum's state trie). We should understand Cosmos SDK store requirements for this.

Batching

Documentation

adlerjohn commented 2 years ago

IMO batch writing is by far the most important of these features since it's critical for performance in all cases. The rest are more related to upstreaming into the Cosmos SDK or are still research questions. We could consider splitting these across a few releases instead of blocking on all of them.

musalbas commented 2 years ago

Agreed, though I'm also not sure batching needs to be implemented in this repo, as it can be in the MapStore implementation. However, for pruning, some concept of a version will be needed which may be related to a commit function/batching.

musalbas commented 2 years ago

Closing as new/pending information may invalidate this wishlist.