-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Randy Grok <98407738+randygrok@users.noreply.github.com> Co-authored-by: Julien Robert <julien@rbrt.fr>
- Loading branch information
1 parent
51b418a
commit 71803b7
Showing
7 changed files
with
36 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,6 @@ | ||
package types | ||
|
||
import ( | ||
corestore "cosmossdk.io/core/store" | ||
storetypes "cosmossdk.io/store/types" | ||
import "github.com/cosmos/cosmos-sdk/runtime" | ||
|
||
"github.com/cosmos/cosmos-sdk/baseapp" | ||
) | ||
|
||
// UpgradeStoreLoader is used to prepare baseapp with a fixed StoreLoader | ||
// pattern. This is useful for custom upgrade loading logic. | ||
func UpgradeStoreLoader(upgradeHeight int64, storeUpgrades *corestore.StoreUpgrades) baseapp.StoreLoader { | ||
return func(ms storetypes.CommitMultiStore) error { | ||
if upgradeHeight == ms.LastCommitID().Version+1 { | ||
// Check if the current commit version and upgrade height matches | ||
if len(storeUpgrades.Deleted) > 0 || len(storeUpgrades.Added) > 0 { | ||
stup := &storetypes.StoreUpgrades{ | ||
Added: storeUpgrades.Added, | ||
Deleted: storeUpgrades.Deleted, | ||
} | ||
return ms.LoadLatestVersionAndUpgrade(stup) | ||
} | ||
} | ||
|
||
// Otherwise load default store loader | ||
return baseapp.DefaultStoreLoader(ms) | ||
} | ||
} | ||
// UpgradeStoreLoader moved to runtime package, keeping this for backwards compatibility | ||
var UpgradeStoreLoader = runtime.UpgradeStoreLoader |