Skip to content

Commit

Permalink
fix: add missing IBC upgrade handler
Browse files Browse the repository at this point in the history
  • Loading branch information
dadamu committed Aug 21, 2023
1 parent c88f93c commit a701fe7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ import (
func (app *DesmosApp) registerUpgradeHandlers() {
app.registerUpgrade(v500.NewUpgrade(app.ModuleManager, app.Configurator(), app.ParamsKeeper, app.ConsensusParamsKeeper))
app.registerUpgrade(v520.NewUpgrade(app.ModuleManager, app.Configurator(), app.ParamsKeeper, app.ConsensusParamsKeeper))
app.registerUpgrade(v6.NewUpgrade(app.ModuleManager, app.Configurator(), app.StakingKeeper))
app.registerUpgrade(v6.NewUpgrade(app.ModuleManager, app.Configurator(), app.StakingKeeper, app.IBCKeeper.ClientKeeper))
}
13 changes: 11 additions & 2 deletions app/upgrades/v6/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper"
"github.com/cosmos/ibc-go/v7/modules/core/exported"

"github.com/desmos-labs/desmos/v6/app/upgrades"
tokenfactorytypes "github.com/desmos-labs/desmos/v6/x/tokenfactory/types"
Expand All @@ -21,15 +23,17 @@ type Upgrade struct {
mm *module.Manager
configurator module.Configurator

sk *stakingkeeper.Keeper
sk *stakingkeeper.Keeper
clientKeeper clientkeeper.Keeper
}

// NewUpgrade returns a new Upgrade instance
func NewUpgrade(mm *module.Manager, configurator module.Configurator, sk *stakingkeeper.Keeper) *Upgrade {
func NewUpgrade(mm *module.Manager, configurator module.Configurator, sk *stakingkeeper.Keeper, clientKeeper clientkeeper.Keeper) *Upgrade {
return &Upgrade{
mm: mm,
configurator: configurator,
sk: sk,
clientKeeper: clientKeeper,
}
}

Expand Down Expand Up @@ -66,6 +70,11 @@ func (u *Upgrade) Handler() upgradetypes.UpgradeHandler {
return false
})

// explicitly update the IBC 02-client params, adding the localhost client type
params := u.clientKeeper.GetParams(ctx)
params.AllowedClients = append(params.AllowedClients, exported.Localhost)
u.clientKeeper.SetParams(ctx, params)

// After properly setting all the validator commissions, we can proceed with the normal migration
return u.mm.RunMigrations(ctx, u.configurator, fromVM)
}
Expand Down

0 comments on commit a701fe7

Please sign in to comment.