proto, evm: use string for address and hash protobuf message fields (#23)

* proto, evm: use string for address and hash protobuf message fields

* fix tests

* msg test
This commit is contained in:
Federico Kunze 2021-05-14 02:52:18 -04:00 committed by GitHub
parent a952bc36d1
commit ba5bf33f19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 536 additions and 447 deletions

View File

@ -9,7 +9,6 @@
- [PubKey](#ethermint.crypto.v1alpha1.ethsecp256k1.PubKey)
- [ethermint/evm/v1alpha1/evm.proto](#ethermint/evm/v1alpha1/evm.proto)
- [AccessList](#ethermint.evm.v1alpha1.AccessList)
- [AccessTuple](#ethermint.evm.v1alpha1.AccessTuple)
- [BytesList](#ethermint.evm.v1alpha1.BytesList)
- [ChainConfig](#ethermint.evm.v1alpha1.ChainConfig)
@ -126,21 +125,6 @@ key format.
<a name="ethermint.evm.v1alpha1.AccessList"></a>
### AccessList
AccessList is an EIP-2930 access list defined as a proto message.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `tuples` | [AccessTuple](#ethermint.evm.v1alpha1.AccessTuple) | repeated | access list tuples |
<a name="ethermint.evm.v1alpha1.AccessTuple"></a>
### AccessTuple
@ -301,10 +285,10 @@ solely as intended in Ethereum abiding by the protocol.
| `nonce` | [uint64](#uint64) | | nonce corresponds to the account nonce (transaction sequence). |
| `gas_price` | [bytes](#bytes) | | price defines the unsigned integer value of the gas price in bytes. |
| `gas` | [uint64](#uint64) | | gas defines the gas limit defined for the transaction. |
| `to` | [bytes](#bytes) | | |
| `to` | [string](#string) | | hex formatted address of the recipient |
| `value` | [bytes](#bytes) | | value defines the unsigned integer value of the transaction amount. |
| `input` | [bytes](#bytes) | | input defines the data payload bytes of the transaction. |
| `accesses` | [AccessList](#ethermint.evm.v1alpha1.AccessList) | | |
| `accesses` | [AccessTuple](#ethermint.evm.v1alpha1.AccessTuple) | repeated | |
| `v` | [bytes](#bytes) | | v defines the signature value |
| `r` | [bytes](#bytes) | | r defines the signature value |
| `s` | [bytes](#bytes) | | s define the signature value |
@ -322,13 +306,13 @@ TxReceipt defines the receipt type stored in KV for each EVM transaction.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `hash` | [bytes](#bytes) | | |
| `from` | [bytes](#bytes) | | |
| `hash` | [string](#string) | | |
| `from` | [string](#string) | | |
| `data` | [TxData](#ethermint.evm.v1alpha1.TxData) | | |
| `result` | [TxResult](#ethermint.evm.v1alpha1.TxResult) | | |
| `index` | [uint64](#uint64) | | |
| `block_height` | [uint64](#uint64) | | |
| `block_hash` | [bytes](#bytes) | | |
| `block_hash` | [string](#string) | | |

View File

@ -148,14 +148,14 @@ func (e *EVMBackend) EthBlockFromTendermint(
ethRPCTxs := make([]interface{}, 0, len(txReceiptsResp.Receipts))
for _, receipt := range txReceiptsResp.Receipts {
hash := common.BytesToHash(receipt.Hash)
hash := common.HexToHash(receipt.Hash)
if fullTx {
// full txs from receipts
tx, err := types.NewTransactionFromData(
receipt.Data,
common.BytesToAddress(receipt.From),
common.HexToAddress(receipt.From),
hash,
common.BytesToHash(receipt.BlockHash),
common.HexToHash(receipt.BlockHash),
receipt.BlockHeight,
receipt.Index,
)

View File

@ -667,9 +667,9 @@ func (e *PublicEthAPI) GetTransactionByHash(hash common.Hash) (*types.RPCTransac
return types.NewTransactionFromData(
resp.Receipt.Data,
common.BytesToAddress(resp.Receipt.From),
common.BytesToHash(resp.Receipt.Hash),
common.BytesToHash(resp.Receipt.BlockHash),
common.HexToAddress(resp.Receipt.From),
common.HexToHash(resp.Receipt.Hash),
common.HexToHash(resp.Receipt.BlockHash),
resp.Receipt.BlockHeight,
resp.Receipt.Index,
)
@ -714,20 +714,19 @@ func (e *PublicEthAPI) getReceiptByIndex(receipts []*evmtypes.TxReceipt, blockHa
receipt := receipts[idx]
if (blockHash != common.Hash{}) {
if !bytes.Equal(receipt.BlockHash, blockHash.Bytes()) {
err := errors.Errorf("receipt found but block hashes don't match %s != %s",
common.Bytes2Hex(receipt.BlockHash),
blockHash.Hex(),
hexBlockHash := blockHash.Hex()
if receipt.BlockHash != hexBlockHash {
return nil, errors.Errorf("receipt found but block hashes don't match %s != %s",
receipt.BlockHash,
hexBlockHash,
)
return nil, err
}
}
return types.NewTransactionFromData(
receipt.Data,
common.BytesToAddress(receipt.From),
common.BytesToHash(receipt.Hash),
common.HexToAddress(receipt.From),
common.HexToHash(receipt.Hash),
blockHash,
receipt.BlockHeight,
uint64(idx),
@ -769,7 +768,7 @@ func (e *PublicEthAPI) GetTransactionReceipt(hash common.Hash) (map[string]inter
toHex := common.Address{}
if len(tx.Receipt.Data.To) > 0 {
toHex = common.BytesToAddress(tx.Receipt.Data.To)
toHex = common.HexToAddress(tx.Receipt.Data.To)
}
contractAddress := common.HexToAddress(tx.Receipt.Result.ContractAddress)
@ -794,7 +793,7 @@ func (e *PublicEthAPI) GetTransactionReceipt(hash common.Hash) (map[string]inter
"transactionIndex": hexutil.Uint64(tx.Receipt.Index),
// sender and receiver (contract or EOA) addreses
"from": common.BytesToAddress(tx.Receipt.From),
"from": common.HexToAddress(tx.Receipt.From),
"to": toHex,
}

View File

@ -79,7 +79,7 @@ func (args *SendTxArgs) ToTransaction() *evmtypes.MsgEthereumTx {
}
data := &evmtypes.TxData{
To: args.To.Bytes(),
To: args.To.Hex(),
ChainID: args.ChainID.ToInt().Bytes(),
Nonce: uint64(*args.Nonce),
GasLimit: uint64(*args.Gas),

View File

@ -304,7 +304,7 @@ func NewTransactionFromData(
var to *common.Address
if len(txData.To) > 0 {
recipient := common.BytesToAddress(txData.To)
recipient := common.HexToAddress(txData.To)
to = &recipient
}
@ -334,21 +334,3 @@ func NewTransactionFromData(
return rpcTx, nil
}
var zeroHash = hexutil.Bytes(make([]byte, 32))
func hashOrZero(data []byte) hexutil.Bytes {
if len(data) == 0 {
return zeroHash
}
return hexutil.Bytes(data)
}
func bigOrZero(i *big.Int) *hexutil.Big {
if i == nil {
return new(hexutil.Big)
}
return (*hexutil.Big)(i)
}

2
go.mod
View File

@ -43,7 +43,7 @@ require (
github.com/tyler-smith/go-bip39 v1.1.0
github.com/xlab/closer v0.0.0-20190328110542-03326addb7c2
github.com/xlab/suplog v1.3.0
golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf
golang.org/x/crypto v0.0.0-20210513122933-cd7d49e622d5
golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6 // indirect
google.golang.org/genproto v0.0.0-20210510173355-fb37daa5cd7a
google.golang.org/grpc v1.37.1

4
go.sum
View File

@ -916,8 +916,8 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf h1:B2n+Zi5QeYRDAEodEu72OS36gmTWjgpXr2+cWcBW90o=
golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/crypto v0.0.0-20210513122933-cd7d49e622d5 h1:N6Jp/LCiEoIBX56BZSR2bepK5GtbSC2DDOYT742mMfE=
golang.org/x/crypto v0.0.0-20210513122933-cd7d49e622d5/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=

View File

@ -174,13 +174,13 @@ message Log {
message TxReceipt {
option (gogoproto.goproto_getters) = false;
bytes hash = 1;
bytes from = 2;
string hash = 1;
string from = 2;
TxData data = 3;
TxResult result = 4;
uint64 index = 5;
uint64 block_height = 6;
bytes block_hash = 7;
string block_hash = 7;
}
// TxResult stores results of Tx execution.
@ -220,12 +220,17 @@ message TxData {
bytes gas_price = 3 [(gogoproto.customname) = "GasPrice"];
// gas defines the gas limit defined for the transaction.
uint64 gas = 4 [(gogoproto.customname) = "GasLimit"];
bytes to = 5;
// hex formatted address of the recipient
string to = 5;
// value defines the unsigned integer value of the transaction amount.
bytes value = 6 [(gogoproto.customname) = "Amount"];
// input defines the data payload bytes of the transaction.
bytes input = 7;
AccessList accesses = 8 [(gogoproto.jsontag) = "accessList"];
repeated AccessTuple accesses = 8 [
(gogoproto.castrepeated) = "AccessList",
(gogoproto.jsontag) = "accessList",
(gogoproto.nullable) = false
];
// v defines the signature value
bytes v = 9;
// r defines the signature value
@ -240,13 +245,6 @@ message BytesList {
repeated bytes bytes = 1;
}
// AccessList is an EIP-2930 access list defined as a proto message.
message AccessList {
// access list tuples
repeated AccessTuple tuples = 1 [(gogoproto.nullable) = false];
}
// AccessTuple is the element type of an access list.
message AccessTuple {
option (gogoproto.goproto_getters) = false;

164
tests/importer/chain_ctx.go Normal file
View File

@ -0,0 +1,164 @@
package importer
import (
"math/big"
ethcmn "github.com/ethereum/go-ethereum/common"
ethcons "github.com/ethereum/go-ethereum/consensus"
ethstate "github.com/ethereum/go-ethereum/core/state"
ethtypes "github.com/ethereum/go-ethereum/core/types"
ethrpc "github.com/ethereum/go-ethereum/rpc"
)
// ChainContext implements Ethereum's core.ChainContext and consensus.Engine
// interfaces. It is needed in order to apply and process Ethereum
// transactions. There should only be a single implementation in Ethermint. For
// the purposes of Ethermint, it should be support retrieving headers and
// consensus parameters from the current blockchain to be used during
// transaction processing.
//
// NOTE: Ethermint will distribute the fees out to validators, so the structure
// and functionality of this is a WIP and subject to change.
type ChainContext struct {
Coinbase ethcmn.Address
headersByNumber map[uint64]*ethtypes.Header
}
// NewChainContext generates new ChainContext based on Ethereum's core.ChainContext and
// consensus.Engine interfaces in order to process Ethereum transactions.
func NewChainContext() *ChainContext {
return &ChainContext{
headersByNumber: make(map[uint64]*ethtypes.Header),
}
}
// Engine implements Ethereum's core.ChainContext interface. As a ChainContext
// implements the consensus.Engine interface, it is simply returned.
func (cc *ChainContext) Engine() ethcons.Engine {
return cc
}
// SetHeader implements Ethereum's core.ChainContext interface. It sets the
// header for the given block number.
func (cc *ChainContext) SetHeader(number uint64, header *ethtypes.Header) {
cc.headersByNumber[number] = header
}
// GetHeader implements Ethereum's core.ChainContext interface.
//
// TODO: The Cosmos SDK supports retreiving such information in contexts and
// multi-store, so this will be need to be integrated.
func (cc *ChainContext) GetHeader(_ ethcmn.Hash, number uint64) *ethtypes.Header {
if header, ok := cc.headersByNumber[number]; ok {
return header
}
return nil
}
// Author implements Ethereum's consensus.Engine interface. It is responsible
// for returned the address of the validtor to receive any fees. This function
// is only invoked if the given author in the ApplyTransaction call is nil.
//
// NOTE: Ethermint will distribute the fees out to validators, so the structure
// and functionality of this is a WIP and subject to change.
func (cc *ChainContext) Author(_ *ethtypes.Header) (ethcmn.Address, error) {
return cc.Coinbase, nil
}
// APIs implements Ethereum's consensus.Engine interface. It currently performs
// a no-op.
//
// TODO: Do we need to support such RPC APIs? This will tie into a bigger
// discussion on if we want to support web3.
func (cc *ChainContext) APIs(_ ethcons.ChainHeaderReader) []ethrpc.API {
return nil
}
// CalcDifficulty implements Ethereum's consensus.Engine interface. It currently
// performs a no-op.
func (cc *ChainContext) CalcDifficulty(_ ethcons.ChainHeaderReader, _ uint64, _ *ethtypes.Header) *big.Int {
return nil
}
// Finalize implements Ethereum's consensus.Engine interface. It currently
// performs a no-op.
//
// TODO: Figure out if this needs to be hooked up to any part of the ABCI?
func (cc *ChainContext) Finalize(
_ ethcons.ChainHeaderReader, _ *ethtypes.Header, _ *ethstate.StateDB,
_ []*ethtypes.Transaction, _ []*ethtypes.Header) {
}
// FinalizeAndAssemble runs any post-transaction state modifications (e.g. block
// rewards) and assembles the final block.
//
// Note: The block header and state database might be updated to reflect any
// consensus rules that happen at finalization (e.g. block rewards).
// TODO: Figure out if this needs to be hooked up to any part of the ABCI?
func (cc *ChainContext) FinalizeAndAssemble(_ ethcons.ChainHeaderReader, _ *ethtypes.Header, _ *ethstate.StateDB, _ []*ethtypes.Transaction,
_ []*ethtypes.Header, _ []*ethtypes.Receipt) (*ethtypes.Block, error) {
return nil, nil
}
// Prepare implements Ethereum's consensus.Engine interface. It currently
// performs a no-op.
//
// TODO: Figure out if this needs to be hooked up to any part of the ABCI?
func (cc *ChainContext) Prepare(_ ethcons.ChainHeaderReader, _ *ethtypes.Header) error {
return nil
}
// Seal implements Ethereum's consensus.Engine interface. It currently
// performs a no-op.
//
// TODO: Figure out if this needs to be hooked up to any part of the ABCI?
func (cc *ChainContext) Seal(_ ethcons.ChainHeaderReader, _ *ethtypes.Block, _ chan<- *ethtypes.Block, _ <-chan struct{}) error {
return nil
}
// SealHash implements Ethereum's consensus.Engine interface. It returns the
// hash of a block prior to it being sealed.
func (cc *ChainContext) SealHash(header *ethtypes.Header) ethcmn.Hash {
return ethcmn.Hash{}
}
// VerifyHeader implements Ethereum's consensus.Engine interface. It currently
// performs a no-op.
//
// TODO: Figure out if this needs to be hooked up to any part of the Cosmos SDK
// handlers?
func (cc *ChainContext) VerifyHeader(_ ethcons.ChainHeaderReader, _ *ethtypes.Header, _ bool) error {
return nil
}
// VerifyHeaders implements Ethereum's consensus.Engine interface. It
// currently performs a no-op.
//
// TODO: Figure out if this needs to be hooked up to any part of the Cosmos SDK
// handlers?
func (cc *ChainContext) VerifyHeaders(_ ethcons.ChainHeaderReader, _ []*ethtypes.Header, _ []bool) (chan<- struct{}, <-chan error) {
return nil, nil
}
// VerifySeal implements Ethereum's consensus.Engine interface. It currently
// performs a no-op.
//
// TODO: Figure out if this needs to be hooked up to any part of the Cosmos SDK
// handlers?
func (cc *ChainContext) VerifySeal(_ ethcons.ChainHeaderReader, _ *ethtypes.Header) error {
return nil
}
// VerifyUncles implements Ethereum's consensus.Engine interface. It currently
// performs a no-op.
func (cc *ChainContext) VerifyUncles(_ ethcons.ChainReader, _ *ethtypes.Block) error {
return nil
}
// Close implements Ethereum's consensus.Engine interface. It terminates any
// background threads maintained by the consensus engine. It currently performs
// a no-op.
func (cc *ChainContext) Close() error {
return nil
}

View File

@ -0,0 +1,119 @@
package importer
// NOTE: A bulk of these unit tests will change and evolve as the context and
// implementation of ChainConext evolves.
import (
"math/big"
"testing"
"github.com/stretchr/testify/require"
ethcmn "github.com/ethereum/go-ethereum/common"
ethcons "github.com/ethereum/go-ethereum/consensus"
ethcore "github.com/ethereum/go-ethereum/core"
ethtypes "github.com/ethereum/go-ethereum/core/types"
)
func TestChainContextInterface(t *testing.T) {
require.Implements(t, (*ethcore.ChainContext)(nil), new(ChainContext))
require.Implements(t, (*ethcons.Engine)(nil), new(ChainContext))
}
func TestNewChainContext(t *testing.T) {
cc := NewChainContext()
require.NotNil(t, cc.headersByNumber)
}
func TestChainContextEngine(t *testing.T) {
cc := NewChainContext()
require.Equal(t, cc, cc.Engine())
}
func TestChainContextSetHeader(t *testing.T) {
cc := NewChainContext()
header := &ethtypes.Header{
Number: big.NewInt(64),
}
cc.SetHeader(uint64(header.Number.Int64()), header)
require.Equal(t, header, cc.headersByNumber[uint64(header.Number.Int64())])
}
func TestChainContextGetHeader(t *testing.T) {
cc := NewChainContext()
header := &ethtypes.Header{
Number: big.NewInt(64),
}
cc.SetHeader(uint64(header.Number.Int64()), header)
require.Equal(t, header, cc.GetHeader(ethcmn.Hash{}, uint64(header.Number.Int64())))
require.Nil(t, cc.GetHeader(ethcmn.Hash{}, 0))
}
func TestChainContextAuthor(t *testing.T) {
cc := NewChainContext()
cb, err := cc.Author(nil)
require.Nil(t, err)
require.Equal(t, cc.Coinbase, cb)
}
func TestChainContextAPIs(t *testing.T) {
cc := NewChainContext()
require.Nil(t, cc.APIs(nil))
}
func TestChainContextCalcDifficulty(t *testing.T) {
cc := NewChainContext()
require.Nil(t, cc.CalcDifficulty(nil, 0, nil))
}
func TestChainContextFinalize(t *testing.T) {
cc := NewChainContext()
cc.Finalize(nil, nil, nil, nil, nil)
}
func TestChainContextPrepare(t *testing.T) {
cc := NewChainContext()
err := cc.Prepare(nil, nil)
require.Nil(t, err)
}
func TestChainContextSeal(t *testing.T) {
cc := NewChainContext()
err := cc.Seal(nil, nil, nil, nil)
require.Nil(t, err)
}
func TestChainContextVerifyHeader(t *testing.T) {
cc := NewChainContext()
err := cc.VerifyHeader(nil, nil, false)
require.Nil(t, err)
}
func TestChainContextVerifyHeaders(t *testing.T) {
cc := NewChainContext()
ch, err := cc.VerifyHeaders(nil, nil, []bool{false})
require.Nil(t, err)
require.Nil(t, ch)
}
func TestChainContextVerifySeal(t *testing.T) {
cc := NewChainContext()
err := cc.VerifySeal(nil, nil)
require.Nil(t, err)
}
func TestChainContextVerifyUncles(t *testing.T) {
cc := NewChainContext()
err := cc.VerifyUncles(nil, nil)
require.Nil(t, err)
}

View File

@ -29,7 +29,6 @@ import (
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/ethermint/codec"
"github.com/cosmos/ethermint/core"
"github.com/cosmos/ethermint/types"
evmkeeper "github.com/cosmos/ethermint/x/evm/keeper"
evmtypes "github.com/cosmos/ethermint/x/evm/types"
@ -226,7 +225,7 @@ func TestImportBlocks(t *testing.T) {
}()
// ethereum mainnet config
chainContext := core.NewChainContext()
chainContext := NewChainContext()
vmConfig := ethvm.Config{}
chainConfig := ethparams.MainnetChainConfig

View File

@ -4,6 +4,8 @@ import (
"bytes"
ethcmn "github.com/ethereum/go-ethereum/common"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
// IsEmptyHash returns true if the hash corresponds to an empty ethereum hex hash.
@ -15,3 +17,20 @@ func IsEmptyHash(hash string) bool {
func IsZeroAddress(address string) bool {
return bytes.Equal(ethcmn.HexToAddress(address).Bytes(), ethcmn.Address{}.Bytes())
}
// ValidateAddress returns an error if the provided string is either not a hex formatted string address
// the it matches the zero address 0x00000000000000000000.
func ValidateAddress(address string) error {
if !ethcmn.IsHexAddress(address) {
return sdkerrors.Wrapf(
sdkerrors.ErrInvalidAddress, "address '%s' is not a valid ethereum hex address",
address,
)
}
if IsZeroAddress(address) {
return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "provided address cannot be the zero address")
}
return nil
}

View File

@ -98,14 +98,14 @@ func (k Keeper) SetBlockBloom(ctx sdk.Context, height int64, bloom ethtypes.Bloo
}
// GetBlockHash gets block height from block consensus hash
func (k Keeper) GetBlockHashFromHeight(ctx sdk.Context, height int64) ([]byte, bool) {
func (k Keeper) GetBlockHashFromHeight(ctx sdk.Context, height int64) (common.Hash, bool) {
store := ctx.KVStore(k.storeKey)
bz := store.Get(types.KeyBlockHeightHash(uint64(height)))
if len(bz) == 0 {
return common.Hash{}.Bytes(), false
return common.Hash{}, false
}
return common.BytesToHash(bz).Bytes(), true
return common.BytesToHash(bz), true
}
// SetBlockHash sets the mapping from block consensus hash to block height

View File

@ -35,7 +35,6 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
txHash := tmtypes.Tx(ctx.TxBytes()).Hash()
ethHash := ethcmn.BytesToHash(txHash)
blockHash, _ := k.GetBlockHashFromHeight(ctx, ctx.BlockHeight())
ethBlockHash := ethcmn.BytesToHash(blockHash)
st := &types.StateTransition{
Message: ethMsg,
@ -50,7 +49,7 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
// other nodes, causing a consensus error
if !st.Simulate {
// Prepare db for logs
k.Prepare(ctx, ethHash, ethBlockHash, k.TxCount)
k.Prepare(ctx, ethHash, blockHash, k.TxCount)
k.TxCount++
}
@ -62,11 +61,11 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
if !st.Simulate {
k.SetTxReceiptToHash(ctx, ethHash, &types.TxReceipt{
Hash: ethHash.Bytes(),
From: sender.Bytes(),
Hash: ethHash.Hex(),
From: sender.Hex(),
Data: msg.Data,
BlockHeight: uint64(ctx.BlockHeight()),
BlockHash: blockHash,
BlockHash: blockHash.Hex(),
Result: &types.TxResult{
ContractAddress: executionResult.Response.ContractAddress,
Bloom: executionResult.Response.Bloom,
@ -96,12 +95,12 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
blockHash, _ := k.GetBlockHashFromHeight(ctx, ctx.BlockHeight())
k.SetTxReceiptToHash(ctx, ethHash, &types.TxReceipt{
Hash: ethHash.Bytes(),
From: sender.Bytes(),
Hash: ethHash.Hex(),
From: sender.Hex(),
Data: msg.Data,
Index: uint64(st.Csdb.TxIndex()),
BlockHeight: uint64(ctx.BlockHeight()),
BlockHash: blockHash,
BlockHash: blockHash.Hex(),
Result: &types.TxResult{
ContractAddress: executionResult.Response.ContractAddress,
Bloom: executionResult.Response.Bloom,
@ -134,11 +133,10 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
})
if len(msg.Data.To) > 0 {
ethAddr := ethcmn.BytesToAddress(msg.Data.To)
ctx.EventManager().EmitEvent(
sdk.NewEvent(
types.EventTypeEthereumTx,
sdk.NewAttribute(types.AttributeKeyRecipient, ethAddr.Hex()),
sdk.NewAttribute(types.AttributeKeyRecipient, msg.Data.To),
),
)
}

View File

@ -135,14 +135,18 @@ func (al *accessList) DeleteAddress(address common.Address) {
delete(al.addresses, address)
}
// AccessList is an EIP-2930 access list that represents the slice of
// the protobuf AccessTuples.
type AccessList []AccessTuple
// NewAccessList creates a new protobuf-compatible AccessList from an ethereum
// core AccessList type
func NewAccessList(ethAccessList *ethtypes.AccessList) *AccessList {
func NewAccessList(ethAccessList *ethtypes.AccessList) AccessList {
if ethAccessList == nil {
return nil
}
var tuples []AccessTuple
var accessList AccessList
for _, tuple := range *ethAccessList {
storageKeys := make([]string, len(tuple.StorageKeys))
@ -150,15 +154,13 @@ func NewAccessList(ethAccessList *ethtypes.AccessList) *AccessList {
storageKeys[i] = tuple.StorageKeys[i].String()
}
tuples = append(tuples, AccessTuple{
accessList = append(accessList, AccessTuple{
Address: tuple.Address.String(),
StorageKeys: storageKeys,
})
}
return &AccessList{
Tuples: tuples,
}
return accessList
}
// ToEthAccessList is an utility function to convert the protobuf compatible
@ -166,7 +168,7 @@ func NewAccessList(ethAccessList *ethtypes.AccessList) *AccessList {
func (al AccessList) ToEthAccessList() *ethtypes.AccessList {
var accessList ethtypes.AccessList
for _, tuple := range al.Tuples {
for _, tuple := range al {
storageKeys := make([]ethcmn.Hash, len(tuple.StorageKeys))
for i := range tuple.StorageKeys {

View File

@ -421,13 +421,13 @@ func (m *Log) GetRemoved() bool {
// TxReceipt defines the receipt type stored in KV for each EVM transaction.
type TxReceipt struct {
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
From []byte `protobuf:"bytes,2,opt,name=from,proto3" json:"from,omitempty"`
Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
From string `protobuf:"bytes,2,opt,name=from,proto3" json:"from,omitempty"`
Data *TxData `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
Result *TxResult `protobuf:"bytes,4,opt,name=result,proto3" json:"result,omitempty"`
Index uint64 `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"`
BlockHeight uint64 `protobuf:"varint,6,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"`
BlockHash []byte `protobuf:"bytes,7,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
BlockHash string `protobuf:"bytes,7,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
}
func (m *TxReceipt) Reset() { *m = TxReceipt{} }
@ -526,12 +526,13 @@ type TxData struct {
GasPrice []byte `protobuf:"bytes,3,opt,name=gas_price,json=gasPrice,proto3" json:"gas_price,omitempty"`
// gas defines the gas limit defined for the transaction.
GasLimit uint64 `protobuf:"varint,4,opt,name=gas,proto3" json:"gas,omitempty"`
To []byte `protobuf:"bytes,5,opt,name=to,proto3" json:"to,omitempty"`
// hex formatted address of the recipient
To string `protobuf:"bytes,5,opt,name=to,proto3" json:"to,omitempty"`
// value defines the unsigned integer value of the transaction amount.
Amount []byte `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"`
// input defines the data payload bytes of the transaction.
Input []byte `protobuf:"bytes,7,opt,name=input,proto3" json:"input,omitempty"`
Accesses *AccessList `protobuf:"bytes,8,opt,name=accesses,proto3" json:"accessList"`
Input []byte `protobuf:"bytes,7,opt,name=input,proto3" json:"input,omitempty"`
Accesses AccessList `protobuf:"bytes,8,rep,name=accesses,proto3,castrepeated=AccessList" json:"accessList"`
// v defines the signature value
V []byte `protobuf:"bytes,9,opt,name=v,proto3" json:"v,omitempty"`
// r defines the signature value
@ -610,52 +611,6 @@ func (m *BytesList) XXX_DiscardUnknown() {
var xxx_messageInfo_BytesList proto.InternalMessageInfo
// AccessList is an EIP-2930 access list defined as a proto message.
type AccessList struct {
// access list tuples
Tuples []AccessTuple `protobuf:"bytes,1,rep,name=tuples,proto3" json:"tuples"`
}
func (m *AccessList) Reset() { *m = AccessList{} }
func (m *AccessList) String() string { return proto.CompactTextString(m) }
func (*AccessList) ProtoMessage() {}
func (*AccessList) Descriptor() ([]byte, []int) {
return fileDescriptor_98f00fcca8b6b943, []int{9}
}
func (m *AccessList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *AccessList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_AccessList.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *AccessList) XXX_Merge(src proto.Message) {
xxx_messageInfo_AccessList.Merge(m, src)
}
func (m *AccessList) XXX_Size() int {
return m.Size()
}
func (m *AccessList) XXX_DiscardUnknown() {
xxx_messageInfo_AccessList.DiscardUnknown(m)
}
var xxx_messageInfo_AccessList proto.InternalMessageInfo
func (m *AccessList) GetTuples() []AccessTuple {
if m != nil {
return m.Tuples
}
return nil
}
// AccessTuple is the element type of an access list.
type AccessTuple struct {
// hex formatted ethereum address
@ -668,7 +623,7 @@ func (m *AccessTuple) Reset() { *m = AccessTuple{} }
func (m *AccessTuple) String() string { return proto.CompactTextString(m) }
func (*AccessTuple) ProtoMessage() {}
func (*AccessTuple) Descriptor() ([]byte, []int) {
return fileDescriptor_98f00fcca8b6b943, []int{10}
return fileDescriptor_98f00fcca8b6b943, []int{9}
}
func (m *AccessTuple) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -707,109 +662,108 @@ func init() {
proto.RegisterType((*TxResult)(nil), "ethermint.evm.v1alpha1.TxResult")
proto.RegisterType((*TxData)(nil), "ethermint.evm.v1alpha1.TxData")
proto.RegisterType((*BytesList)(nil), "ethermint.evm.v1alpha1.BytesList")
proto.RegisterType((*AccessList)(nil), "ethermint.evm.v1alpha1.AccessList")
proto.RegisterType((*AccessTuple)(nil), "ethermint.evm.v1alpha1.AccessTuple")
}
func init() { proto.RegisterFile("ethermint/evm/v1alpha1/evm.proto", fileDescriptor_98f00fcca8b6b943) }
var fileDescriptor_98f00fcca8b6b943 = []byte{
// 1516 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xcb, 0x6f, 0x1b, 0x45,
0x18, 0x8f, 0x1f, 0x71, 0xec, 0xf1, 0xc6, 0x31, 0xd3, 0x10, 0xdc, 0x56, 0x78, 0xcd, 0x22, 0xd1,
0x20, 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, 0x30, 0xdb, 0x38, 0xf5, 0x35, 0xd1, 0xd4, 0xa3, 0xc8, 0x2c, 0xa8,
0x1b, 0x68, 0x14, 0x4b, 0xd4, 0x98, 0x6c, 0xac, 0x22, 0x48, 0x85, 0x44, 0x45, 0xd6, 0x40, 0x62,
0x09, 0x6f, 0x80, 0x6c, 0x48, 0x7a, 0x24, 0xe4, 0xa4, 0x25, 0xe3, 0x96, 0x45, 0x63, 0x19, 0x5e,
0x07, 0x59, 0x07, 0xb3, 0x46, 0x97, 0x91, 0x96, 0x0e, 0xdb, 0x92, 0x83, 0xd9, 0x57, 0x8c, 0xb4,
0x74, 0x4c, 0xfe, 0x49, 0x82, 0x8c, 0x4a, 0x1e, 0xdc, 0x02, 0x59, 0x5b, 0x7c, 0xae, 0x36, 0xdc,
0x96, 0x2a, 0x8b, 0xfa, 0xda, 0x30, 0x32, 0x97, 0xe4, 0x27, 0xec, 0xc1, 0xee, 0x69, 0x64, 0x2e,
0xd9, 0x6a, 0x89, 0xf4, 0xa2, 0x25, 0x9c, 0x0f, 0x68, 0x60, 0xab, 0x71, 0x90, 0x46, 0x4a, 0x80,
0x9f, 0x83, 0x9c, 0x20, 0xed, 0x84, 0xae, 0x4d, 0x54, 0x07, 0xd6, 0x8d, 0x61, 0x64, 0x66, 0x1f,
0x61, 0x76, 0x24, 0x74, 0x48, 0xdc, 0x49, 0xae, 0x60, 0x19, 0xa4, 0x1c, 0xcc, 0x74, 0x2b, 0xc6,
0x46, 0x87, 0xae, 0xef, 0x72, 0x24, 0x36, 0x60, 0x01, 0x24, 0x39, 0x95, 0x5e, 0x19, 0x28, 0xc9,
0x29, 0xac, 0xc4, 0xf3, 0x27, 0x23, 0x61, 0xc1, 0x30, 0x32, 0x33, 0x35, 0x9f, 0x76, 0x03, 0xae,
0x67, 0x91, 0x2a, 0xa1, 0x4e, 0x97, 0xeb, 0x22, 0x50, 0x02, 0x7c, 0x0a, 0xb2, 0xd8, 0xb6, 0x09,
0x63, 0x84, 0x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 0x00, 0x00,
// 1506 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0x4b, 0x6f, 0x1b, 0x47,
0x12, 0x16, 0x1f, 0xa2, 0x86, 0xcd, 0x11, 0xc5, 0x6d, 0x6b, 0xb5, 0xb4, 0x8d, 0xe5, 0x70, 0x67,
0x81, 0xb5, 0x16, 0xb0, 0x25, 0x4b, 0x86, 0xb0, 0x82, 0x81, 0x3d, 0x90, 0x96, 0x6c, 0x09, 0x96,
0x77, 0x85, 0xb6, 0xd6, 0x5e, 0xe4, 0x42, 0x34, 0x67, 0xda, 0xc3, 0x89, 0x66, 0xa6, 0x99, 0xe9,
0x26, 0x4d, 0x06, 0x08, 0x90, 0x63, 0x8e, 0xc9, 0x2d, 0xc7, 0x9c, 0xf3, 0x03, 0xf2, 0x1b, 0x8c,
0x9c, 0x7c, 0x0c, 0x72, 0x98, 0x04, 0xf4, 0x4d, 0x47, 0x5e, 0x72, 0x09, 0x90, 0xa0, 0x1f, 0x43,
0x91, 0x7a, 0x04, 0x20, 0x74, 0x62, 0x57, 0x75, 0xf5, 0xf7, 0x75, 0x55, 0x75, 0x55, 0x0d, 0x41,
0x9d, 0xf0, 0x0e, 0x89, 0x43, 0x3f, 0xe2, 0x9b, 0xa4, 0x1f, 0x6e, 0xf6, 0xb7, 0x70, 0xd0, 0xed,
0xe0, 0x2d, 0x21, 0x6c, 0x74, 0x63, 0xca, 0x29, 0x5c, 0x9b, 0x58, 0x6c, 0x08, 0x65, 0x6a, 0x71,
0x67, 0xd5, 0xa3, 0x1e, 0x95, 0x26, 0x9b, 0x62, 0xa5, 0xac, 0xed, 0x5f, 0x33, 0xa0, 0x70, 0x8c,
0x63, 0x1c, 0x32, 0xb8, 0x05, 0x8a, 0xa4, 0x1f, 0xb6, 0x5c, 0x12, 0xd1, 0xb0, 0x9a, 0xa9, 0x67,
0xd6, 0x8b, 0xcd, 0x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, 0xe8, 0xde, 0xe5, 0xd9, 0x72, 0xfe, 0x2f, 0x71, 0x20, 0xff, 0x27, 0xca, 0x01, 0xd3, 0x2e,
0xc8, 0xff, 0x7c, 0x8f, 0x7e, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xf2, 0x3d, 0x7c, 0x52, 0x45, 0x0e,
0x00, 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
@ -1405,17 +1359,19 @@ func (m *TxData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x4a
}
if m.Accesses != nil {
{
size, err := m.Accesses.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
if len(m.Accesses) > 0 {
for iNdEx := len(m.Accesses) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Accesses[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintEvm(dAtA, i, uint64(size))
}
i -= size
i = encodeVarintEvm(dAtA, i, uint64(size))
i--
dAtA[i] = 0x42
}
i--
dAtA[i] = 0x42
}
if len(m.Input) > 0 {
i -= len(m.Input)
@ -1497,43 +1453,6 @@ func (m *BytesList) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *AccessList) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *AccessList) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *AccessList) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Tuples) > 0 {
for iNdEx := len(m.Tuples) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Tuples[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintEvm(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *AccessTuple) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -1827,9 +1746,11 @@ func (m *TxData) Size() (n int) {
if l > 0 {
n += 1 + l + sovEvm(uint64(l))
}
if m.Accesses != nil {
l = m.Accesses.Size()
n += 1 + l + sovEvm(uint64(l))
if len(m.Accesses) > 0 {
for _, e := range m.Accesses {
l = e.Size()
n += 1 + l + sovEvm(uint64(l))
}
}
l = len(m.V)
if l > 0 {
@ -1861,21 +1782,6 @@ func (m *BytesList) Size() (n int) {
return n
}
func (m *AccessList) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Tuples) > 0 {
for _, e := range m.Tuples {
l = e.Size()
n += 1 + l + sovEvm(uint64(l))
}
}
return n
}
func (m *AccessTuple) Size() (n int) {
if m == nil {
return 0
@ -3210,7 +3116,7 @@ func (m *TxReceipt) Unmarshal(dAtA []byte) error {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType)
}
var byteLen int
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
@ -3220,31 +3126,29 @@ func (m *TxReceipt) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + byteLen
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...)
if m.Hash == nil {
m.Hash = []byte{}
}
m.Hash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field From", wireType)
}
var byteLen int
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
@ -3254,25 +3158,23 @@ func (m *TxReceipt) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + byteLen
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.From = append(m.From[:0], dAtA[iNdEx:postIndex]...)
if m.From == nil {
m.From = []byte{}
}
m.From = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
@ -3388,7 +3290,7 @@ func (m *TxReceipt) Unmarshal(dAtA []byte) error {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType)
}
var byteLen int
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
@ -3398,25 +3300,23 @@ func (m *TxReceipt) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + byteLen
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...)
if m.BlockHash == nil {
m.BlockHash = []byte{}
}
m.BlockHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
@ -3806,7 +3706,7 @@ func (m *TxData) Unmarshal(dAtA []byte) error {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field To", wireType)
}
var byteLen int
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
@ -3816,25 +3716,23 @@ func (m *TxData) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + byteLen
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.To = append(m.To[:0], dAtA[iNdEx:postIndex]...)
if m.To == nil {
m.To = []byte{}
}
m.To = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
@ -3933,10 +3831,8 @@ func (m *TxData) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Accesses == nil {
m.Accesses = &AccessList{}
}
if err := m.Accesses.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
m.Accesses = append(m.Accesses, AccessTuple{})
if err := m.Accesses[len(m.Accesses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@ -4151,93 +4047,6 @@ func (m *BytesList) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *AccessList) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: AccessList: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: AccessList: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Tuples", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Tuples = append(m.Tuples, AccessTuple{})
if err := m.Tuples[len(m.Tuples)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvm(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *AccessTuple) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0

View File

@ -8,6 +8,7 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/ethermint/types"
ethcmn "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
@ -52,9 +53,9 @@ func newMsgEthereumTx(
input = ethcmn.CopyBytes(input)
}
var toBz []byte
var toHex string
if to != nil {
toBz = to.Bytes()
toHex = to.Hex()
}
var chainIDBz []byte
@ -65,7 +66,7 @@ func newMsgEthereumTx(
txData := &TxData{
ChainID: chainIDBz,
Nonce: nonce,
To: toBz,
To: toHex,
Input: input,
GasLimit: gasLimit,
Amount: []byte{},
@ -106,17 +107,29 @@ func (msg MsgEthereumTx) ValidateBasic() error {
return sdkerrors.Wrapf(ErrInvalidValue, "amount cannot be negative %s", amount)
}
if msg.Data.To != "" {
if err := types.ValidateAddress(msg.Data.To); err != nil {
return sdkerrors.Wrap(err, "invalid to address")
}
}
if msg.From != "" {
if err := types.ValidateAddress(msg.From); err != nil {
return sdkerrors.Wrap(err, "invalid from address")
}
}
return nil
}
// To returns the recipient address of the transaction. It returns nil if the
// transaction is a contract creation.
func (msg MsgEthereumTx) To() *ethcmn.Address {
if len(msg.Data.To) == 0 {
if msg.Data.To == "" {
return nil
}
recipient := ethcmn.BytesToAddress(msg.Data.To)
recipient := ethcmn.HexToAddress(msg.Data.To)
return &recipient
}
@ -297,8 +310,8 @@ func (msg MsgEthereumTx) AsMessage() (core.Message, error) {
from := ethcmn.HexToAddress(msg.From)
var to *ethcmn.Address
if msg.Data.To != nil {
toAddr := ethcmn.BytesToAddress(msg.Data.To)
if msg.Data.To != "" {
toAddr := ethcmn.HexToAddress(msg.Data.To)
to = &toAddr
}
@ -324,8 +337,8 @@ func (msg MsgEthereumTx) AsMessage() (core.Message, error) {
// TxData defined on the Cosmos EVM.
func (data TxData) AsEthereumData() ethtypes.TxData {
var to *ethcmn.Address
if data.To != nil {
toAddr := ethcmn.BytesToAddress(data.To)
if data.To != "" {
toAddr := ethcmn.HexToAddress(data.To)
to = &toAddr
}

View File

@ -47,7 +47,7 @@ func (suite *MsgsTestSuite) SetupTest() {
func (suite *MsgsTestSuite) TestMsgEthereumTx_Constructor() {
msg := NewMsgEthereumTx(nil, 0, &suite.to, nil, 100000, nil, []byte("test"), nil)
suite.Require().Equal(msg.Data.To, suite.to.Bytes())
suite.Require().Equal(msg.Data.To, suite.to.Hex())
suite.Require().Equal(msg.Route(), RouterKey)
suite.Require().Equal(msg.Type(), TypeMsgEthereumTx)
suite.Require().NotNil(msg.To())
@ -57,27 +57,30 @@ func (suite *MsgsTestSuite) TestMsgEthereumTx_Constructor() {
msg = NewMsgEthereumTxContract(nil, 0, nil, 100000, nil, []byte("test"), nil)
suite.Require().NotNil(msg)
suite.Require().Nil(msg.Data.To)
suite.Require().Empty(msg.Data.To)
suite.Require().Nil(msg.To())
}
func (suite *MsgsTestSuite) TestMsgEthereumTx_ValidateBasic() {
testCases := []struct {
msg string
to *ethcmn.Address
amount *big.Int
gasPrice *big.Int
expectPass bool
}{
{msg: "pass", amount: big.NewInt(100), gasPrice: big.NewInt(100000), expectPass: true},
{msg: "pass with recipient", to: &suite.to, amount: big.NewInt(100), gasPrice: big.NewInt(100000), expectPass: true},
{msg: "pass contract", to: nil, amount: big.NewInt(100), gasPrice: big.NewInt(100000), expectPass: true},
{msg: "invalid recipient", to: &ethcmn.Address{}, amount: big.NewInt(-1), gasPrice: big.NewInt(1000), expectPass: true},
// NOTE: these can't be effectively tested because the SetBytes function from big.Int only sets
// the absolute value
{msg: "negative amount", amount: big.NewInt(-1), gasPrice: big.NewInt(1000), expectPass: true},
{msg: "negative gas price", amount: big.NewInt(100), gasPrice: big.NewInt(-1), expectPass: true},
{msg: "zero gas price", amount: big.NewInt(100), gasPrice: big.NewInt(0), expectPass: true},
{msg: "negative amount", to: &suite.to, amount: big.NewInt(-1), gasPrice: big.NewInt(1000), expectPass: true},
{msg: "negative gas price", to: &suite.to, amount: big.NewInt(100), gasPrice: big.NewInt(-1), expectPass: true},
{msg: "zero gas price", to: &suite.to, amount: big.NewInt(100), gasPrice: big.NewInt(0), expectPass: true},
}
for i, tc := range testCases {
msg := NewMsgEthereumTx(suite.chainID, 0, nil, tc.amount, 0, tc.gasPrice, nil, nil)
msg := NewMsgEthereumTx(suite.chainID, 0, tc.to, tc.amount, 0, tc.gasPrice, nil, nil)
err := msg.ValidateBasic()
if tc.expectPass {