Skip to content

Commit

Permalink
imp: remove crisis module in v15 upgrade (#1847)
Browse files Browse the repository at this point in the history
(cherry picked from commit a456910)

# Conflicts:
#	CHANGELOG.md
#	app/app.go
#	app/upgrades/v15/constants.go
#	app/upgrades/v15/upgrades.go
  • Loading branch information
facs95 authored and mergify[bot] committed Oct 16, 2023
1 parent 2d87db1 commit ffcb293
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 23 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@ Ref: https://keepachangelog.com/en/1.0.0/

### State Machine Breaking

<<<<<<< HEAD
- (sdk) [#1869](https://github.com/evmos/evmos/pull/1869) Bump Cosmos SDK to v0.47.5.
- (evm) [#1851](https://github.com/evmos/evmos/pull/1851) Enable [EIP 3855](https://eips.ethereum.org/EIPS/eip-3855) (`PUSH0` opcode) during upgrade.
- (upgrade) [#1845](https://github.com/evmos/evmos/pull/1845) Include remaining strategic reserve migrations.
=======
- (staking)[#1734](https://github.com/evmos/evmos/pull/1734) Return single struct from staking precompile queries.
- (deps) [#1780](https://github.com/evmos/evmos/pull/1780) Bump ibc-go version to `v7.3.0`.
- (imp) [#1847](https://github.com/evmos/evmos/pull/1847) Remove crisis module in v15 upgrade handler.
>>>>>>> a4569105 (imp: remove `crisis` module in v15 upgrade (#1847))
### Improvements

Expand Down
80 changes: 60 additions & 20 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ import (
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
"github.com/cosmos/cosmos-sdk/x/consensus"
"github.com/cosmos/cosmos-sdk/x/crisis"
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
Expand Down Expand Up @@ -122,6 +120,7 @@ import (
// unnamed import of statik for swagger UI support
_ "github.com/evmos/evmos/v15/client/docs/statik"

<<<<<<< HEAD

Check failure on line 123 in app/app.go

View workflow job for this annotation

GitHub Actions / dependency-review

missing import path

Check failure on line 123 in app/app.go

View workflow job for this annotation

GitHub Actions / dependency-review

missing import path

Check failure on line 123 in app/app.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

syntax error: missing import path

Check failure on line 123 in app/app.go

View workflow job for this annotation

GitHub Actions / test-unit-cover

missing import path
"github.com/evmos/evmos/v15/app/ante"
ethante "github.com/evmos/evmos/v15/app/ante/evm"
v10 "github.com/evmos/evmos/v15/app/upgrades/v10"
Expand Down Expand Up @@ -173,6 +172,59 @@ import (
vestingclient "github.com/evmos/evmos/v15/x/vesting/client"
vestingkeeper "github.com/evmos/evmos/v15/x/vesting/keeper"
vestingtypes "github.com/evmos/evmos/v15/x/vesting/types"
=======

Check failure on line 175 in app/app.go

View workflow job for this annotation

GitHub Actions / dependency-review

missing import path

Check failure on line 175 in app/app.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

syntax error: missing import path
"github.com/evmos/evmos/v14/app/ante"
ethante "github.com/evmos/evmos/v14/app/ante/evm"
v10 "github.com/evmos/evmos/v14/app/upgrades/v10"
v11 "github.com/evmos/evmos/v14/app/upgrades/v11"
v12 "github.com/evmos/evmos/v14/app/upgrades/v12"
v13 "github.com/evmos/evmos/v14/app/upgrades/v13"
v14 "github.com/evmos/evmos/v14/app/upgrades/v14"
v15 "github.com/evmos/evmos/v14/app/upgrades/v15"
v8 "github.com/evmos/evmos/v14/app/upgrades/v8"
v81 "github.com/evmos/evmos/v14/app/upgrades/v8_1"
v82 "github.com/evmos/evmos/v14/app/upgrades/v8_2"
v9 "github.com/evmos/evmos/v14/app/upgrades/v9"
v91 "github.com/evmos/evmos/v14/app/upgrades/v9_1"
"github.com/evmos/evmos/v14/encoding"
"github.com/evmos/evmos/v14/ethereum/eip712"
"github.com/evmos/evmos/v14/precompiles/common"
srvflags "github.com/evmos/evmos/v14/server/flags"
evmostypes "github.com/evmos/evmos/v14/types"
"github.com/evmos/evmos/v14/x/claims"
claimskeeper "github.com/evmos/evmos/v14/x/claims/keeper"
claimstypes "github.com/evmos/evmos/v14/x/claims/types"
"github.com/evmos/evmos/v14/x/epochs"
epochskeeper "github.com/evmos/evmos/v14/x/epochs/keeper"
epochstypes "github.com/evmos/evmos/v14/x/epochs/types"
"github.com/evmos/evmos/v14/x/erc20"
erc20client "github.com/evmos/evmos/v14/x/erc20/client"
erc20keeper "github.com/evmos/evmos/v14/x/erc20/keeper"
erc20types "github.com/evmos/evmos/v14/x/erc20/types"
"github.com/evmos/evmos/v14/x/evm"
evmkeeper "github.com/evmos/evmos/v14/x/evm/keeper"
evmtypes "github.com/evmos/evmos/v14/x/evm/types"
"github.com/evmos/evmos/v14/x/feemarket"
feemarketkeeper "github.com/evmos/evmos/v14/x/feemarket/keeper"
feemarkettypes "github.com/evmos/evmos/v14/x/feemarket/types"
"github.com/evmos/evmos/v14/x/incentives"
incentivesclient "github.com/evmos/evmos/v14/x/incentives/client"
incentiveskeeper "github.com/evmos/evmos/v14/x/incentives/keeper"
incentivestypes "github.com/evmos/evmos/v14/x/incentives/types"
"github.com/evmos/evmos/v14/x/inflation"
inflationkeeper "github.com/evmos/evmos/v14/x/inflation/keeper"
inflationtypes "github.com/evmos/evmos/v14/x/inflation/types"
"github.com/evmos/evmos/v14/x/recovery"
recoverykeeper "github.com/evmos/evmos/v14/x/recovery/keeper"
recoverytypes "github.com/evmos/evmos/v14/x/recovery/types"
revenue "github.com/evmos/evmos/v14/x/revenue/v1"
revenuekeeper "github.com/evmos/evmos/v14/x/revenue/v1/keeper"
revenuetypes "github.com/evmos/evmos/v14/x/revenue/v1/types"
"github.com/evmos/evmos/v14/x/vesting"
vestingclient "github.com/evmos/evmos/v14/x/vesting/client"
vestingkeeper "github.com/evmos/evmos/v14/x/vesting/keeper"
vestingtypes "github.com/evmos/evmos/v14/x/vesting/types"
>>>>>>> a4569105 (imp: remove `crisis` module in v15 upgrade (#1847))

Check failure on line 227 in app/app.go

View workflow job for this annotation

GitHub Actions / dependency-review

missing import path

Check failure on line 227 in app/app.go

View workflow job for this annotation

GitHub Actions / dependency-review

expected ';', found ':'

Check failure on line 227 in app/app.go

View workflow job for this annotation

GitHub Actions / dependency-review

illegal character U+0023 '#'

// NOTE: override ICS20 keeper to support IBC transfers of ERC20 tokens
"github.com/evmos/evmos/v15/x/ibc/transfer"
Expand Down Expand Up @@ -228,7 +280,6 @@ var (
},
),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
ibc.AppModuleBasic{},
ibctm.AppModuleBasic{},
Expand Down Expand Up @@ -305,7 +356,6 @@ type Evmos struct {
SlashingKeeper slashingkeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper govkeeper.Keeper
CrisisKeeper crisiskeeper.Keeper
UpgradeKeeper upgradekeeper.Keeper
ParamsKeeper paramskeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
Expand Down Expand Up @@ -397,7 +447,7 @@ func NewEvmos(
distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, upgradetypes.StoreKey,
evidencetypes.StoreKey, capabilitytypes.StoreKey, consensusparamtypes.StoreKey,
feegrant.StoreKey, authzkeeper.StoreKey, crisistypes.StoreKey,
feegrant.StoreKey, authzkeeper.StoreKey,
// ibc keys
ibcexported.StoreKey, ibctransfertypes.StoreKey,
// ica keys
Expand Down Expand Up @@ -472,9 +522,6 @@ func NewEvmos(
app.SlashingKeeper = slashingkeeper.NewKeeper(
appCodec, app.LegacyAmino(), keys[slashingtypes.StoreKey], stakingKeeper, authAddr,
)
app.CrisisKeeper = *crisiskeeper.NewKeeper(
appCodec, keys[crisistypes.StoreKey], invCheckPeriod, app.BankKeeper, authtypes.FeeCollectorName, authAddr,
)
app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper)
app.UpgradeKeeper = *upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authAddr)

Expand Down Expand Up @@ -691,10 +738,6 @@ func NewEvmos(

/**** Module Options ****/

// NOTE: we may consider parsing `appOpts` inside module constructors. For the moment
// we prefer to be more strict in what arguments the modules expect.
skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants))

// NOTE: Any module instantiated in the module manager that is later modified
// must be passed by reference here.
app.mm = module.NewManager(
Expand All @@ -706,7 +749,6 @@ func NewEvmos(
auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)),
capability.NewAppModule(appCodec, *app.CapabilityKeeper, false),
crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)),
gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)),
Expand Down Expand Up @@ -766,7 +808,6 @@ func NewEvmos(
authtypes.ModuleName,
banktypes.ModuleName,
govtypes.ModuleName,
crisistypes.ModuleName,
genutiltypes.ModuleName,
authz.ModuleName,
feegrant.ModuleName,
Expand All @@ -783,7 +824,6 @@ func NewEvmos(

// NOTE: fee market module must go last in order to retrieve the block gas used.
app.mm.SetOrderEndBlockers(
crisistypes.ModuleName,
govtypes.ModuleName,
stakingtypes.ModuleName,
evmtypes.ModuleName,
Expand Down Expand Up @@ -855,12 +895,9 @@ func NewEvmos(
epochstypes.ModuleName,
recoverytypes.ModuleName,
revenuetypes.ModuleName,
// NOTE: crisis module must go at the end to check for invariants on each module
crisistypes.ModuleName,
consensusparamtypes.ModuleName,
)

app.mm.RegisterInvariants(&app.CrisisKeeper)
app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())
app.mm.RegisterServices(app.configurator)

Expand Down Expand Up @@ -1204,7 +1241,6 @@ func initParamsKeeper(
paramsKeeper.Subspace(distrtypes.ModuleName)
paramsKeeper.Subspace(slashingtypes.ModuleName)
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) //nolint: staticcheck
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
Expand Down Expand Up @@ -1384,7 +1420,11 @@ func (app *Evmos) setupUpgradeHandlers() {
crisistypes.ModuleName,
},
}
// !! ATTENTION !!
case v15.UpgradeName:
// crisis module is deprecated in v15
storeUpgrades = &storetypes.StoreUpgrades{
Deleted: []string{"crisis"},
}
}

if storeUpgrades != nil {
Expand Down
3 changes: 0 additions & 3 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ func (app *Evmos) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []s
allowedAddrsMap[addr] = true
}

/* Just to be safe, assert the invariants on current state. */
app.CrisisKeeper.AssertInvariants(ctx)

/* Handle fee distribution state. */

// withdraw all validator commission
Expand Down
7 changes: 7 additions & 0 deletions app/upgrades/v15/constants.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// Copyright Tharsis Labs Ltd.(Evmos)
// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE)
<<<<<<< HEAD

Check failure on line 3 in app/upgrades/v15/constants.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

expected 'package', found '<<' (typecheck)

Check failure on line 3 in app/upgrades/v15/constants.go

View workflow job for this annotation

GitHub Actions / test-unit-cover

expected 'package', found '<<'

=======
>>>>>>> a4569105 (imp: remove `crisis` module in v15 upgrade (#1847))

Check failure on line 6 in app/upgrades/v15/constants.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

illegal character U+0023 '#' (typecheck)
package v15

const (
// UpgradeName is the shared upgrade plan name for mainnet
UpgradeName = "v15.0.0"
// UpgradeInfo defines the binaries that will be used for the upgrade
<<<<<<< HEAD
UpgradeInfo = `'{"binaries":{"darwin/arm64":"https://github.com/evmos/evmos/releases/download/v15.0.0/evmos_15.0.0_Darwin_arm64.tar.gz","darwin/amd64":"https://github.com/evmos/evmos/releases/download/v15.0.0/evmos_15.0.0_Darwin_amd64.tar.gz","linux/arm64":"https://github.com/evmos/evmos/releases/download/v15.0.0/evmos_15.0.0_Linux_arm64.tar.gz","linux/amd64":"https://github.com/evmos/evmos/releases/download/v15.0.0/evmos_15.0.0_Linux_amd64.tar.gz","windows/x86_64":"https://github.com/evmos/evmos/releases/download/v15.0.0/evmos_15.0.0_Windows_x86_64.zip"}}'`
=======
UpgradeInfo = `'{"binaries":{"darwin/amd64":"https://github.com/evmos/evmos/releases/download/v15.0.0/evmos_15.0.0_Darwin_arm64.tar.gz","darwin/x86_64":"https://github.com/evmos/evmos/releases/download/v15.0.0/evmos_15.0.0_Darwin_x86_64.tar.gz","linux/arm64":"https://github.com/evmos/evmos/releases/download/v15.0.0/evmos_15.0.0_Linux_arm64.tar.gz","linux/amd64":"https://github.com/evmos/evmos/releases/download/v15.0.0/evmos_15.0.0_Linux_amd64.tar.gz","windows/x86_64":"https://github.com/evmos/evmos/releases/download/v15.0.0/evmos_15.0.0_Windows_x86_64.zip"}}'`
>>>>>>> a4569105 (imp: remove `crisis` module in v15 upgrade (#1847))
)
15 changes: 15 additions & 0 deletions app/upgrades/v15/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,33 @@ package v15
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
<<<<<<< HEAD

Check failure on line 8 in app/upgrades/v15/upgrades.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

missing import path (typecheck)
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
v14 "github.com/evmos/evmos/v15/app/upgrades/v14"
"github.com/evmos/evmos/v15/utils"
evmkeeper "github.com/evmos/evmos/v15/x/evm/keeper"
=======

Check failure on line 15 in app/upgrades/v15/upgrades.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

missing import path (typecheck)
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
>>>>>>> a4569105 (imp: remove `crisis` module in v15 upgrade (#1847))

Check failure on line 17 in app/upgrades/v15/upgrades.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

missing import path (typecheck)
)

// CreateUpgradeHandler creates an SDK upgrade handler for v15.0.0
func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
<<<<<<< HEAD
bk bankkeeper.Keeper,
ek *evmkeeper.Keeper,
sk stakingkeeper.Keeper,
=======
>>>>>>> a4569105 (imp: remove `crisis` module in v15 upgrade (#1847))

Check failure on line 29 in app/upgrades/v15/upgrades.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

illegal character U+0023 '#' (typecheck)
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
logger := ctx.Logger().With("upgrade", UpgradeName)

<<<<<<< HEAD
if utils.IsMainnet(ctx.ChainID()) {
logger.Info("migrating strategic reserves")
if err := v14.MigrateNativeMultisigs(
Expand All @@ -45,13 +53,18 @@ func CreateUpgradeHandler(

// we are deprecating the crisis module since it is not being used
logger.Debug("deleting crisis module from version map...")
=======
// we are depecrating crisis module since it is not being used
logger.Debug("deleting feesplit module from version map...")
>>>>>>> a4569105 (imp: remove `crisis` module in v15 upgrade (#1847))

Check failure on line 59 in app/upgrades/v15/upgrades.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

illegal character U+0023 '#' (typecheck)
delete(vm, "crisis")

// Leave modules are as-is to avoid running InitGenesis.
logger.Debug("running module migrations ...")
return mm.RunMigrations(ctx, configurator, vm)
}
}
<<<<<<< HEAD

// EnableEIPs enables the given EIPs in the EVM parameters.
func EnableEIPs(ctx sdk.Context, ek *evmkeeper.Keeper, eips ...int64) error {
Expand All @@ -60,3 +73,5 @@ func EnableEIPs(ctx sdk.Context, ek *evmkeeper.Keeper, eips ...int64) error {

return ek.SetParams(ctx, evmParams)
}
=======
>>>>>>> a4569105 (imp: remove `crisis` module in v15 upgrade (#1847))

0 comments on commit ffcb293

Please sign in to comment.