feat: add get all versions (#11124)

* add get all versions

* add changelog entry
This commit is contained in:
Marko 2022-02-08 19:29:39 +01:00 committed by GitHub
parent 870c6e7c64
commit d624a65679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -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
* (x/authz) [\#10447](https://github.com/cosmos/cosmos-sdk/pull/10447) authz `NewGrant` takes a new argument: block time, to correctly validate expire time.
### Client Breaking Changes

View File

@ -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

View File

@ -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{}
}