Skip to content

Commit

Permalink
feat: decouple x/capability from simapp (cosmos#12256)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored Jun 16, 2022
1 parent facbc72 commit 7aa0f3c
Showing 1 changed file with 3 additions and 34 deletions.
37 changes: 3 additions & 34 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ type SimApp struct {
invCheckPeriod uint

// keys to access the substores
keys map[string]*storetypes.KVStoreKey
tkeys map[string]*storetypes.TransientStoreKey
memKeys map[string]*storetypes.MemoryStoreKey
keys map[string]*storetypes.KVStoreKey

// keepers
AccountKeeper authkeeper.AccountKeeper
Expand Down Expand Up @@ -239,9 +237,6 @@ func NewSimApp(
govtypes.StoreKey,
upgradetypes.StoreKey,
)
// NOTE: The testingkey is just mounted for testing purposes. Actual applications should
// not include this key.
app.memKeys = sdk.NewMemoryStoreKeys("testingkey")

// configure state listening capabilities using AppOptions
// we are doing nothing with the returned streamingServices and waitGroup in this case
Expand Down Expand Up @@ -322,13 +317,13 @@ func NewSimApp(
app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...)

// Uncomment if you want to set a custom migration order here.
// app.mm.SetOrderMigrations(custom order)
// app.ModuleManager.SetOrderMigrations(custom order)

app.ModuleManager.RegisterInvariants(&app.CrisisKeeper)
app.ModuleManager.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)

// RegisterUpgradeHandlers is used for registering any on-chain upgrades.
// Make sure it's called after `app.mm` and `app.configurator` are set.
// Make sure it's called after `app.ModuleManager` and `app.configurator` are set.
app.RegisterUpgradeHandlers()

// add test gRPC service for testing gRPC queries in isolation
Expand All @@ -347,7 +342,6 @@ func NewSimApp(

// initialize stores
app.MountKVStores(app.keys)
app.MountMemoryStores(app.memKeys)

// initialize BaseApp
app.SetInitChainer(app.InitChainer)
Expand Down Expand Up @@ -411,31 +405,6 @@ func (app *SimApp) GetKey(storeKey string) *storetypes.KVStoreKey {
return kvStoreKey
}

// GetTKey returns the TransientStoreKey for the provided store key.
//
// NOTE: This is solely to be used for testing purposes.
func (app *SimApp) GetTKey(storeKey string) *storetypes.TransientStoreKey {
return app.tkeys[storeKey]
}

// GetMemKey returns the MemStoreKey for the provided mem key.
//
// NOTE: This is solely used for testing purposes.
func (app *SimApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey {
msk := app.memKeys[storeKey]
if msk != nil {
return msk
}

sk := app.UnsafeFindStoreKey(storeKey)
memStoreKey, ok := sk.(*storetypes.MemoryStoreKey)
if !ok {
return nil
}

return memStoreKey
}

// GetSubspace returns a param subspace for a given module name.
//
// NOTE: This is solely to be used for testing purposes.
Expand Down

0 comments on commit 7aa0f3c

Please sign in to comment.