Skip to content

Commit

Permalink
v0.40.0-rc4 (#8051)
Browse files Browse the repository at this point in the history
* multistore: fix SetInitialVersion (#8048)

* update changelog for rc4

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
  • Loading branch information
clevinson and alexanderbez authored Dec 1, 2020
1 parent 5903586 commit 5d32ed6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ Ref: https://keepachangelog.com/en/1.0.0/

## [Unreleased]

## [v0.40.0-rc4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.40.0-rc4) - 2020-11-30

### Bug Fixes

* (store) [#8048](https://github.com/cosmos/cosmos-sdk/pull/8048) Fix issue where `SetInitialVersion` was never getting called, causing all queries to return empty on chains with non-zero initial height

## [v0.40.0-rc3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.40.0-rc3) - 2020-11-06

### Improvements
Expand Down
9 changes: 6 additions & 3 deletions store/rootmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,12 @@ func (rs *Store) SetInitialVersion(version int64) error {

// Loop through all the stores, if it's an IAVL store, then set initial
// version on it.
for _, commitKVStore := range rs.stores {
if storeWithVersion, ok := commitKVStore.(types.StoreWithInitialVersion); ok {
storeWithVersion.SetInitialVersion(version)
for key, store := range rs.stores {
if store.GetStoreType() == types.StoreTypeIAVL {
// If the store is wrapped with an inter-block cache, we must first unwrap
// it to get the underlying IAVL store.
store = rs.GetCommitKVStore(key)
store.(*iavl.Store).SetInitialVersion(version)
}
}

Expand Down
7 changes: 7 additions & 0 deletions store/rootmulti/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,11 +657,18 @@ func TestSetInitialVersion(t *testing.T) {
db := dbm.NewMemDB()
multi := newMultiStoreWithMounts(db, types.PruneNothing)

require.NoError(t, multi.LoadLatestVersion())

multi.SetInitialVersion(5)
require.Equal(t, int64(5), multi.initialVersion)

multi.Commit()
require.Equal(t, int64(5), multi.LastCommitID().Version)

ckvs := multi.GetCommitKVStore(multi.keysByName["store1"])
iavlStore, ok := ckvs.(*iavl.Store)
require.True(t, ok)
require.True(t, iavlStore.VersionExists(5))
}

func BenchmarkMultistoreSnapshot100K(b *testing.B) {
Expand Down

0 comments on commit 5d32ed6

Please sign in to comment.