From 7aa26b99e9daf84c7a89c25ce60da28d2577d449 Mon Sep 17 00:00:00 2001 From: Tony Chen Date: Wed, 27 May 2026 11:14:54 +0800 Subject: [PATCH 1/4] Remove crisis module from app wiring Drop x/crisis from the Sei app module manager, init-genesis order, end blocker, invariant registration, init flags, and app-owned keeper state. Crisis has no dedicated mounted KV store in app/app.go, so the rootmulti store key list is unchanged. Also decouple crisis package tests from the full app now that App no longer exposes CrisisKeeper. Tested with: go test ./app ./app/legacyabci ./cmd/seid/cmd ./sei-cosmos/x/crisis/... Upgrade tested with a 4-node Docker cluster: started from the pre-removal binary, passed software upgrade v99.0.1-crisis-removal at height 342, restarted all validators on the removal binary, and verified all nodes reached height 514 with catching_up=false and matching app hash A53F9F78B05C8F6C07247186EF5BFB89D5BCFE7535AE52E54895B57E1844485E. --- app/app.go | 25 +---------- app/export.go | 3 -- app/legacyabci/end_block.go | 4 -- cmd/seid/cmd/root.go | 5 +-- sei-cosmos/x/crisis/handler_test.go | 51 ++++++++++++---------- sei-cosmos/x/crisis/keeper/keeper_test.go | 53 ++++++++++++++--------- 6 files changed, 63 insertions(+), 78 deletions(-) diff --git a/app/app.go b/app/app.go index bad9997209..cbdd6084c8 100644 --- a/app/app.go +++ b/app/app.go @@ -67,9 +67,6 @@ import ( "github.com/sei-protocol/sei-chain/sei-cosmos/x/capability" capabilitykeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/capability/keeper" capabilitytypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/capability/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis" - crisiskeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/keeper" - crisistypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" distr "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution" distrclient "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution/client" distrkeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution/keeper" @@ -166,7 +163,6 @@ import ( tokenfactorymodule "github.com/sei-protocol/sei-chain/x/tokenfactory" tokenfactorykeeper "github.com/sei-protocol/sei-chain/x/tokenfactory/keeper" tokenfactorytypes "github.com/sei-protocol/sei-chain/x/tokenfactory/types" - "github.com/spf13/cast" dbm "github.com/tendermint/tm-db" "go.opentelemetry.io/otel/attribute" otelmetric "go.opentelemetry.io/otel/metric" @@ -229,7 +225,6 @@ var ( distr.AppModuleBasic{}, gov.NewAppModuleBasic(getGovProposalHandlers()...), params.AppModuleBasic{}, - crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, ibc.AppModuleBasic{}, @@ -389,8 +384,6 @@ type App struct { appCodec codec.Codec interfaceRegistry types.InterfaceRegistry - invCheckPeriod uint - // keys to access the substores keys map[string]*sdk.KVStoreKey tkeys map[string]*sdk.TransientStoreKey @@ -407,7 +400,6 @@ type App struct { MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper GovKeeper govkeeper.Keeper - CrisisKeeper crisiskeeper.Keeper UpgradeKeeper upgradekeeper.Keeper ParamsKeeper paramskeeper.Keeper IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly @@ -504,7 +496,7 @@ func New( _ bool, skipUpgradeHeights map[int64]bool, homePath string, - invCheckPeriod uint, + _ uint, enableCustomEVMPrecompiles bool, tmConfig *tmcfg.Config, encodingConfig appparams.EncodingConfig, @@ -539,7 +531,6 @@ func New( cdc: cdc, appCodec: appCodec, interfaceRegistry: interfaceRegistry, - invCheckPeriod: invCheckPeriod, keys: keys, tkeys: tkeys, memKeys: memKeys, @@ -597,9 +588,6 @@ func New( app.SlashingKeeper = slashingkeeper.NewKeeper( appCodec, keys[slashingtypes.StoreKey], &stakingKeeper, app.GetSubspace(slashingtypes.ModuleName), ) - app.CrisisKeeper = crisiskeeper.NewKeeper( - app.GetSubspace(crisistypes.ModuleName), invCheckPeriod, app.BankKeeper, authtypes.FeeCollectorName, - ) app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp) @@ -869,12 +857,6 @@ func New( app.EvmKeeper.SetCustomPrecompiles(customPrecompiles, LatestUpgrade) } - /**** 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. @@ -888,7 +870,6 @@ func New( bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), capability.NewAppModule(appCodec, *app.CapabilityKeeper), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), @@ -920,7 +901,6 @@ func New( EvmKeeper: &app.EvmKeeper, } app.EndBlockKeepers = legacyabci.EndBlockKeepers{ - CrisisKeeper: &app.CrisisKeeper, GovKeeper: &app.GovKeeper, StakingKeeper: &app.StakingKeeper, OracleKeeper: &app.OracleKeeper, @@ -967,7 +947,6 @@ func New( govtypes.ModuleName, minttypes.ModuleName, vestingtypes.ModuleName, - crisistypes.ModuleName, ibchost.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, @@ -982,7 +961,6 @@ func New( // this line is used by starport scaffolding # stargate/app/initGenesis ) - app.mm.RegisterInvariants(&app.CrisisKeeper) app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.mm.RegisterServices(app.configurator) @@ -2865,7 +2843,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()) - paramsKeeper.Subspace(crisistypes.ModuleName) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) paramsKeeper.Subspace(oracletypes.ModuleName) diff --git a/app/export.go b/app/export.go index 3f871d494e..a254b0dbe2 100644 --- a/app/export.go +++ b/app/export.go @@ -110,9 +110,6 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str 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 diff --git a/app/legacyabci/end_block.go b/app/legacyabci/end_block.go index 0de780de79..c59caa3aa7 100644 --- a/app/legacyabci/end_block.go +++ b/app/legacyabci/end_block.go @@ -2,8 +2,6 @@ package legacyabci import ( sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis" - crisiskeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/keeper" "github.com/sei-protocol/sei-chain/sei-cosmos/x/gov" govkeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/gov/keeper" "github.com/sei-protocol/sei-chain/sei-cosmos/x/staking" @@ -15,7 +13,6 @@ import ( ) type EndBlockKeepers struct { - CrisisKeeper *crisiskeeper.Keeper GovKeeper *govkeeper.Keeper StakingKeeper *stakingkeeper.Keeper OracleKeeper *oraclekeeper.Keeper @@ -23,7 +20,6 @@ type EndBlockKeepers struct { } func EndBlock(ctx sdk.Context, height int64, blockGasUsed int64, keepers EndBlockKeepers) []abci.ValidatorUpdate { - crisis.EndBlocker(ctx, *keepers.CrisisKeeper) gov.EndBlocker(ctx, *keepers.GovKeeper) vals := staking.EndBlocker(ctx, *keepers.StakingKeeper) oracle.EndBlocker(ctx, *keepers.OracleKeeper) diff --git a/cmd/seid/cmd/root.go b/cmd/seid/cmd/root.go index c5f9a185cf..37d57fa693 100644 --- a/cmd/seid/cmd/root.go +++ b/cmd/seid/cmd/root.go @@ -35,7 +35,6 @@ import ( authcmd "github.com/sei-protocol/sei-chain/sei-cosmos/x/auth/client/cli" "github.com/sei-protocol/sei-chain/sei-cosmos/x/auth/types" banktypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/bank/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis" genutilcli "github.com/sei-protocol/sei-chain/sei-cosmos/x/genutil/client/cli" seidbconfig "github.com/sei-protocol/sei-chain/sei-db/config" tmcfg "github.com/sei-protocol/sei-chain/sei-tendermint/config" @@ -219,9 +218,7 @@ func txCommand() *cobra.Command { return cmd } -func addModuleInitFlags(startCmd *cobra.Command) { - crisis.AddModuleInitFlags(startCmd) -} +func addModuleInitFlags(_ *cobra.Command) {} // newApp creates a new Cosmos SDK app func newApp( diff --git a/sei-cosmos/x/crisis/handler_test.go b/sei-cosmos/x/crisis/handler_test.go index 3ce52f5281..46141ae4a1 100644 --- a/sei-cosmos/x/crisis/handler_test.go +++ b/sei-cosmos/x/crisis/handler_test.go @@ -3,15 +3,17 @@ package crisis_test import ( "testing" + "github.com/sei-protocol/sei-chain/sei-cosmos/codec" + codectypes "github.com/sei-protocol/sei-chain/sei-cosmos/codec/types" tmproto "github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" "github.com/stretchr/testify/require" - seiapp "github.com/sei-protocol/sei-chain/app" sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis" + crisiskeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/keeper" "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" - distrtypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution/types" - stakingtypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/staking/types" + paramskeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/params/keeper" + paramstypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/params/types" ) var ( @@ -20,32 +22,31 @@ var ( dummyRouteWhichFails = types.NewInvarRoute(testModuleName, "which-fails", func(_ sdk.Context) (string, bool) { return "whoops", true }) ) -func createTestApp(t *testing.T) (*seiapp.App, sdk.Context, []sdk.AccAddress) { - app := seiapp.Setup(t, false, false, false) - ctx := app.NewContext(false, tmproto.Header{}) +type noopSupplyKeeper struct{} - constantFee := sdk.NewInt64Coin(sdk.DefaultBondDenom, 10) - app.CrisisKeeper.SetConstantFee(ctx, constantFee) - app.StakingKeeper.SetParams(ctx, stakingtypes.DefaultParams()) - - app.CrisisKeeper.RegisterRoute(testModuleName, dummyRouteWhichPasses.Route, dummyRouteWhichPasses.Invar) - app.CrisisKeeper.RegisterRoute(testModuleName, dummyRouteWhichFails.Route, dummyRouteWhichFails.Invar) +func (noopSupplyKeeper) SendCoinsFromAccountToModule(sdk.Context, sdk.AccAddress, string, sdk.Coins) error { + return nil +} - feePool := distrtypes.InitialFeePool() - feePool.CommunityPool = sdk.NewDecCoinsFromCoins(sdk.NewCoins(constantFee)...) - app.DistrKeeper.SetFeePool(ctx, feePool) +func createTestKeeper() (crisiskeeper.Keeper, sdk.Context) { + legacyAmino := codec.NewLegacyAmino() + cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + key := sdk.NewKVStoreKey(paramstypes.StoreKey) + tkey := sdk.NewTransientStoreKey(paramstypes.TStoreKey) + paramsKeeper := paramskeeper.NewKeeper(cdc, legacyAmino, key, tkey) - addrs := seiapp.AddTestAddrs(app, ctx, 1, sdk.NewInt(10000)) + keeper := crisiskeeper.NewKeeper(paramsKeeper.Subspace(types.ModuleName), 1, noopSupplyKeeper{}, "fee_collector") + keeper.RegisterRoute(testModuleName, dummyRouteWhichPasses.Route, dummyRouteWhichPasses.Invar) + keeper.RegisterRoute(testModuleName, dummyRouteWhichFails.Route, dummyRouteWhichFails.Invar) - return app, ctx, addrs + return keeper, sdk.NewContext(nil, tmproto.Header{}, false) } // TestHandleMsgVerifyInvariant verifies that all VerifyInvariant calls return an // error because the feature is currently unsupported. func TestHandleMsgVerifyInvariant(t *testing.T) { - app, ctx, addrs := createTestApp(t) - sender := addrs[0] - h := crisis.NewHandler(app.CrisisKeeper) + keeper, ctx := createTestKeeper() + h := crisis.NewHandler(keeper) cases := []struct { name string @@ -59,7 +60,11 @@ func TestHandleMsgVerifyInvariant(t *testing.T) { for _, tc := range cases { tc := tc t.Run(tc.name, func(t *testing.T) { - msg := types.NewMsgVerifyInvariant(sender, testModuleName, tc.route) + msg := &types.MsgVerifyInvariant{ + Sender: "sei1sender", + InvariantModuleName: testModuleName, + InvariantRoute: tc.route, + } res, err := h(ctx, msg) require.Error(t, err) require.Nil(t, res) @@ -69,8 +74,8 @@ func TestHandleMsgVerifyInvariant(t *testing.T) { // TestHandleUnknownMsg verifies that unrecognized message types return an error. func TestHandleUnknownMsg(t *testing.T) { - app, ctx, _ := createTestApp(t) - h := crisis.NewHandler(app.CrisisKeeper) + keeper, ctx := createTestKeeper() + h := crisis.NewHandler(keeper) res, err := h(ctx, nil) require.Error(t, err) diff --git a/sei-cosmos/x/crisis/keeper/keeper_test.go b/sei-cosmos/x/crisis/keeper/keeper_test.go index 396e276425..e994e075e6 100644 --- a/sei-cosmos/x/crisis/keeper/keeper_test.go +++ b/sei-cosmos/x/crisis/keeper/keeper_test.go @@ -1,40 +1,53 @@ package keeper_test import ( - "context" "testing" - abci "github.com/sei-protocol/sei-chain/sei-tendermint/abci/types" + "github.com/sei-protocol/sei-chain/sei-cosmos/codec" + codectypes "github.com/sei-protocol/sei-chain/sei-cosmos/codec/types" tmproto "github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" "github.com/stretchr/testify/require" - seiapp "github.com/sei-protocol/sei-chain/app" sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" + crisiskeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/keeper" + crisistypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" + paramskeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/params/keeper" + paramstypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/params/types" ) +type noopSupplyKeeper struct{} + +func (noopSupplyKeeper) SendCoinsFromAccountToModule(sdk.Context, sdk.AccAddress, string, sdk.Coins) error { + return nil +} + +func createTestKeeper() crisiskeeper.Keeper { + legacyAmino := codec.NewLegacyAmino() + cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + key := sdk.NewKVStoreKey(paramstypes.StoreKey) + tkey := sdk.NewTransientStoreKey(paramstypes.TStoreKey) + paramsKeeper := paramskeeper.NewKeeper(cdc, legacyAmino, key, tkey) + + return crisiskeeper.NewKeeper(paramsKeeper.Subspace(crisistypes.ModuleName), 1, noopSupplyKeeper{}, "fee_collector") +} + func TestInvariants(t *testing.T) { - app := seiapp.Setup(t, false, false, false) - app.Commit(context.Background()) - app.FinalizeBlock(context.Background(), &abci.RequestFinalizeBlock{Header: &tmproto.Header{Height: app.LastBlockHeight() + 1}}) + keeper := createTestKeeper() - require.Equal(t, app.CrisisKeeper.InvCheckPeriod(), uint(1)) + require.Equal(t, uint(1), keeper.InvCheckPeriod()) - // SimApp has 11 registered invariants - orgInvRoutes := app.CrisisKeeper.Routes() - app.CrisisKeeper.RegisterRoute("testModule", "testRoute", func(sdk.Context) (string, bool) { return "", false }) - require.Equal(t, len(app.CrisisKeeper.Routes()), len(orgInvRoutes)+1) + orgInvRoutes := keeper.Routes() + keeper.RegisterRoute("testModule", "testRoute", func(sdk.Context) (string, bool) { return "", false }) + require.Equal(t, len(orgInvRoutes)+1, len(keeper.Routes())) } func TestAssertInvariants(t *testing.T) { - app := seiapp.Setup(t, false, false, false) - app.Commit(context.Background()) - app.FinalizeBlock(context.Background(), &abci.RequestFinalizeBlock{Header: &tmproto.Header{Height: app.LastBlockHeight() + 1}}) - - ctx := app.NewContext(true, tmproto.Header{}) + keeper := createTestKeeper() + ctx := sdk.NewContext(nil, tmproto.Header{}, true) - app.CrisisKeeper.RegisterRoute("testModule", "testRoute1", func(sdk.Context) (string, bool) { return "", false }) - require.NotPanics(t, func() { app.CrisisKeeper.AssertInvariants(ctx) }) + keeper.RegisterRoute("testModule", "testRoute1", func(sdk.Context) (string, bool) { return "", false }) + require.NotPanics(t, func() { keeper.AssertInvariants(ctx) }) - app.CrisisKeeper.RegisterRoute("testModule", "testRoute2", func(sdk.Context) (string, bool) { return "", true }) - require.Panics(t, func() { app.CrisisKeeper.AssertInvariants(ctx) }) + keeper.RegisterRoute("testModule", "testRoute2", func(sdk.Context) (string, bool) { return "", true }) + require.Panics(t, func() { keeper.AssertInvariants(ctx) }) } From f76f011f77af28d0fa059a7335be7e25b703996b Mon Sep 17 00:00:00 2001 From: Tony Chen Date: Thu, 28 May 2026 13:08:19 +0800 Subject: [PATCH 2/4] Remove crisis module code and store --- app/app.go | 10 + docker/localnode/scripts/step2_genesis.sh | 1 - scripts/dump_app_state_for_height.sh | 2 +- .../proto/cosmos/crisis/v1beta1/genesis.proto | 17 - .../proto/cosmos/crisis/v1beta1/tx.proto | 25 - sei-cosmos/x/README.md | 1 - sei-cosmos/x/crisis/abci.go | 21 - sei-cosmos/x/crisis/client/cli/tx.go | 60 -- .../x/crisis/client/testsuite/cli_test.go | 18 - sei-cosmos/x/crisis/client/testsuite/suite.go | 104 --- sei-cosmos/x/crisis/handler.go | 25 - sei-cosmos/x/crisis/handler_test.go | 83 --- sei-cosmos/x/crisis/keeper/genesis.go | 17 - sei-cosmos/x/crisis/keeper/keeper.go | 94 --- sei-cosmos/x/crisis/keeper/keeper_test.go | 53 -- sei-cosmos/x/crisis/keeper/msg_server.go | 69 -- sei-cosmos/x/crisis/keeper/params.go | 17 - sei-cosmos/x/crisis/legacy/v039/types.go | 13 - sei-cosmos/x/crisis/legacy/v040/migrate.go | 16 - sei-cosmos/x/crisis/legacy/v040/types.go | 5 - sei-cosmos/x/crisis/module.go | 179 ----- sei-cosmos/x/crisis/spec/01_state.md | 17 - sei-cosmos/x/crisis/spec/02_messages.md | 25 - sei-cosmos/x/crisis/spec/03_events.md | 18 - sei-cosmos/x/crisis/spec/04_params.md | 11 - sei-cosmos/x/crisis/spec/05_client.md | 31 - sei-cosmos/x/crisis/spec/README.md | 24 - sei-cosmos/x/crisis/types/codec.go | 41 -- sei-cosmos/x/crisis/types/errors.go | 11 - sei-cosmos/x/crisis/types/events.go | 9 - sei-cosmos/x/crisis/types/expected_keepers.go | 10 - sei-cosmos/x/crisis/types/genesis.go | 29 - sei-cosmos/x/crisis/types/genesis.pb.go | 329 ---------- sei-cosmos/x/crisis/types/keys.go | 6 - sei-cosmos/x/crisis/types/msgs.go | 45 -- sei-cosmos/x/crisis/types/params.go | 33 - sei-cosmos/x/crisis/types/route.go | 26 - sei-cosmos/x/crisis/types/tx.pb.go | 615 ------------------ sei-db/tools/cmd/seidb/operations/module.go | 2 +- sei-ibc-go/testing/simapp/app.go | 27 +- sei-ibc-go/testing/simapp/export.go | 3 - sei-ibc-go/testing/simapp/simd/cmd/root.go | 4 +- sei-wasmd/app/app.go | 28 +- sei-wasmd/app/export.go | 3 - sei-wasmd/x/wasm/keeper/test_common.go | 4 - 45 files changed, 16 insertions(+), 2165 deletions(-) delete mode 100644 sei-cosmos/proto/cosmos/crisis/v1beta1/genesis.proto delete mode 100644 sei-cosmos/proto/cosmos/crisis/v1beta1/tx.proto delete mode 100644 sei-cosmos/x/crisis/abci.go delete mode 100644 sei-cosmos/x/crisis/client/cli/tx.go delete mode 100644 sei-cosmos/x/crisis/client/testsuite/cli_test.go delete mode 100644 sei-cosmos/x/crisis/client/testsuite/suite.go delete mode 100644 sei-cosmos/x/crisis/handler.go delete mode 100644 sei-cosmos/x/crisis/handler_test.go delete mode 100644 sei-cosmos/x/crisis/keeper/genesis.go delete mode 100644 sei-cosmos/x/crisis/keeper/keeper.go delete mode 100644 sei-cosmos/x/crisis/keeper/keeper_test.go delete mode 100644 sei-cosmos/x/crisis/keeper/msg_server.go delete mode 100644 sei-cosmos/x/crisis/keeper/params.go delete mode 100644 sei-cosmos/x/crisis/legacy/v039/types.go delete mode 100644 sei-cosmos/x/crisis/legacy/v040/migrate.go delete mode 100644 sei-cosmos/x/crisis/legacy/v040/types.go delete mode 100644 sei-cosmos/x/crisis/module.go delete mode 100644 sei-cosmos/x/crisis/spec/01_state.md delete mode 100644 sei-cosmos/x/crisis/spec/02_messages.md delete mode 100644 sei-cosmos/x/crisis/spec/03_events.md delete mode 100644 sei-cosmos/x/crisis/spec/04_params.md delete mode 100644 sei-cosmos/x/crisis/spec/05_client.md delete mode 100644 sei-cosmos/x/crisis/spec/README.md delete mode 100644 sei-cosmos/x/crisis/types/codec.go delete mode 100644 sei-cosmos/x/crisis/types/errors.go delete mode 100644 sei-cosmos/x/crisis/types/events.go delete mode 100644 sei-cosmos/x/crisis/types/expected_keepers.go delete mode 100644 sei-cosmos/x/crisis/types/genesis.go delete mode 100644 sei-cosmos/x/crisis/types/genesis.pb.go delete mode 100644 sei-cosmos/x/crisis/types/keys.go delete mode 100644 sei-cosmos/x/crisis/types/msgs.go delete mode 100644 sei-cosmos/x/crisis/types/params.go delete mode 100644 sei-cosmos/x/crisis/types/route.go delete mode 100644 sei-cosmos/x/crisis/types/tx.pb.go diff --git a/app/app.go b/app/app.go index cbdd6084c8..4e5dbab994 100644 --- a/app/app.go +++ b/app/app.go @@ -1142,6 +1142,7 @@ func (app *App) SetStoreUpgradeHandlers() { } accesscontrolStoreKeyName := "aclaccesscontrol" + crisisStoreKeyName := "crisis" if upgradeInfo.Name == "1.0.4beta" && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := storetypes.StoreUpgrades{ @@ -1213,6 +1214,15 @@ func (app *App) SetStoreUpgradeHandlers() { // configure store loader that checks if version == upgradeHeight and applies store upgrades app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) } + + if (upgradeInfo.Name == "vTODO") && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + storeUpgrades := storetypes.StoreUpgrades{ + Deleted: []string{crisisStoreKeyName}, + } + + // configure store loader that checks if version == upgradeHeight and applies store upgrades + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) + } } // AppName returns the name of the App diff --git a/docker/localnode/scripts/step2_genesis.sh b/docker/localnode/scripts/step2_genesis.sh index 6849c7651b..9373ac6745 100755 --- a/docker/localnode/scripts/step2_genesis.sh +++ b/docker/localnode/scripts/step2_genesis.sh @@ -13,7 +13,6 @@ override_genesis() { cat ~/.sei/config/genesis.json | jq "$1" > ~/.sei/config/tmp_genesis.json && mv ~/.sei/config/tmp_genesis.json ~/.sei/config/genesis.json; } -override_genesis '.app_state["crisis"]["constant_fee"]["denom"]="usei"' override_genesis '.app_state["mint"]["params"]["mint_denom"]="usei"' override_genesis '.app_state["staking"]["params"]["bond_denom"]="usei"' override_genesis '.app_state["oracle"]["params"]["vote_period"]="2"' diff --git a/scripts/dump_app_state_for_height.sh b/scripts/dump_app_state_for_height.sh index 6ae38c373c..5beb19ed2e 100755 --- a/scripts/dump_app_state_for_height.sh +++ b/scripts/dump_app_state_for_height.sh @@ -28,7 +28,7 @@ fi cd $HOME sudo rm -r state_$HEIGHT mkdir state_$HEIGHT -for key in wasm oracle epoch mint acc bank crisis feegrant staking distribution slashing gov params ibc upgrade evidence transfer tokenfactory +for key in wasm oracle epoch mint acc bank feegrant staking distribution slashing gov params ibc upgrade evidence transfer tokenfactory do $HOME/go/bin/iaviewer data $HOME/.sei/data/application.db "s/k:"$key"/" $HEIGHT > $HOME/state_$HEIGHT/$key.data $HOME/go/bin/iaviewer shape $HOME/.sei/data/application.db "s/k:"$key"/" $HEIGHT > $HOME/state_$HEIGHT/$key.shape diff --git a/sei-cosmos/proto/cosmos/crisis/v1beta1/genesis.proto b/sei-cosmos/proto/cosmos/crisis/v1beta1/genesis.proto deleted file mode 100644 index e84ff408a9..0000000000 --- a/sei-cosmos/proto/cosmos/crisis/v1beta1/genesis.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; -package cosmos.crisis.v1beta1; - -import "cosmos/base/v1beta1/coin.proto"; -import "gogoproto/gogo.proto"; - -option go_package = "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types"; - -// GenesisState defines the crisis module's genesis state. -message GenesisState { - // constant_fee is the fee used to verify the invariant in the crisis - // module. - cosmos.base.v1beta1.Coin constant_fee = 3 [ - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"constant_fee\"" - ]; -} diff --git a/sei-cosmos/proto/cosmos/crisis/v1beta1/tx.proto b/sei-cosmos/proto/cosmos/crisis/v1beta1/tx.proto deleted file mode 100644 index 86ee93fad2..0000000000 --- a/sei-cosmos/proto/cosmos/crisis/v1beta1/tx.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package cosmos.crisis.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types"; - -// Msg defines the bank Msg service. -service Msg { - // VerifyInvariant defines a method to verify a particular invariance. - rpc VerifyInvariant(MsgVerifyInvariant) returns (MsgVerifyInvariantResponse); -} - -// MsgVerifyInvariant represents a message to verify a particular invariance. -message MsgVerifyInvariant { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string sender = 1; - string invariant_module_name = 2 [(gogoproto.moretags) = "yaml:\"invariant_module_name\""]; - string invariant_route = 3 [(gogoproto.moretags) = "yaml:\"invariant_route\""]; -} - -// MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. -message MsgVerifyInvariantResponse {} diff --git a/sei-cosmos/x/README.md b/sei-cosmos/x/README.md index 464d801e74..4362b310b8 100644 --- a/sei-cosmos/x/README.md +++ b/sei-cosmos/x/README.md @@ -11,7 +11,6 @@ Here are some production-grade modules that can be used in Cosmos SDK applicatio - [Authz](authz/spec/README.md) - Authorization for accounts to perform actions on behalf of other accounts. - [Bank](bank/spec/README.md) - Token transfer functionalities. - [Capability](capability/spec/README.md) - Object capability implementation. -- [Crisis](crisis/spec/README.md) - Halting the blockchain under certain circumstances (e.g. if an invariant is broken). - [Distribution](distribution/spec/README.md) - Fee distribution, and staking token provision distribution. - [Evidence](evidence/spec/README.md) - Evidence handling for double signing, misbehaviour, etc. - [Governance](gov/spec/README.md) - On-chain proposals and voting. diff --git a/sei-cosmos/x/crisis/abci.go b/sei-cosmos/x/crisis/abci.go deleted file mode 100644 index f16af5c277..0000000000 --- a/sei-cosmos/x/crisis/abci.go +++ /dev/null @@ -1,21 +0,0 @@ -package crisis - -import ( - "time" - - "github.com/sei-protocol/sei-chain/sei-cosmos/telemetry" - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/keeper" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" -) - -// check all registered invariants -func EndBlocker(ctx sdk.Context, k keeper.Keeper) { - defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker) - - if k.InvCheckPeriod() == 0 || ctx.BlockHeight()%int64(k.InvCheckPeriod()) != 0 { //nolint:gosec // InvCheckPeriod is a small config value, won't overflow int64 - // skip running the invariant check - return - } - k.AssertInvariants(ctx) -} diff --git a/sei-cosmos/x/crisis/client/cli/tx.go b/sei-cosmos/x/crisis/client/cli/tx.go deleted file mode 100644 index fa4b2f0b21..0000000000 --- a/sei-cosmos/x/crisis/client/cli/tx.go +++ /dev/null @@ -1,60 +0,0 @@ -package cli - -import ( - "errors" - - "github.com/spf13/cobra" - - "github.com/sei-protocol/sei-chain/sei-cosmos/client" - "github.com/sei-protocol/sei-chain/sei-cosmos/client/flags" - "github.com/sei-protocol/sei-chain/sei-cosmos/client/tx" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" -) - -// NewTxCmd returns a root CLI command handler for all x/crisis transaction commands. -func NewTxCmd() *cobra.Command { - txCmd := &cobra.Command{ - Use: types.ModuleName, - Short: "Crisis transactions subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - txCmd.AddCommand(NewMsgVerifyInvariantTxCmd()) - - return txCmd -} - -// NewMsgVerifyInvariantTxCmd returns a CLI command handler for creating a -// MsgVerifyInvariant transaction. -func NewMsgVerifyInvariantTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "invariant-broken [module-name] [invariant-route]", - Short: "Submit proof that an invariant broken to halt the chain", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - moduleName, route := args[0], args[1] - if moduleName == "" { - return errors.New("invalid module name") - } - if route == "" { - return errors.New("invalid invariant route") - } - - senderAddr := clientCtx.GetFromAddress() - - msg := types.NewMsgVerifyInvariant(senderAddr, moduleName, route) - - return tx.GenerateOrBroadcastTxCLI(cmd.Context(), clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/sei-cosmos/x/crisis/client/testsuite/cli_test.go b/sei-cosmos/x/crisis/client/testsuite/cli_test.go deleted file mode 100644 index 679ae015cc..0000000000 --- a/sei-cosmos/x/crisis/client/testsuite/cli_test.go +++ /dev/null @@ -1,18 +0,0 @@ -//go:build norace -// +build norace - -package testutil - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - "github.com/sei-protocol/sei-chain/sei-cosmos/testutil/network" -) - -func TestIntegrationTestSuite(t *testing.T) { - cfg := network.DefaultConfig() - cfg.NumValidators = 1 - suite.Run(t, NewIntegrationTestSuite(cfg)) -} diff --git a/sei-cosmos/x/crisis/client/testsuite/suite.go b/sei-cosmos/x/crisis/client/testsuite/suite.go deleted file mode 100644 index f5312d5c15..0000000000 --- a/sei-cosmos/x/crisis/client/testsuite/suite.go +++ /dev/null @@ -1,104 +0,0 @@ -package testutil - -import ( - "fmt" - - "github.com/gogo/protobuf/proto" - "github.com/stretchr/testify/suite" - - "github.com/sei-protocol/sei-chain/sei-cosmos/client/flags" - clitestutil "github.com/sei-protocol/sei-chain/sei-cosmos/testutil/cli" - "github.com/sei-protocol/sei-chain/sei-cosmos/testutil/network" - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/client/cli" -) - -type IntegrationTestSuite struct { - suite.Suite - - cfg network.Config - network *network.Network -} - -func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { - return &IntegrationTestSuite{cfg: cfg} -} - -func (s *IntegrationTestSuite) SetupSuite() { - s.T().Log("setting up integration test suite") - - s.network = network.New(s.T(), s.cfg) - _, err := s.network.WaitForHeight(1) - s.Require().NoError(err) -} - -func (s *IntegrationTestSuite) TearDownSuite() { - s.T().Log("tearing down integration test suite") - s.network.Cleanup() -} - -func (s *IntegrationTestSuite) TestNewMsgVerifyInvariantTxCmd() { - val := s.network.Validators[0] - - testCases := []struct { - name string - args []string - expectErr bool - expectedCode uint32 - respType proto.Message - }{ - { - "missing module", - []string{ - "", "total-supply", - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - }, - true, 0, nil, - }, - { - "missing invariant route", - []string{ - "bank", "", - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - }, - true, 0, nil, - }, - { - "valid transaction", - []string{ - "bank", "total-supply", - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - }, - false, 0, &sdk.TxResponse{}, - }, - } - - for _, tc := range testCases { - tc := tc - - s.Run(tc.name, func() { - cmd := cli.NewMsgVerifyInvariantTxCmd() - clientCtx := val.ClientCtx - - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) - if tc.expectErr { - s.Require().Error(err) - } else { - s.Require().NoError(err) - s.Require().NoError(clientCtx.Codec.UnmarshalAsJSON(out.Bytes(), tc.respType), out.String()) - - txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code) - } - }) - } -} diff --git a/sei-cosmos/x/crisis/handler.go b/sei-cosmos/x/crisis/handler.go deleted file mode 100644 index 0e32d1f274..0000000000 --- a/sei-cosmos/x/crisis/handler.go +++ /dev/null @@ -1,25 +0,0 @@ -package crisis - -import ( - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - sdkerrors "github.com/sei-protocol/sei-chain/sei-cosmos/types/errors" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" -) - -// RouterKey -const RouterKey = types.ModuleName - -func NewHandler(k types.MsgServer) sdk.Handler { - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - case *types.MsgVerifyInvariant: - res, err := k.VerifyInvariant(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized crisis message type: %T", msg) - } - } -} diff --git a/sei-cosmos/x/crisis/handler_test.go b/sei-cosmos/x/crisis/handler_test.go deleted file mode 100644 index 46141ae4a1..0000000000 --- a/sei-cosmos/x/crisis/handler_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package crisis_test - -import ( - "testing" - - "github.com/sei-protocol/sei-chain/sei-cosmos/codec" - codectypes "github.com/sei-protocol/sei-chain/sei-cosmos/codec/types" - tmproto "github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" - "github.com/stretchr/testify/require" - - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis" - crisiskeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/keeper" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" - paramskeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/params/keeper" - paramstypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/params/types" -) - -var ( - testModuleName = "dummy" - dummyRouteWhichPasses = types.NewInvarRoute(testModuleName, "which-passes", func(_ sdk.Context) (string, bool) { return "", false }) - dummyRouteWhichFails = types.NewInvarRoute(testModuleName, "which-fails", func(_ sdk.Context) (string, bool) { return "whoops", true }) -) - -type noopSupplyKeeper struct{} - -func (noopSupplyKeeper) SendCoinsFromAccountToModule(sdk.Context, sdk.AccAddress, string, sdk.Coins) error { - return nil -} - -func createTestKeeper() (crisiskeeper.Keeper, sdk.Context) { - legacyAmino := codec.NewLegacyAmino() - cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) - key := sdk.NewKVStoreKey(paramstypes.StoreKey) - tkey := sdk.NewTransientStoreKey(paramstypes.TStoreKey) - paramsKeeper := paramskeeper.NewKeeper(cdc, legacyAmino, key, tkey) - - keeper := crisiskeeper.NewKeeper(paramsKeeper.Subspace(types.ModuleName), 1, noopSupplyKeeper{}, "fee_collector") - keeper.RegisterRoute(testModuleName, dummyRouteWhichPasses.Route, dummyRouteWhichPasses.Invar) - keeper.RegisterRoute(testModuleName, dummyRouteWhichFails.Route, dummyRouteWhichFails.Invar) - - return keeper, sdk.NewContext(nil, tmproto.Header{}, false) -} - -// TestHandleMsgVerifyInvariant verifies that all VerifyInvariant calls return an -// error because the feature is currently unsupported. -func TestHandleMsgVerifyInvariant(t *testing.T) { - keeper, ctx := createTestKeeper() - h := crisis.NewHandler(keeper) - - cases := []struct { - name string - route string - }{ - {"passing invariant route", dummyRouteWhichPasses.Route}, - {"failing invariant route", dummyRouteWhichFails.Route}, - {"nonexistent route", "route-that-doesnt-exist"}, - } - - for _, tc := range cases { - tc := tc - t.Run(tc.name, func(t *testing.T) { - msg := &types.MsgVerifyInvariant{ - Sender: "sei1sender", - InvariantModuleName: testModuleName, - InvariantRoute: tc.route, - } - res, err := h(ctx, msg) - require.Error(t, err) - require.Nil(t, res) - }) - } -} - -// TestHandleUnknownMsg verifies that unrecognized message types return an error. -func TestHandleUnknownMsg(t *testing.T) { - keeper, ctx := createTestKeeper() - h := crisis.NewHandler(keeper) - - res, err := h(ctx, nil) - require.Error(t, err) - require.Nil(t, res) -} diff --git a/sei-cosmos/x/crisis/keeper/genesis.go b/sei-cosmos/x/crisis/keeper/genesis.go deleted file mode 100644 index d7993d9474..0000000000 --- a/sei-cosmos/x/crisis/keeper/genesis.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" -) - -// new crisis genesis -func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) { - k.SetConstantFee(ctx, data.ConstantFee) -} - -// ExportGenesis returns a GenesisState for a given context and keeper. -func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - constantFee := k.GetConstantFee(ctx) - return types.NewGenesisState(constantFee) -} diff --git a/sei-cosmos/x/crisis/keeper/keeper.go b/sei-cosmos/x/crisis/keeper/keeper.go deleted file mode 100644 index 00764bd968..0000000000 --- a/sei-cosmos/x/crisis/keeper/keeper.go +++ /dev/null @@ -1,94 +0,0 @@ -package keeper - -import ( - "fmt" - "time" - - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" - paramtypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/params/types" - "github.com/sei-protocol/seilog" -) - -var logger = seilog.NewLogger("cosmos", "x", "crisis", "keeper") - -// Keeper - crisis keeper -type Keeper struct { - routes []types.InvarRoute - paramSpace paramtypes.Subspace - invCheckPeriod uint - - supplyKeeper types.SupplyKeeper - - feeCollectorName string // name of the FeeCollector ModuleAccount -} - -// NewKeeper creates a new Keeper object -func NewKeeper( - paramSpace paramtypes.Subspace, invCheckPeriod uint, supplyKeeper types.SupplyKeeper, - feeCollectorName string, -) Keeper { - - // set KeyTable if it has not already been set - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } - - return Keeper{ - routes: make([]types.InvarRoute, 0), - paramSpace: paramSpace, - invCheckPeriod: invCheckPeriod, - supplyKeeper: supplyKeeper, - feeCollectorName: feeCollectorName, - } -} - -// RegisterRoute register the routes for each of the invariants -func (k *Keeper) RegisterRoute(moduleName, route string, invar sdk.Invariant) { - invarRoute := types.NewInvarRoute(moduleName, route, invar) - k.routes = append(k.routes, invarRoute) -} - -// Routes - return the keeper's invariant routes -func (k Keeper) Routes() []types.InvarRoute { - return k.routes -} - -// Invariants returns a copy of all registered Crisis keeper invariants. -func (k Keeper) Invariants() []sdk.Invariant { - invars := make([]sdk.Invariant, len(k.routes)) - for i, route := range k.routes { - invars[i] = route.Invar - } - return invars -} - -// AssertInvariants asserts all registered invariants. If any invariant fails, -// the method panics. -func (k Keeper) AssertInvariants(ctx sdk.Context) { - - start := time.Now() - invarRoutes := k.Routes() - n := len(invarRoutes) - for i, ir := range invarRoutes { - logger.Info("asserting crisis invariants", "inv", fmt.Sprint(i+1, "/", n), "name", ir.FullRoute()) - if res, stop := ir.Invar(ctx); stop { - // TODO: Include app name as part of context to allow for this to be - // variable. - panic(fmt.Errorf("invariant broken: %s\n"+ - "\tCRITICAL please submit the following transaction:\n"+ - "\t\t tx crisis invariant-broken %s %s", res, ir.ModuleName, ir.Route)) - } - } - - diff := time.Since(start) - logger.Info("asserted all invariants", "duration", diff, "height", ctx.BlockHeight()) -} - -// InvCheckPeriod returns the invariant checks period. -func (k Keeper) InvCheckPeriod() uint { return k.invCheckPeriod } - -// SendCoinsFromAccountToFeeCollector transfers amt to the fee collector account. -func (k Keeper) SendCoinsFromAccountToFeeCollector(ctx sdk.Context, senderAddr sdk.AccAddress, amt sdk.Coins) error { - return k.supplyKeeper.SendCoinsFromAccountToModule(ctx, senderAddr, k.feeCollectorName, amt) -} diff --git a/sei-cosmos/x/crisis/keeper/keeper_test.go b/sei-cosmos/x/crisis/keeper/keeper_test.go deleted file mode 100644 index e994e075e6..0000000000 --- a/sei-cosmos/x/crisis/keeper/keeper_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/sei-protocol/sei-chain/sei-cosmos/codec" - codectypes "github.com/sei-protocol/sei-chain/sei-cosmos/codec/types" - tmproto "github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" - "github.com/stretchr/testify/require" - - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - crisiskeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/keeper" - crisistypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" - paramskeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/params/keeper" - paramstypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/params/types" -) - -type noopSupplyKeeper struct{} - -func (noopSupplyKeeper) SendCoinsFromAccountToModule(sdk.Context, sdk.AccAddress, string, sdk.Coins) error { - return nil -} - -func createTestKeeper() crisiskeeper.Keeper { - legacyAmino := codec.NewLegacyAmino() - cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) - key := sdk.NewKVStoreKey(paramstypes.StoreKey) - tkey := sdk.NewTransientStoreKey(paramstypes.TStoreKey) - paramsKeeper := paramskeeper.NewKeeper(cdc, legacyAmino, key, tkey) - - return crisiskeeper.NewKeeper(paramsKeeper.Subspace(crisistypes.ModuleName), 1, noopSupplyKeeper{}, "fee_collector") -} - -func TestInvariants(t *testing.T) { - keeper := createTestKeeper() - - require.Equal(t, uint(1), keeper.InvCheckPeriod()) - - orgInvRoutes := keeper.Routes() - keeper.RegisterRoute("testModule", "testRoute", func(sdk.Context) (string, bool) { return "", false }) - require.Equal(t, len(orgInvRoutes)+1, len(keeper.Routes())) -} - -func TestAssertInvariants(t *testing.T) { - keeper := createTestKeeper() - ctx := sdk.NewContext(nil, tmproto.Header{}, true) - - keeper.RegisterRoute("testModule", "testRoute1", func(sdk.Context) (string, bool) { return "", false }) - require.NotPanics(t, func() { keeper.AssertInvariants(ctx) }) - - keeper.RegisterRoute("testModule", "testRoute2", func(sdk.Context) (string, bool) { return "", true }) - require.Panics(t, func() { keeper.AssertInvariants(ctx) }) -} diff --git a/sei-cosmos/x/crisis/keeper/msg_server.go b/sei-cosmos/x/crisis/keeper/msg_server.go deleted file mode 100644 index a6750264d2..0000000000 --- a/sei-cosmos/x/crisis/keeper/msg_server.go +++ /dev/null @@ -1,69 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - // sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" -) - -var _ types.MsgServer = Keeper{} - -func (k Keeper) VerifyInvariant(goCtx context.Context, msg *types.MsgVerifyInvariant) (*types.MsgVerifyInvariantResponse, error) { - return nil, fmt.Errorf("verify invariant is currently unsupported") - // TODO: uncomment to reimplement verify invariant behavior in the future - // ctx := sdk.UnwrapSDKContext(goCtx) - // constantFee := sdk.NewCoins(k.GetConstantFee(ctx)) - - // sender, err := sdk.AccAddressFromBech32(msg.Sender) - // if err != nil { - // return nil, err - // } - // if err := k.SendCoinsFromAccountToFeeCollector(ctx, sender, constantFee); err != nil { - // return nil, err - // } - - // // use a cached context to avoid gas costs during invariants - // cacheCtx, _ := ctx.CacheContext() - - // found := false - // msgFullRoute := msg.FullInvariantRoute() - - // var res string - // var stop bool - // for _, invarRoute := range k.Routes() { - // if invarRoute.FullRoute() == msgFullRoute { - // res, stop = invarRoute.Invar(cacheCtx) - // found = true - - // break - // } - // } - - // if !found { - // return nil, types.ErrUnknownInvariant - // } - - // if stop { - // // Currently, because the chain halts here, this transaction will never be included in the - // // blockchain thus the constant fee will have never been deducted. Thus no refund is required. - - // // TODO replace with circuit breaker - // panic(res) - // } - - // ctx.EventManager().EmitEvents(sdk.Events{ - // sdk.NewEvent( - // types.EventTypeInvariant, - // sdk.NewAttribute(types.AttributeKeyRoute, msg.InvariantRoute), - // ), - // sdk.NewEvent( - // sdk.EventTypeMessage, - // sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCrisis), - // sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender), - // ), - // }) - - // return &types.MsgVerifyInvariantResponse{}, nil -} diff --git a/sei-cosmos/x/crisis/keeper/params.go b/sei-cosmos/x/crisis/keeper/params.go deleted file mode 100644 index bd405f8a9c..0000000000 --- a/sei-cosmos/x/crisis/keeper/params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" -) - -// GetConstantFee get's the constant fee from the paramSpace -func (k Keeper) GetConstantFee(ctx sdk.Context) (constantFee sdk.Coin) { - k.paramSpace.Get(ctx, types.ParamStoreKeyConstantFee, &constantFee) - return -} - -// GetConstantFee set's the constant fee in the paramSpace -func (k Keeper) SetConstantFee(ctx sdk.Context, constantFee sdk.Coin) { - k.paramSpace.Set(ctx, types.ParamStoreKeyConstantFee, constantFee) -} diff --git a/sei-cosmos/x/crisis/legacy/v039/types.go b/sei-cosmos/x/crisis/legacy/v039/types.go deleted file mode 100644 index 207b57441b..0000000000 --- a/sei-cosmos/x/crisis/legacy/v039/types.go +++ /dev/null @@ -1,13 +0,0 @@ -package v039 - -import sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - -const ( - ModuleName = "crisis" -) - -type ( - GenesisState struct { - ConstantFee sdk.Coin `json:"constant_fee" yaml:"constant_fee"` - } -) diff --git a/sei-cosmos/x/crisis/legacy/v040/migrate.go b/sei-cosmos/x/crisis/legacy/v040/migrate.go deleted file mode 100644 index 2356fc67c4..0000000000 --- a/sei-cosmos/x/crisis/legacy/v040/migrate.go +++ /dev/null @@ -1,16 +0,0 @@ -package v040 - -import ( - v039crisis "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/legacy/v039" - v040crisis "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" -) - -// Migrate accepts exported v0.39 x/crisis genesis state and -// migrates it to v0.40 x/crisis genesis state. The migration includes: -// -// - Re-encode in v0.40 GenesisState. -func Migrate(crisisGenState v039crisis.GenesisState) *v040crisis.GenesisState { - return &v040crisis.GenesisState{ - ConstantFee: crisisGenState.ConstantFee, - } -} diff --git a/sei-cosmos/x/crisis/legacy/v040/types.go b/sei-cosmos/x/crisis/legacy/v040/types.go deleted file mode 100644 index 68c25e93ee..0000000000 --- a/sei-cosmos/x/crisis/legacy/v040/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package v040 - -const ( - ModuleName = "crisis" -) diff --git a/sei-cosmos/x/crisis/module.go b/sei-cosmos/x/crisis/module.go deleted file mode 100644 index 99e171054c..0000000000 --- a/sei-cosmos/x/crisis/module.go +++ /dev/null @@ -1,179 +0,0 @@ -package crisis - -import ( - "encoding/json" - "fmt" - "time" - - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - abci "github.com/sei-protocol/sei-chain/sei-tendermint/abci/types" - "github.com/spf13/cobra" - - "github.com/sei-protocol/sei-chain/sei-cosmos/client" - "github.com/sei-protocol/sei-chain/sei-cosmos/codec" - codectypes "github.com/sei-protocol/sei-chain/sei-cosmos/codec/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/telemetry" - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/types/module" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/client/cli" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/keeper" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// Module init related flags -const ( - FlagSkipGenesisInvariants = "x-crisis-skip-assert-invariants" -) - -// AppModuleBasic defines the basic application module used by the crisis module. -type AppModuleBasic struct{} - -// Name returns the crisis module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the crisis module's types on the given LegacyAmino codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) -} - -// DefaultGenesis returns default genesis state as raw bytes for the crisis -// module. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) -} - -// ValidateGenesis performs genesis state validation for the crisis module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var data types.GenesisState - if err := cdc.UnmarshalAsJSON(bz, &data); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - - return types.ValidateGenesis(&data) -} - -func (am AppModuleBasic) ValidateGenesisStream(cdc codec.JSONCodec, config client.TxEncodingConfig, genesisCh <-chan json.RawMessage) error { - for genesis := range genesisCh { - err := am.ValidateGenesis(cdc, config, genesis) - if err != nil { - return err - } - } - return nil -} - -// RegisterRESTRoutes registers no REST routes for the crisis module. -func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the capability module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) {} - -// GetTxCmd returns the root tx command for the crisis module. -func (b AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.NewTxCmd() -} - -// GetQueryCmd returns no root query command for the crisis module. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { return nil } - -// RegisterInterfaces registers interfaces and implementations of the crisis -// module. -func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { - types.RegisterInterfaces(registry) -} - -// AppModule implements an application module for the crisis module. -type AppModule struct { - AppModuleBasic - - // NOTE: We store a reference to the keeper here so that after a module - // manager is created, the invariants can be properly registered and - // executed. - keeper *keeper.Keeper - - skipGenesisInvariants bool -} - -// NewAppModule creates a new AppModule object. If initChainAssertInvariants is set, -// we will call keeper.AssertInvariants during InitGenesis (it may take a significant time) -// - which doesn't impact the chain security unless 66+% of validators have a wrongly -// modified genesis file. -func NewAppModule(keeper *keeper.Keeper, skipGenesisInvariants bool) AppModule { - return AppModule{ - AppModuleBasic: AppModuleBasic{}, - keeper: keeper, - - skipGenesisInvariants: skipGenesisInvariants, - } -} - -// AddModuleInitFlags implements servertypes.ModuleInitFlags interface. -func AddModuleInitFlags(startCmd *cobra.Command) { - startCmd.Flags().Bool(FlagSkipGenesisInvariants, false, "Skip x/crisis invariants check on startup") -} - -// Name returns the crisis module's name. -func (AppModule) Name() string { - return types.ModuleName -} - -// RegisterInvariants performs a no-op. -func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// Route returns the message routing key for the crisis module. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(RouterKey, NewHandler(*am.keeper)) -} - -// QuerierRoute returns no querier route. -func (AppModule) QuerierRoute() string { return "" } - -// LegacyQuerierHandler returns no sdk.Querier. -func (AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier { return nil } - -// RegisterServices registers module services. -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), am.keeper) -} - -// InitGenesis performs genesis initialization for the crisis module. It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { - start := time.Now() - var genesisState types.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) - telemetry.MeasureSince(start, "InitGenesis", "crisis", "unmarshal") - - am.keeper.InitGenesis(ctx, &genesisState) - if !am.skipGenesisInvariants { - am.keeper.AssertInvariants(ctx) - } - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the exported genesis state as raw bytes for the crisis -// module. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - gs := am.keeper.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) -} - -func (am AppModule) ExportGenesisStream(ctx sdk.Context, cdc codec.JSONCodec) <-chan json.RawMessage { - ch := make(chan json.RawMessage) - go func() { - ch <- am.ExportGenesis(ctx, cdc) - close(ch) - }() - return ch -} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } diff --git a/sei-cosmos/x/crisis/spec/01_state.md b/sei-cosmos/x/crisis/spec/01_state.md deleted file mode 100644 index 1efc7fe04f..0000000000 --- a/sei-cosmos/x/crisis/spec/01_state.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# State - -## ConstantFee - -Due to the anticipated large gas cost requirement to verify an invariant (and -potential to exceed the maximum allowable block gas limit) a constant fee is -used instead of the standard gas consumption method. The constant fee is -intended to be larger than the anticipated gas cost of running the invariant -with the standard gas consumption method. - -The ConstantFee param is held in the global params store. - -- Params: `mint/params -> legacy_amino(sdk.Coin)` diff --git a/sei-cosmos/x/crisis/spec/02_messages.md b/sei-cosmos/x/crisis/spec/02_messages.md deleted file mode 100644 index 640d2c4615..0000000000 --- a/sei-cosmos/x/crisis/spec/02_messages.md +++ /dev/null @@ -1,25 +0,0 @@ - - -# Messages - -In this section we describe the processing of the crisis messages and the -corresponding updates to the state. - -## MsgVerifyInvariant - -Blockchain invariants can be checked using the `MsgVerifyInvariant` message. - -+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc7/proto/cosmos/crisis/v1beta1/tx.proto#L14-L22 - -This message is expected to fail if: - -- the sender does not have enough coins for the constant fee -- the invariant route is not registered - -This message checks the invariant provided, and if the invariant is broken it -panics, halting the blockchain. If the invariant is broken, the constant fee is -never deducted as the transaction is never committed to a block (equivalent to -being refunded). However, if the invariant is not broken, the constant fee will -not be refunded. diff --git a/sei-cosmos/x/crisis/spec/03_events.md b/sei-cosmos/x/crisis/spec/03_events.md deleted file mode 100644 index 5aef2078eb..0000000000 --- a/sei-cosmos/x/crisis/spec/03_events.md +++ /dev/null @@ -1,18 +0,0 @@ - - -# Events - -The crisis module emits the following events: - -## Handlers - -### MsgVerifyInvariance - -| Type | Attribute Key | Attribute Value | -|-----------|---------------|------------------| -| invariant | route | {invariantRoute} | -| message | module | crisis | -| message | action | verify_invariant | -| message | sender | {senderAddress} | diff --git a/sei-cosmos/x/crisis/spec/04_params.md b/sei-cosmos/x/crisis/spec/04_params.md deleted file mode 100644 index 0d046adaa5..0000000000 --- a/sei-cosmos/x/crisis/spec/04_params.md +++ /dev/null @@ -1,11 +0,0 @@ - - -# Parameters - -The crisis module contains the following parameters: - -| Key | Type | Example | -|-------------|---------------|-----------------------------------| -| ConstantFee | object (coin) | {"denom":"uatom","amount":"1000"} | diff --git a/sei-cosmos/x/crisis/spec/05_client.md b/sei-cosmos/x/crisis/spec/05_client.md deleted file mode 100644 index 5f95955a65..0000000000 --- a/sei-cosmos/x/crisis/spec/05_client.md +++ /dev/null @@ -1,31 +0,0 @@ - - -# Client - -## CLI - -A user can query and interact with the `crisis` module using the CLI. - -### Transactions - -The `tx` commands allow users to interact with the `crisis` module. - -```bash -simd tx crisis --help -``` - -#### invariant-broken - -The `invariant-broken` command submits proof when an invariant was broken to halt the chain - -```bash -simd tx crisis invariant-broken [module-name] [invariant-route] [flags] -``` - -Example: - -```bash -simd tx crisis invariant-broken bank total-supply --from=[keyname or address] -``` diff --git a/sei-cosmos/x/crisis/spec/README.md b/sei-cosmos/x/crisis/spec/README.md deleted file mode 100644 index 3704da56d1..0000000000 --- a/sei-cosmos/x/crisis/spec/README.md +++ /dev/null @@ -1,24 +0,0 @@ - - -# `crisis` - -## Overview - -The crisis module halts the blockchain under the circumstance that a blockchain -invariant is broken. Invariants can be registered with the application during the -application initialization process. - -## Contents - -1. **[State](01_state.md)** - - [ConstantFee](01_state.md#constantfee) -2. **[Messages](02_messages.md)** - - [MsgVerifyInvariant](02_messages.md#msgverifyinvariant) -3. **[Events](03_events.md)** - - [Handlers](03_events.md#handlers) -4. **[Parameters](04_params.md)** diff --git a/sei-cosmos/x/crisis/types/codec.go b/sei-cosmos/x/crisis/types/codec.go deleted file mode 100644 index cf7d733001..0000000000 --- a/sei-cosmos/x/crisis/types/codec.go +++ /dev/null @@ -1,41 +0,0 @@ -package types - -import ( - "github.com/sei-protocol/sei-chain/sei-cosmos/codec" - codectypes "github.com/sei-protocol/sei-chain/sei-cosmos/codec/types" - cryptocodec "github.com/sei-protocol/sei-chain/sei-cosmos/crypto/codec" - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/types/msgservice" -) - -// RegisterLegacyAminoCodec registers the necessary x/crisis interfaces and concrete types -// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgVerifyInvariant{}, "cosmos-sdk/MsgVerifyInvariant", nil) -} - -func RegisterInterfaces(registry codectypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgVerifyInvariant{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/crisis module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding as Amino is - // still used for that purpose. - // - // The actual codec used for serialization should be provided to x/crisis and - // defined at the application level. - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} diff --git a/sei-cosmos/x/crisis/types/errors.go b/sei-cosmos/x/crisis/types/errors.go deleted file mode 100644 index 2a70a70a4d..0000000000 --- a/sei-cosmos/x/crisis/types/errors.go +++ /dev/null @@ -1,11 +0,0 @@ -package types - -import ( - sdkerrors "github.com/sei-protocol/sei-chain/sei-cosmos/types/errors" -) - -// x/crisis module sentinel errors -var ( - ErrNoSender = sdkerrors.Register(ModuleName, 2, "sender address is empty") - ErrUnknownInvariant = sdkerrors.Register(ModuleName, 3, "unknown invariant") -) diff --git a/sei-cosmos/x/crisis/types/events.go b/sei-cosmos/x/crisis/types/events.go deleted file mode 100644 index a20a7d7a7e..0000000000 --- a/sei-cosmos/x/crisis/types/events.go +++ /dev/null @@ -1,9 +0,0 @@ -package types - -// crisis module event types -const ( - EventTypeInvariant = "invariant" - - AttributeValueCrisis = ModuleName - AttributeKeyRoute = "route" -) diff --git a/sei-cosmos/x/crisis/types/expected_keepers.go b/sei-cosmos/x/crisis/types/expected_keepers.go deleted file mode 100644 index 130a28f894..0000000000 --- a/sei-cosmos/x/crisis/types/expected_keepers.go +++ /dev/null @@ -1,10 +0,0 @@ -package types - -import ( - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" -) - -// SupplyKeeper defines the expected supply keeper (noalias) -type SupplyKeeper interface { - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error -} diff --git a/sei-cosmos/x/crisis/types/genesis.go b/sei-cosmos/x/crisis/types/genesis.go deleted file mode 100644 index f3802d0d38..0000000000 --- a/sei-cosmos/x/crisis/types/genesis.go +++ /dev/null @@ -1,29 +0,0 @@ -package types - -import ( - "fmt" - - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" -) - -// NewGenesisState creates a new GenesisState object -func NewGenesisState(constantFee sdk.Coin) *GenesisState { - return &GenesisState{ - ConstantFee: constantFee, - } -} - -// DefaultGenesisState creates a default GenesisState object -func DefaultGenesisState() *GenesisState { - return &GenesisState{ - ConstantFee: sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1000)), - } -} - -// ValidateGenesis - validate crisis genesis data -func ValidateGenesis(data *GenesisState) error { - if !data.ConstantFee.IsPositive() { - return fmt.Errorf("constant fee must be positive: %s", data.ConstantFee) - } - return nil -} diff --git a/sei-cosmos/x/crisis/types/genesis.pb.go b/sei-cosmos/x/crisis/types/genesis.pb.go deleted file mode 100644 index fa7c2b2e10..0000000000 --- a/sei-cosmos/x/crisis/types/genesis.pb.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/crisis/v1beta1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - types "github.com/sei-protocol/sei-chain/sei-cosmos/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the crisis module's genesis state. -type GenesisState struct { - // constant_fee is the fee used to verify the invariant in the crisis - // module. - ConstantFee types.Coin `protobuf:"bytes,3,opt,name=constant_fee,json=constantFee,proto3" json:"constant_fee" yaml:"constant_fee"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_7a9c2781aa8a27ae, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetConstantFee() types.Coin { - if m != nil { - return m.ConstantFee - } - return types.Coin{} -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "cosmos.crisis.v1beta1.GenesisState") -} - -func init() { - proto.RegisterFile("cosmos/crisis/v1beta1/genesis.proto", fileDescriptor_7a9c2781aa8a27ae) -} - -var fileDescriptor_7a9c2781aa8a27ae = []byte{ - // 248 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2e, 0xca, 0x2c, 0xce, 0x2c, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, - 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, - 0x12, 0x85, 0x28, 0xd2, 0x83, 0x28, 0xd2, 0x83, 0x2a, 0x92, 0x92, 0x83, 0xea, 0x4d, 0x4a, 0x2c, - 0x4e, 0x85, 0xeb, 0x4c, 0xce, 0xcf, 0xcc, 0x83, 0x68, 0x93, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, - 0x33, 0xf5, 0x41, 0x2c, 0x88, 0xa8, 0x52, 0x26, 0x17, 0x8f, 0x3b, 0xc4, 0xf4, 0xe0, 0x92, 0xc4, - 0x92, 0x54, 0xa1, 0x48, 0x2e, 0x9e, 0xe4, 0xfc, 0xbc, 0xe2, 0x92, 0xc4, 0xbc, 0x92, 0xf8, 0xb4, - 0xd4, 0x54, 0x09, 0x66, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x49, 0x3d, 0xa8, 0x9d, 0x20, 0xc3, 0x61, - 0x36, 0xea, 0x39, 0xe7, 0x67, 0xe6, 0x39, 0x49, 0x9f, 0xb8, 0x27, 0xcf, 0xf0, 0xe9, 0x9e, 0xbc, - 0x70, 0x65, 0x62, 0x6e, 0x8e, 0x95, 0x12, 0xb2, 0x66, 0xa5, 0x20, 0x6e, 0x18, 0xd7, 0x2d, 0x35, - 0xd5, 0x29, 0xf4, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, - 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xac, 0xd3, 0x33, - 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x8b, 0x53, 0x33, 0x75, 0xc1, 0x4e, 0x4b, - 0xce, 0xcf, 0x01, 0x73, 0x92, 0x33, 0x12, 0x33, 0xf3, 0x20, 0x2c, 0x88, 0x07, 0x2b, 0x60, 0xc1, - 0x53, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x56, 0x6d, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, - 0x36, 0x14, 0x8a, 0x75, 0x3c, 0x01, 0x00, 0x00, -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConstantFee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConstantFee.Size() - n += 1 + l + sovGenesis(uint64(l)) - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConstantFee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConstantFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/sei-cosmos/x/crisis/types/keys.go b/sei-cosmos/x/crisis/types/keys.go deleted file mode 100644 index 8f009eda41..0000000000 --- a/sei-cosmos/x/crisis/types/keys.go +++ /dev/null @@ -1,6 +0,0 @@ -package types - -const ( - // module name - ModuleName = "crisis" -) diff --git a/sei-cosmos/x/crisis/types/msgs.go b/sei-cosmos/x/crisis/types/msgs.go deleted file mode 100644 index 5d06973c90..0000000000 --- a/sei-cosmos/x/crisis/types/msgs.go +++ /dev/null @@ -1,45 +0,0 @@ -package types - -import ( - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" -) - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgVerifyInvariant{} - -// NewMsgVerifyInvariant creates a new MsgVerifyInvariant object -func NewMsgVerifyInvariant(sender sdk.AccAddress, invModeName, invRoute string) *MsgVerifyInvariant { - return &MsgVerifyInvariant{ - Sender: sender.String(), - InvariantModuleName: invModeName, - InvariantRoute: invRoute, - } -} - -func (msg MsgVerifyInvariant) Route() string { return ModuleName } -func (msg MsgVerifyInvariant) Type() string { return "verify_invariant" } - -// get the bytes for the message signer to sign on -func (msg MsgVerifyInvariant) GetSigners() []sdk.AccAddress { - sender, _ := sdk.AccAddressFromBech32(msg.Sender) - return []sdk.AccAddress{sender} -} - -// GetSignBytes gets the sign bytes for the msg MsgVerifyInvariant -func (msg MsgVerifyInvariant) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// quick validity check -func (msg MsgVerifyInvariant) ValidateBasic() error { - if msg.Sender == "" { - return ErrNoSender - } - return nil -} - -// FullInvariantRoute - get the messages full invariant route -func (msg MsgVerifyInvariant) FullInvariantRoute() string { - return msg.InvariantModuleName + "/" + msg.InvariantRoute -} diff --git a/sei-cosmos/x/crisis/types/params.go b/sei-cosmos/x/crisis/types/params.go deleted file mode 100644 index dbb7744082..0000000000 --- a/sei-cosmos/x/crisis/types/params.go +++ /dev/null @@ -1,33 +0,0 @@ -package types - -import ( - "fmt" - - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" - paramtypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/params/types" -) - -var ( - // key for constant fee parameter - ParamStoreKeyConstantFee = []byte("ConstantFee") -) - -// type declaration for parameters -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable( - paramtypes.NewParamSetPair(ParamStoreKeyConstantFee, sdk.Coin{}, validateConstantFee), - ) -} - -func validateConstantFee(i interface{}) error { - v, ok := i.(sdk.Coin) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if !v.IsValid() { - return fmt.Errorf("invalid constant fee: %s", v) - } - - return nil -} diff --git a/sei-cosmos/x/crisis/types/route.go b/sei-cosmos/x/crisis/types/route.go deleted file mode 100644 index 1dc4111971..0000000000 --- a/sei-cosmos/x/crisis/types/route.go +++ /dev/null @@ -1,26 +0,0 @@ -package types - -import ( - sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" -) - -// invariant route -type InvarRoute struct { - ModuleName string - Route string - Invar sdk.Invariant -} - -// NewInvarRoute - create an InvarRoute object -func NewInvarRoute(moduleName, route string, invar sdk.Invariant) InvarRoute { - return InvarRoute{ - ModuleName: moduleName, - Route: route, - Invar: invar, - } -} - -// get the full invariance route -func (i InvarRoute) FullRoute() string { - return i.ModuleName + "/" + i.Route -} diff --git a/sei-cosmos/x/crisis/types/tx.pb.go b/sei-cosmos/x/crisis/types/tx.pb.go deleted file mode 100644 index b2377202c1..0000000000 --- a/sei-cosmos/x/crisis/types/tx.pb.go +++ /dev/null @@ -1,615 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/crisis/v1beta1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgVerifyInvariant represents a message to verify a particular invariance. -type MsgVerifyInvariant struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - InvariantModuleName string `protobuf:"bytes,2,opt,name=invariant_module_name,json=invariantModuleName,proto3" json:"invariant_module_name,omitempty" yaml:"invariant_module_name"` - InvariantRoute string `protobuf:"bytes,3,opt,name=invariant_route,json=invariantRoute,proto3" json:"invariant_route,omitempty" yaml:"invariant_route"` -} - -func (m *MsgVerifyInvariant) Reset() { *m = MsgVerifyInvariant{} } -func (m *MsgVerifyInvariant) String() string { return proto.CompactTextString(m) } -func (*MsgVerifyInvariant) ProtoMessage() {} -func (*MsgVerifyInvariant) Descriptor() ([]byte, []int) { - return fileDescriptor_61276163172fe867, []int{0} -} -func (m *MsgVerifyInvariant) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgVerifyInvariant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgVerifyInvariant.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgVerifyInvariant) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgVerifyInvariant.Merge(m, src) -} -func (m *MsgVerifyInvariant) XXX_Size() int { - return m.Size() -} -func (m *MsgVerifyInvariant) XXX_DiscardUnknown() { - xxx_messageInfo_MsgVerifyInvariant.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgVerifyInvariant proto.InternalMessageInfo - -// MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. -type MsgVerifyInvariantResponse struct { -} - -func (m *MsgVerifyInvariantResponse) Reset() { *m = MsgVerifyInvariantResponse{} } -func (m *MsgVerifyInvariantResponse) String() string { return proto.CompactTextString(m) } -func (*MsgVerifyInvariantResponse) ProtoMessage() {} -func (*MsgVerifyInvariantResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_61276163172fe867, []int{1} -} -func (m *MsgVerifyInvariantResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgVerifyInvariantResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgVerifyInvariantResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgVerifyInvariantResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgVerifyInvariantResponse.Merge(m, src) -} -func (m *MsgVerifyInvariantResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgVerifyInvariantResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgVerifyInvariantResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgVerifyInvariantResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgVerifyInvariant)(nil), "cosmos.crisis.v1beta1.MsgVerifyInvariant") - proto.RegisterType((*MsgVerifyInvariantResponse)(nil), "cosmos.crisis.v1beta1.MsgVerifyInvariantResponse") -} - -func init() { proto.RegisterFile("cosmos/crisis/v1beta1/tx.proto", fileDescriptor_61276163172fe867) } - -var fileDescriptor_61276163172fe867 = []byte{ - // 329 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2e, 0xca, 0x2c, 0xce, 0x2c, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, - 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0xc8, 0xeb, 0x41, - 0xe4, 0xf5, 0xa0, 0xf2, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x15, 0xfa, 0x20, 0x16, 0x44, - 0xb1, 0xd2, 0x45, 0x46, 0x2e, 0x21, 0xdf, 0xe2, 0xf4, 0xb0, 0xd4, 0xa2, 0xcc, 0xb4, 0x4a, 0xcf, - 0xbc, 0xb2, 0xc4, 0xa2, 0xcc, 0xc4, 0xbc, 0x12, 0x21, 0x31, 0x2e, 0xb6, 0xe2, 0xd4, 0xbc, 0x94, - 0xd4, 0x22, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x28, 0x4f, 0x28, 0x84, 0x4b, 0x34, 0x13, - 0xa6, 0x28, 0x3e, 0x37, 0x3f, 0xa5, 0x34, 0x27, 0x35, 0x3e, 0x2f, 0x31, 0x37, 0x55, 0x82, 0x09, - 0xa4, 0xcc, 0x49, 0xe1, 0xd3, 0x3d, 0x79, 0x99, 0xca, 0xc4, 0xdc, 0x1c, 0x2b, 0x25, 0xac, 0xca, - 0x94, 0x82, 0x84, 0xe1, 0xe2, 0xbe, 0x60, 0x61, 0xbf, 0xc4, 0xdc, 0x54, 0x21, 0x67, 0x2e, 0x7e, - 0x84, 0xf2, 0xa2, 0xfc, 0xd2, 0x92, 0x54, 0x09, 0x66, 0xb0, 0x79, 0x52, 0x9f, 0xee, 0xc9, 0x8b, - 0xa1, 0x9b, 0x07, 0x56, 0xa0, 0x14, 0xc4, 0x07, 0x17, 0x09, 0x02, 0x09, 0x58, 0x71, 0x74, 0x2c, - 0x90, 0x67, 0x78, 0xb1, 0x40, 0x9e, 0x41, 0x49, 0x86, 0x4b, 0x0a, 0xd3, 0x4b, 0x41, 0xa9, 0xc5, - 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x46, 0x65, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0xf9, 0x5c, 0xfc, - 0xe8, 0x9e, 0xd6, 0xd4, 0xc3, 0x1a, 0x72, 0x7a, 0x98, 0x86, 0x49, 0x19, 0x12, 0xad, 0x14, 0x66, - 0xaf, 0x53, 0xe8, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, - 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x59, 0xa7, 0x67, - 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x17, 0xa7, 0x66, 0xea, 0x82, 0x63, 0x26, - 0x39, 0x3f, 0x07, 0xcc, 0x49, 0xce, 0x48, 0xcc, 0xcc, 0x83, 0xb0, 0x20, 0xd1, 0x5e, 0x01, 0x8b, - 0xf8, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x6a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x87, 0xa0, 0xcd, 0x34, 0x16, 0x02, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - // VerifyInvariant defines a method to verify a particular invariance. - VerifyInvariant(ctx context.Context, in *MsgVerifyInvariant, opts ...grpc.CallOption) (*MsgVerifyInvariantResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) VerifyInvariant(ctx context.Context, in *MsgVerifyInvariant, opts ...grpc.CallOption) (*MsgVerifyInvariantResponse, error) { - out := new(MsgVerifyInvariantResponse) - err := c.cc.Invoke(ctx, "/cosmos.crisis.v1beta1.Msg/VerifyInvariant", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // VerifyInvariant defines a method to verify a particular invariance. - VerifyInvariant(context.Context, *MsgVerifyInvariant) (*MsgVerifyInvariantResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) VerifyInvariant(ctx context.Context, req *MsgVerifyInvariant) (*MsgVerifyInvariantResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method VerifyInvariant not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_VerifyInvariant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgVerifyInvariant) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).VerifyInvariant(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.crisis.v1beta1.Msg/VerifyInvariant", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).VerifyInvariant(ctx, req.(*MsgVerifyInvariant)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.crisis.v1beta1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "VerifyInvariant", - Handler: _Msg_VerifyInvariant_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/crisis/v1beta1/tx.proto", -} - -func (m *MsgVerifyInvariant) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgVerifyInvariant) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgVerifyInvariant) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.InvariantRoute) > 0 { - i -= len(m.InvariantRoute) - copy(dAtA[i:], m.InvariantRoute) - i = encodeVarintTx(dAtA, i, uint64(len(m.InvariantRoute))) - i-- - dAtA[i] = 0x1a - } - if len(m.InvariantModuleName) > 0 { - i -= len(m.InvariantModuleName) - copy(dAtA[i:], m.InvariantModuleName) - i = encodeVarintTx(dAtA, i, uint64(len(m.InvariantModuleName))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgVerifyInvariantResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgVerifyInvariantResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgVerifyInvariantResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgVerifyInvariant) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.InvariantModuleName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.InvariantRoute) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgVerifyInvariantResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgVerifyInvariant) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgVerifyInvariant: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVerifyInvariant: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InvariantModuleName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InvariantModuleName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InvariantRoute", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InvariantRoute = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgVerifyInvariantResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgVerifyInvariantResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVerifyInvariantResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/sei-db/tools/cmd/seidb/operations/module.go b/sei-db/tools/cmd/seidb/operations/module.go index e2136a7dc3..766cfb3c02 100644 --- a/sei-db/tools/cmd/seidb/operations/module.go +++ b/sei-db/tools/cmd/seidb/operations/module.go @@ -1,5 +1,5 @@ package operations var AllModules = []string{ - "evm", "wasm", "oracle", "epoch", "mint", "acc", "bank", "crisis", "feegrant", "staking", "distribution", "slashing", "gov", "params", "ibc", "upgrade", "evidence", "transfer", "tokenfactory", + "evm", "wasm", "oracle", "epoch", "mint", "acc", "bank", "feegrant", "staking", "distribution", "slashing", "gov", "params", "ibc", "upgrade", "evidence", "transfer", "tokenfactory", } diff --git a/sei-ibc-go/testing/simapp/app.go b/sei-ibc-go/testing/simapp/app.go index c4619ea9c5..b0e881ecc9 100644 --- a/sei-ibc-go/testing/simapp/app.go +++ b/sei-ibc-go/testing/simapp/app.go @@ -14,7 +14,6 @@ import ( tmcfg "github.com/sei-protocol/sei-chain/sei-tendermint/config" tmos "github.com/sei-protocol/sei-chain/sei-tendermint/libs/os" tmproto "github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" - "github.com/spf13/cast" dbm "github.com/tendermint/tm-db" "github.com/sei-protocol/sei-chain/sei-cosmos/baseapp" @@ -49,9 +48,6 @@ import ( capabilitytypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/capability/types" simappparams "github.com/sei-protocol/sei-chain/sei-ibc-go/testing/simapp/params" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis" - crisiskeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/keeper" - crisistypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" distr "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution" distrclient "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution/client" distrkeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution/keeper" @@ -131,7 +127,6 @@ var ( ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler, ), params.AppModuleBasic{}, - crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, ibc.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, @@ -171,8 +166,6 @@ type SimApp struct { appCodec codec.Codec interfaceRegistry types.InterfaceRegistry - invCheckPeriod uint - // keys to access the substores keys map[string]*sdk.KVStoreKey tkeys map[string]*sdk.TransientStoreKey @@ -186,7 +179,6 @@ type SimApp struct { SlashingKeeper slashingkeeper.Keeper DistrKeeper distrkeeper.Keeper GovKeeper govkeeper.Keeper - CrisisKeeper crisiskeeper.Keeper UpgradeKeeper upgradekeeper.Keeper ParamsKeeper paramskeeper.Keeper AuthzKeeper authzkeeper.Keeper @@ -230,7 +222,7 @@ func init() { // NewSimApp returns a reference to an initialized SimApp. func NewSimApp( db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool, - homePath string, invCheckPeriod uint, tmConfig *tmcfg.Config, encodingConfig simappparams.EncodingConfig, + homePath string, _ uint, tmConfig *tmcfg.Config, encodingConfig simappparams.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *SimApp { appCodec := encodingConfig.Marshaler @@ -257,7 +249,6 @@ func NewSimApp( legacyAmino: legacyAmino, appCodec: appCodec, interfaceRegistry: interfaceRegistry, - invCheckPeriod: invCheckPeriod, keys: keys, tkeys: tkeys, memKeys: memKeys, @@ -301,10 +292,6 @@ func NewSimApp( app.SlashingKeeper = slashingkeeper.NewKeeper( appCodec, keys[slashingtypes.StoreKey], &stakingKeeper, app.GetSubspace(slashingtypes.ModuleName), ) - app.CrisisKeeper = crisiskeeper.NewKeeper( - app.GetSubspace(crisistypes.ModuleName), invCheckPeriod, app.BankKeeper, authtypes.FeeCollectorName, - ) - app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp) @@ -385,12 +372,6 @@ func NewSimApp( // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper - /**** 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( @@ -402,7 +383,6 @@ func NewSimApp( vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), capability.NewAppModule(appCodec, *app.CapabilityKeeper), - crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), @@ -425,12 +405,11 @@ func NewSimApp( // can do so safely. app.mm.SetOrderInitGenesis( capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, - slashingtypes.ModuleName, govtypes.ModuleName, crisistypes.ModuleName, + slashingtypes.ModuleName, govtypes.ModuleName, ibchost.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, ibctransfertypes.ModuleName, icatypes.ModuleName, ibcmock.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, ) - app.mm.RegisterInvariants(&app.CrisisKeeper) app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.mm.RegisterServices(app.configurator) @@ -568,7 +547,6 @@ func (app *SimApp) BeginBlocker(ctx sdk.Context) { // EndBlocker application updates every end block func (app *SimApp) EndBlocker(ctx sdk.Context) []abci.ValidatorUpdate { - crisis.EndBlocker(ctx, app.CrisisKeeper) gov.EndBlocker(ctx, app.GovKeeper) return staking.EndBlocker(ctx, app.StakingKeeper) } @@ -739,7 +717,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()) - paramsKeeper.Subspace(crisistypes.ModuleName) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) paramsKeeper.Subspace(icacontrollertypes.SubModuleName) diff --git a/sei-ibc-go/testing/simapp/export.go b/sei-ibc-go/testing/simapp/export.go index e5d365deb0..79258d1665 100644 --- a/sei-ibc-go/testing/simapp/export.go +++ b/sei-ibc-go/testing/simapp/export.go @@ -64,9 +64,6 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] 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 diff --git a/sei-ibc-go/testing/simapp/simd/cmd/root.go b/sei-ibc-go/testing/simapp/simd/cmd/root.go index 65e84e18e0..90f9ffd5cc 100644 --- a/sei-ibc-go/testing/simapp/simd/cmd/root.go +++ b/sei-ibc-go/testing/simapp/simd/cmd/root.go @@ -22,7 +22,6 @@ import ( authcmd "github.com/sei-protocol/sei-chain/sei-cosmos/x/auth/client/cli" "github.com/sei-protocol/sei-chain/sei-cosmos/x/auth/types" banktypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/bank/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis" genutilcli "github.com/sei-protocol/sei-chain/sei-cosmos/x/genutil/client/cli" tmcfg "github.com/sei-protocol/sei-chain/sei-tendermint/config" tmcli "github.com/sei-protocol/sei-chain/sei-tendermint/libs/cli" @@ -170,8 +169,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { rootCmd.AddCommand(server.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler)) } -func addModuleInitFlags(startCmd *cobra.Command) { - crisis.AddModuleInitFlags(startCmd) +func addModuleInitFlags(_ *cobra.Command) { } func queryCommand() *cobra.Command { diff --git a/sei-wasmd/app/app.go b/sei-wasmd/app/app.go index 3b6ce3d578..3d0b15fb17 100644 --- a/sei-wasmd/app/app.go +++ b/sei-wasmd/app/app.go @@ -40,9 +40,6 @@ import ( "github.com/sei-protocol/sei-chain/sei-cosmos/x/capability" capabilitykeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/capability/keeper" capabilitytypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/capability/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis" - crisiskeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/keeper" - crisistypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" distr "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution" distrclient "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution/client" distrkeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution/keeper" @@ -102,7 +99,6 @@ import ( tmjson "github.com/sei-protocol/sei-chain/sei-tendermint/libs/json" tmos "github.com/sei-protocol/sei-chain/sei-tendermint/libs/os" tmproto "github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" - "github.com/spf13/cast" dbm "github.com/tendermint/tm-db" wasmappparams "github.com/sei-protocol/sei-chain/sei-wasmd/app/params" @@ -194,7 +190,6 @@ var ( )..., ), params.AppModuleBasic{}, - crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, ibc.AppModuleBasic{}, @@ -231,8 +226,6 @@ type WasmApp struct { appCodec codec.Codec interfaceRegistry types.InterfaceRegistry - invCheckPeriod uint - // keys to access the substores keys map[string]*sdk.KVStoreKey tkeys map[string]*sdk.TransientStoreKey @@ -247,7 +240,6 @@ type WasmApp struct { mintKeeper mintkeeper.Keeper distrKeeper distrkeeper.Keeper govKeeper govkeeper.Keeper - crisisKeeper crisiskeeper.Keeper upgradeKeeper upgradekeeper.Keeper paramsKeeper paramskeeper.Keeper evidenceKeeper evidencekeeper.Keeper @@ -281,7 +273,7 @@ func NewWasmApp( loadLatest bool, skipUpgradeHeights map[int64]bool, homePath string, - invCheckPeriod uint, + _ uint, tmConfig *tmcfg.Config, encodingConfig wasmappparams.EncodingConfig, enabledProposals []wasm.ProposalType, @@ -311,7 +303,6 @@ func NewWasmApp( legacyAmino: legacyAmino, appCodec: appCodec, interfaceRegistry: interfaceRegistry, - invCheckPeriod: invCheckPeriod, keys: keys, tkeys: tkeys, memKeys: memKeys, @@ -394,12 +385,6 @@ func NewWasmApp( &stakingKeeper, app.getSubspace(slashingtypes.ModuleName), ) - app.crisisKeeper = crisiskeeper.NewKeeper( - app.getSubspace(crisistypes.ModuleName), - invCheckPeriod, - app.bankKeeper, - authtypes.FeeCollectorName, - ) app.upgradeKeeper = upgradekeeper.NewKeeper( skipUpgradeHeights, keys[upgradetypes.StoreKey], @@ -540,12 +525,6 @@ func NewWasmApp( app.paramsKeeper, govRouter, ) - /**** 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( @@ -572,7 +551,6 @@ func NewWasmApp( transferModule, authzmodule.NewAppModule(appCodec, app.authzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry), params.NewAppModule(app.paramsKeeper), - crisis.NewAppModule(&app.crisisKeeper, skipGenesisInvariants), // always be last to make sure that it checks for all invariants and not only part of them ) // NOTE: The genutils module must occur after staking so that pools are @@ -591,7 +569,6 @@ func NewWasmApp( slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, - crisistypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, @@ -610,7 +587,6 @@ func NewWasmApp( // Uncomment if you want to set a custom migration order here. // app.mm.SetOrderMigrations(custom order) - app.mm.RegisterInvariants(&app.crisisKeeper) app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) @@ -772,7 +748,6 @@ func (app *WasmApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci } func (app *WasmApp) EndBlocker(ctx sdk.Context) []abci.ValidatorUpdate { - crisis.EndBlocker(ctx, app.crisisKeeper) gov.EndBlocker(ctx, app.govKeeper) return staking.EndBlocker(ctx, app.stakingKeeper) } @@ -887,7 +862,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()) - paramsKeeper.Subspace(crisistypes.ModuleName) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) paramsKeeper.Subspace(icahosttypes.SubModuleName) diff --git a/sei-wasmd/app/export.go b/sei-wasmd/app/export.go index 65e58dc9cf..f2f7ceacb3 100644 --- a/sei-wasmd/app/export.go +++ b/sei-wasmd/app/export.go @@ -66,9 +66,6 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ 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 diff --git a/sei-wasmd/x/wasm/keeper/test_common.go b/sei-wasmd/x/wasm/keeper/test_common.go index 110388ef96..929e697e53 100644 --- a/sei-wasmd/x/wasm/keeper/test_common.go +++ b/sei-wasmd/x/wasm/keeper/test_common.go @@ -26,8 +26,6 @@ import ( "github.com/sei-protocol/sei-chain/sei-cosmos/x/capability" capabilitykeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/capability/keeper" capabilitytypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/capability/types" - "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis" - crisistypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/crisis/types" "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution" distrclient "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution/client" distributionkeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution/keeper" @@ -81,7 +79,6 @@ var ModuleBasics = module.NewBasicManager( paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, ), params.AppModuleBasic{}, - crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, @@ -248,7 +245,6 @@ func createTestInput( minttypes.ModuleName, distributiontypes.ModuleName, slashingtypes.ModuleName, - crisistypes.ModuleName, ibctransfertypes.ModuleName, capabilitytypes.ModuleName, ibchost.ModuleName, From 4972f18133874cdfb8c11b804c8ac2c8a36e8705 Mon Sep 17 00:00:00 2001 From: Tony Chen Date: Thu, 28 May 2026 13:22:37 +0800 Subject: [PATCH 3/4] Set crisis removal upgrade to v6.6.0 --- app/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 4e5dbab994..ee78f94660 100644 --- a/app/app.go +++ b/app/app.go @@ -1215,7 +1215,7 @@ func (app *App) SetStoreUpgradeHandlers() { app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) } - if (upgradeInfo.Name == "vTODO") && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + if (upgradeInfo.Name == "v6.6.0") && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := storetypes.StoreUpgrades{ Deleted: []string{crisisStoreKeyName}, } From 0001bf89175cd2668e39d624f74e641412568032 Mon Sep 17 00:00:00 2001 From: Tony Chen Date: Fri, 29 May 2026 11:43:04 +0800 Subject: [PATCH 4/4] Remove crisis store deletion hook --- app/app.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/app.go b/app/app.go index ee78f94660..cbdd6084c8 100644 --- a/app/app.go +++ b/app/app.go @@ -1142,7 +1142,6 @@ func (app *App) SetStoreUpgradeHandlers() { } accesscontrolStoreKeyName := "aclaccesscontrol" - crisisStoreKeyName := "crisis" if upgradeInfo.Name == "1.0.4beta" && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := storetypes.StoreUpgrades{ @@ -1214,15 +1213,6 @@ func (app *App) SetStoreUpgradeHandlers() { // configure store loader that checks if version == upgradeHeight and applies store upgrades app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) } - - if (upgradeInfo.Name == "v6.6.0") && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := storetypes.StoreUpgrades{ - Deleted: []string{crisisStoreKeyName}, - } - - // configure store loader that checks if version == upgradeHeight and applies store upgrades - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) - } } // AppName returns the name of the App