-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bump cosmos-sdk and evmos, add upgrade
- Loading branch information
Showing
10 changed files
with
140 additions
and
15 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
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,6 +1,21 @@ | ||
package v1 | ||
|
||
import ( | ||
store "github.com/cosmos/cosmos-sdk/store/types" | ||
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" | ||
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" | ||
) | ||
|
||
const ( | ||
// UpgradeName is the shared upgrade plan name for mainnet | ||
UpgradeName = "v2.0.0" | ||
) | ||
|
||
var ( | ||
StoreUpgrades = store.StoreUpgrades{ | ||
Added: []string{ | ||
consensustypes.ModuleName, | ||
crisistypes.ModuleName, | ||
}, | ||
} | ||
) |
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,18 +1,86 @@ | ||
package v1 | ||
|
||
import ( | ||
"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" | ||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" | ||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" | ||
consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" | ||
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" | ||
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" | ||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" | ||
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" | ||
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" | ||
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" | ||
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" | ||
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" | ||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" | ||
ibctmmigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations" | ||
evmtypes "github.com/evmos/evmos/v19/x/evm/types" | ||
feemarkettypes "github.com/evmos/evmos/v19/x/feemarket/types" | ||
) | ||
|
||
// CreateUpgradeHandler creates an SDK upgrade handler for v2 | ||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
ck consensuskeeper.Keeper, | ||
clientKeeper ibctmmigrations.ClientKeeper, | ||
pk paramskeeper.Keeper, | ||
cdc codec.BinaryCodec, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
// Leave modules as-is to avoid running InitGenesis. | ||
logger := ctx.Logger().With("upgrade", UpgradeName) | ||
|
||
// Set param key table for params module migration | ||
for _, subspace := range pk.GetSubspaces() { | ||
var keyTable paramstypes.KeyTable | ||
switch subspace.Name() { | ||
case authtypes.ModuleName: | ||
keyTable = authtypes.ParamKeyTable() //nolint:staticcheck | ||
case banktypes.ModuleName: | ||
keyTable = banktypes.ParamKeyTable() //nolint:staticcheck,nolintlint | ||
case stakingtypes.ModuleName: | ||
keyTable = stakingtypes.ParamKeyTable() | ||
case minttypes.ModuleName: | ||
keyTable = minttypes.ParamKeyTable() //nolint:staticcheck | ||
case distrtypes.ModuleName: | ||
keyTable = distrtypes.ParamKeyTable() //nolint:staticcheck,nolintlint | ||
case slashingtypes.ModuleName: | ||
keyTable = slashingtypes.ParamKeyTable() //nolint:staticcheck | ||
case govtypes.ModuleName: | ||
keyTable = govv1.ParamKeyTable() //nolint:staticcheck | ||
case crisistypes.ModuleName: | ||
keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck | ||
case ibctransfertypes.ModuleName: | ||
keyTable = ibctransfertypes.ParamKeyTable() | ||
case evmtypes.ModuleName: | ||
keyTable = evmtypes.ParamKeyTable() //nolint:staticcheck | ||
case feemarkettypes.ModuleName: | ||
keyTable = feemarkettypes.ParamKeyTable() | ||
default: | ||
continue | ||
} | ||
if !subspace.HasKeyTable() { | ||
subspace.WithKeyTable(keyTable) | ||
} | ||
} | ||
|
||
baseAppLegacySS := pk.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) | ||
|
||
baseapp.MigrateParams(ctx, baseAppLegacySS, &ck) | ||
|
||
// 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 | ||
} | ||
|
||
logger.Debug("running module migrations ...") | ||
return mm.RunMigrations(ctx, configurator, vm) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"title": "v2.0.0", | ||
"authors": "adf", | ||
"summary": "upgrade to v2.0.0", | ||
"details": "da", | ||
"proposal_forum_url": "https:dsafc", | ||
"vote_option_context": "null" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"messages": [ | ||
{ | ||
"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", | ||
"authority": "settlus10d07y265gmmuvt4z0w9aw880jnsr700jdl3s23", | ||
"plan": { | ||
"name": "v2.0.0", | ||
"time": "0001-01-01T00:00:00Z", | ||
"height": "100", | ||
"info": "", | ||
"upgraded_client_state": null | ||
} | ||
} | ||
], | ||
"metadata": "ipfs://CID", | ||
"deposit": "1000asetl" | ||
} |
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 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