Moved crypto codec registration to module (#79)

This commit is contained in:
Austin Abell 2019-08-11 10:50:30 -04:00 committed by GitHub
parent cfac906f92
commit 64b63f33f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -2,9 +2,10 @@ package app
import ( import (
"encoding/json" "encoding/json"
"github.com/cosmos/ethermint/x/evm"
"os" "os"
"github.com/cosmos/ethermint/x/evm"
bam "github.com/cosmos/cosmos-sdk/baseapp" bam "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
@ -25,7 +26,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/supply" "github.com/cosmos/cosmos-sdk/x/supply"
"github.com/cosmos/ethermint/crypto"
evmtypes "github.com/cosmos/ethermint/x/evm/types" evmtypes "github.com/cosmos/ethermint/x/evm/types"
abci "github.com/tendermint/tendermint/abci/types" abci "github.com/tendermint/tendermint/abci/types"
@ -67,9 +67,6 @@ var (
func MakeCodec() *codec.Codec { func MakeCodec() *codec.Codec {
var cdc = codec.New() var cdc = codec.New()
// TODO: Move this codec to module (Issue #12 https://github.com/ChainSafe/ethermint/issues/12)
crypto.RegisterCodec(cdc)
ModuleBasics.RegisterCodec(cdc) ModuleBasics.RegisterCodec(cdc)
sdk.RegisterCodec(cdc) sdk.RegisterCodec(cdc)
codec.RegisterCrypto(cdc) codec.RegisterCrypto(cdc)

View File

@ -1,6 +1,9 @@
package types package types
import "github.com/cosmos/cosmos-sdk/codec" import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/ethermint/crypto"
)
var ModuleCdc = codec.New() var ModuleCdc = codec.New()
@ -16,4 +19,5 @@ func init() {
// RegisterCodec registers concrete types and interfaces on the given codec. // RegisterCodec registers concrete types and interfaces on the given codec.
func RegisterCodec(cdc *codec.Codec) { func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterConcrete(&EthereumTxMsg{}, "ethermint/MsgEthereumTx", nil) cdc.RegisterConcrete(&EthereumTxMsg{}, "ethermint/MsgEthereumTx", nil)
crypto.RegisterCodec(cdc)
} }