From 826ccb971fbd6f6b27e34a806339105220d8ace8 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 7 Feb 2022 00:10:57 +0100 Subject: [PATCH 1/2] add get all versions --- store/iavl/store.go | 5 +++++ store/iavl/tree.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/store/iavl/store.go b/store/iavl/store.go index 50702da585c8..a5706553668c 100644 --- a/store/iavl/store.go +++ b/store/iavl/store.go @@ -143,6 +143,11 @@ func (st *Store) VersionExists(version int64) bool { return st.tree.VersionExists(version) } +// GetAllVersions returns all versions in the iavl tree +func (st *Store) GetAllVersions() []int { + return st.tree.AvailableVersions() +} + // Implements Store. func (st *Store) GetStoreType() types.StoreType { return types.StoreTypeIAVL diff --git a/store/iavl/tree.go b/store/iavl/tree.go index 83d1ada301fd..c78782e49e38 100644 --- a/store/iavl/tree.go +++ b/store/iavl/tree.go @@ -31,6 +31,7 @@ type ( GetVersionedWithProof(key []byte, version int64) ([]byte, *iavl.RangeProof, error) GetImmutable(version int64) (*iavl.ImmutableTree, error) SetInitialVersion(version uint64) + AvailableVersions() []int } // immutableTree is a simple wrapper around a reference to an iavl.ImmutableTree @@ -92,3 +93,7 @@ func (it *immutableTree) GetImmutable(version int64) (*iavl.ImmutableTree, error return it.ImmutableTree, nil } + +func (it *immutableTree) AvailableVersions() []int { + return []int{} +} From d1a535110568fe950f8dbd44dec6e36299dc524e Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 7 Feb 2022 12:15:40 +0100 Subject: [PATCH 2/2] add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index deaaa63f5986..b3c7df5b8161 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -119,6 +119,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [\#10816](https://github.com/cosmos/cosmos-sdk/pull/10816) Reuse blocked addresses from the bank module. No need to pass them to distribution. * [\#10852](https://github.com/cosmos/cosmos-sdk/pull/10852) Move `x/gov/types` to `x/gov/types/v1beta2`. * [\#10868](https://github.com/cosmos/cosmos-sdk/pull/10868), [\#10989](https://github.com/cosmos/cosmos-sdk/pull/10989), [\#11093](https://github.com/cosmos/cosmos-sdk/pull/11093) The Gov keeper accepts now 2 more mandatory arguments, the ServiceMsgRouter and a gov Config including the max metadata length. +* [\#11124](https://github.com/cosmos/cosmos-sdk/pull/11124) Add `GetAllVersions` to application store ### Client Breaking Changes * [\#11089](https://github.com/cosmos/cosmos-sdk/pull/11089]) interacting with the node through `grpc.Dial` requires clients to pass a codec refer to [doc](docs/run-node/interact-node.md).