Skip to content

Commit

Permalink
Problem: nft module store is not initialized
Browse files Browse the repository at this point in the history
Solution:
- call SetStoreLoader to initialise nft module store
  • Loading branch information
yihuang committed May 17, 2021
1 parent f9285ff commit f6e8310
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
26 changes: 22 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand Down Expand Up @@ -414,6 +415,27 @@ func New(
)
app.SetEndBlocker(app.EndBlocker)

planName := "v2.0.0"
app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, _ upgradetypes.Plan) {
// https://github.com/crypto-org-chain/chain-main/blob/master/doc/architecture/adr-003.md
})

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}

if upgradeInfo.Name == planName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{nfttypes.StoreKey},
Renamed: []storetypes.StoreRename{},
Deleted: []string{},
}

// configure store loader that checks if version == upgradeHeight and applies store upgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
tmos.Exit(err.Error())
Expand All @@ -433,10 +455,6 @@ func New(
app.ScopedIBCKeeper = scopedIBCKeeper
app.ScopedTransferKeeper = scopedTransferKeeper

app.UpgradeKeeper.SetUpgradeHandler("v2.0.0", func(ctx sdk.Context, _ upgradetypes.Plan) {
// https://github.com/crypto-org-chain/chain-main/blob/master/doc/architecture/adr-003.md
})

return app
}

Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let
lib = pkgs.lib;
build-chain-maind = { ledger_zemu ? false, network ? "mainnet" }: pkgs.buildGoApplication rec {
pname = "chain-maind";
version = "1.2.0";
version = "2.0.0";
src = lib.cleanSourceWith {
name = "src";
src = lib.sourceByRegex ./. src_regexes;
Expand Down

0 comments on commit f6e8310

Please sign in to comment.