Skip to content

Commit d624a65

Browse files
authored
feat: add get all versions (cosmos#11124)
* add get all versions * add changelog entry
1 parent 870c6e7 commit d624a65

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
119119
* [\#10816](https://github.com/cosmos/cosmos-sdk/pull/10816) Reuse blocked addresses from the bank module. No need to pass them to distribution.
120120
* [\#10852](https://github.com/cosmos/cosmos-sdk/pull/10852) Move `x/gov/types` to `x/gov/types/v1beta2`.
121121
* [\#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.
122+
* [\#11124](https://github.com/cosmos/cosmos-sdk/pull/11124) Add `GetAllVersions` to application store
122123
* (x/authz) [\#10447](https://github.com/cosmos/cosmos-sdk/pull/10447) authz `NewGrant` takes a new argument: block time, to correctly validate expire time.
123124

124125
### Client Breaking Changes

store/iavl/store.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ func (st *Store) VersionExists(version int64) bool {
143143
return st.tree.VersionExists(version)
144144
}
145145

146+
// GetAllVersions returns all versions in the iavl tree
147+
func (st *Store) GetAllVersions() []int {
148+
return st.tree.AvailableVersions()
149+
}
150+
146151
// Implements Store.
147152
func (st *Store) GetStoreType() types.StoreType {
148153
return types.StoreTypeIAVL

store/iavl/tree.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type (
3131
GetVersionedWithProof(key []byte, version int64) ([]byte, *iavl.RangeProof, error)
3232
GetImmutable(version int64) (*iavl.ImmutableTree, error)
3333
SetInitialVersion(version uint64)
34+
AvailableVersions() []int
3435
}
3536

3637
// 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
9293

9394
return it.ImmutableTree, nil
9495
}
96+
97+
func (it *immutableTree) AvailableVersions() []int {
98+
return []int{}
99+
}

0 commit comments

Comments
 (0)