Skip to content

Commit

Permalink
refactor: move simapp.App to runtime.AppI (cosmos#13378)
Browse files Browse the repository at this point in the history
* refactor: move `simapp.App` to `runtime.AppI`

* add changelog

* `go mod tidy`

* fix app legacy build
  • Loading branch information
julienrbrt authored Sep 24, 2022
1 parent a940042 commit 97b2d0c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 45 deletions.
5 changes: 4 additions & 1 deletion app.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ import (
)

var (
// App is deprecated, use runtime.AppI instead
App runtime.AppI

// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string

Expand Down Expand Up @@ -124,7 +127,7 @@ var (
)

var (
_ App = (*SimApp)(nil)
_ runtime.AppI = (*SimApp)(nil)
_ servertypes.Application = (*SimApp)(nil)
)

Expand Down
6 changes: 5 additions & 1 deletion app_legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
Expand Down Expand Up @@ -99,6 +100,9 @@ import (
const appName = "SimApp"

var (
// App is deprecated, use runtime.AppI instead
App runtime.AppI

// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string

Expand Down Expand Up @@ -145,7 +149,7 @@ var (
)

var (
_ App = (*SimApp)(nil)
_ runtime.AppI = (*SimApp)(nil)
_ servertypes.Application = (*SimApp)(nil)
)

Expand Down
41 changes: 0 additions & 41 deletions types.go

This file was deleted.

5 changes: 3 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/runtime"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/kv"
Expand Down Expand Up @@ -49,7 +50,7 @@ func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string,

// SimulationOperations retrieves the simulation params from the provided file path
// and returns all the modules weighted operations
func SimulationOperations(app App, cdc codec.JSONCodec, config simtypes.Config) []simtypes.WeightedOperation {
func SimulationOperations(app runtime.AppI, cdc codec.JSONCodec, config simtypes.Config) []simtypes.WeightedOperation {
simState := module.SimulationState{
AppParams: make(simtypes.AppParams),
Cdc: cdc,
Expand All @@ -74,7 +75,7 @@ func SimulationOperations(app App, cdc codec.JSONCodec, config simtypes.Config)
// CheckExportSimulation exports the app state and simulation parameters to JSON
// if the export paths are defined.
func CheckExportSimulation(
app App, config simtypes.Config, params simtypes.Params,
app runtime.AppI, config simtypes.Config, params simtypes.Params,
) error {
if config.ExportStatePath != "" {
fmt.Println("exporting app state...")
Expand Down

0 comments on commit 97b2d0c

Please sign in to comment.