Skip to content

Commit 9509e18

Browse files
authored
encoding: fix test (#64)
1 parent 475c618 commit 9509e18

7 files changed

Lines changed: 15 additions & 12 deletions

File tree

app/ante/utils_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/cosmos/ethermint/app"
2525
ante "github.com/cosmos/ethermint/app/ante"
2626
"github.com/cosmos/ethermint/crypto/ethsecp256k1"
27+
"github.com/cosmos/ethermint/encoding"
2728
"github.com/cosmos/ethermint/tests"
2829
evmtypes "github.com/cosmos/ethermint/x/evm/types"
2930

@@ -53,7 +54,7 @@ func (suite *AnteTestSuite) SetupTest() {
5354
suite.app.AccountKeeper.SetParams(infCtx, authtypes.DefaultParams())
5455
suite.app.EvmKeeper.SetParams(infCtx, evmtypes.DefaultParams())
5556

56-
encodingConfig := app.MakeEncodingConfig()
57+
encodingConfig := encoding.MakeConfig(app.ModuleBasics)
5758
// We're using TestMsg amino encoding in some tests, so register it here.
5859
encodingConfig.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil)
5960

cmd/ethermintd/root.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ import (
3838

3939
"github.com/cosmos/ethermint/app"
4040
ethermintclient "github.com/cosmos/ethermint/client"
41+
"github.com/cosmos/ethermint/encoding"
4142
)
4243

4344
// NewRootCmd creates a new root command for simd. It is called once in the
4445
// main function.
4546
func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
46-
encodingConfig := app.MakeEncodingConfig()
47+
encodingConfig := encoding.MakeConfig(app.ModuleBasics)
4748
initClientCtx := client.Context{}.
4849
WithJSONMarshaler(encodingConfig.Marshaler).
4950
WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
@@ -225,7 +226,7 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts serverty
225226
logger, db, traceStore, true, skipUpgradeHeights,
226227
cast.ToString(appOpts.Get(flags.FlagHome)),
227228
cast.ToUint(appOpts.Get(sdkserver.FlagInvCheckPeriod)),
228-
app.MakeEncodingConfig(), // Ideally, we would reuse the one created by NewRootCmd.
229+
encoding.MakeConfig(app.ModuleBasics), // Ideally, we would reuse the one created by NewRootCmd.
229230
appOpts,
230231
baseapp.SetPruning(pruningOpts),
231232
baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(sdkserver.FlagMinGasPrices))),
@@ -249,7 +250,7 @@ func createAppAndExport(
249250
logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string,
250251
appOpts servertypes.AppOptions,
251252
) (servertypes.ExportedApp, error) {
252-
encCfg := app.MakeEncodingConfig() // Ideally, we would reuse the one created by NewRootCmd.
253+
encCfg := encoding.MakeConfig(app.ModuleBasics) // Ideally, we would reuse the one created by NewRootCmd.
253254
encCfg.Marshaler = codec.NewProtoCodec(encCfg.InterfaceRegistry)
254255
var ethermintApp *app.EthermintApp
255256
if height != -1 {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package encoding
1+
package codec
22

33
import (
44
"github.com/cosmos/cosmos-sdk/codec"

encoding/config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
ethtypes "github.com/ethereum/go-ethereum/core/types"
1313

14+
enccodec "github.com/cosmos/ethermint/encoding/codec"
1415
evmtypes "github.com/cosmos/ethermint/x/evm/types"
1516
)
1617

@@ -27,9 +28,9 @@ func MakeConfig(mb module.BasicManager) params.EncodingConfig {
2728
Amino: cdc,
2829
}
2930

30-
RegisterLegacyAminoCodec(encodingConfig.Amino)
31+
enccodec.RegisterLegacyAminoCodec(encodingConfig.Amino)
3132
mb.RegisterLegacyAminoCodec(encodingConfig.Amino)
32-
RegisterInterfaces(encodingConfig.InterfaceRegistry)
33+
enccodec.RegisterInterfaces(encodingConfig.InterfaceRegistry)
3334
mb.RegisterInterfaces(encodingConfig.InterfaceRegistry)
3435
return encodingConfig
3536
}

tests/importer/importer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
paramkeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
2929
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
3030

31-
"github.com/cosmos/ethermint/codec"
31+
"github.com/cosmos/ethermint/encoding/codec"
3232
"github.com/cosmos/ethermint/types"
3333
evmkeeper "github.com/cosmos/ethermint/x/evm/keeper"
3434
evmtypes "github.com/cosmos/ethermint/x/evm/types"

types/account_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
sdk "github.com/cosmos/cosmos-sdk/types"
1313
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
1414

15-
ethermintcodec "github.com/cosmos/ethermint/codec"
1615
cryptocodec "github.com/cosmos/ethermint/crypto/codec"
1716
"github.com/cosmos/ethermint/crypto/ethsecp256k1"
17+
ethermintcodec "github.com/cosmos/ethermint/encoding/codec"
1818
"github.com/cosmos/ethermint/types"
1919
)
2020

x/evm/types/journal_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"os"
66
"testing"
77

8+
"github.com/cosmos/ethermint/crypto/ethsecp256k1"
9+
enccodec "github.com/cosmos/ethermint/encoding/codec"
810
ethermint "github.com/cosmos/ethermint/types"
911

1012
"github.com/stretchr/testify/suite"
@@ -28,8 +30,6 @@ import (
2830

2931
"github.com/cosmos/cosmos-sdk/codec"
3032
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
31-
ethcodec "github.com/cosmos/ethermint/codec"
32-
"github.com/cosmos/ethermint/crypto/ethsecp256k1"
3333
)
3434

3535
func newTestCodec() (codec.BinaryMarshaler, *codec.LegacyAmino) {
@@ -39,7 +39,7 @@ func newTestCodec() (codec.BinaryMarshaler, *codec.LegacyAmino) {
3939

4040
sdk.RegisterLegacyAminoCodec(amino)
4141

42-
ethcodec.RegisterInterfaces(interfaceRegistry)
42+
enccodec.RegisterInterfaces(interfaceRegistry)
4343

4444
return cdc, amino
4545
}

0 commit comments

Comments
 (0)