Skip to content

Commit

Permalink
chore: remove manually set services and stores
Browse files Browse the repository at this point in the history
  • Loading branch information
dadamu committed Sep 22, 2023
1 parent 2d05697 commit a5d609e
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ type DesmosApp struct {
txConfig client.TxConfig
interfaceRegistry types.InterfaceRegistry

// non depinject support modules store keys
keys map[string]*storetypes.KVStoreKey

// Keepers
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
Expand Down Expand Up @@ -282,11 +279,13 @@ func NewDesmosApp(
app.App = appBuilder.Build(logger, db, traceStore, baseAppOptions...)

// set up non depinject support modules store keys
app.keys = sdk.NewKVStoreKeys(
storeKeys := sdk.NewKVStoreKeys(
ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey,
icahosttypes.StoreKey, icacontrollertypes.StoreKey, wasmtypes.StoreKey,
)
app.MountKVStores(app.keys)
for _, key := range storeKeys {
app.RegisterStores(key)
}

// load state streaming if enabled
if _, _, err := streaming.LoadStreamingServices(app.App.BaseApp, appOpts, app.appCodec, logger, app.kvStoreKeys()); err != nil {
Expand Down Expand Up @@ -461,12 +460,8 @@ func NewDesmosApp(
wasm.NewAppModule(app.appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
}

app.RegisterModules(legacyModules...)
cfg := app.Configurator()
for _, m := range legacyModules {
if s, ok := m.(module.HasServices); ok {
s.RegisterServices(cfg)
}
if err := app.RegisterModules(legacyModules...); err != nil {
panic(err)
}

// create the simulation manager and define the order of the modules for deterministic simulations
Expand Down Expand Up @@ -611,10 +606,6 @@ func (app *DesmosApp) TxConfig() client.TxConfig {
//
// NOTE: This is solely to be used for testing purposes.
func (app *DesmosApp) GetKey(storeKey string) *storetypes.KVStoreKey {
if key, ok := app.keys[storeKey]; ok {
return key
}

sk := app.UnsafeFindStoreKey(storeKey)
kvStoreKey, ok := sk.(*storetypes.KVStoreKey)
if !ok {
Expand All @@ -632,10 +623,6 @@ func (app *DesmosApp) kvStoreKeys() map[string]*storetypes.KVStoreKey {
}
}

for _, kv := range app.keys {
keys[kv.Name()] = kv
}

return keys
}

Expand Down

0 comments on commit a5d609e

Please sign in to comment.