diff --git a/ante/ante.go b/ante/ante.go index 4139fe5da0..01ad29a64b 100644 --- a/ante/ante.go +++ b/ante/ante.go @@ -6,6 +6,8 @@ import ( cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante" "github.com/cosmos/cosmos-sdk/x/auth/signing" "github.com/cosmos/cosmos-sdk/x/auth/types" + ibcante "github.com/cosmos/ibc-go/v5/modules/core/ante" + ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper" ) type HandlerOptions struct { @@ -13,6 +15,7 @@ type HandlerOptions struct { BankKeeper types.BankKeeper FeegrantKeeper cosmosante.FeegrantKeeper OracleKeeper OracleKeeper + IBCKeeper *ibckeeper.Keeper SignModeHandler signing.SignModeHandler SigGasConsumer cosmosante.SignatureVerificationGasConsumer } @@ -49,5 +52,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { cosmosante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), cosmosante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), cosmosante.NewIncrementSequenceDecorator(options.AccountKeeper), + ibcante.NewRedundantRelayDecorator(options.IBCKeeper), ), nil } diff --git a/app/app.go b/app/app.go index b75ba3004a..2aefa5e7b4 100644 --- a/app/app.go +++ b/app/app.go @@ -691,10 +691,11 @@ func (app *UmeeApp) setAnteHandler(txConfig client.TxConfig) { customante.HandlerOptions{ AccountKeeper: app.AccountKeeper, BankKeeper: app.BankKeeper, + OracleKeeper: app.OracleKeeper, + IBCKeeper: app.IBCKeeper, SignModeHandler: txConfig.SignModeHandler(), FeegrantKeeper: app.FeeGrantKeeper, SigGasConsumer: ante.DefaultSigVerificationGasConsumer, - OracleKeeper: app.OracleKeeper, }, ) if err != nil { diff --git a/app/upgrades.go b/app/upgrades.go index 286e8087f8..ce04e32211 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -8,10 +8,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/group" "github.com/cosmos/cosmos-sdk/x/nft" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - bech32ibckeeper "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/keeper" bech32ibctypes "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/types" - v3upgrades "github.com/umee-network/umee/v3/app/upgrades/v3" + + "github.com/umee-network/umee/v3/app/upgradev3" leveragetypes "github.com/umee-network/umee/v3/x/leverage/types" oracletypes "github.com/umee-network/umee/v3/x/oracle/types" ) @@ -24,33 +23,33 @@ func (app UmeeApp) RegisterUpgradeHandlers() { UpgradeV3_0Plan, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { ctx.Logger().Info("Upgrade handler execution", "name", UpgradeV3_0Plan) - err := setupBech32ibcKeeper(&app.bech32IbcKeeper, ctx) + ctx.Logger().Info("Running setupBech32ibcKeeper") + err := upgradev3.SetupBech32ibcKeeper(&app.bech32IbcKeeper, ctx) if err != nil { return nil, sdkerrors.Wrapf( - err, "Calypso %q Upgrade: Unable to upgrade, bech32ibc module not initialized", UpgradeV3_0Plan) + err, "%q Upgrade: Unable to upgrade, bech32ibc module not initialized", UpgradeV3_0Plan) } - ctx.Logger().Info("Upgrade handler execution finished, running migrations", "name", UpgradeV3_0Plan) + ctx.Logger().Info("Running module migrations") vm, err := app.mm.RunMigrations(ctx, app.configurator, fromVM) if err != nil { return vm, err } - ctx.Logger().Info("Upgrade handler execution finished, updating minimum commission rate param of staking module", - "name", UpgradeV3_0Plan) - minCommissionRate, err := v3upgrades.UpdateMinimumCommissionRateParam(ctx, app.StakingKeeper) + ctx.Logger().Info("Updating validator minimum commission rate param of staking module") + minCommissionRate, err := upgradev3.UpdateMinimumCommissionRateParam(ctx, app.StakingKeeper) if err != nil { return vm, sdkerrors.Wrapf( - err, "Calypso %q Upgrade: Unable to upgrade, failed to update minimum commission rate param of staking module", + err, "%q Upgrade: failed to update minimum commission rate param of staking module", UpgradeV3_0Plan) } ctx.Logger().Info("Upgrade handler execution finished, updating minimum commission rate of all validators", "name", UpgradeV3_0Plan) - err = v3upgrades.SetMinimumCommissionRateToValidators(ctx, app.StakingKeeper, minCommissionRate) + err = upgradev3.SetMinimumCommissionRateToValidators(ctx, app.StakingKeeper, minCommissionRate) if err != nil { return vm, sdkerrors.Wrapf( - err, "Calypso %q Upgrade: Unable to upgrade, failed to update minimum commission rate for validators", + err, "%q Upgrade: failed to update minimum commission rate for validators", UpgradeV3_0Plan) } @@ -68,6 +67,9 @@ func (app UmeeApp) RegisterUpgradeHandlers() { group.ModuleName, nft.ModuleName, bech32ibctypes.ModuleName, + // icacontrollertypes.StoreKey, + // icahosttypes.StoreKey, + oracletypes.ModuleName, leveragetypes.ModuleName, }, @@ -77,10 +79,3 @@ func (app UmeeApp) RegisterUpgradeHandlers() { upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) } } - -// Sets up bech32ibc module by setting the native account prefix to "umee". -// Failing to set the native prefix will cause a chain halt on init genesis or -// in the firstBeginBlocker assertions. -func setupBech32ibcKeeper(bech32IbcKeeper *bech32ibckeeper.Keeper, ctx sdk.Context) error { - return bech32IbcKeeper.SetNativeHrp(ctx, sdk.GetConfig().GetBech32AccountAddrPrefix()) -} diff --git a/app/upgrades/v3/expected_types.go b/app/upgradev3/expected_types.go similarity index 96% rename from app/upgrades/v3/expected_types.go rename to app/upgradev3/expected_types.go index 9526cc6038..ec370efd9c 100644 --- a/app/upgrades/v3/expected_types.go +++ b/app/upgradev3/expected_types.go @@ -1,4 +1,4 @@ -package v3 +package upgradev3 import ( sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/app/upgrades/v3/min_commission.go b/app/upgradev3/migrations.go similarity index 71% rename from app/upgrades/v3/min_commission.go rename to app/upgradev3/migrations.go index 1895751602..a61cd208d9 100644 --- a/app/upgrades/v3/min_commission.go +++ b/app/upgradev3/migrations.go @@ -1,7 +1,8 @@ -package v3 +package upgradev3 import ( sdk "github.com/cosmos/cosmos-sdk/types" + bech32ibckeeper "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/keeper" ) var minCommissionRate = sdk.MustNewDecFromStr("0.05") @@ -37,3 +38,10 @@ func SetMinimumCommissionRateToValidators(ctx sdk.Context, keeper StakingKeeper, return nil } + +// SetupBech32ibcKeeper updates keeper by setting the native account prefix to "umee". +// Failing to set the native prefix will cause a chain halt on init genesis or +// in the firstBeginBlocker assertions. +func SetupBech32ibcKeeper(bech32IbcKeeper *bech32ibckeeper.Keeper, ctx sdk.Context) error { + return bech32IbcKeeper.SetNativeHrp(ctx, sdk.GetConfig().GetBech32AccountAddrPrefix()) +} diff --git a/app/upgrades/v3/min_commission_test.go b/app/upgradev3/min_commission_test.go similarity index 98% rename from app/upgrades/v3/min_commission_test.go rename to app/upgradev3/min_commission_test.go index e4413c7ed6..9ce5c02f12 100644 --- a/app/upgrades/v3/min_commission_test.go +++ b/app/upgradev3/min_commission_test.go @@ -1,4 +1,4 @@ -package v3 +package upgradev3 import ( "testing" diff --git a/app/upgrades/v3/staking_util_test.go b/app/upgradev3/staking_util_test.go similarity index 99% rename from app/upgrades/v3/staking_util_test.go rename to app/upgradev3/staking_util_test.go index ce576fc710..36bb55fa88 100644 --- a/app/upgrades/v3/staking_util_test.go +++ b/app/upgradev3/staking_util_test.go @@ -1,4 +1,4 @@ -package v3 +package upgradev3 import ( "crypto/rand"