From 97a6ea857717edd0ccc9d1fed13f338d6d717db7 Mon Sep 17 00:00:00 2001 From: stackman27 Date: Tue, 23 May 2023 16:15:30 -0700 Subject: [PATCH] added migration function to upgrades.go --- app/upgrades/v16/upgrades.go | 7 +++++-- x/protorev/module.go | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index 008d8819835..8af4b315735 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -9,7 +9,6 @@ import ( "github.com/osmosis-labs/osmosis/v15/app/keepers" "github.com/osmosis-labs/osmosis/v15/app/upgrades" - protorevtypes "github.com/osmosis-labs/osmosis/v15/x/protorev/types" tokenfactorykeeper "github.com/osmosis-labs/osmosis/v15/x/tokenfactory/keeper" tokenfactorytypes "github.com/osmosis-labs/osmosis/v15/x/tokenfactory/types" @@ -67,7 +66,7 @@ func CreateUpgradeHandler( return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { // Added since when testing the fromVersion was set to 2 // and therefore did not run the migration for protorev - fromVM[protorevtypes.ModuleName] = 1 + // fromVM[protorevtypes.ModuleName] = 1 // Run migrations before applying any other state changes. // NOTE: DO NOT PUT ANY STATE CHANGES BEFORE RunMigrations(). @@ -91,6 +90,10 @@ func CreateUpgradeHandler( updateTokenFactoryParams(ctx, keepers.TokenFactoryKeeper) + if err := keepers.ProtoRevKeeper.SendDeveloperFeesToDeveloperAccount(ctx); err != nil { + return nil, err + } + return migrations, nil } } diff --git a/x/protorev/module.go b/x/protorev/module.go index cf9e4cf63c7..7e59a98c42a 100644 --- a/x/protorev/module.go +++ b/x/protorev/module.go @@ -138,9 +138,9 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(am.keeper)) types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServer(am.keeper)) - if err := cfg.RegisterMigration(types.ModuleName, 1, am.Upgrade1to2); err != nil { - panic(fmt.Sprintf("failed to migrate x/protorev from version 1 to 2: %v", err)) - } + // if err := cfg.RegisterMigration(types.ModuleName, 1, am.Upgrade1to2); err != nil { + // panic(fmt.Sprintf("failed to migrate x/protorev from version 1 to 2: %v", err)) + // } } func (a AppModuleBasic) RegisterRESTRoutes(ctx client.Context, r *mux.Router) { @@ -167,7 +167,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} @@ -181,11 +181,11 @@ func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Valid // Upgrades // ---------------------------------------------------------------------------- -func (am AppModule) Upgrade1to2(ctx sdk.Context) error { - err := am.keeper.SendDeveloperFeesToDeveloperAccount(ctx) - if err != nil { - return err - } +// func (am AppModule) Upgrade1to2(ctx sdk.Context) error { +// err := am.keeper.SendDeveloperFeesToDeveloperAccount(ctx) +// if err != nil { +// return err +// } - return nil -} +// return nil +// }