Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle committed Dec 3, 2024
1 parent 5d6c5f0 commit e2a8fd5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions store/v2/commitment/iavl/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (t *IavlTree) Commit() ([]byte, uint64, error) {

// GetProof returns a proof for the given key and version.
func (t *IavlTree) GetProof(version uint64, key []byte) (*ics23.CommitmentProof, error) {
// the mutable tree is empty at genesis & when the key is removed, but the immutable tree is not
// the mutable tree is empty at genesis & when the storekey is removed, but the immutable tree is not but the immutable tree is not empty when the storekey is removed
// by checking the latest version we can determine if we are in genesis or have a key that has been removed
lv, err := t.tree.GetLatestVersion()
if err != nil {
Expand All @@ -103,7 +103,7 @@ func (t *IavlTree) GetProof(version uint64, key []byte) (*ics23.CommitmentProof,

// Get implements the Reader interface.
func (t *IavlTree) Get(version uint64, key []byte) ([]byte, error) {
// the mutable tree is empty at genesis & when the key is removed, but the immutable tree is not
// the mutable tree is empty at genesis & when the storekey is removed, but the immutable tree is not but the immutable tree is not empty when the storekey is removed
// by checking the latest version we can determine if we are in genesis or have a key that has been removed
lv, err := t.tree.GetLatestVersion()
if err != nil {
Expand All @@ -123,7 +123,7 @@ func (t *IavlTree) Get(version uint64, key []byte) ([]byte, error) {

// Iterator implements the Reader interface.
func (t *IavlTree) Iterator(version uint64, start, end []byte, ascending bool) (corestore.Iterator, error) {
// the mutable tree is empty at genesis & when the key is removed, but the immutable tree is not
// the mutable tree is empty at genesis & when the storekey is removed, but the immutable tree is not empty when the storekey is removed
// by checking the latest version we can determine if we are in genesis or have a key that has been removed
lv, err := t.tree.GetLatestVersion()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion store/v2/commitment/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func (c *CommitStore) VersionExists(version uint64) (bool, error) {
return false, err
}
if latestVersion == 0 {
return true, nil
return version == 0, nil
}

ci, err := c.metadata.GetCommitInfo(version)
Expand Down

0 comments on commit e2a8fd5

Please sign in to comment.