@@ -234,6 +234,7 @@ func StoreKeys() (
234234 map [string ]* storetypes.KVStoreKey ,
235235 map [string ]* storetypes.TransientStoreKey ,
236236 map [string ]* storetypes.ObjectStoreKey ,
237+ map [string ]* storetypes.MemoryStoreKey ,
237238) {
238239 storeKeys := []string {
239240 authtypes .StoreKey , banktypes .StoreKey , stakingtypes .StoreKey ,
@@ -255,9 +256,10 @@ func StoreKeys() (
255256 }
256257 keys := storetypes .NewKVStoreKeys (storeKeys ... )
257258 tkeys := storetypes .NewTransientStoreKeys (paramstypes .TStoreKey )
259+ memKeys := storetypes .NewMemoryStoreKeys (stakingtypes .CacheStoreKey )
258260 okeys := storetypes .NewObjectStoreKeys (banktypes .ObjectStoreKey , evmtypes .ObjectStoreKey )
259261
260- return keys , tkeys , okeys
262+ return keys , tkeys , okeys , memKeys
261263}
262264
263265var (
@@ -288,7 +290,7 @@ type App struct {
288290 keys map [string ]* storetypes.KVStoreKey
289291 tkeys map [string ]* storetypes.TransientStoreKey
290292 okeys map [string ]* storetypes.ObjectStoreKey
291-
293+ memKeys map [ string ] * storetypes. MemoryStoreKey
292294 // keepers
293295 AccountKeeper authkeeper.AccountKeeper
294296 BankKeeper bankkeeper.Keeper
@@ -447,7 +449,7 @@ func New(
447449 bApp .SetInterfaceRegistry (interfaceRegistry )
448450 bApp .SetTxEncoder (txConfig .TxEncoder ())
449451
450- keys , tkeys , okeys := StoreKeys ()
452+ keys , tkeys , okeys , memKeys := StoreKeys ()
451453
452454 invCheckPeriod := cast .ToUint (appOpts .Get (server .FlagInvCheckPeriod ))
453455 app := & App {
@@ -461,6 +463,7 @@ func New(
461463 keys : keys ,
462464 tkeys : tkeys ,
463465 okeys : okeys ,
466+ memKeys : memKeys ,
464467 blockProposalHandler : blockProposalHandler ,
465468 dummyCheckTx : cast .ToBool (appOpts .Get (FlagUnsafeDummyCheckTx )),
466469 }
@@ -516,14 +519,17 @@ func New(
516519 panic (err )
517520 }
518521 app .txConfig = txConfig
522+ stakingCacheSize := cast .ToInt (appOpts .Get (server .FlagStakingCacheSize ))
519523 app .StakingKeeper = stakingkeeper .NewKeeper (
520524 appCodec ,
521525 runtime .NewKVStoreService (keys [stakingtypes .StoreKey ]),
526+ runtime .NewMemStoreService (memKeys [stakingtypes .CacheStoreKey ]),
522527 app .AccountKeeper ,
523528 app .BankKeeper ,
524529 authAddr ,
525530 address .NewBech32Codec (sdk .GetConfig ().GetBech32ValidatorAddrPrefix ()),
526531 address .NewBech32Codec (sdk .GetConfig ().GetBech32ConsensusAddrPrefix ()),
532+ stakingCacheSize ,
527533 )
528534 app .MintKeeper = mintkeeper .NewKeeper (
529535 appCodec ,
@@ -975,7 +981,7 @@ func New(
975981 app .MountKVStores (keys )
976982 app .MountTransientStores (tkeys )
977983 app .MountObjectStores (okeys )
978-
984+ app . MountMemoryStores ( memKeys )
979985 // initialize BaseApp
980986 app .SetInitChainer (app .InitChainer )
981987 app .SetPreBlocker (app .PreBlocker )
0 commit comments