Skip to content

Commit e769fda

Browse files
committed
feat: update core deps and remove x/crisis
1 parent 2faa826 commit e769fda

File tree

14 files changed

+20
-253
lines changed

14 files changed

+20
-253
lines changed

app/consumer-democracy/app.go

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ import (
6969
"github.com/cosmos/cosmos-sdk/x/consensus"
7070
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
7171
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
72-
"github.com/cosmos/cosmos-sdk/x/crisis"
73-
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
74-
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
7572
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
7673
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
7774
"github.com/cosmos/cosmos-sdk/x/genutil"
@@ -154,7 +151,6 @@ var (
154151
},
155152
),
156153
params.AppModuleBasic{},
157-
crisis.AppModuleBasic{},
158154
slashing.AppModuleBasic{},
159155
feegrantmodule.AppModuleBasic{},
160156
authzmodule.AppModuleBasic{},
@@ -212,7 +208,6 @@ type App struct { // nolint: golint
212208
MintKeeper mintkeeper.Keeper
213209
DistrKeeper distrkeeper.Keeper
214210
GovKeeper govkeeper.Keeper
215-
CrisisKeeper crisiskeeper.Keeper
216211
UpgradeKeeper upgradekeeper.Keeper
217212
ParamsKeeper paramskeeper.Keeper
218213
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
@@ -262,7 +257,7 @@ func New(
262257
bApp.SetInterfaceRegistry(interfaceRegistry)
263258

264259
keys := storetypes.NewKVStoreKeys(
265-
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey,
260+
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
266261
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
267262
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
268263
evidencetypes.StoreKey, ibctransfertypes.StoreKey,
@@ -371,16 +366,6 @@ func New(
371366
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
372367
)
373368

374-
invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod))
375-
app.CrisisKeeper = *crisiskeeper.NewKeeper(
376-
appCodec,
377-
runtime.NewKVStoreService(keys[crisistypes.StoreKey]),
378-
invCheckPeriod,
379-
app.BankKeeper,
380-
authtypes.FeeCollectorName,
381-
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
382-
app.AccountKeeper.AddressCodec(),
383-
)
384369
// get skipUpgradeHeights from the app options
385370
skipUpgradeHeights := map[int64]bool{}
386371
for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) {
@@ -509,7 +494,6 @@ func New(
509494

510495
app.EvidenceKeeper = *evidenceKeeper
511496

512-
skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants))
513497

514498
// NOTE: Any module instantiated in the module manager that is later modified
515499
// must be passed by reference here.
@@ -524,7 +508,6 @@ func New(
524508
vesting.NewAppModule(app.AccountKeeper, app.BankKeeper),
525509
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)),
526510
// IBC v10: Capability module removed
527-
crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)),
528511
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
529512
ccvgov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, IsProposalWhitelisted, app.GetSubspace(govtypes.ModuleName), IsModuleWhiteList),
530513
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)),
@@ -568,7 +551,6 @@ func New(
568551
authtypes.ModuleName,
569552
banktypes.ModuleName,
570553
govtypes.ModuleName,
571-
crisistypes.ModuleName,
572554
authz.ModuleName,
573555
feegrant.ModuleName,
574556
paramstypes.ModuleName,
@@ -580,7 +562,6 @@ func New(
580562
consumertypes.ModuleName,
581563
)
582564
app.MM.SetOrderEndBlockers(
583-
crisistypes.ModuleName,
584565
govtypes.ModuleName,
585566
stakingtypes.ModuleName,
586567
// IBC v10: Capability module removed from begin block order
@@ -628,10 +609,8 @@ func New(
628609
ibchost.ModuleName,
629610
ibctransfertypes.ModuleName,
630611
consumertypes.ModuleName,
631-
crisistypes.ModuleName,
632612
)
633613

634-
app.MM.RegisterInvariants(&app.CrisisKeeper)
635614
app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())
636615
err := app.MM.RegisterServices(app.configurator)
637616
if err != nil {
@@ -1017,7 +996,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
1017996
paramsKeeper.Subspace(distrtypes.ModuleName)
1018997
paramsKeeper.Subspace(slashingtypes.ModuleName)
1019998
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(gov.ProvideKeyTable())
1020-
paramsKeeper.Subspace(crisistypes.ModuleName)
1021999
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
10221000
paramsKeeper.Subspace(ibchost.ModuleName)
10231001
paramsKeeper.Subspace(consumertypes.ModuleName)

app/consumer-democracy/export.go

Lines changed: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -49,131 +49,7 @@ func (app *App) ExportAppStateAndValidators(
4949
}
5050

5151
// prepare for fresh start at zero height
52-
// NOTE zero height genesis is a temporary feature which will be deprecated
53-
//
54-
// in favour of export at a block height
5552
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
56-
// applyAllowedAddrs := false
57-
58-
// check if there is a allowed address list
59-
// if len(jailAllowedAddrs) > 0 {
60-
// applyAllowedAddrs = true
61-
// }
62-
63-
// allowedAddrsMap := make(map[string]bool)
64-
65-
// for _, addr := range jailAllowedAddrs {
66-
// _, err := sdk.ValAddressFromBech32(addr)
67-
// if err != nil {
68-
// log.Fatal(err)
69-
// }
70-
// allowedAddrsMap[addr] = true
71-
// }
72-
73-
/* Just to be safe, assert the invariants on current state. */
74-
app.CrisisKeeper.AssertInvariants(ctx)
75-
76-
/* Handle fee distribution state. */
77-
78-
// withdraw all validator commission
79-
// app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
80-
// _, err := app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator())
81-
// if err != nil {
82-
// panic(err)
83-
// }
84-
// return false
85-
// })
86-
87-
// withdraw all delegator rewards
88-
// dels := app.StakingKeeper.GetAllDelegations(ctx)
89-
// for _, delegation := range dels {
90-
// _, err := app.DistrKeeper.WithdrawDelegationRewards(ctx, delegation.GetDelegatorAddr(), delegation.GetValidatorAddr())
91-
// if err != nil {
92-
// panic(err)
93-
// }
94-
// }
95-
96-
// clear validator slash events
97-
// app.DistrKeeper.DeleteAllValidatorSlashEvents(ctx)
98-
99-
// clear validator historical rewards
100-
// app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx)
101-
102-
// set context height to zero
103-
height := ctx.BlockHeight()
104-
ctx = ctx.WithBlockHeight(0)
105-
106-
// reinitialize all validators
107-
// app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
108-
// // donate any unwithdrawn outstanding reward fraction tokens to the community pool
109-
// scraps := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator())
110-
// feePool := app.DistrKeeper.GetFeePool(ctx)
111-
// feePool.CommunityPool = feePool.CommunityPool.Add(scraps...)
112-
// app.DistrKeeper.SetFeePool(ctx, feePool)
113-
114-
// app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator())
115-
// return false
116-
// })
117-
118-
// reinitialize all delegations
119-
// for _, del := range dels {
120-
// app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr())
121-
// app.DistrKeeper.Hooks().AfterDelegationModified(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr())
122-
// }
123-
124-
// reset context height
125-
ctx = ctx.WithBlockHeight(height)
126-
127-
/* Handle staking state. */
128-
129-
// iterate through redelegations, reset creation height
130-
// app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) {
131-
// for i := range red.Entries {
132-
// red.Entries[i].CreationHeight = 0
133-
// }
134-
// app.StakingKeeper.SetRedelegation(ctx, red)
135-
// return false
136-
// })
137-
138-
// iterate through unbonding delegations, reset creation height
139-
// app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
140-
// for i := range ubd.Entries {
141-
// ubd.Entries[i].CreationHeight = 0
142-
// }
143-
// app.StakingKeeper.SetUnbondingDelegation(ctx, ubd)
144-
// return false
145-
// })
146-
147-
// Iterate through validators by power descending, reset bond heights, and
148-
// update bond intra-tx counters.
149-
// store := ctx.KVStore(app.keys[stakingtypes.StoreKey])
150-
// iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey)
151-
// counter := int16(0)
152-
153-
// for ; iter.Valid(); iter.Next() {
154-
// addr := sdk.ValAddress(iter.Key()[1:])
155-
// validator, found := app.StakingKeeper.GetValidator(ctx, addr)
156-
// if !found {
157-
// panic("expected validator, not found")
158-
// }
159-
160-
// validator.UnbondingHeight = 0
161-
// if applyAllowedAddrs && !allowedAddrsMap[addr.String()] {
162-
// validator.Jailed = true
163-
// }
164-
165-
// app.StakingKeeper.SetValidator(ctx, validator)
166-
// counter++
167-
// }
168-
169-
// iter.Close()
170-
171-
// if _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx); err != nil {
172-
// panic(err)
173-
// }
174-
175-
/* Handle slashing state. */
176-
17753
// reset start height on signing infos
17854
app.SlashingKeeper.IterateValidatorSigningInfos(
17955
ctx,

app/consumer/app.go

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ import (
7171
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
7272
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
7373
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
74-
"github.com/cosmos/cosmos-sdk/x/crisis"
75-
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
76-
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
7774
"github.com/cosmos/cosmos-sdk/x/genutil"
7875
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
7976
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
@@ -127,7 +124,6 @@ var (
127124
bank.AppModuleBasic{},
128125
// IBC v10: capability.AppModuleBasic{} removed,
129126
params.AppModuleBasic{},
130-
crisis.AppModuleBasic{},
131127
slashing.AppModuleBasic{},
132128
feegrantmodule.AppModuleBasic{},
133129
authzmodule.AppModuleBasic{},
@@ -178,7 +174,6 @@ type App struct { // nolint: golint
178174
// IBC v10: CapabilityKeeper removed
179175
SlashingKeeper slashingkeeper.Keeper
180176

181-
CrisisKeeper crisiskeeper.Keeper
182177
UpgradeKeeper upgradekeeper.Keeper
183178
ParamsKeeper paramskeeper.Keeper
184179
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
@@ -228,7 +223,7 @@ func New(
228223
bApp.SetInterfaceRegistry(interfaceRegistry)
229224

230225
keys := storetypes.NewKVStoreKeys(
231-
authtypes.StoreKey, banktypes.StoreKey, slashingtypes.StoreKey, crisistypes.StoreKey,
226+
authtypes.StoreKey, banktypes.StoreKey, slashingtypes.StoreKey,
232227
paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey,
233228
evidencetypes.StoreKey, ibctransfertypes.StoreKey,
234229
feegrant.StoreKey, authzkeeper.StoreKey,
@@ -311,17 +306,6 @@ func New(
311306
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
312307
)
313308

314-
invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod))
315-
app.CrisisKeeper = *crisiskeeper.NewKeeper(
316-
appCodec,
317-
runtime.NewKVStoreService(keys[crisistypes.StoreKey]),
318-
invCheckPeriod,
319-
app.BankKeeper,
320-
authtypes.FeeCollectorName,
321-
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
322-
app.AccountKeeper.AddressCodec(),
323-
)
324-
325309
// get skipUpgradeHeights from the app options
326310
skipUpgradeHeights := map[int64]bool{}
327311
for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) {
@@ -416,8 +400,6 @@ func New(
416400

417401
app.EvidenceKeeper = *evidenceKeeper
418402

419-
skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants))
420-
421403
// IBC v10: Create light client module for tendermint
422404
// Reference: https://github.com/cosmos/interchain-security/blob/v7.0.1/app/consumer/app.go#L403-L404
423405
tmLightClientModule := ibctm.NewLightClientModule(appCodec, app.IBCKeeper.ClientKeeper.GetStoreProvider())
@@ -436,7 +418,6 @@ func New(
436418
vesting.NewAppModule(app.AccountKeeper, app.BankKeeper),
437419
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)),
438420
// IBC v10: Capability module removed
439-
crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)),
440421
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.ConsumerKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry),
441422
upgrade.NewAppModule(&app.UpgradeKeeper, app.AccountKeeper.AddressCodec()),
442423
evidence.NewAppModule(app.EvidenceKeeper),
@@ -468,7 +449,6 @@ func New(
468449
// IBC v10: capability module removed from begin block order
469450
app.MM.SetOrderBeginBlockers(
470451
// upgrades should be run first
471-
crisistypes.ModuleName,
472452
ibctransfertypes.ModuleName,
473453
ibchost.ModuleName,
474454
authtypes.ModuleName,
@@ -485,7 +465,6 @@ func New(
485465
app.SetPreBlocker(app.PreBlocker)
486466

487467
app.MM.SetOrderEndBlockers(
488-
crisistypes.ModuleName,
489468
ibctransfertypes.ModuleName,
490469
ibchost.ModuleName,
491470
feegrant.ModuleName,
@@ -511,7 +490,6 @@ func New(
511490
authtypes.ModuleName,
512491
banktypes.ModuleName,
513492
slashingtypes.ModuleName,
514-
crisistypes.ModuleName,
515493
ibchost.ModuleName,
516494
evidencetypes.ModuleName,
517495
ibctransfertypes.ModuleName,
@@ -524,7 +502,6 @@ func New(
524502
ibcconsumertypes.ModuleName,
525503
)
526504

527-
app.MM.RegisterInvariants(&app.CrisisKeeper)
528505
app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())
529506
err := app.MM.RegisterServices(app.configurator)
530507
if err != nil {
@@ -840,7 +817,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
840817
paramsKeeper.Subspace(authtypes.ModuleName)
841818
paramsKeeper.Subspace(banktypes.ModuleName)
842819
paramsKeeper.Subspace(slashingtypes.ModuleName)
843-
paramsKeeper.Subspace(crisistypes.ModuleName)
844820
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
845821
paramsKeeper.Subspace(ibchost.ModuleName)
846822
paramsKeeper.Subspace(ibcconsumertypes.ModuleName)

app/consumer/export.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ func (app *App) ExportAppStateAndValidators(
5454
//
5555
// in favour of export at a block height
5656
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
57-
/* Just to be safe, assert the invariants on current state. */
58-
app.CrisisKeeper.AssertInvariants(ctx)
5957

6058
// set context height to zero
6159
height := ctx.BlockHeight()

0 commit comments

Comments
 (0)