diff --git a/client/keys/add_ledger_test.go b/client/keys/add_ledger_test.go index e46b7e26fcc4..cf900785dbc0 100644 --- a/client/keys/add_ledger_test.go +++ b/client/keys/add_ledger_test.go @@ -15,9 +15,9 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + clienttestutil "github.com/cosmos/cosmos-sdk/client/testutil" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -44,7 +44,7 @@ func Test_runAddCmdLedgerWithCustomCoinType(t *testing.T) { // Prepare a keybase kbHome := t.TempDir() - cdc := simapp.MakeTestEncodingConfig().Codec + cdc := clienttestutil.MakeTestCodec(t) clientCtx := client.Context{}.WithKeyringDir(kbHome).WithCodec(cdc) ctx := context.WithValue(context.Background(), client.ClientContextKey, &clientCtx) @@ -96,9 +96,9 @@ func Test_runAddCmdLedger(t *testing.T) { mockIn := testutil.ApplyMockIODiscardOutErr(cmd) kbHome := t.TempDir() - encCfg := simapp.MakeTestEncodingConfig() + cdc := clienttestutil.MakeTestCodec(t) - clientCtx := client.Context{}.WithKeyringDir(kbHome).WithCodec(encCfg.Codec) + clientCtx := client.Context{}.WithKeyringDir(kbHome).WithCodec(cdc) ctx := context.WithValue(context.Background(), client.ClientContextKey, &clientCtx) cmd.SetArgs([]string{ @@ -114,7 +114,7 @@ func Test_runAddCmdLedger(t *testing.T) { require.NoError(t, cmd.ExecuteContext(ctx)) // Now check that it has been stored properly - kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, kbHome, mockIn, encCfg.Codec) + kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, kbHome, mockIn, cdc) require.NoError(t, err) // Now check that it has been stored properly @@ -137,7 +137,7 @@ func Test_runAddCmdLedger(t *testing.T) { } func Test_runAddCmdLedgerDryRun(t *testing.T) { - cdc := simapp.MakeTestEncodingConfig().Codec + cdc := clienttestutil.MakeTestCodec(t) testData := []struct { name string args []string diff --git a/client/keys/add_test.go b/client/keys/add_test.go index 53f10ecb6327..5b8bf8229310 100644 --- a/client/keys/add_test.go +++ b/client/keys/add_test.go @@ -12,9 +12,9 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + clienttestutil "github.com/cosmos/cosmos-sdk/client/testutil" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" @@ -28,7 +28,7 @@ func Test_runAddCmdBasic(t *testing.T) { mockIn := testutil.ApplyMockIODiscardOutErr(cmd) kbHome := t.TempDir() - cdc := simapp.MakeTestEncodingConfig().Codec + cdc := clienttestutil.MakeTestCodec(t) kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, kbHome, mockIn, cdc) require.NoError(t, err) @@ -124,7 +124,7 @@ func Test_runAddCmdBasic(t *testing.T) { func Test_runAddCmdDryRun(t *testing.T) { pubkey1 := `{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AtObiFVE4s+9+RX5SP8TN9r2mxpoaT4eGj9CJfK7VRzN"}` pubkey2 := `{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A/se1vkqgdQ7VJQCM4mxN+L+ciGhnnJ4XYsQCRBMrdRi"}` - cdc := simapp.MakeTestEncodingConfig().Codec + cdc := clienttestutil.MakeTestCodec(t) testData := []struct { name string @@ -235,7 +235,7 @@ func Test_runAddCmdDryRun(t *testing.T) { func TestAddRecoverFileBackend(t *testing.T) { cmd := AddKeyCommand() cmd.Flags().AddFlagSet(Commands("home").PersistentFlags()) - cdc := simapp.MakeTestEncodingConfig().Codec + cdc := clienttestutil.MakeTestCodec(t) mockIn := testutil.ApplyMockIODiscardOutErr(cmd) kbHome := t.TempDir() diff --git a/client/keys/delete_test.go b/client/keys/delete_test.go index e38329ee1ad8..c3799b00249a 100644 --- a/client/keys/delete_test.go +++ b/client/keys/delete_test.go @@ -9,9 +9,9 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + clienttestutil "github.com/cosmos/cosmos-sdk/client/testutil" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" @@ -34,7 +34,7 @@ func Test_runDeleteCmd(t *testing.T) { fakeKeyName2 := "runDeleteCmd_Key2" path := sdk.GetConfig().GetFullBIP44Path() - cdc := simapp.MakeTestEncodingConfig().Codec + cdc := clienttestutil.MakeTestCodec(t) cmd.SetArgs([]string{"blah", fmt.Sprintf("--%s=%s", flags.FlagHome, kbHome)}) kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, kbHome, mockIn, cdc) diff --git a/client/keys/export_test.go b/client/keys/export_test.go index 0a8aa2d20ab1..4af52288d2a7 100644 --- a/client/keys/export_test.go +++ b/client/keys/export_test.go @@ -9,18 +9,18 @@ import ( "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/client" + clienttestutil "github.com/cosmos/cosmos-sdk/client/testutil" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" ) func Test_runExportCmd(t *testing.T) { - cdc := simapp.MakeTestEncodingConfig().Codec + cdc := clienttestutil.MakeTestCodec(t) testCases := []struct { name string keyringBackend string diff --git a/client/keys/import_test.go b/client/keys/import_test.go index 416992c2c55a..5ab732632a51 100644 --- a/client/keys/import_test.go +++ b/client/keys/import_test.go @@ -11,14 +11,14 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + clienttestutil "github.com/cosmos/cosmos-sdk/client/testutil" "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" ) func Test_runImportCmd(t *testing.T) { - cdc := simapp.MakeTestEncodingConfig().Codec + cdc := clienttestutil.MakeTestCodec(t) testCases := []struct { name string keyringBackend string diff --git a/client/keys/list_test.go b/client/keys/list_test.go index 548413efad06..ec833b8d8fdb 100644 --- a/client/keys/list_test.go +++ b/client/keys/list_test.go @@ -9,9 +9,9 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + clienttestutil "github.com/cosmos/cosmos-sdk/client/testutil" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" @@ -35,8 +35,8 @@ func Test_runListCmd(t *testing.T) { kbHome2 := t.TempDir() mockIn := testutil.ApplyMockIODiscardOutErr(cmd) - encCfg := simapp.MakeTestEncodingConfig() - kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, kbHome2, mockIn, encCfg.Codec) + cdc := clienttestutil.MakeTestCodec(t) + kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, kbHome2, mockIn, cdc) require.NoError(t, err) clientCtx := client.Context{}.WithKeyring(kb) diff --git a/client/keys/migrate_test.go b/client/keys/migrate_test.go index b105db7cb747..a53745c4457d 100644 --- a/client/keys/migrate_test.go +++ b/client/keys/migrate_test.go @@ -11,12 +11,12 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + clienttestutil "github.com/cosmos/cosmos-sdk/client/testutil" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/testutil" ) @@ -36,7 +36,7 @@ type MigrateTestSuite struct { func (s *MigrateTestSuite) SetupSuite() { s.dir = s.T().TempDir() - s.cdc = simapp.MakeTestEncodingConfig().Codec + s.cdc = clienttestutil.MakeTestCodec(s.T()) s.appName = "cosmos" s.priv = cryptotypes.PrivKey(secp256k1.GenPrivKey()) s.pub = s.priv.PubKey() diff --git a/client/keys/rename_test.go b/client/keys/rename_test.go index a21d33df282d..b78c8f48e6dc 100644 --- a/client/keys/rename_test.go +++ b/client/keys/rename_test.go @@ -9,9 +9,9 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + clienttestutil "github.com/cosmos/cosmos-sdk/client/testutil" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" @@ -32,7 +32,7 @@ func Test_runRenameCmd(t *testing.T) { path := sdk.GetConfig().GetFullBIP44Path() - cdc := simapp.MakeTestEncodingConfig().Codec + cdc := clienttestutil.MakeTestCodec(t) kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, kbHome, mockIn, cdc) require.NoError(t, err) diff --git a/client/keys/show_test.go b/client/keys/show_test.go index 4045b0d3c482..490c3d645907 100644 --- a/client/keys/show_test.go +++ b/client/keys/show_test.go @@ -9,12 +9,12 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + clienttestutil "github.com/cosmos/cosmos-sdk/client/testutil" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" @@ -53,7 +53,7 @@ func Test_runShowCmd(t *testing.T) { mockIn := testutil.ApplyMockIODiscardOutErr(cmd) kbHome := t.TempDir() - cdc := simapp.MakeTestEncodingConfig().Codec + cdc := clienttestutil.MakeTestCodec(t) kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, kbHome, mockIn, cdc) require.NoError(t, err) diff --git a/client/testutil/util.go b/client/testutil/util.go new file mode 100644 index 000000000000..8d09f5de4777 --- /dev/null +++ b/client/testutil/util.go @@ -0,0 +1,32 @@ +package testutil + +import ( + "testing" + + "github.com/stretchr/testify/require" + + runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" + appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" + "cosmossdk.io/core/appconfig" + "cosmossdk.io/depinject" + "github.com/cosmos/cosmos-sdk/codec" + _ "github.com/cosmos/cosmos-sdk/runtime" +) + +var TestConfig = appconfig.Compose(&appv1alpha1.Config{ + Modules: []*appv1alpha1.ModuleConfig{ + { + Name: "runtime", + Config: appconfig.WrapAny(&runtimev1alpha1.Module{ + AppName: "clientTest", + }), + }, + }, +}) + +func MakeTestCodec(t *testing.T) codec.Codec { + var cdc codec.Codec + err := depinject.Inject(TestConfig, &cdc) + require.NoError(t, err) + return cdc +} diff --git a/client/tx/aux_builder_test.go b/client/tx/aux_builder_test.go index ae4dd0541093..5f183c4a9d09 100644 --- a/client/tx/aux_builder_test.go +++ b/client/tx/aux_builder_test.go @@ -5,20 +5,32 @@ import ( "github.com/stretchr/testify/require" + _ "cosmossdk.io/api/cosmos/bank/v1beta1" + "cosmossdk.io/depinject" + clienttestutil "github.com/cosmos/cosmos-sdk/client/testutil" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" typestx "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/bank" ) func TestAuxTxBuilder(t *testing.T) { - encCfg := simapp.MakeTestEncodingConfig() - testdata.RegisterInterfaces(encCfg.InterfaceRegistry) + var ( + reg codectypes.InterfaceRegistry + cdc codec.Codec + ) + err := depinject.Inject(clienttestutil.TestConfig, ®, &cdc) + bankModule := bank.AppModuleBasic{} + + require.NoError(t, err) + testdata.RegisterInterfaces(reg) + // required for test case: "GetAuxSignerData works for DIRECT_AUX" + bankModule.RegisterInterfaces(reg) var b tx.AuxTxBuilder @@ -159,7 +171,7 @@ func TestAuxTxBuilder(t *testing.T) { auxSignerData, err := b.GetAuxSignerData() // Make sure auxSignerData is correctly populated - checkCorrectData(t, encCfg.Codec, auxSignerData, signing.SignMode_SIGN_MODE_DIRECT_AUX) + checkCorrectData(t, cdc, auxSignerData, signing.SignMode_SIGN_MODE_DIRECT_AUX) return err }, @@ -202,7 +214,7 @@ func TestAuxTxBuilder(t *testing.T) { auxSignerData, err := b.GetAuxSignerData() // Make sure auxSignerData is correctly populated - checkCorrectData(t, encCfg.Codec, auxSignerData, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON) + checkCorrectData(t, cdc, auxSignerData, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON) return err }, diff --git a/client/tx/legacy_test.go b/client/tx/legacy_test.go index 8d5b451b7c09..640995ae8ad3 100644 --- a/client/tx/legacy_test.go +++ b/client/tx/legacy_test.go @@ -6,11 +6,12 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "cosmossdk.io/depinject" "github.com/cosmos/cosmos-sdk/client" + clienttestutil "github.com/cosmos/cosmos-sdk/client/testutil" tx2 "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/simapp" - "github.com/cosmos/cosmos-sdk/simapp/params" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" "github.com/cosmos/cosmos-sdk/types" typestx "github.com/cosmos/cosmos-sdk/types/tx" @@ -58,16 +59,22 @@ func buildTestTx(t *testing.T, builder client.TxBuilder) { type TestSuite struct { suite.Suite - encCfg params.EncodingConfig + codec codec.Codec + amino *codec.LegacyAmino protoCfg client.TxConfig aminoCfg client.TxConfig } func (s *TestSuite) SetupSuite() { - encCfg := simapp.MakeTestEncodingConfig() - s.encCfg = encCfg - s.protoCfg = tx.NewTxConfig(codec.NewProtoCodec(encCfg.InterfaceRegistry), tx.DefaultSignModes) - s.aminoCfg = legacytx.StdTxConfig{Cdc: encCfg.Amino} + var ( + reg codectypes.InterfaceRegistry + amino *codec.LegacyAmino + ) + err := depinject.Inject(clienttestutil.TestConfig, ®, &amino) + require.NoError(s.T(), err) + + s.protoCfg = tx.NewTxConfig(codec.NewProtoCodec(reg), tx.DefaultSignModes) + s.aminoCfg = legacytx.StdTxConfig{Cdc: amino} } func (s *TestSuite) TestCopyTx() { @@ -114,7 +121,7 @@ func (s *TestSuite) TestConvertTxToStdTx() { // proto tx protoBuilder := s.protoCfg.NewTxBuilder() buildTestTx(s.T(), protoBuilder) - stdTx, err := tx2.ConvertTxToStdTx(s.encCfg.Amino, protoBuilder.GetTx()) + stdTx, err := tx2.ConvertTxToStdTx(s.amino, protoBuilder.GetTx()) s.Require().NoError(err) s.Require().Equal(memo, stdTx.Memo) s.Require().Equal(gas, stdTx.Fee.Gas) @@ -134,7 +141,7 @@ func (s *TestSuite) TestConvertTxToStdTx() { }, }) s.Require().NoError(err) - stdTx, err = tx2.ConvertTxToStdTx(s.encCfg.Amino, protoBuilder.GetTx()) + stdTx, err = tx2.ConvertTxToStdTx(s.amino, protoBuilder.GetTx()) s.Require().NoError(err) s.Require().Equal(memo, stdTx.Memo) s.Require().Equal(gas, stdTx.Fee.Gas) @@ -148,7 +155,7 @@ func (s *TestSuite) TestConvertTxToStdTx() { aminoBuilder := s.aminoCfg.NewTxBuilder() buildTestTx(s.T(), aminoBuilder) stdTx = aminoBuilder.GetTx().(legacytx.StdTx) - stdTx2, err := tx2.ConvertTxToStdTx(s.encCfg.Amino, stdTx) + stdTx2, err := tx2.ConvertTxToStdTx(s.amino, stdTx) s.Require().NoError(err) s.Require().Equal(stdTx, stdTx2) } diff --git a/client/tx/tx_test.go b/client/tx/tx_test.go index 5e917fa1bff3..cef79555a70e 100644 --- a/client/tx/tx_test.go +++ b/client/tx/tx_test.go @@ -8,22 +8,30 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/grpc" + "cosmossdk.io/depinject" "github.com/cosmos/cosmos-sdk/client" + clienttestutil "github.com/cosmos/cosmos-sdk/client/testutil" "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" txtypes "github.com/cosmos/cosmos-sdk/types/tx" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/x/auth/signing" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) -func NewTestTxConfig() client.TxConfig { - cfg := simapp.MakeTestEncodingConfig() - return cfg.TxConfig +func newTestTxConfig(t *testing.T) (client.TxConfig, codec.Codec) { + var ( + pcdc codec.ProtoCodecMarshaler + cdc codec.Codec + ) + err := depinject.Inject(clienttestutil.TestConfig, &pcdc, &cdc) + require.NoError(t, err) + return authtx.NewTxConfig(pcdc, authtx.DefaultSignModes), cdc } // mockContext is a mock client.Context to return abitrary simulation response, used to @@ -70,7 +78,7 @@ func TestCalculateGas(t *testing.T) { for _, tc := range testCases { stc := tc - txCfg := NewTestTxConfig() + txCfg, _ := newTestTxConfig(t) txf := tx.Factory{}. WithChainID("test-chain"). @@ -96,10 +104,9 @@ func TestCalculateGas(t *testing.T) { } func TestBuildSimTx(t *testing.T) { - txCfg := NewTestTxConfig() - encCfg := simapp.MakeTestEncodingConfig() + txCfg, cdc := newTestTxConfig(t) - kb, err := keyring.New(t.Name(), "test", t.TempDir(), nil, encCfg.Codec) + kb, err := keyring.New(t.Name(), "test", t.TempDir(), nil, cdc) require.NoError(t, err) path := hd.CreateHDPath(118, 0, 0).String() @@ -123,8 +130,8 @@ func TestBuildSimTx(t *testing.T) { } func TestBuildUnsignedTx(t *testing.T) { - encCfg := simapp.MakeTestEncodingConfig() - kb, err := keyring.New(t.Name(), "test", t.TempDir(), nil, encCfg.Codec) + txConfig, cdc := newTestTxConfig(t) + kb, err := keyring.New(t.Name(), "test", t.TempDir(), nil, cdc) require.NoError(t, err) path := hd.CreateHDPath(118, 0, 0).String() @@ -133,7 +140,7 @@ func TestBuildUnsignedTx(t *testing.T) { require.NoError(t, err) txf := tx.Factory{}. - WithTxConfig(NewTestTxConfig()). + WithTxConfig(txConfig). WithAccountNumber(50). WithSequence(23). WithFees("50stake"). @@ -152,10 +159,10 @@ func TestBuildUnsignedTx(t *testing.T) { } func TestSign(t *testing.T) { + txConfig, cdc := newTestTxConfig(t) requireT := require.New(t) path := hd.CreateHDPath(118, 0, 0).String() - encCfg := simapp.MakeTestEncodingConfig() - kb, err := keyring.New(t.Name(), "test", t.TempDir(), nil, encCfg.Codec) + kb, err := keyring.New(t.Name(), "test", t.TempDir(), nil, cdc) requireT.NoError(err) from1 := "test_key1" @@ -179,7 +186,7 @@ func TestSign(t *testing.T) { t.Log("Pub keys:", pubKey1, pubKey2) txfNoKeybase := tx.Factory{}. - WithTxConfig(NewTestTxConfig()). + WithTxConfig(txConfig). WithAccountNumber(50). WithSequence(23). WithFees("50stake").