-
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.
feat(runtime/v2): store loader on simappv2 (#21704)
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
- Loading branch information
1 parent
b712516
commit 7d6ff0d
Showing
8 changed files
with
72 additions
and
29 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
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 |