From 9cf139d98dc05e42e893690f4c3630aa31a049a3 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Tue, 29 Oct 2024 09:44:58 -0500 Subject: [PATCH 1/2] Add missing SDK 0.47 upgrade steps --- app/app.go | 10 +++++++++- app/upgrades/v8/upgrades.go | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 3b6b2f89..b7c6813f 100644 --- a/app/app.go +++ b/app/app.go @@ -1024,7 +1024,11 @@ func (app *SommelierApp) setupUpgradeStoreLoaders() { if upgradeInfo.Name == v8.UpgradeName { storeUpgrades = &storetypes.StoreUpgrades{ - Added: []string{addressestypes.ModuleName}, + Added: []string{ + addressestypes.ModuleName, + consensusparamtypes.ModuleName, + crisistypes.ModuleName, + }, } } @@ -1034,12 +1038,16 @@ func (app *SommelierApp) setupUpgradeStoreLoaders() { } func (app *SommelierApp) setupUpgradeHandlers() { + baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) + // TODO: Add v8 upgrade handle app.UpgradeKeeper.SetUpgradeHandler( v8.UpgradeName, v8.CreateUpgradeHandler( app.mm, app.configurator, + &baseAppLegacySS, + &app.ConsensusParamsKeeper, ), ) } diff --git a/app/upgrades/v8/upgrades.go b/app/upgrades/v8/upgrades.go index b4ca0f7d..5a1ec233 100644 --- a/app/upgrades/v8/upgrades.go +++ b/app/upgrades/v8/upgrades.go @@ -1,18 +1,26 @@ package v8 import ( + "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) func CreateUpgradeHandler( mm *module.Manager, configurator module.Configurator, + baseAppLegacySS *paramstypes.Subspace, + consensusParamsKeeper *consensusparamkeeper.Keeper, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { ctx.Logger().Info("v8 upgrade: entering handler and running migrations") + // new x/consensus module params migration + baseapp.MigrateParams(ctx, baseAppLegacySS, consensusParamsKeeper) + return mm.RunMigrations(ctx, configurator, vm) } } From 442e5b843dfa19a806e84cfb942a7eeca1da9a34 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Tue, 29 Oct 2024 09:45:10 -0500 Subject: [PATCH 2/2] Remove msg event boilerplate replace in 0.47 --- x/cork/keeper/msg_server.go | 4 ---- x/pubsub/keeper/msg_server.go | 42 ----------------------------------- 2 files changed, 46 deletions(-) diff --git a/x/cork/keeper/msg_server.go b/x/cork/keeper/msg_server.go index 58df9504..898f0d30 100644 --- a/x/cork/keeper/msg_server.go +++ b/x/cork/keeper/msg_server.go @@ -49,10 +49,6 @@ func (k Keeper) ScheduleCork(c context.Context, msg *types.MsgScheduleCorkReques ctx.EventManager().EmitEvents( sdk.Events{ - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, corktypes.AttributeValueCategory), - ), sdk.NewEvent( corktypes.EventTypeCork, sdk.NewAttribute(sdk.AttributeKeyModule, corktypes.AttributeValueCategory), diff --git a/x/pubsub/keeper/msg_server.go b/x/pubsub/keeper/msg_server.go index 3bb7818d..a13d8878 100644 --- a/x/pubsub/keeper/msg_server.go +++ b/x/pubsub/keeper/msg_server.go @@ -40,12 +40,6 @@ func (k Keeper) AddPublisherIntent(c context.Context, msg *types.MsgAddPublisher ctx.EventManager().EmitEvents( sdk.Events{ - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeyAction, types.EventTypeAddPublisherIntent), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Signer), - ), sdk.NewEvent( types.EventTypeAddPublisherIntent, sdk.NewAttribute(types.AttributeKeySubscriptionID, publisherIntent.SubscriptionId), @@ -127,12 +121,6 @@ func (k Keeper) AddSubscriberIntent(c context.Context, msg *types.MsgAddSubscrib ctx.EventManager().EmitEvents( sdk.Events{ - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeyAction, types.EventTypeAddSubscriberIntent), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Signer), - ), sdk.NewEvent( types.EventTypeAddSubscriberIntent, sdk.NewAttribute(types.AttributeKeySubscriptionID, subscriberIntent.SubscriptionId), @@ -164,12 +152,6 @@ func (k Keeper) AddSubscriber(c context.Context, msg *types.MsgAddSubscriberRequ ctx.EventManager().EmitEvents( sdk.Events{ - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeyAction, types.EventTypeAddSubscriber), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Signer), - ), sdk.NewEvent( types.EventTypeAddSubscriber, sdk.NewAttribute(types.AttributeKeySubscriberAddress, subscriber.Address), @@ -212,12 +194,6 @@ func (k Keeper) RemovePublisherIntent(c context.Context, msg *types.MsgRemovePub ctx.EventManager().EmitEvents( sdk.Events{ - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeyAction, types.EventTypeRemovePublisherIntent), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Signer), - ), sdk.NewEvent( types.EventTypeRemovePublisherIntent, sdk.NewAttribute(types.AttributeKeySubscriptionID, subscriptionID), @@ -263,12 +239,6 @@ func (k Keeper) RemoveSubscriberIntent(c context.Context, msg *types.MsgRemoveSu ctx.EventManager().EmitEvents( sdk.Events{ - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeyAction, types.EventTypeRemoveSubscriberIntent), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Signer), - ), sdk.NewEvent( types.EventTypeRemoveSubscriberIntent, sdk.NewAttribute(types.AttributeKeySubscriptionID, subscriptionID), @@ -305,12 +275,6 @@ func (k Keeper) RemoveSubscriber(c context.Context, msg *types.MsgRemoveSubscrib ctx.EventManager().EmitEvents( sdk.Events{ - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeyAction, types.EventTypeRemoveSubscriber), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Signer), - ), sdk.NewEvent( types.EventTypeRemoveSubscriber, sdk.NewAttribute(types.AttributeKeySubscriptionID, subscriberAddress), @@ -343,12 +307,6 @@ func (k Keeper) RemovePublisher(c context.Context, msg *types.MsgRemovePublisher ctx.EventManager().EmitEvents( sdk.Events{ - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeyAction, types.EventTypeRemovePublisher), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Signer), - ), sdk.NewEvent( types.EventTypeRemovePublisher, sdk.NewAttribute(types.AttributeKeyPublisherDomain, publisherDomain),