From e2a8fd5ecfed4bbed80f9d2554ad3e8ad482a120 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Tue, 3 Dec 2024 11:28:33 +0100 Subject: [PATCH] address comments --- store/v2/commitment/iavl/tree.go | 6 +++--- store/v2/commitment/store.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/store/v2/commitment/iavl/tree.go b/store/v2/commitment/iavl/tree.go index 5fbaf0d4d5e..4aaac08ab8b 100644 --- a/store/v2/commitment/iavl/tree.go +++ b/store/v2/commitment/iavl/tree.go @@ -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 { @@ -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 { @@ -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 { diff --git a/store/v2/commitment/store.go b/store/v2/commitment/store.go index 3803a506bf6..aa383b57ae5 100644 --- a/store/v2/commitment/store.go +++ b/store/v2/commitment/store.go @@ -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)