Skip to content

Commit

Permalink
fix node home issue
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Jan 18, 2024
1 parent da7cac5 commit da4f325
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
5 changes: 2 additions & 3 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

"cosmossdk.io/x/upgrade"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
"github.com/cosmos/cosmos-sdk/x/bank"

ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts"
Expand Down Expand Up @@ -67,7 +66,7 @@ func TestInitGenesisOnMigration(t *testing.T) {
db := dbm.NewMemDB()
logger := log.NewLogger(os.Stdout)
app := NewMinitiaApp(
logger, db, nil, true, []wasmkeeper.Option{}, simtestutil.EmptyAppOptions{})
logger, db, nil, true, []wasmkeeper.Option{}, EmptyAppOptions{})
ctx := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()})

// Create a mock module. This module will serve as the new module we're
Expand Down Expand Up @@ -122,7 +121,7 @@ func TestGetKey(t *testing.T) {
db := dbm.NewMemDB()
app := NewMinitiaApp(
log.NewLogger(os.Stdout),
db, nil, true, []wasmkeeper.Option{}, simtestutil.EmptyAppOptions{})
db, nil, true, []wasmkeeper.Option{}, EmptyAppOptions{})

require.NotEmpty(t, app.GetKey(banktypes.StoreKey))
require.NotEmpty(t, app.GetMemKey(capabilitytypes.MemStoreKey))
Expand Down
20 changes: 16 additions & 4 deletions app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"cosmossdk.io/core/appmodule"
"cosmossdk.io/log"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/client/flags"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"
Expand All @@ -18,7 +18,7 @@ import (

// MakeEncodingConfig creates an EncodingConfig for testing
func MakeEncodingConfig() params.EncodingConfig {
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, simtestutil.EmptyAppOptions{})
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, EmptyAppOptions{})
encodingConfig := params.EncodingConfig{
InterfaceRegistry: tempApp.InterfaceRegistry(),
Codec: tempApp.AppCodec(),
Expand All @@ -30,7 +30,7 @@ func MakeEncodingConfig() params.EncodingConfig {
}

func AutoCliOpts() autocli.AppOptions {
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, simtestutil.EmptyAppOptions{})
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, EmptyAppOptions{})
modules := make(map[string]appmodule.AppModule, 0)
for _, m := range tempApp.ModuleManager.Modules {
if moduleWithName, ok := m.(module.HasName); ok {
Expand All @@ -51,6 +51,18 @@ func AutoCliOpts() autocli.AppOptions {
}

func BasicManager() module.BasicManager {
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, simtestutil.EmptyAppOptions{})
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, EmptyAppOptions{})
return tempApp.BasicModuleManager
}

// EmptyAppOptions is a stub implementing AppOptions
type EmptyAppOptions struct{}

// Get implements AppOptions
func (ao EmptyAppOptions) Get(o string) interface{} {
if o == flags.FlagHome {
return DefaultNodeHome
}

return nil
}
3 changes: 1 addition & 2 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
Expand Down Expand Up @@ -61,7 +60,7 @@ func setup(db *dbm.DB, withGenesis bool) (*MinitiaApp, GenesisState) {
nil,
true,
[]wasmkeeper.Option{},
simtestutil.EmptyAppOptions{},
EmptyAppOptions{},
)

if withGenesis {
Expand Down

0 comments on commit da4f325

Please sign in to comment.