diff --git a/app/app.go b/app/app.go index 8eb1d28c9..20b7c29c4 100644 --- a/app/app.go +++ b/app/app.go @@ -12,6 +12,7 @@ import ( "cosmossdk.io/client/v2/autocli" "cosmossdk.io/core/appmodule" "cosmossdk.io/log" + upgradetypes "cosmossdk.io/x/upgrade/types" dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" @@ -137,6 +138,11 @@ func NewIrisApp( // must be passed by reference here. app.mm = module.NewManager(appModules(app, encodingConfig, skipGenesisInvariants)...) + // NOTE: upgrade module is required to be prioritized + app.mm.SetOrderPreBlockers( + upgradetypes.ModuleName, + ) + // During begin block slashing happens after distr.BeginBlocker so that // there is nothing left over in the validator fee pool, so as to keep the // CanWithdrawInvariant invariant. @@ -209,6 +215,7 @@ func NewIrisApp( app.Init() app.SetAnteHandler(anteHandler) app.SetInitChainer(app.InitChainer) + app.SetPreBlocker(app.PreBlocker) app.SetBeginBlocker(app.BeginBlocker) app.SetEndBlocker(app.EndBlocker) app.RegisterUpgradePlans() @@ -233,6 +240,11 @@ func NewIrisApp( // Name returns the name of the App func (app *IrisApp) Name() string { return app.BaseApp.Name() } +// PreBlocker application updates every pre block +func (app *IrisApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { + return app.mm.PreBlock(ctx) +} + // BeginBlocker application updates every begin block func (app *IrisApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { return app.mm.BeginBlock(ctx) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 1ae9e618c..68fbb8439 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -68,6 +68,7 @@ import ( icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" "github.com/cosmos/ibc-go/v8/modules/apps/transfer" ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" evmkeeper "github.com/evmos/ethermint/x/evm/keeper" @@ -613,6 +614,10 @@ func initParamsKeeper( ) paramskeeper.Keeper { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) + // register the key tables for legacy param subspaces + keyTable := ibcclienttypes.ParamKeyTable() + keyTable.RegisterParamSet(&ibcconnectiontypes.Params{}) + paramsKeeper.Subspace(authtypes.ModuleName).WithKeyTable(authtypes.ParamKeyTable()) paramsKeeper.Subspace(banktypes.ModuleName).WithKeyTable(banktypes.ParamKeyTable()) paramsKeeper.Subspace(stakingtypes.ModuleName).WithKeyTable(stakingtypes.ParamKeyTable()) @@ -621,16 +626,16 @@ func initParamsKeeper( paramsKeeper.Subspace(slashingtypes.ModuleName).WithKeyTable(slashingtypes.ParamKeyTable()) paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) paramsKeeper.Subspace(crisistypes.ModuleName).WithKeyTable(crisistypes.ParamKeyTable()) - paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(tokentypes.ModuleName).WithKeyTable(tokenv1.ParamKeyTable()) paramsKeeper.Subspace(recordtypes.ModuleName) paramsKeeper.Subspace(htlctypes.ModuleName).WithKeyTable(htlctypes.ParamKeyTable()) paramsKeeper.Subspace(coinswaptypes.ModuleName).WithKeyTable(coinswaptypes.ParamKeyTable()) paramsKeeper.Subspace(servicetypes.ModuleName).WithKeyTable(servicetypes.ParamKeyTable()) - paramsKeeper.Subspace(ibcexported.ModuleName) paramsKeeper.Subspace(farmtypes.ModuleName).WithKeyTable(farmtypes.ParamKeyTable()) paramsKeeper.Subspace(tibchost.ModuleName) - paramsKeeper.Subspace(icahosttypes.SubModuleName) + paramsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable) + paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) + paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) // ethermint subspaces paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(evmtypes.ParamKeyTable()) diff --git a/app/modules.go b/app/modules.go index c5490c63d..21fdd83c8 100644 --- a/app/modules.go +++ b/app/modules.go @@ -48,6 +48,7 @@ import ( "github.com/cosmos/ibc-go/v8/modules/apps/transfer" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ibc "github.com/cosmos/ibc-go/v8/modules/core" + //ibcclientclient "github.com/cosmos/ibc-go/v8/modules/core/02-client/client" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" @@ -478,8 +479,6 @@ NOTE: capability module's beginblocker must come before any modules using capabi func orderBeginBlockers() []string { return []string{ - // upgrades should be run first - upgradetypes.ModuleName, capabilitytypes.ModuleName, minttypes.ModuleName, feemarkettypes.ModuleName, diff --git a/app/rpc/auth.go b/app/rpc/auth.go index a93fcad1b..b4d67c90d 100644 --- a/app/rpc/auth.go +++ b/app/rpc/auth.go @@ -44,6 +44,10 @@ func overrideAuthServices(cdc codec.Codec, cfg module.Configurator, appKeepers k if err := cfg.RegisterMigration(types.ModuleName, 3, m.Migrate3to4); err != nil { panic(fmt.Sprintf("failed to migrate x/%s from version 3 to 4: %v", types.ModuleName, err)) } + + if err := cfg.RegisterMigration(types.ModuleName, 4, m.Migrate4To5); err != nil { + panic(fmt.Sprintf("failed to migrate x/%s from version 4 to 5", types.ModuleName)) + } } // Since: cosmos-sdk 0.43