72fc3ca3af
* WIP setting up evm tx command and updating emint keys output * Fix linting issue * Wip restructuring to allow for ethereum signing and encoding * WIP setting up keybase and context to use Ethermint keys * Fixed encoding and decoding of emint keys * Adds command for generating explicit ethereum tx * Fixed evm route for handling tx * Fixed tx and msg encoding which allows transactions to be sent * Added relevant documentation for changes and cleaned up code * Added documentation and indicators why code was overriden
29 lines
628 B
Go
29 lines
628 B
Go
package encoding
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
emintcrypto "github.com/cosmos/ethermint/crypto"
|
|
)
|
|
|
|
func TestKeyEncodingDecoding(t *testing.T) {
|
|
// Priv Key encoding and decoding
|
|
privKey, err := emintcrypto.GenerateKey()
|
|
require.NoError(t, err)
|
|
privBytes := privKey.Bytes()
|
|
|
|
decodedPriv, err := PrivKeyFromBytes(privBytes)
|
|
require.NoError(t, err)
|
|
require.Equal(t, privKey, decodedPriv)
|
|
|
|
// Pub key encoding and decoding
|
|
pubKey := privKey.PubKey()
|
|
pubBytes := pubKey.Bytes()
|
|
|
|
decodedPub, err := PubKeyFromBytes(pubBytes)
|
|
require.NoError(t, err)
|
|
require.Equal(t, pubKey, decodedPub)
|
|
}
|