@@ -74,12 +74,18 @@ import (
7474 "github.com/cosmos/cosmos-sdk/x/consensus"
7575 consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
7676 consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
77+ "github.com/cosmos/cosmos-sdk/x/distribution"
78+ distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
79+ distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
7780 "github.com/cosmos/cosmos-sdk/x/genutil"
7881 genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
7982 "github.com/cosmos/cosmos-sdk/x/gov"
8083 govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
8184 govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
8285 govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
86+ "github.com/cosmos/cosmos-sdk/x/slashing"
87+ slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
88+ slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
8389 "github.com/cosmos/cosmos-sdk/x/staking"
8490 stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
8591 stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
@@ -101,6 +107,7 @@ var (
101107 // module account permissions
102108 maccPerms = map [string ][]string {
103109 authtypes .FeeCollectorName : nil ,
110+ distrtypes .ModuleName : nil ,
104111 stakingtypes .BondedPoolName : {authtypes .Burner , authtypes .Staking },
105112 stakingtypes .NotBondedPoolName : {authtypes .Burner , authtypes .Staking },
106113 govtypes .ModuleName : {authtypes .Burner },
@@ -139,6 +146,8 @@ type App struct {
139146 AccountKeeper authkeeper.AccountKeeper
140147 BankKeeper bankkeeper.Keeper
141148 StakingKeeper * stakingkeeper.Keeper
149+ SlashingKeeper slashingkeeper.Keeper
150+ DistributionKeeper distrkeeper.Keeper
142151 GovKeeper govkeeper.Keeper
143152 IBCKeeper * ibckeeper.Keeper
144153 UpgradeKeeper * upgradekeeper.Keeper
@@ -186,8 +195,8 @@ func New(
186195
187196 keys := storetypes .NewKVStoreKeys (
188197 authtypes .StoreKey , banktypes .StoreKey , stakingtypes .StoreKey ,
189- govtypes .StoreKey , upgradetypes .StoreKey , consensustypes .StoreKey ,
190- ibcexported .StoreKey ,
198+ distrtypes .StoreKey , slashingtypes .StoreKey , govtypes .StoreKey ,
199+ upgradetypes . StoreKey , consensustypes . StoreKey , ibcexported .StoreKey ,
191200 // Cosmos EVM store keys
192201 evmtypes .StoreKey , feemarkettypes .StoreKey ,
193202 )
@@ -258,6 +267,16 @@ func New(
258267 appCodec , runtime .NewKVStoreService (keys [stakingtypes .StoreKey ]), app .AccountKeeper , app .BankKeeper , authAddr , address .NewBech32Codec (sdk .GetConfig ().GetBech32ValidatorAddrPrefix ()), address .NewBech32Codec (sdk .GetConfig ().GetBech32ConsensusAddrPrefix ()),
259268 )
260269
270+ app .DistributionKeeper = distrkeeper .NewKeeper (appCodec , runtime .NewKVStoreService (keys [distrtypes .StoreKey ]), app .AccountKeeper , app .BankKeeper , app .StakingKeeper , authtypes .FeeCollectorName , authAddr )
271+
272+ app .SlashingKeeper = slashingkeeper .NewKeeper (appCodec , app .LegacyAmino (), runtime .NewKVStoreService (keys [slashingtypes .StoreKey ]), app .StakingKeeper , authAddr )
273+
274+ // register the staking hooks
275+ // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
276+ app .StakingKeeper .SetHooks (
277+ stakingtypes .NewMultiStakingHooks (app .DistributionKeeper .Hooks (), app .SlashingKeeper .Hooks ()),
278+ )
279+
261280 // get skipUpgradeHeights from the app options
262281 skipUpgradeHeights := map [int64 ]bool {}
263282 for _ , h := range cast .ToIntSlice (appOpts .Get (server .FlagUnsafeSkipUpgrades )) {
@@ -278,12 +297,12 @@ func New(
278297 */
279298 govKeeper := govkeeper .NewKeeper (
280299 appCodec , runtime .NewKVStoreService (keys [govtypes .StoreKey ]), app .AccountKeeper , app .BankKeeper ,
281- app .StakingKeeper , dummyDistrKeeper {} , app .MsgServiceRouter (), govConfig , authAddr ,
300+ app .StakingKeeper , app . DistributionKeeper , app .MsgServiceRouter (), govConfig , authAddr ,
282301 )
283302
284303 app .GovKeeper = * govKeeper .SetHooks (
285304 govtypes .NewMultiGovHooks (
286- // register the governance hooks
305+ // register the governance hooks
287306 ),
288307 )
289308
@@ -312,6 +331,7 @@ func New(
312331 ).WithStaticPrecompiles (
313332 StaticPrecompiles (
314333 * app .StakingKeeper ,
334+ app .DistributionKeeper ,
315335 app .BankKeeper ,
316336 app .GovKeeper ,
317337 app .IBCKeeper .ClientKeeper ,
@@ -341,6 +361,8 @@ func New(
341361 auth .NewAppModule (appCodec , app .AccountKeeper , nil , nil ),
342362 bank .NewAppModule (appCodec , app .BankKeeper , app .AccountKeeper , nil ),
343363 gov .NewAppModule (appCodec , & app .GovKeeper , app .AccountKeeper , app .BankKeeper , nil ),
364+ slashing .NewAppModule (appCodec , app .SlashingKeeper , app .AccountKeeper , app .BankKeeper , app .StakingKeeper , nil , app .interfaceRegistry ),
365+ distribution .NewAppModule (appCodec , app .DistributionKeeper , app .AccountKeeper , app .BankKeeper , app .StakingKeeper , nil ),
344366 staking .NewAppModule (appCodec , app .StakingKeeper , app .AccountKeeper , app .BankKeeper , nil ),
345367 upgrade .NewAppModule (app .UpgradeKeeper , app .AccountKeeper .AddressCodec ()),
346368 consensus .NewAppModule (appCodec , app .ConsensusParamsKeeper ),
@@ -378,6 +400,8 @@ func New(
378400 // NOTE: staking module is required if HistoricalEntries param > 0
379401 app .ModuleManager .SetOrderBeginBlockers (
380402 // Cosmos EVM BeginBlockers
403+ distrtypes .ModuleName ,
404+ slashingtypes .ModuleName ,
381405 stakingtypes .ModuleName ,
382406 genutiltypes .ModuleName ,
383407 ibcexported .ModuleName ,
@@ -393,6 +417,8 @@ func New(
393417 banktypes .ModuleName ,
394418 govtypes .ModuleName ,
395419 stakingtypes .ModuleName ,
420+ distrtypes .ModuleName ,
421+ slashingtypes .ModuleName ,
396422 authtypes .ModuleName ,
397423 ibcexported .ModuleName ,
398424
@@ -411,7 +437,9 @@ func New(
411437 genesisModuleOrder := []string {
412438 authtypes .ModuleName ,
413439 banktypes .ModuleName ,
440+ distrtypes .ModuleName ,
414441 stakingtypes .ModuleName ,
442+ slashingtypes .ModuleName ,
415443 govtypes .ModuleName ,
416444 ibcexported .ModuleName ,
417445
@@ -461,10 +489,7 @@ func New(
461489 app .SetEndBlocker (app .EndBlocker )
462490 app .setAnteHandler (app .txConfig , maxGasWanted )
463491
464- err = app .configureEVMMempool (appOpts , logger )
465- if err != nil {
466- panic (err )
467- }
492+ app .configureEVMMempool (appOpts , logger )
468493
469494 // In v0.46, the SDK introduces _postHandlers_. PostHandlers are like
470495 // antehandlers, but are run _after_ the `runMsgs` execution. They are also
0 commit comments