From 82b75e4d7c1e60d560a2818560b5a5faafdaa0ae Mon Sep 17 00:00:00 2001 From: beer-1 <147697694+beer-1@users.noreply.github.com> Date: Thu, 18 Jan 2024 17:13:47 +0900 Subject: [PATCH] fix node home to use default --- app/app_test.go | 5 ++--- app/encoding.go | 20 ++++++++++++++++---- app/test_helpers.go | 3 +-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/app_test.go b/app/app_test.go index 7e2b58f..203dea4 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -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" ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" "github.com/cosmos/ibc-go/v8/modules/apps/transfer" @@ -67,7 +66,7 @@ func TestInitGenesisOnMigration(t *testing.T) { db := dbm.NewMemDB() logger := log.NewLogger(os.Stdout) app := NewMinitiaApp( - logger, db, nil, true, moveconfig.DefaultMoveConfig(), simtestutil.EmptyAppOptions{}) + logger, db, nil, true, moveconfig.DefaultMoveConfig(), EmptyAppOptions{}) ctx := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()}) // Create a mock module. This module will serve as the new module we're @@ -122,7 +121,7 @@ func TestGetKey(t *testing.T) { db := dbm.NewMemDB() app := NewMinitiaApp( log.NewLogger(os.Stdout), - db, nil, true, moveconfig.DefaultMoveConfig(), simtestutil.EmptyAppOptions{}) + db, nil, true, moveconfig.DefaultMoveConfig(), EmptyAppOptions{}) require.NotEmpty(t, app.GetKey(banktypes.StoreKey)) require.NotEmpty(t, app.GetMemKey(capabilitytypes.MemStoreKey)) diff --git a/app/encoding.go b/app/encoding.go index 5007f15..3721d77 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -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" @@ -16,7 +16,7 @@ import ( ) func MakeEncodingConfig() params.EncodingConfig { - tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, moveconfig.DefaultMoveConfig(), simtestutil.EmptyAppOptions{}) + tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, moveconfig.DefaultMoveConfig(), EmptyAppOptions{}) encodingConfig := params.EncodingConfig{ InterfaceRegistry: tempApp.InterfaceRegistry(), Codec: tempApp.AppCodec(), @@ -28,7 +28,7 @@ func MakeEncodingConfig() params.EncodingConfig { } func AutoCliOpts() autocli.AppOptions { - tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, moveconfig.DefaultMoveConfig(), simtestutil.EmptyAppOptions{}) + tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, moveconfig.DefaultMoveConfig(), EmptyAppOptions{}) modules := make(map[string]appmodule.AppModule, 0) for _, m := range tempApp.ModuleManager.Modules { if moduleWithName, ok := m.(module.HasName); ok { @@ -49,6 +49,18 @@ func AutoCliOpts() autocli.AppOptions { } func BasicManager() module.BasicManager { - tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, moveconfig.DefaultMoveConfig(), simtestutil.EmptyAppOptions{}) + tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, moveconfig.DefaultMoveConfig(), 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 +} diff --git a/app/test_helpers.go b/app/test_helpers.go index 1e49e8e..a5e02fa 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -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" @@ -60,7 +59,7 @@ func setup(db *dbm.DB, withGenesis bool) (*MinitiaApp, GenesisState) { nil, true, moveconfig.DefaultMoveConfig(), - simtestutil.EmptyAppOptions{}, + EmptyAppOptions{}, ) if withGenesis {