-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add missing SDK 0.47 upgrade steps * Remove msg event boilerplate replace in 0.47 * Add missing param migrations and additional IBC client type * Fixing cellarfees params migration * More cellarfees params fixing * Even more cellarfees params fixing * Hopefully last cellarfees params fix * Hopefully the last last cellarfees fix * Remove write to old cellarfees param subspace * Use correct method to retrieve legacy cellarfees subspace * Add missing IBC migration stuff * Test commit for debugging * More debugging * Please * Debugging * AHHHH * just trying stuff * . * .. * Trying with legacySubspace passed in via app module, and deleting param by key * Fix method call * Fix method call * Move upgrade handler setup after store mount * Hardcode cellarfees params * Incentives params test * Cellarfees params migration fix test * Clean up auction params migration * Explicitly set new auction module account permissions * Fix axelarcork export genesis bug that results in null values for CorkResults and ScheduledCorks * Actually add the upgrade fix... * Move auction permission to end of upgrade handler * Wow. * Tweak auction test * Fix params validation in cellarfees
- Loading branch information
Showing
20 changed files
with
355 additions
and
3,243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,83 @@ | ||
package v8 | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/cosmos/cosmos-sdk/baseapp" | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" | ||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" | ||
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" | ||
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" | ||
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" | ||
ibctmmigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations" | ||
auctiontypes "github.com/peggyjv/sommelier/v8/x/auction/types" | ||
) | ||
|
||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
baseAppLegacySS *paramstypes.Subspace, | ||
consensusParamsKeeper *consensusparamkeeper.Keeper, | ||
ibcKeeper *ibckeeper.Keeper, | ||
cdc codec.BinaryCodec, | ||
clientKeeper ibctmmigrations.ClientKeeper, | ||
accountKeeper *authkeeper.AccountKeeper, | ||
) 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") | ||
|
||
// Include this when migrating to ibc-go v7 (optional) | ||
// source: https://github.com/cosmos/ibc-go/blob/v7.2.0/docs/migrations/v6-to-v7.md | ||
// prune expired tendermint consensus states to save storage space | ||
if _, err := ibctmmigrations.PruneExpiredConsensusStates(ctx, cdc, clientKeeper); err != nil { | ||
return nil, err | ||
} | ||
|
||
// new x/consensus module params migration | ||
baseapp.MigrateParams(ctx, baseAppLegacySS, consensusParamsKeeper) | ||
|
||
return mm.RunMigrations(ctx, configurator, vm) | ||
// explicitly update the IBC 02-client params, adding the localhost client type | ||
params := ibcKeeper.ClientKeeper.GetParams(ctx) | ||
params.AllowedClients = append(params.AllowedClients, ibcexported.Localhost) | ||
ibcKeeper.ClientKeeper.SetParams(ctx, params) | ||
|
||
vm, err := mm.RunMigrations(ctx, configurator, vm) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
// add burner permission to auction account | ||
if err := MigrateAuctionAccountPermissions(ctx, accountKeeper); err != nil { | ||
return nil, err | ||
} | ||
|
||
return vm, nil | ||
} | ||
} | ||
|
||
func MigrateAuctionAccountPermissions(ctx sdk.Context, accountKeeper *authkeeper.AccountKeeper) error { | ||
ctx.Logger().Info("Migrating auction account permissions") | ||
oldAcctI := accountKeeper.GetModuleAccount(ctx, auctiontypes.ModuleName) | ||
|
||
if oldAcctI == nil { | ||
return fmt.Errorf("module account not found") | ||
} | ||
|
||
newAcct := authtypes.NewEmptyModuleAccount(auctiontypes.ModuleName, authtypes.Burner) | ||
newAcct.AccountNumber = oldAcctI.GetAccountNumber() | ||
newAcct.Address = oldAcctI.GetAddress().String() | ||
newAcct.Sequence = oldAcctI.GetSequence() | ||
newAcct.Name = oldAcctI.GetName() | ||
newAcctI := (accountKeeper.NewAccount(ctx, newAcct)).(authtypes.ModuleAccountI) | ||
|
||
accountKeeper.SetModuleAccount(ctx, newAcctI) | ||
|
||
ctx.Logger().Info("Auction account permissions migrated") | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.