evm: TxData as proto.Any (#220)

* evm: TxData as proto.Any

* proto message

* fix protobuf any generation

* Int pointer

* fix build and tests

* ante tests

* swagger

* cleanup

* c++
This commit is contained in:
Federico Kunze Küllmer
2021-07-05 16:39:08 +00:00
committed by GitHub
parent 79e7062250
commit 5f1f252361
36 changed files with 2483 additions and 1699 deletions
+11 -11
View File
@@ -78,7 +78,7 @@ func TestEvmTestSuite(t *testing.T) {
// "passed",
// func() {
// to := ethcmn.BytesToAddress(suite.to)
// tx = types.NewMsgEthereumTx(suite.chainID, 0, &to, big.NewInt(100), 0, big.NewInt(10000), nil, nil)
// tx = types.NewTx(suite.chainID, 0, &to, big.NewInt(100), 0, big.NewInt(10000), nil, nil)
// tx.From = suite.from.String()
// // sign transaction
@@ -90,7 +90,7 @@ func TestEvmTestSuite(t *testing.T) {
// {
// "insufficient balance",
// func() {
// tx = types.NewMsgEthereumTxContract(suite.chainID, 0, big.NewInt(100), 0, big.NewInt(10000), nil, nil)
// tx = types.NewTxContract(suite.chainID, 0, big.NewInt(100), 0, big.NewInt(10000), nil, nil)
// tx.From = suite.from.Hex()
// // sign transaction
// err := tx.Sign(suite.ethSigner, suite.signer)
@@ -101,7 +101,7 @@ func TestEvmTestSuite(t *testing.T) {
// {
// "tx encoding failed",
// func() {
// tx = types.NewMsgEthereumTxContract(suite.chainID, 0, big.NewInt(100), 0, big.NewInt(10000), nil, nil)
// tx = types.NewTxContract(suite.chainID, 0, big.NewInt(100), 0, big.NewInt(10000), nil, nil)
// },
// false,
// },
@@ -115,7 +115,7 @@ func TestEvmTestSuite(t *testing.T) {
// {
// "VerifySig failed",
// func() {
// tx = types.NewMsgEthereumTxContract(suite.chainID, 0, big.NewInt(100), 0, big.NewInt(10000), nil, nil)
// tx = types.NewTxContract(suite.chainID, 0, big.NewInt(100), 0, big.NewInt(10000), nil, nil)
// },
// false,
// },
@@ -165,7 +165,7 @@ func TestEvmTestSuite(t *testing.T) {
// gasPrice := big.NewInt(1000000)
// bytecode := common.FromHex("0x6080604052348015600f57600080fd5b5060117f775a94827b8fd9b519d36cd827093c664f93347070a554f65e4a6f56cd73889860405160405180910390a2603580604b6000396000f3fe6080604052600080fdfea165627a7a723058206cab665f0f557620554bb45adf266708d2bd349b8a4314bdff205ee8440e3c240029")
// tx := types.NewMsgEthereumTx(suite.chainID, 1, nil, big.NewInt(0), gasLimit, gasPrice, bytecode, nil)
// tx := types.NewTx(suite.chainID, 1, nil, big.NewInt(0), gasLimit, gasPrice, bytecode, nil)
// tx.From = suite.from.String()
// err := tx.Sign(suite.ethSigner, suite.signer)
@@ -249,7 +249,7 @@ func TestEvmTestSuite(t *testing.T) {
// gasPrice := big.NewInt(10000)
// bytecode := common.FromHex("0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a36102c4806100dc6000396000f3fe608060405234801561001057600080fd5b5060043610610053576000357c010000000000000000000000000000000000000000000000000000000090048063893d20e814610058578063a6f9dae1146100a2575b600080fd5b6100606100e6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100e4600480360360208110156100b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061010f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f43616c6c6572206973206e6f74206f776e65720000000000000000000000000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72315820f397f2733a89198bc7fed0764083694c5b828791f39ebcbc9e414bccef14b48064736f6c63430005100032")
// tx := types.NewMsgEthereumTx(suite.chainID, 1, nil, big.NewInt(0), gasLimit, gasPrice, bytecode, nil)
// tx := types.NewTx(suite.chainID, 1, nil, big.NewInt(0), gasLimit, gasPrice, bytecode, nil)
// tx.From = suite.from.String()
// err := tx.Sign(suite.ethSigner, suite.signer)
@@ -268,7 +268,7 @@ func TestEvmTestSuite(t *testing.T) {
// storeAddr := "0xa6f9dae10000000000000000000000006a82e4a67715c8412a9114fbd2cbaefbc8181424"
// bytecode = common.FromHex(storeAddr)
// tx = types.NewMsgEthereumTx(suite.chainID, 2, &receiver, big.NewInt(0), gasLimit, gasPrice, bytecode, nil)
// tx = types.NewTx(suite.chainID, 2, &receiver, big.NewInt(0), gasLimit, gasPrice, bytecode, nil)
// tx.From = suite.from.String()
// err = tx.Sign(suite.ethSigner, suite.signer)
@@ -282,7 +282,7 @@ func TestEvmTestSuite(t *testing.T) {
// // query - getOwner
// bytecode = common.FromHex("0x893d20e8")
// tx = types.NewMsgEthereumTx(suite.chainID, 2, &receiver, big.NewInt(0), gasLimit, gasPrice, bytecode, nil)
// tx = types.NewTx(suite.chainID, 2, &receiver, big.NewInt(0), gasLimit, gasPrice, bytecode, nil)
// tx.From = suite.from.String()
// err = tx.Sign(suite.ethSigner, suite.signer)
// suite.Require().NoError(err)
@@ -302,7 +302,7 @@ func TestEvmTestSuite(t *testing.T) {
// gasPrice := big.NewInt(0x55ae82600)
// // send simple value transfer with gasLimit=21000
// tx := types.NewMsgEthereumTx(suite.chainID, 1, &ethcmn.Address{0x1}, big.NewInt(1), gasLimit, gasPrice, nil, nil)
// tx := types.NewTx(suite.chainID, 1, &ethcmn.Address{0x1}, big.NewInt(1), gasLimit, gasPrice, nil, nil)
// tx.From = suite.from.String()
// err := tx.Sign(suite.ethSigner, suite.signer)
// suite.Require().NoError(err)
@@ -373,7 +373,7 @@ func TestEvmTestSuite(t *testing.T) {
// gasPrice := big.NewInt(10000)
// bytecode := common.FromHex("0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a36102c4806100dc6000396000f3fe608060405234801561001057600080fd5b5060043610610053576000357c010000000000000000000000000000000000000000000000000000000090048063893d20e814610058578063a6f9dae1146100a2575b600080fd5b6100606100e6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100e4600480360360208110156100b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061010f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f43616c6c6572206973206e6f74206f776e65720000000000000000000000000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72315820f397f2733a89198bc7fed0764083694c5b828791f39ebcbc9e414bccef14b48064736f6c63430005100032")
// tx := types.NewMsgEthereumTx(suite.chainID, 1, nil, big.NewInt(0), gasLimit, gasPrice, bytecode, nil)
// tx := types.NewTx(suite.chainID, 1, nil, big.NewInt(0), gasLimit, gasPrice, bytecode, nil)
// tx.From = suite.from.String()
// err := tx.Sign(suite.ethSigner, suite.signer)
@@ -402,7 +402,7 @@ func TestEvmTestSuite(t *testing.T) {
// bytecode := common.FromHex("0xa6f9dae10000000000000000000000006a82e4a67715c8412a9114fbd2cbaefbc8181424")
// tx := types.NewMsgEthereumTx(suite.chainID, 1, nil, big.NewInt(0), gasLimit, gasPrice, bytecode, nil)
// tx := types.NewTx(suite.chainID, 1, nil, big.NewInt(0), gasLimit, gasPrice, bytecode, nil)
// tx.From = suite.from.String()
// err := tx.Sign(suite.ethSigner, suite.signer)
+1 -1
View File
@@ -314,7 +314,7 @@ func (k Keeper) StaticCall(c context.Context, req *types.QueryStaticCallRequest)
// so := k.GetOrNewStateObject(*recipient)
// sender := ethcmn.HexToAddress("0xaDd00275E3d9d213654Ce5223f0FADE8b106b707")
// msg := types.NewMsgEthereumTx(
// msg := types.NewTx(
// chainIDEpoch, so.Nonce(), recipient, big.NewInt(0), 100000000, big.NewInt(0), req.Input, nil,
// )
// msg.From = sender.Hex()
+7 -7
View File
@@ -24,21 +24,21 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
ctx := sdk.UnwrapSDKContext(goCtx)
k.WithContext(ctx)
sender := msg.From
tx := msg.AsTransaction()
var labels []metrics.Label
if msg.To() == nil {
if tx.To() == nil {
labels = []metrics.Label{
telemetry.NewLabel("execution", "create"),
}
} else {
labels = []metrics.Label{
telemetry.NewLabel("execution", "call"),
telemetry.NewLabel("to", msg.Data.To), // recipient address (contract or account)
telemetry.NewLabel("to", tx.To().Hex()), // recipient address (contract or account)
}
}
sender := msg.From
tx := msg.AsTransaction()
response, err := k.ApplyTransaction(tx)
if err != nil {
return nil, stacktrace.Propagate(err, "failed to apply transaction")
@@ -71,8 +71,8 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
attrs = append(attrs, sdk.NewAttribute(types.AttributeKeyTxHash, hash.String()))
}
if len(msg.Data.To) > 0 {
attrs = append(attrs, sdk.NewAttribute(types.AttributeKeyRecipient, msg.Data.To))
if tx.To() != nil {
attrs = append(attrs, sdk.NewAttribute(types.AttributeKeyRecipient, tx.To().Hex()))
}
// emit events
+1 -1
View File
@@ -478,7 +478,7 @@ func (suite *KeeperTestSuite) CreateTestTx(msg *evmtypes.MsgEthereumTx, priv cry
func (suite *KeeperTestSuite) TestAddLog() {
addr, privKey := tests.NewAddrKey()
msg := types.NewMsgEthereumTx(big.NewInt(1), 0, &suite.address, big.NewInt(1), 100000, big.NewInt(1), []byte("test"), nil)
msg := types.NewTx(big.NewInt(1), 0, &suite.address, big.NewInt(1), 100000, big.NewInt(1), []byte("test"), nil)
msg.From = addr.Hex()
tx := suite.CreateTestTx(msg, privKey)
+205
View File
@@ -0,0 +1,205 @@
package types
import (
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/tharsis/ethermint/types"
)
func newAccessListTx(tx *ethtypes.Transaction) *AccessListTx {
txData := &AccessListTx{
Nonce: tx.Nonce(),
Data: tx.Data(),
GasLimit: tx.Gas(),
}
v, r, s := tx.RawSignatureValues()
if tx.To() != nil {
txData.To = tx.To().Hex()
}
if tx.Value() != nil {
amountInt := sdk.NewIntFromBigInt(tx.Value())
txData.Amount = &amountInt
}
if tx.GasPrice() != nil {
gasPriceInt := sdk.NewIntFromBigInt(tx.GasPrice())
txData.GasPrice = &gasPriceInt
}
if tx.AccessList() != nil {
al := tx.AccessList()
txData.Accesses = NewAccessList(&al)
}
txData.SetSignatureValues(tx.ChainId(), v, r, s)
return txData
}
// TxType returns the tx type
func (tx *AccessListTx) TxType() uint8 {
return ethtypes.AccessListTxType
}
// Copy returns an instance with the same field values
func (tx *AccessListTx) Copy() TxData {
return &AccessListTx{
ChainID: tx.ChainID,
Nonce: tx.Nonce,
GasPrice: tx.GasPrice,
GasLimit: tx.GasLimit,
To: tx.To,
Amount: tx.Amount,
Data: common.CopyBytes(tx.Data),
Accesses: tx.Accesses,
V: common.CopyBytes(tx.V),
R: common.CopyBytes(tx.R),
S: common.CopyBytes(tx.S),
}
}
// GetChainID returns the chain id field from the AccessListTx
func (tx *AccessListTx) GetChainID() *big.Int {
if tx.ChainID == nil {
return nil
}
return tx.ChainID.BigInt()
}
// GetAccessList returns the AccessList field.
func (tx *AccessListTx) GetAccessList() ethtypes.AccessList {
if tx.Accesses == nil {
return nil
}
return *tx.Accesses.ToEthAccessList()
}
// GetData returns the a copy of the input data bytes.
func (tx *AccessListTx) GetData() []byte {
return common.CopyBytes(tx.Data)
}
// GetGas returns the gas limit.
func (tx *AccessListTx) GetGas() uint64 {
return tx.GasLimit
}
// GetGasPrice returns the gas price field.
func (tx *AccessListTx) GetGasPrice() *big.Int {
if tx.GasPrice == nil {
return nil
}
return tx.GasPrice.BigInt()
}
// GetValue returns the tx amount.
func (tx *AccessListTx) GetValue() *big.Int {
if tx.Amount == nil {
return nil
}
return tx.Amount.BigInt()
}
// GetNonce returns the account sequence for the transaction.
func (tx *AccessListTx) GetNonce() uint64 { return tx.Nonce }
// GetTo returns the pointer to the recipient address.
func (tx *AccessListTx) GetTo() *common.Address {
if tx.To == "" {
return nil
}
to := common.HexToAddress(tx.To)
return &to
}
// AsEthereumData returns an AccessListTx transaction tx from the proto-formatted
// TxData defined on the Cosmos EVM.
func (tx *AccessListTx) AsEthereumData() ethtypes.TxData {
v, r, s := tx.GetRawSignatureValues()
return &ethtypes.AccessListTx{
ChainID: tx.GetChainID(),
Nonce: tx.GetNonce(),
GasPrice: tx.GetGasPrice(),
Gas: tx.GetGas(),
To: tx.GetTo(),
Value: tx.GetValue(),
Data: tx.GetData(),
AccessList: tx.GetAccessList(),
V: v,
R: r,
S: s,
}
}
// GetRawSignatureValues returns the V, R, S signature values of the transaction.
// The return values should not be modified by the caller.
func (tx *AccessListTx) GetRawSignatureValues() (v, r, s *big.Int) {
return rawSignatureValues(tx.V, tx.R, tx.S)
}
// SetSignatureValues sets the signature values to the transaction.
func (tx *AccessListTx) SetSignatureValues(chainID, v, r, s *big.Int) {
if v != nil {
tx.V = v.Bytes()
}
if r != nil {
tx.R = r.Bytes()
}
if s != nil {
tx.S = s.Bytes()
}
if chainID != nil {
chainIDInt := sdk.NewIntFromBigInt(chainID)
tx.ChainID = &chainIDInt
}
}
// Validate performs a stateless validation of the tx fields.
func (tx AccessListTx) Validate() error {
gasPrice := tx.GetGasPrice()
if gasPrice == nil {
return sdkerrors.Wrap(ErrInvalidGasPrice, "cannot be nil")
}
if gasPrice.Sign() == -1 {
return sdkerrors.Wrapf(ErrInvalidGasPrice, "gas price cannot be negative %s", gasPrice)
}
amount := tx.GetValue()
// Amount can be 0
if amount != nil && amount.Sign() == -1 {
return sdkerrors.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount)
}
if tx.To != "" {
if err := types.ValidateAddress(tx.To); err != nil {
return sdkerrors.Wrap(err, "invalid to address")
}
}
if tx.GetChainID() == nil {
return sdkerrors.Wrap(
sdkerrors.ErrInvalidChainID,
"chain ID must be present on AccessList txs",
)
}
return nil
}
// Fee returns gasprice * gaslimit.
func (tx AccessListTx) Fee() *big.Int {
return fee(tx.GetGasPrice(), tx.GetGas())
}
// Cost returns amount + gasprice * gaslimit.
func (tx AccessListTx) Cost() *big.Int {
return cost(tx.Fee(), tx.GetValue())
}
+46 -3
View File
@@ -4,6 +4,13 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/msgservice"
proto "github.com/gogo/protobuf/proto"
)
var (
ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
)
type (
@@ -27,8 +34,44 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
(*ExtensionOptionsWeb3TxI)(nil),
&ExtensionOptionsWeb3Tx{},
)
registry.RegisterInterface(
"ethermint.evm.v1alpha1.TxData",
(*TxData)(nil),
&AccessListTx{},
&LegacyTx{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}
var (
ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
)
// PackClientState constructs a new Any packed with the given tx data value. It returns
// an error if the client state can't be casted to a protobuf message or if the concrete
// implemention is not registered to the protobuf codec.
func PackTxData(txData TxData) (*codectypes.Any, error) {
msg, ok := txData.(proto.Message)
if !ok {
return nil, sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", txData)
}
anyTxData, err := codectypes.NewAnyWithValue(msg)
if err != nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrPackAny, err.Error())
}
return anyTxData, nil
}
// UnpackTxData unpacks an Any into a TxData. It returns an error if the
// client state can't be unpacked into a TxData.
func UnpackTxData(any *codectypes.Any) (TxData, error) {
if any == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrUnpackAny, "protobuf Any message cannot be nil")
}
txData, ok := any.GetCachedValue().(TxData)
if !ok {
return nil, sdkerrors.Wrapf(sdkerrors.ErrUnpackAny, "cannot unpack Any into TxData %T", any)
}
return txData, nil
}
+62
View File
@@ -0,0 +1,62 @@
package types
import (
"testing"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/stretchr/testify/require"
)
type caseAny struct {
name string
any *codectypes.Any
expPass bool
}
func TestPackTxData(t *testing.T) {
testCases := []struct {
name string
txData TxData
expPass bool
}{
{
"access list tx",
&AccessListTx{},
true,
},
{
"legacy tx",
&LegacyTx{},
true,
},
{
"nil",
nil,
false,
},
}
testCasesAny := []caseAny{}
for _, tc := range testCases {
txDataAny, err := PackTxData(tc.txData)
if tc.expPass {
require.NoError(t, err, tc.name)
} else {
require.Error(t, err, tc.name)
}
testCasesAny = append(testCasesAny, caseAny{tc.name, txDataAny, tc.expPass})
}
for i, tc := range testCasesAny {
cs, err := UnpackTxData(tc.any)
if tc.expPass {
require.NoError(t, err, tc.name)
require.Equal(t, testCases[i].txData, cs, tc.name)
} else {
require.Error(t, err, tc.name)
}
}
}
+87 -734
View File
@@ -473,65 +473,6 @@ func (m *TxResult) XXX_DiscardUnknown() {
var xxx_messageInfo_TxResult proto.InternalMessageInfo
// TxData implements the Ethereum transaction data structure. It is used
// solely as intended in Ethereum abiding by the protocol.
type TxData struct {
// destination EVM chain ID
ChainID github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"chainID"`
// nonce corresponds to the account nonce (transaction sequence).
Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"`
// gas price defines the value for each gas unit
GasPrice github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=gas_price,json=gasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gas_price"`
// gas defines the gas limit defined for the transaction.
GasLimit uint64 `protobuf:"varint,4,opt,name=gas,proto3" json:"gas,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 github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"value"`
// 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,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
R []byte `protobuf:"bytes,10,opt,name=r,proto3" json:"r,omitempty"`
// s define the signature value
S []byte `protobuf:"bytes,11,opt,name=s,proto3" json:"s,omitempty"`
}
func (m *TxData) Reset() { *m = TxData{} }
func (m *TxData) String() string { return proto.CompactTextString(m) }
func (*TxData) ProtoMessage() {}
func (*TxData) Descriptor() ([]byte, []int) {
return fileDescriptor_98f00fcca8b6b943, []int{6}
}
func (m *TxData) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *TxData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_TxData.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 *TxData) XXX_Merge(src proto.Message) {
xxx_messageInfo_TxData.Merge(m, src)
}
func (m *TxData) XXX_Size() int {
return m.Size()
}
func (m *TxData) XXX_DiscardUnknown() {
xxx_messageInfo_TxData.DiscardUnknown(m)
}
var xxx_messageInfo_TxData proto.InternalMessageInfo
// AccessTuple is the element type of an access list.
type AccessTuple struct {
// hex formatted ethereum address
@@ -544,7 +485,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{7}
return fileDescriptor_98f00fcca8b6b943, []int{6}
}
func (m *AccessTuple) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -580,104 +521,91 @@ func init() {
proto.RegisterType((*TransactionLogs)(nil), "ethermint.evm.v1alpha1.TransactionLogs")
proto.RegisterType((*Log)(nil), "ethermint.evm.v1alpha1.Log")
proto.RegisterType((*TxResult)(nil), "ethermint.evm.v1alpha1.TxResult")
proto.RegisterType((*TxData)(nil), "ethermint.evm.v1alpha1.TxData")
proto.RegisterType((*AccessTuple)(nil), "ethermint.evm.v1alpha1.AccessTuple")
}
func init() { proto.RegisterFile("ethermint/evm/v1alpha1/evm.proto", fileDescriptor_98f00fcca8b6b943) }
var fileDescriptor_98f00fcca8b6b943 = []byte{
// 1431 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xbf, 0x6f, 0x1b, 0xb7,
0x17, 0xb7, 0x2c, 0xd9, 0x3e, 0x51, 0x67, 0x59, 0x5f, 0xc6, 0x5f, 0x57, 0x49, 0x00, 0x9f, 0x71,
0x05, 0x5a, 0x0f, 0x89, 0x14, 0x3b, 0x30, 0x6a, 0x04, 0xe8, 0x20, 0xc5, 0x4e, 0x22, 0xc4, 0x49,
0x0d, 0xc6, 0x4d, 0x8a, 0x2e, 0x07, 0xea, 0x8e, 0x39, 0x5d, 0x7d, 0x77, 0x54, 0x8f, 0x94, 0x22,
0x15, 0x28, 0xd0, 0xb1, 0x63, 0xbb, 0x75, 0xcc, 0xdc, 0xbf, 0x24, 0xe8, 0x94, 0xb1, 0xe8, 0x70,
0x2d, 0x94, 0x4d, 0xa3, 0x80, 0x6e, 0x1d, 0x0a, 0xfe, 0xd0, 0x2f, 0xc7, 0x29, 0x20, 0x78, 0x12,
0x3f, 0x8f, 0x8f, 0x9f, 0x0f, 0xdf, 0xe3, 0x23, 0xdf, 0x09, 0xec, 0x10, 0xde, 0x22, 0x49, 0x14,
0xc4, 0xbc, 0x4a, 0xba, 0x51, 0xb5, 0xbb, 0x87, 0xc3, 0x76, 0x0b, 0xef, 0x09, 0x50, 0x69, 0x27,
0x94, 0x53, 0xb8, 0x35, 0xf1, 0xa8, 0x08, 0xe3, 0xd8, 0xe3, 0xc6, 0xa6, 0x4f, 0x7d, 0x2a, 0x5d,
0xaa, 0x62, 0xa4, 0xbc, 0xed, 0x7f, 0x32, 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, 0x77, 0xb8, 0xac,
0x64, 0x13, 0x29, 0x00, 0x31, 0x30, 0xb0, 0xeb, 0x12, 0xc6, 0x08, 0x2b, 0x1b, 0xf2, 0xea, 0x7f,
0xfc, 0xa1, 0x72, 0xa8, 0x49, 0xbf, 0xb3, 0x8e, 0x68, 0xd3, 0x3b, 0x62, 0x37, 0xc3, 0xd4, 0x02,
0x6a, 0xf1, 0x49, 0xc0, 0xf8, 0xaf, 0x7f, 0x5a, 0xa0, 0x36, 0x41, 0x68, 0x42, 0x0b, 0x4d, 0x90,
0xe9, 0xca, 0x7a, 0x37, 0x51, 0xa6, 0x2b, 0x50, 0x22, 0x9b, 0xb9, 0x89, 0x32, 0x89, 0x40, 0x4c,
0xb6, 0x59, 0x13, 0x65, 0x98, 0x3e, 0x77, 0x0c, 0x0a, 0x33, 0x52, 0xff, 0xf1, 0xbe, 0xec, 0x03,
0x93, 0x71, 0x9a, 0x60, 0x9f, 0x38, 0xe7, 0xa4, 0xaf, 0x5f, 0x19, 0xf5, 0x66, 0x68, 0xfb, 0x63,
0xd2, 0x67, 0x68, 0x16, 0x28, 0x89, 0x7a, 0xfd, 0xcd, 0x60, 0x3b, 0xf3, 0x76, 0xb0, 0x9d, 0xf9,
0x6b, 0xb0, 0x9d, 0xf9, 0xe9, 0xdd, 0xf6, 0xd2, 0xdb, 0x77, 0xdb, 0x4b, 0xbf, 0xbf, 0xdb, 0x5e,
0xfa, 0x7a, 0x77, 0x26, 0xbd, 0xbc, 0x85, 0x13, 0x16, 0xb0, 0xea, 0xf4, 0x3f, 0x5e, 0x4f, 0xfe,
0xcb, 0x93, 0x49, 0x6e, 0xae, 0xca, 0x7f, 0x6c, 0x77, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x3c,
0xab, 0x3d, 0x9c, 0x03, 0x0e, 0x00, 0x00,
// 1239 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4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 0x14, 0x3d, 0xc2, 0xed,
0x1e, 0xa7, 0xae, 0x3e, 0x0f, 0xbc, 0xe1, 0x11, 0xfe, 0x35, 0xa7, 0xee, 0xfd, 0xc2, 0xcf, 0xf2,
0x67, 0x90, 0x80, 0xf2, 0x91, 0xe3, 0x50, 0xce, 0x4f, 0x7b, 0x71, 0x40, 0xff, 0xa3, 0xce, 0x0e,
0x40, 0x85, 0x0b, 0x96, 0x10, 0x8f, 0xda, 0x67, 0x74, 0x68, 0xaa, 0x4d, 0xd7, 0x8e, 0xf1, 0x3f,
0xa5, 0x43, 0x8e, 0x67, 0x0d, 0x8d, 0x68, 0xb7, 0xdf, 0x8f, 0xb6, 0x73, 0x1f, 0x46, 0xdb, 0xb9,
0xbf, 0x46, 0xdb, 0xb9, 0x5f, 0xce, 0xb7, 0x57, 0x3e, 0x9c, 0x6f, 0xaf, 0xfc, 0x71, 0xbe, 0xbd,
0xf2, 0xed, 0xee, 0xcc, 0xb5, 0x15, 0x5d, 0x92, 0x70, 0x9f, 0xb7, 0xa6, 0xff, 0xfa, 0x03, 0xf5,
0xb7, 0xaf, 0x2e, 0x6f, 0x67, 0x5d, 0xfd, 0xb9, 0xdf, 0xfd, 0x27, 0x00, 0x00, 0xff, 0xff, 0x17,
0xd8, 0xae, 0xb6, 0x0b, 0x0c, 0x00, 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
@@ -1166,118 +1094,6 @@ func (m *TxResult) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *TxData) 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 *TxData) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TxData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.S) > 0 {
i -= len(m.S)
copy(dAtA[i:], m.S)
i = encodeVarintEvm(dAtA, i, uint64(len(m.S)))
i--
dAtA[i] = 0x5a
}
if len(m.R) > 0 {
i -= len(m.R)
copy(dAtA[i:], m.R)
i = encodeVarintEvm(dAtA, i, uint64(len(m.R)))
i--
dAtA[i] = 0x52
}
if len(m.V) > 0 {
i -= len(m.V)
copy(dAtA[i:], m.V)
i = encodeVarintEvm(dAtA, i, uint64(len(m.V)))
i--
dAtA[i] = 0x4a
}
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--
dAtA[i] = 0x42
}
}
if len(m.Input) > 0 {
i -= len(m.Input)
copy(dAtA[i:], m.Input)
i = encodeVarintEvm(dAtA, i, uint64(len(m.Input)))
i--
dAtA[i] = 0x3a
}
{
size := m.Amount.Size()
i -= size
if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintEvm(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
if len(m.To) > 0 {
i -= len(m.To)
copy(dAtA[i:], m.To)
i = encodeVarintEvm(dAtA, i, uint64(len(m.To)))
i--
dAtA[i] = 0x2a
}
if m.GasLimit != 0 {
i = encodeVarintEvm(dAtA, i, uint64(m.GasLimit))
i--
dAtA[i] = 0x20
}
{
size := m.GasPrice.Size()
i -= size
if _, err := m.GasPrice.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintEvm(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
if m.Nonce != 0 {
i = encodeVarintEvm(dAtA, i, uint64(m.Nonce))
i--
dAtA[i] = 0x10
}
{
size := m.ChainID.Size()
i -= size
if _, err := m.ChainID.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
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)
@@ -1506,53 +1322,6 @@ func (m *TxResult) Size() (n int) {
return n
}
func (m *TxData) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.ChainID.Size()
n += 1 + l + sovEvm(uint64(l))
if m.Nonce != 0 {
n += 1 + sovEvm(uint64(m.Nonce))
}
l = m.GasPrice.Size()
n += 1 + l + sovEvm(uint64(l))
if m.GasLimit != 0 {
n += 1 + sovEvm(uint64(m.GasLimit))
}
l = len(m.To)
if l > 0 {
n += 1 + l + sovEvm(uint64(l))
}
l = m.Amount.Size()
n += 1 + l + sovEvm(uint64(l))
l = len(m.Input)
if l > 0 {
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 {
n += 1 + l + sovEvm(uint64(l))
}
l = len(m.R)
if l > 0 {
n += 1 + l + sovEvm(uint64(l))
}
l = len(m.S)
if l > 0 {
n += 1 + l + sovEvm(uint64(l))
}
return n
}
func (m *AccessTuple) Size() (n int) {
if m == nil {
return 0
@@ -1761,10 +1530,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) > l {
@@ -2342,10 +2108,7 @@ func (m *ChainConfig) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) > l {
@@ -2459,10 +2222,7 @@ func (m *State) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) > l {
@@ -2578,10 +2338,7 @@ func (m *TransactionLogs) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) > l {
@@ -2870,10 +2627,7 @@ func (m *Log) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) > l {
@@ -3095,405 +2849,7 @@ func (m *TxResult) Unmarshal(dAtA []byte) error {
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 *TxData) 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: TxData: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: TxData: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ChainID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
}
m.Nonce = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Nonce |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.GasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType)
}
m.GasLimit = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.GasLimit |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field To", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.To = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Input = append(m.Input[:0], dAtA[iNdEx:postIndex]...)
if m.Input == nil {
m.Input = []byte{}
}
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Accesses", 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.Accesses = append(m.Accesses, AccessTuple{})
if err := m.Accesses[len(m.Accesses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field V", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.V = append(m.V[:0], dAtA[iNdEx:postIndex]...)
if m.V == nil {
m.V = []byte{}
}
iNdEx = postIndex
case 10:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field R", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.R = append(m.R[:0], dAtA[iNdEx:postIndex]...)
if m.R == nil {
m.R = []byte{}
}
iNdEx = postIndex
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field S", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvm
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthEvm
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthEvm
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.S = append(m.S[:0], dAtA[iNdEx:postIndex]...)
if m.S == nil {
m.S = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvm(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) > l {
@@ -3607,10 +2963,7 @@ func (m *AccessTuple) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvm
}
if (iNdEx + skippy) > l {
+2 -8
View File
@@ -556,10 +556,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
@@ -707,10 +704,7 @@ func (m *GenesisAccount) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
+178
View File
@@ -0,0 +1,178 @@
package types
import (
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/tharsis/ethermint/types"
)
func newLegacyTx(tx *ethtypes.Transaction) *LegacyTx {
txData := &LegacyTx{
Nonce: tx.Nonce(),
Data: tx.Data(),
GasLimit: tx.Gas(),
}
v, r, s := tx.RawSignatureValues()
if tx.To() != nil {
txData.To = tx.To().Hex()
}
if tx.Value() != nil {
amountInt := sdk.NewIntFromBigInt(tx.Value())
txData.Amount = &amountInt
}
if tx.GasPrice() != nil {
gasPriceInt := sdk.NewIntFromBigInt(tx.GasPrice())
txData.GasPrice = &gasPriceInt
}
txData.SetSignatureValues(tx.ChainId(), v, r, s)
return txData
}
// TxType returns the tx type
func (tx *LegacyTx) TxType() uint8 {
return ethtypes.LegacyTxType
}
// Copy returns an instance with the same field values
func (tx *LegacyTx) Copy() TxData {
return &LegacyTx{
Nonce: tx.Nonce,
GasPrice: tx.GasPrice,
GasLimit: tx.GasLimit,
To: tx.To,
Amount: tx.Amount,
Data: common.CopyBytes(tx.Data),
V: common.CopyBytes(tx.V),
R: common.CopyBytes(tx.R),
S: common.CopyBytes(tx.S),
}
}
// GetChainID returns the chain id field from the derived signature values
func (tx *LegacyTx) GetChainID() *big.Int {
v, _, _ := tx.GetRawSignatureValues()
return DeriveChainID(v)
}
// GetAccessList returns nil
func (tx *LegacyTx) GetAccessList() ethtypes.AccessList {
return nil
}
// GetData returns the a copy of the input data bytes.
func (tx *LegacyTx) GetData() []byte {
return common.CopyBytes(tx.Data)
}
// GetGas returns the gas limit.
func (tx *LegacyTx) GetGas() uint64 {
return tx.GasLimit
}
// GetGasPrice returns the gas price field.
func (tx *LegacyTx) GetGasPrice() *big.Int {
if tx.GasPrice == nil {
return nil
}
return tx.GasPrice.BigInt()
}
// GetValue returns the tx amount.
func (tx *LegacyTx) GetValue() *big.Int {
if tx.Amount == nil {
return nil
}
return tx.Amount.BigInt()
}
// GetNonce returns the account sequence for the transaction.
func (tx *LegacyTx) GetNonce() uint64 { return tx.Nonce }
// GetTo returns the pointer to the recipient address.
func (tx *LegacyTx) GetTo() *common.Address {
if tx.To == "" {
return nil
}
to := common.HexToAddress(tx.To)
return &to
}
// AsEthereumData returns an AccessListTx transaction tx from the proto-formatted
// TxData defined on the Cosmos EVM.
func (tx *LegacyTx) AsEthereumData() ethtypes.TxData {
v, r, s := tx.GetRawSignatureValues()
return &ethtypes.LegacyTx{
Nonce: tx.GetNonce(),
GasPrice: tx.GetGasPrice(),
Gas: tx.GetGas(),
To: tx.GetTo(),
Value: tx.GetValue(),
Data: tx.GetData(),
V: v,
R: r,
S: s,
}
}
// GetRawSignatureValues returns the V, R, S signature values of the transaction.
// The return values should not be modified by the caller.
func (tx *LegacyTx) GetRawSignatureValues() (v, r, s *big.Int) {
return rawSignatureValues(tx.V, tx.R, tx.S)
}
// SetSignatureValues sets the signature values to the transaction.
func (tx *LegacyTx) SetSignatureValues(_, v, r, s *big.Int) {
if v != nil {
tx.V = v.Bytes()
}
if r != nil {
tx.R = r.Bytes()
}
if s != nil {
tx.S = s.Bytes()
}
}
// Validate performs a stateless validation of the tx fields.
func (tx LegacyTx) Validate() error {
gasPrice := tx.GetGasPrice()
if gasPrice == nil {
return sdkerrors.Wrap(ErrInvalidGasPrice, "cannot be nil")
}
if gasPrice.Sign() == -1 {
return sdkerrors.Wrapf(ErrInvalidGasPrice, "gas price cannot be negative %s", gasPrice)
}
amount := tx.GetValue()
// Amount can be 0
if amount != nil && amount.Sign() == -1 {
return sdkerrors.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount)
}
if tx.To != "" {
if err := types.ValidateAddress(tx.To); err != nil {
return sdkerrors.Wrap(err, "invalid to address")
}
}
return nil
}
// Fee returns gasprice * gaslimit.
func (tx LegacyTx) Fee() *big.Int {
return fee(tx.GetGasPrice(), tx.GetGas())
}
// Cost returns amount + gasprice * gaslimit.
func (tx LegacyTx) Cost() *big.Int {
return cost(tx.Fee(), tx.GetValue())
}
+97 -67
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"math/big"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
@@ -20,6 +21,8 @@ var (
_ sdk.Msg = &MsgEthereumTx{}
_ sdk.Tx = &MsgEthereumTx{}
_ ante.GasTx = &MsgEthereumTx{}
_ codectypes.UnpackInterfacesMessage = MsgEthereumTx{}
)
// message type and route constants
@@ -28,17 +31,17 @@ const (
TypeMsgEthereumTx = "ethereum_tx"
)
// NewMsgEthereumTx returns a reference to a new Ethereum transaction message.
func NewMsgEthereumTx(
// NewTx returns a reference to a new Ethereum transaction message.
func NewTx(
chainID *big.Int, nonce uint64, to *common.Address, amount *big.Int,
gasLimit uint64, gasPrice *big.Int, input []byte, accesses *ethtypes.AccessList,
) *MsgEthereumTx {
return newMsgEthereumTx(chainID, nonce, to, amount, gasLimit, gasPrice, input, accesses)
}
// NewMsgEthereumTxContract returns a reference to a new Ethereum transaction
// NewTxContract returns a reference to a new Ethereum transaction
// message designated for contract creation.
func NewMsgEthereumTxContract(
func NewTxContract(
chainID *big.Int, nonce uint64, amount *big.Int,
gasLimit uint64, gasPrice *big.Int, input []byte, accesses *ethtypes.AccessList,
) *MsgEthereumTx {
@@ -49,35 +52,71 @@ func newMsgEthereumTx(
chainID *big.Int, nonce uint64, to *common.Address, amount *big.Int,
gasLimit uint64, gasPrice *big.Int, input []byte, accesses *ethtypes.AccessList,
) *MsgEthereumTx {
txData := newTxData(chainID, nonce, to, amount, gasLimit, gasPrice, input, accesses)
return &MsgEthereumTx{Data: txData}
var (
cid, amt, gp *sdk.Int
toAddr string
txData TxData
)
if to != nil {
toAddr = to.Hex()
}
if amount != nil {
amountInt := sdk.NewIntFromBigInt(amount)
amt = &amountInt
}
if chainID != nil {
chainIDInt := sdk.NewIntFromBigInt(chainID)
cid = &chainIDInt
}
if gasPrice != nil {
gasPriceInt := sdk.NewIntFromBigInt(gasPrice)
gp = &gasPriceInt
}
if accesses == nil {
txData = &LegacyTx{
Nonce: nonce,
To: toAddr,
Amount: amt,
GasLimit: gasLimit,
GasPrice: gp,
Data: input,
}
} else {
txData = &AccessListTx{
ChainID: cid,
Nonce: nonce,
To: toAddr,
Amount: amt,
GasLimit: gasLimit,
GasPrice: gp,
Data: input,
Accesses: NewAccessList(accesses),
}
}
dataAny, err := PackTxData(txData)
if err != nil {
panic(err)
}
return &MsgEthereumTx{Data: dataAny}
}
// fromEthereumTx populates the message fields from the given ethereum transaction
func (msg *MsgEthereumTx) FromEthereumTx(tx *ethtypes.Transaction) {
msg.Data = &TxData{
Nonce: tx.Nonce(),
Input: tx.Data(),
GasLimit: tx.Gas(),
txData := NewTxDataFromTx(tx)
anyTxData, err := PackTxData(txData)
if err != nil {
panic(err)
}
v, r, s := tx.RawSignatureValues()
if tx.To() != nil {
msg.Data.To = tx.To().Hex()
}
if tx.Value() != nil {
msg.Data.Amount = sdk.NewIntFromBigInt(tx.Value())
}
if tx.GasPrice() != nil {
msg.Data.GasPrice = sdk.NewIntFromBigInt(tx.GasPrice())
}
if tx.AccessList() != nil {
al := tx.AccessList()
msg.Data.Accesses = NewAccessList(&al)
}
msg.Data.setSignatureValues(tx.ChainId(), v, r, s)
msg.Data = anyTxData
msg.Size_ = float64(tx.Size())
msg.Hash = tx.Hash().Hex()
}
@@ -97,13 +136,12 @@ func (msg MsgEthereumTx) ValidateBasic() error {
}
}
return msg.Data.Validate()
}
txData, err := UnpackTxData(msg.Data)
if err != nil {
return sdkerrors.Wrap(err, "failed to unpack tx data")
}
// To returns the recipient address of the transaction. It returns nil if the
// transaction is a contract creation.
func (msg MsgEthereumTx) To() *common.Address {
return msg.Data.to()
return txData.Validate()
}
// GetMsgs returns a single MsgEthereumTx as an sdk.Msg.
@@ -115,14 +153,18 @@ func (msg *MsgEthereumTx) GetMsgs() []sdk.Msg {
// For such a message, there should exist only a single 'signer'.
//
// NOTE: This method panics if 'Sign' hasn't been called first.
func (msg MsgEthereumTx) GetSigners() []sdk.AccAddress {
v, r, s := msg.RawSignatureValues()
if msg.From == "" || v == nil || r == nil || s == nil {
panic("must use 'Sign' to get the signer address")
func (msg *MsgEthereumTx) GetSigners() []sdk.AccAddress {
data, err := UnpackTxData(msg.Data)
if err != nil {
panic(err)
}
signer := sdk.AccAddress(common.HexToAddress(msg.From).Bytes())
sender, err := msg.GetSender(data.GetChainID())
if err != nil {
panic(err)
}
signer := sdk.AccAddress(sender.Bytes())
return []sdk.AccAddress{signer}
}
@@ -167,34 +209,11 @@ func (msg *MsgEthereumTx) Sign(ethSigner ethtypes.Signer, keyringSigner keyring.
// GetGas implements the GasTx interface. It returns the GasLimit of the transaction.
func (msg MsgEthereumTx) GetGas() uint64 {
return msg.Data.gas()
}
// Fee returns gasprice * gaslimit.
func (msg MsgEthereumTx) Fee() *big.Int {
gasPrice := msg.Data.gasPrice()
gasLimit := new(big.Int).SetUint64(msg.Data.gas())
return new(big.Int).Mul(gasPrice, gasLimit)
}
// ChainID returns which chain id this transaction was signed for (if at all)
func (msg *MsgEthereumTx) ChainID() *big.Int {
return msg.Data.chainID()
}
// Cost returns amount + gasprice * gaslimit.
func (msg MsgEthereumTx) Cost() *big.Int {
total := msg.Fee()
if msg.Data.amount() != nil {
total.Add(total, msg.Data.amount())
txData, err := UnpackTxData(msg.Data)
if err != nil {
return 0
}
return total
}
// RawSignatureValues returns the V, R, S signature values of the transaction.
// The return values should not be modified by the caller.
func (msg MsgEthereumTx) RawSignatureValues() (v, r, s *big.Int) {
return msg.Data.rawSignatureValues()
return txData.GetGas()
}
// GetFrom loads the ethereum sender address from the sigcache and returns an
@@ -209,7 +228,12 @@ func (msg *MsgEthereumTx) GetFrom() sdk.AccAddress {
// AsTransaction creates an Ethereum Transaction type from the msg fields
func (msg MsgEthereumTx) AsTransaction() *ethtypes.Transaction {
return ethtypes.NewTx(msg.Data.AsEthereumData())
txData, err := UnpackTxData(msg.Data)
if err != nil {
return nil
}
return ethtypes.NewTx(txData.AsEthereumData())
}
// AsMessage creates an Ethereum core.Message from the msg fields
@@ -224,6 +248,12 @@ func (msg *MsgEthereumTx) GetSender(chainID *big.Int) (common.Address, error) {
if err != nil {
return common.Address{}, err
}
msg.From = from.Hex()
return from, nil
}
// UnpackInterfaces implements UnpackInterfacesMesssage.UnpackInterfaces
func (msg MsgEthereumTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return unpacker.UnpackAny(msg.Data, new(TxData))
}
+53 -53
View File
@@ -11,6 +11,7 @@ import (
"github.com/tharsis/ethermint/crypto/ethsecp256k1"
"github.com/tharsis/ethermint/tests"
"github.com/ethereum/go-ethereum/common"
ethcmn "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
ethtypes "github.com/ethereum/go-ethereum/core/types"
@@ -46,80 +47,79 @@ func (suite *MsgsTestSuite) SetupTest() {
}
func (suite *MsgsTestSuite) TestMsgEthereumTx_Constructor() {
msg := NewMsgEthereumTx(nil, 0, &suite.to, nil, 100000, nil, []byte("test"), nil)
msg := NewTx(nil, 0, &suite.to, nil, 100000, nil, []byte("test"), nil)
suite.Require().Equal(msg.Data.To, suite.to.Hex())
// 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())
// suite.Require().NotNil(msg.To())
suite.Require().Equal(msg.GetMsgs(), []sdk.Msg{msg})
suite.Require().Panics(func() { msg.GetSigners() })
suite.Require().Panics(func() { msg.GetSignBytes() })
msg = NewMsgEthereumTxContract(nil, 0, nil, 100000, nil, []byte("test"), nil)
msg = NewTxContract(nil, 0, nil, 100000, nil, []byte("test"), nil)
suite.Require().NotNil(msg)
suite.Require().Empty(msg.Data.To)
suite.Require().Nil(msg.To())
// suite.Require().Empty(msg.Data.To)
// suite.Require().Nil(msg.To())
}
func (suite *MsgsTestSuite) TestMsgEthereumTx_ValidateBasic() {
hundredInt := sdk.NewInt(100)
zeroInt := sdk.ZeroInt()
minusOneInt := sdk.NewInt(-1)
testCases := []struct {
msg string
to string
amount sdk.Int
gasPrice sdk.Int
amount *sdk.Int
gasPrice *sdk.Int
from string
accessList *ethtypes.AccessList
chainID sdk.Int
chainID *sdk.Int
expectPass bool
}{
{msg: "pass with recipient - Legacy Tx", to: suite.to.Hex(), amount: sdk.NewInt(100), gasPrice: sdk.NewInt(100000), expectPass: true},
{msg: "pass with recipient - AccessList Tx", to: suite.to.Hex(), amount: sdk.NewInt(100), gasPrice: sdk.ZeroInt(), accessList: &ethtypes.AccessList{}, chainID: sdk.OneInt(), expectPass: true},
{msg: "pass contract - Legacy Tx", to: "", amount: sdk.NewInt(100), gasPrice: sdk.NewInt(100000), expectPass: true},
{msg: "invalid recipient", to: invalidFromAddress, amount: sdk.NewInt(-1), gasPrice: sdk.NewInt(1000), expectPass: false},
{msg: "nil amount", to: suite.to.Hex(), amount: sdk.Int{}, gasPrice: sdk.NewInt(1000), expectPass: true},
{msg: "negative amount", to: suite.to.Hex(), amount: sdk.NewInt(-1), gasPrice: sdk.NewInt(1000), expectPass: false},
{msg: "nil gas price", to: suite.to.Hex(), amount: sdk.NewInt(100), gasPrice: sdk.Int{}, expectPass: false},
{msg: "negative gas price", to: suite.to.Hex(), amount: sdk.NewInt(100), gasPrice: sdk.NewInt(-1), expectPass: false},
{msg: "zero gas price", to: suite.to.Hex(), amount: sdk.NewInt(100), gasPrice: sdk.ZeroInt(), expectPass: true},
{msg: "invalid from address", to: suite.to.Hex(), amount: sdk.NewInt(100), gasPrice: sdk.ZeroInt(), from: invalidFromAddress, expectPass: false},
{msg: "chain ID not set on AccessListTx", to: suite.to.Hex(), amount: sdk.NewInt(100), gasPrice: sdk.ZeroInt(), accessList: &ethtypes.AccessList{}, chainID: sdk.Int{}, expectPass: false},
{msg: "pass with recipient - Legacy Tx", to: suite.to.Hex(), amount: &hundredInt, gasPrice: &hundredInt, expectPass: true},
{msg: "pass with recipient - AccessList Tx", to: suite.to.Hex(), amount: &hundredInt, gasPrice: &zeroInt, accessList: &ethtypes.AccessList{}, chainID: &hundredInt, expectPass: true},
{msg: "pass contract - Legacy Tx", to: "", amount: &hundredInt, gasPrice: &hundredInt, expectPass: true},
// {msg: "invalid recipient", to: invalidFromAddress, amount: &minusOneInt, gasPrice: &hundredInt, expectPass: false},
{msg: "nil amount - Legacy Tx", to: suite.to.Hex(), amount: nil, gasPrice: &hundredInt, expectPass: true},
{msg: "negative amount - Legacy Tx", to: suite.to.Hex(), amount: &minusOneInt, gasPrice: &hundredInt, expectPass: false},
{msg: "nil gas price - Legacy Tx", to: suite.to.Hex(), amount: &hundredInt, gasPrice: nil, expectPass: false},
{msg: "negative gas price - Legacy Tx", to: suite.to.Hex(), amount: &hundredInt, gasPrice: &minusOneInt, expectPass: false},
{msg: "zero gas price - Legacy Tx", to: suite.to.Hex(), amount: &hundredInt, gasPrice: &zeroInt, expectPass: true},
{msg: "invalid from address - Legacy Tx", to: suite.to.Hex(), amount: &hundredInt, gasPrice: &zeroInt, from: invalidFromAddress, expectPass: false},
{msg: "nil amount - AccessListTx", to: suite.to.Hex(), amount: nil, gasPrice: &hundredInt, accessList: &ethtypes.AccessList{}, chainID: &hundredInt, expectPass: true},
{msg: "negative amount - AccessListTx", to: suite.to.Hex(), amount: &minusOneInt, gasPrice: &hundredInt, accessList: &ethtypes.AccessList{}, chainID: nil, expectPass: false},
{msg: "nil gas price - AccessListTx", to: suite.to.Hex(), amount: &hundredInt, gasPrice: nil, accessList: &ethtypes.AccessList{}, chainID: &hundredInt, expectPass: false},
{msg: "negative gas price - AccessListTx", to: suite.to.Hex(), amount: &hundredInt, gasPrice: &minusOneInt, accessList: &ethtypes.AccessList{}, chainID: nil, expectPass: false},
{msg: "zero gas price - AccessListTx", to: suite.to.Hex(), amount: &hundredInt, gasPrice: &zeroInt, accessList: &ethtypes.AccessList{}, chainID: &hundredInt, expectPass: true},
{msg: "invalid from address - AccessListTx", to: suite.to.Hex(), amount: &hundredInt, gasPrice: &zeroInt, from: invalidFromAddress, accessList: &ethtypes.AccessList{}, chainID: &hundredInt, expectPass: false},
{msg: "chain ID not set on AccessListTx", to: suite.to.Hex(), amount: &hundredInt, gasPrice: &zeroInt, accessList: &ethtypes.AccessList{}, chainID: nil, expectPass: false},
}
for i, tc := range testCases {
// recreate txData
txData := TxData{
Nonce: 0,
GasLimit: 0,
To: tc.to,
to := common.HexToAddress(tc.from)
var chainID, amount, gasPrice *big.Int
if tc.chainID != nil {
chainID = tc.chainID.BigInt()
}
if tc.amount != nil {
amount = tc.amount.BigInt()
}
if tc.gasPrice != nil {
gasPrice = tc.gasPrice.BigInt()
}
if tc.accessList != nil {
txData.Accesses = NewAccessList(tc.accessList)
if !tc.chainID.IsNil() {
txData.ChainID = tc.chainID
}
}
tx := NewTx(chainID, 1, &to, amount, 1000, gasPrice, nil, tc.accessList)
tx.From = tc.from
if !tc.amount.IsNil() {
txData.Amount = tc.amount
}
if !tc.gasPrice.IsNil() {
txData.GasPrice = tc.gasPrice
}
msg := MsgEthereumTx{
Data: &txData,
}
msg.From = tc.from
err := msg.ValidateBasic()
err := tx.ValidateBasic()
if tc.expectPass {
suite.Require().NoError(err, "valid test %d failed: %s, %v", i, tc.msg, msg)
suite.Require().NoError(err, "valid test %d failed: %s, %v", i, tc.msg)
} else {
suite.Require().Error(err, "invalid test %d passed: %s, %v", i, tc.msg, msg.Data)
suite.Require().Error(err, "invalid test %d passed: %s, %v", i, tc.msg)
}
}
}
@@ -134,42 +134,42 @@ func (suite *MsgsTestSuite) TestMsgEthereumTx_Sign() {
}{
{
"pass - EIP2930 signer",
NewMsgEthereumTx(suite.chainID, 0, &suite.to, nil, 100000, nil, []byte("test"), &types.AccessList{}),
NewTx(suite.chainID, 0, &suite.to, nil, 100000, nil, []byte("test"), &types.AccessList{}),
ethtypes.NewEIP2930Signer(suite.chainID),
func(tx *MsgEthereumTx) { tx.From = suite.from.Hex() },
true,
},
{
"pass - EIP155 signer",
NewMsgEthereumTx(suite.chainID, 0, &suite.to, nil, 100000, nil, []byte("test"), nil),
NewTx(suite.chainID, 0, &suite.to, nil, 100000, nil, []byte("test"), nil),
ethtypes.NewEIP155Signer(suite.chainID),
func(tx *MsgEthereumTx) { tx.From = suite.from.Hex() },
true,
},
{
"pass - Homestead signer",
NewMsgEthereumTx(suite.chainID, 0, &suite.to, nil, 100000, nil, []byte("test"), nil),
NewTx(suite.chainID, 0, &suite.to, nil, 100000, nil, []byte("test"), nil),
ethtypes.HomesteadSigner{},
func(tx *MsgEthereumTx) { tx.From = suite.from.Hex() },
true,
},
{
"pass - Frontier signer",
NewMsgEthereumTx(suite.chainID, 0, &suite.to, nil, 100000, nil, []byte("test"), nil),
NewTx(suite.chainID, 0, &suite.to, nil, 100000, nil, []byte("test"), nil),
ethtypes.FrontierSigner{},
func(tx *MsgEthereumTx) { tx.From = suite.from.Hex() },
true,
},
{
"no from address ",
NewMsgEthereumTx(suite.chainID, 0, &suite.to, nil, 100000, nil, []byte("test"), &types.AccessList{}),
NewTx(suite.chainID, 0, &suite.to, nil, 100000, nil, []byte("test"), &types.AccessList{}),
ethtypes.NewEIP2930Signer(suite.chainID),
func(tx *MsgEthereumTx) { tx.From = "" },
false,
},
{
"from address ≠ signer address",
NewMsgEthereumTx(suite.chainID, 0, &suite.to, nil, 100000, nil, []byte("test"), &types.AccessList{}),
NewTx(suite.chainID, 0, &suite.to, nil, 100000, nil, []byte("test"), &types.AccessList{}),
ethtypes.NewEIP2930Signer(suite.chainID),
func(tx *MsgEthereumTx) { tx.From = suite.to.Hex() },
false,
+22 -88
View File
@@ -2746,10 +2746,7 @@ func (m *QueryAccountRequest) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -2882,10 +2879,7 @@ func (m *QueryAccountResponse) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -2967,10 +2961,7 @@ func (m *QueryCosmosAccountRequest) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -3090,10 +3081,7 @@ func (m *QueryCosmosAccountResponse) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -3175,10 +3163,7 @@ func (m *QueryValidatorAccountRequest) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -3298,10 +3283,7 @@ func (m *QueryValidatorAccountResponse) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -3383,10 +3365,7 @@ func (m *QueryBalanceRequest) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -3468,10 +3447,7 @@ func (m *QueryBalanceResponse) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -3585,10 +3561,7 @@ func (m *QueryStorageRequest) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -3670,10 +3643,7 @@ func (m *QueryStorageResponse) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -3755,10 +3725,7 @@ func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -3842,10 +3809,7 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -3927,10 +3891,7 @@ func (m *QueryTxLogsRequest) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -4014,10 +3975,7 @@ func (m *QueryTxLogsResponse) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -4135,10 +4093,7 @@ func (m *QueryBlockLogsRequest) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -4258,10 +4213,7 @@ func (m *QueryBlockLogsResponse) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -4311,10 +4263,7 @@ func (m *QueryBlockBloomRequest) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -4398,10 +4347,7 @@ func (m *QueryBlockBloomResponse) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -4451,10 +4397,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -4537,10 +4480,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -4656,10 +4596,7 @@ func (m *QueryStaticCallRequest) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
@@ -4743,10 +4680,7 @@ func (m *QueryStaticCallResponse) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
+1205 -47
View File
File diff suppressed because it is too large Load Diff
+58 -184
View File
@@ -3,200 +3,49 @@ package types
import (
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/tharsis/ethermint/types"
)
// var _ ethtypes.TxData = &TxData{}
var _ TxData = &AccessListTx{}
func newTxData(
chainID *big.Int, nonce uint64, to *common.Address, amount *big.Int,
gasLimit uint64, gasPrice *big.Int, input []byte, accesses *ethtypes.AccessList,
) *TxData {
txData := &TxData{
Nonce: nonce,
GasLimit: gasLimit,
// TxData implements the Ethereum transaction tx structure. It is used
// solely as intended in Ethereum abiding by the protocol.
type TxData interface {
// TODO: embed ethtypes.TxData. See https://github.com/ethereum/go-ethereum/issues/23154
TxType() byte
Copy() TxData
GetChainID() *big.Int
GetAccessList() ethtypes.AccessList
GetData() []byte
GetNonce() uint64
GetGas() uint64
GetGasPrice() *big.Int
GetValue() *big.Int
GetTo() *common.Address
GetRawSignatureValues() (v, r, s *big.Int)
SetSignatureValues(chainID, v, r, s *big.Int)
AsEthereumData() ethtypes.TxData
Validate() error
Fee() *big.Int
Cost() *big.Int
}
func NewTxDataFromTx(tx *ethtypes.Transaction) TxData {
var txData TxData
switch tx.Type() {
case ethtypes.AccessListTxType:
txData = newAccessListTx(tx)
default:
txData = newLegacyTx(tx)
}
txData.Input = common.CopyBytes(input)
if to != nil {
txData.To = to.Hex()
}
if accesses != nil {
txData.Accesses = NewAccessList(accesses)
// NOTE: we don't populate chain id on LegacyTx type
if chainID != nil {
txData.ChainID = sdk.NewIntFromBigInt(chainID)
}
}
if amount != nil {
txData.Amount = sdk.NewIntFromBigInt(amount)
}
if gasPrice != nil {
txData.GasPrice = sdk.NewIntFromBigInt(gasPrice)
}
return txData
}
// Type returns the tx type
func (data TxData) Type() uint8 {
return data.txType()
}
func (data *TxData) txType() uint8 {
if data.Accesses == nil {
return ethtypes.LegacyTxType
}
return ethtypes.AccessListTxType
}
func (data *TxData) chainID() *big.Int {
if data.txType() == ethtypes.LegacyTxType {
v, _, _ := data.rawSignatureValues()
return DeriveChainID(v)
}
return data.ChainID.BigInt()
}
func (data *TxData) accessList() ethtypes.AccessList {
if data.Accesses == nil {
return nil
}
return *data.Accesses.ToEthAccessList()
}
func (data *TxData) data() []byte {
return common.CopyBytes(data.Input)
}
func (data *TxData) gas() uint64 {
return data.GasLimit
}
func (data *TxData) gasPrice() *big.Int {
return data.GasPrice.BigInt()
}
func (data *TxData) amount() *big.Int {
return data.Amount.BigInt()
}
func (data *TxData) nonce() uint64 { return data.Nonce }
func (data *TxData) to() *common.Address {
if data.To == "" {
return nil
}
to := common.HexToAddress(data.To)
return &to
}
// AsEthereumData returns an AccessListTx transaction data from the proto-formatted
// TxData defined on the Cosmos EVM.
func (data *TxData) AsEthereumData() ethtypes.TxData {
v, r, s := data.rawSignatureValues()
if data.Accesses == nil {
return &ethtypes.LegacyTx{
Nonce: data.nonce(),
GasPrice: data.gasPrice(),
Gas: data.gas(),
To: data.to(),
Value: data.amount(),
Data: data.data(),
V: v,
R: r,
S: s,
}
}
return &ethtypes.AccessListTx{
ChainID: data.chainID(),
Nonce: data.nonce(),
GasPrice: data.gasPrice(),
Gas: data.gas(),
To: data.to(),
Value: data.amount(),
Data: data.data(),
AccessList: data.accessList(),
V: v,
R: r,
S: s,
}
}
// rawSignatureValues returns the V, R, S signature values of the transaction.
// The return values should not be modified by the caller.
func (data *TxData) rawSignatureValues() (v, r, s *big.Int) {
if len(data.V) > 0 {
v = new(big.Int).SetBytes(data.V)
}
if len(data.R) > 0 {
r = new(big.Int).SetBytes(data.R)
}
if len(data.S) > 0 {
s = new(big.Int).SetBytes(data.S)
}
return v, r, s
}
func (data *TxData) setSignatureValues(chainID, v, r, s *big.Int) {
if v != nil {
data.V = v.Bytes()
}
if r != nil {
data.R = r.Bytes()
}
if s != nil {
data.S = s.Bytes()
}
if data.txType() == ethtypes.AccessListTxType && chainID != nil {
data.ChainID = sdk.NewIntFromBigInt(chainID)
}
}
// Validate performs a basic validation of the tx data fields.
func (data TxData) Validate() error {
gasPrice := data.gasPrice()
if gasPrice == nil {
return sdkerrors.Wrap(ErrInvalidGasPrice, "cannot be nil")
}
if gasPrice.Sign() == -1 {
return sdkerrors.Wrapf(ErrInvalidGasPrice, "gas price cannot be negative %s", gasPrice)
}
amount := data.amount()
// Amount can be 0
if amount != nil && amount.Sign() == -1 {
return sdkerrors.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount)
}
if data.To != "" {
if err := types.ValidateAddress(data.To); err != nil {
return sdkerrors.Wrap(err, "invalid to address")
}
}
if data.txType() == ethtypes.AccessListTxType && data.chainID() == nil {
return sdkerrors.Wrap(
sdkerrors.ErrInvalidChainID,
"chain ID must be present on AccessList txs",
)
}
return nil
}
// DeriveChainID derives the chain id from the given v parameter
func DeriveChainID(v *big.Int) *big.Int {
if v == nil {
@@ -213,3 +62,28 @@ func DeriveChainID(v *big.Int) *big.Int {
v = new(big.Int).Sub(v, big.NewInt(35))
return v.Div(v, big.NewInt(2))
}
func rawSignatureValues(vBz, rBz, sBz []byte) (v, r, s *big.Int) {
if len(vBz) > 0 {
v = new(big.Int).SetBytes(vBz)
}
if len(rBz) > 0 {
r = new(big.Int).SetBytes(rBz)
}
if len(sBz) > 0 {
s = new(big.Int).SetBytes(sBz)
}
return v, r, s
}
func fee(gasPrice *big.Int, gas uint64) *big.Int {
gasLimit := new(big.Int).SetUint64(gas)
return new(big.Int).Mul(gasPrice, gasLimit)
}
func cost(fee, value *big.Int) *big.Int {
if value != nil {
return new(big.Int).Add(fee, value)
}
return fee
}
+12 -10
View File
@@ -13,24 +13,26 @@ import (
)
func TestTxData_chainID(t *testing.T) {
chainID := sdk.NewInt(1)
testCases := []struct {
msg string
data TxData
expChainID *big.Int
}{
{
"access list tx", TxData{Accesses: AccessList{}, ChainID: sdk.NewInt(1)}, big.NewInt(1),
"access list tx", &AccessListTx{Accesses: AccessList{}, ChainID: &chainID}, big.NewInt(1),
},
{
"access list tx, nil chain ID", TxData{Accesses: AccessList{}}, nil,
"access list tx, nil chain ID", &AccessListTx{Accesses: AccessList{}}, nil,
},
{
"legacy tx, derived", TxData{}, nil,
"legacy tx, derived", &LegacyTx{}, nil,
},
}
for _, tc := range testCases {
chainID := tc.data.chainID()
chainID := tc.data.GetChainID()
require.Equal(t, chainID, tc.expChainID, tc.msg)
}
}
@@ -43,24 +45,24 @@ func TestTxData_DeriveChainID(t *testing.T) {
from common.Address
}{
{
"v = 0", TxData{V: big.NewInt(0).Bytes()}, nil, tests.GenerateAddress(),
"v = 0", &AccessListTx{V: big.NewInt(0).Bytes()}, nil, tests.GenerateAddress(),
},
{
"v = 1", TxData{V: big.NewInt(1).Bytes()}, big.NewInt(9223372036854775791), tests.GenerateAddress(),
"v = 1", &AccessListTx{V: big.NewInt(1).Bytes()}, big.NewInt(9223372036854775791), tests.GenerateAddress(),
},
{
"v = 27", TxData{V: big.NewInt(27).Bytes()}, new(big.Int), tests.GenerateAddress(),
"v = 27", &AccessListTx{V: big.NewInt(27).Bytes()}, new(big.Int), tests.GenerateAddress(),
},
{
"v = 28", TxData{V: big.NewInt(28).Bytes()}, new(big.Int), tests.GenerateAddress(),
"v = 28", &AccessListTx{V: big.NewInt(28).Bytes()}, new(big.Int), tests.GenerateAddress(),
},
{
"v = nil ", TxData{V: nil}, nil, tests.GenerateAddress(),
"v = nil ", &AccessListTx{V: nil}, nil, tests.GenerateAddress(),
},
}
for _, tc := range testCases {
v, _, _ := tc.data.rawSignatureValues()
v, _, _ := tc.data.GetRawSignatureValues()
chainID := DeriveChainID(v)
require.Equal(t, tc.expChainID, chainID, tc.msg)