Skip to content

Commit

Permalink
chore: skip upgrade handler on testnet (#635)
Browse files Browse the repository at this point in the history
Co-authored-by: nulnut <[email protected]>
  • Loading branch information
zakir-code and nulnut authored Aug 8, 2024
1 parent 9724622 commit e9ff4b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func Test_UpgradeAndMigrate(t *testing.T) {

home := filepath.Join(os.Getenv("HOME"), "tmp")
chainId := fxtypes.TestnetChainId // The upgrade test is not related to chainId, do not modify it
fxtypes.SetChainId(chainId)

db, err := dbm.NewDB("application", dbm.GoLevelDBBackend, filepath.Join(home, "data"))
require.NoError(t, err)
Expand Down
4 changes: 4 additions & 0 deletions app/upgrades/v7/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ import (
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"

"github.com/functionx/fx-core/v7/app/upgrades"
fxtypes "github.com/functionx/fx-core/v7/types"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: "v7.5.x",
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: func() *storetypes.StoreUpgrades {
if fxtypes.ChainId() == fxtypes.TestnetChainId {
return &storetypes.StoreUpgrades{}
}
return &storetypes.StoreUpgrades{
Added: []string{
crisistypes.ModuleName,
Expand Down
5 changes: 5 additions & 0 deletions app/upgrades/v7/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ import (

"github.com/functionx/fx-core/v7/app/keepers"
"github.com/functionx/fx-core/v7/contract"
fxtypes "github.com/functionx/fx-core/v7/types"
crosschaintypes "github.com/functionx/fx-core/v7/x/crosschain/types"
fxevmkeeper "github.com/functionx/fx-core/v7/x/evm/keeper"
)

func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, app *keepers.AppKeepers) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// Testnet skip
if fxtypes.ChainId() == fxtypes.TestnetChainId {
return fromVM, nil
}
// Migrate Tendermint consensus parameters from x/params module to a dedicated x/consensus module.
baseAppLegacySS, found := app.ParamsKeeper.GetSubspace(baseapp.Paramspace)
if !found {
Expand Down

0 comments on commit e9ff4b2

Please sign in to comment.