Skip to content

Commit

Permalink
storeMigration to packetforwardmiddleware
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Nov 6, 2023
1 parent 3b5ba48 commit 4acd42a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fmt "fmt"

const (
// ModuleName defines the module name
ModuleName = "packetfowardmiddleware"
ModuleName = "packetforwardmiddleware"

// StoreKey is the store key string for IBC transfer
StoreKey = ModuleName
Expand Down
33 changes: 17 additions & 16 deletions middleware/packet-forward-middleware/testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package simapp

import (
"encoding/json"
"fmt"
"io"
"net/http"
"os"
Expand Down Expand Up @@ -762,23 +763,23 @@ func (app *SimApp) setupUpgradeHandlers() {

// setupUpgradeStoreLoaders sets all necessary store loaders required by upgrades.
func (app *SimApp) setupUpgradeStoreLoaders() {
// upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
// if err != nil {
// tmos.Exit(fmt.Sprintf("failed to read upgrade info from disk %s", err))
// }
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
tmos.Exit(fmt.Sprintf("failed to read upgrade info from disk %s", err))
}

// // Future: if we want to fix the module name, we can do it here.
// if upgradeInfo.Name == upgrades.V2 && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
// storeUpgrades := storetypes.StoreUpgrades{
// Renamed: []storetypes.StoreRename{{
// OldKey: "packetfoward", // previous misspelling
// NewKey: packetforwardtypes.ModuleName,
// }},
// }

// // configure store loader that checks if version == upgradeHeight and applies store upgrades
// app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
// }
// Future: if we want to fix the module name, we can do it here.
if upgradeInfo.Name == upgrades.V2 && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Renamed: []storetypes.StoreRename{{
OldKey: "packetfowardmiddleware", // previous misspelling
NewKey: packetforwardtypes.ModuleName,
}},
}

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

// RegisterAPIRoutes registers all application module routes with the provided
Expand Down

0 comments on commit 4acd42a

Please sign in to comment.