diff --git a/app/app.go b/app/app.go index 26d53df3..d0a44c10 100644 --- a/app/app.go +++ b/app/app.go @@ -344,16 +344,10 @@ func New( // must be set manually as follow. The upgrade module will de-duplicate the module version map. // initChainer := func(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { - - // TODO: Is there a cleaner way to update the denom without having to unmarshal and marshal the genesis state? - // At the time of validator being created, the denom is still the old one if we just set the params here: - // - // stakingParams := app.StakingKeeper.GetParams(ctx) - // stakingParams.BondDenom = BondDenom - // app.StakingKeeper.SetParams(ctx, stakingParams) - // - // The above approach doesn't work because the params need to be set before InitGenesis runs. - // Hence, we need to update the genesis state directly. + // Temp workaround to set default IBC params until app wiring is fully supported. + if req.InitialHeight == 1 { + app.setDefaultIBCParams(ctx) + } var genesisState GenesisState err := json.Unmarshal(req.AppStateBytes, &genesisState) @@ -376,8 +370,8 @@ func New( } return app.App.InitChainer(ctx, req) - } + app.SetInitChainer(initChainer) if err := app.Load(loadLatest); err != nil { @@ -418,7 +412,6 @@ func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { if !ok { return nil } - return key } @@ -430,7 +423,6 @@ func (app *App) kvStoreKeys() map[string]*storetypes.KVStoreKey { keys[kv.Name()] = kv } } - return keys } diff --git a/app/ibc.go b/app/ibc.go index 2b0bd569..3efae355 100644 --- a/app/ibc.go +++ b/app/ibc.go @@ -4,6 +4,7 @@ import ( "cosmossdk.io/core/appmodule" storetypes "cosmossdk.io/store/types" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -28,6 +29,7 @@ import ( ibc "github.com/cosmos/ibc-go/v8/modules/core" ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + ibcchanneltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" @@ -179,6 +181,19 @@ func (app *App) registerIBCModules() { } } +// setDefaultIBCParams is used to set default IBC params until app wiring is fully supported. +func (app *App) setDefaultIBCParams(ctx sdk.Context) { + app.IBCKeeper.ClientKeeper.SetNextClientSequence(ctx, 0) + app.IBCKeeper.ConnectionKeeper.SetNextConnectionSequence(ctx, 0) + app.IBCKeeper.ChannelKeeper.SetNextChannelSequence(ctx, 0) + app.IBCKeeper.ClientKeeper.SetParams(ctx, ibcclienttypes.DefaultParams()) + app.IBCKeeper.ConnectionKeeper.SetParams(ctx, ibcconnectiontypes.DefaultParams()) + app.IBCKeeper.ChannelKeeper.SetParams(ctx, ibcchanneltypes.DefaultParams()) + app.ICAControllerKeeper.SetParams(ctx, icacontrollertypes.DefaultParams()) + app.ICAHostKeeper.SetParams(ctx, icahosttypes.DefaultParams()) + app.TransferKeeper.SetParams(ctx, ibctransfertypes.DefaultParams()) +} + // Since the IBC modules don't support dependency injection, we need to // manually register the modules on the client side. // This needs to be removed after IBC supports App Wiring.