feat: use sdk.Int for TxData (#208)

* feat: use sdk.Int for TxData

* c++

* fix

* fix test

* fix rpc

* lint
This commit is contained in:
Federico Kunze Küllmer 2021-06-30 11:28:38 -04:00 committed by GitHub
parent 0113b4d2c0
commit 86e30e8fa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 359 additions and 1085 deletions

View File

@ -46,6 +46,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### API Breaking ### API Breaking
* (proto, evm) [tharsis#207](https://github.com/tharsis/ethermint/issues/207) Replace `big.Int` in favor of `sdk.Int` for `TxData` fields
* (proto, evm) [tharsis#81](https://github.com/tharsis/ethermint/pull/81) gRPC Query and Tx service changes: * (proto, evm) [tharsis#81](https://github.com/tharsis/ethermint/pull/81) gRPC Query and Tx service changes:
* The `TxReceipt`, `TxReceiptsByBlockHeight` endpoints have been removed from the Query service. * The `TxReceipt`, `TxReceiptsByBlockHeight` endpoints have been removed from the Query service.
* The `ContractAddress`, `Bloom` have been removed from the `MsgEthereumTxResponse` and the * The `ContractAddress`, `Bloom` have been removed from the `MsgEthereumTxResponse` and the

View File

@ -164,7 +164,7 @@ var (
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner}, govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and substraction of balance using module account evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account
} }
// module accounts that are allowed to receive tokens // module accounts that are allowed to receive tokens

File diff suppressed because one or more lines are too long

View File

@ -16,6 +16,7 @@ paths:
properties: properties:
balance: balance:
type: string type: string
format: int64
description: balance is the balance of the EVM denomination. description: balance is the balance of the EVM denomination.
code_hash: code_hash:
type: string type: string
@ -71,6 +72,7 @@ paths:
properties: properties:
balance: balance:
type: string type: string
format: int64
description: balance is the balance of the EVM denomination. description: balance is the balance of the EVM denomination.
description: >- description: >-
QueryBalanceResponse is the response type for the Query/Balance QueryBalanceResponse is the response type for the Query/Balance
@ -10577,6 +10579,7 @@ definitions:
properties: properties:
balance: balance:
type: string type: string
format: int64
description: balance is the balance of the EVM denomination. description: balance is the balance of the EVM denomination.
code_hash: code_hash:
type: string type: string
@ -10593,6 +10596,7 @@ definitions:
properties: properties:
balance: balance:
type: string type: string
format: int64
description: balance is the balance of the EVM denomination. description: balance is the balance of the EVM denomination.
description: >- description: >-
QueryBalanceResponse is the response type for the Query/Balance RPC QueryBalanceResponse is the response type for the Query/Balance RPC

View File

@ -52,26 +52,6 @@ func printKeyInfo(w io.Writer, keyInfo cryptokeyring.Info, bechKeyOut bechKeyOut
} }
} }
func printInfos(w io.Writer, infos []cryptokeyring.Info, output string) {
kos, err := cryptokeyring.MkAccKeysOutput(infos)
if err != nil {
panic(err)
}
switch output {
case OutputFormatText:
printTextInfos(w, kos)
case OutputFormatJSON:
out, err := keys.KeysCdc.MarshalJSON(kos)
if err != nil {
panic(err)
}
fmt.Fprintf(w, "%s", out)
}
}
func printTextInfos(w io.Writer, kos []cryptokeyring.KeyOutput) { func printTextInfos(w io.Writer, kos []cryptokeyring.KeyOutput) {
out, err := yaml.Marshal(&kos) out, err := yaml.Marshal(&kos)
if err != nil { if err != nil {

View File

@ -10,14 +10,12 @@
- [ethermint/evm/v1alpha1/evm.proto](#ethermint/evm/v1alpha1/evm.proto) - [ethermint/evm/v1alpha1/evm.proto](#ethermint/evm/v1alpha1/evm.proto)
- [AccessTuple](#ethermint.evm.v1alpha1.AccessTuple) - [AccessTuple](#ethermint.evm.v1alpha1.AccessTuple)
- [BytesList](#ethermint.evm.v1alpha1.BytesList)
- [ChainConfig](#ethermint.evm.v1alpha1.ChainConfig) - [ChainConfig](#ethermint.evm.v1alpha1.ChainConfig)
- [Log](#ethermint.evm.v1alpha1.Log) - [Log](#ethermint.evm.v1alpha1.Log)
- [Params](#ethermint.evm.v1alpha1.Params) - [Params](#ethermint.evm.v1alpha1.Params)
- [State](#ethermint.evm.v1alpha1.State) - [State](#ethermint.evm.v1alpha1.State)
- [TransactionLogs](#ethermint.evm.v1alpha1.TransactionLogs) - [TransactionLogs](#ethermint.evm.v1alpha1.TransactionLogs)
- [TxData](#ethermint.evm.v1alpha1.TxData) - [TxData](#ethermint.evm.v1alpha1.TxData)
- [TxReceipt](#ethermint.evm.v1alpha1.TxReceipt)
- [TxResult](#ethermint.evm.v1alpha1.TxResult) - [TxResult](#ethermint.evm.v1alpha1.TxResult)
- [ethermint/evm/v1alpha1/genesis.proto](#ethermint/evm/v1alpha1/genesis.proto) - [ethermint/evm/v1alpha1/genesis.proto](#ethermint/evm/v1alpha1/genesis.proto)
@ -137,21 +135,6 @@ AccessTuple is the element type of an access list.
<a name="ethermint.evm.v1alpha1.BytesList"></a>
### BytesList
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `bytes` | [bytes](#bytes) | repeated | |
<a name="ethermint.evm.v1alpha1.ChainConfig"></a> <a name="ethermint.evm.v1alpha1.ChainConfig"></a>
### ChainConfig ### ChainConfig
@ -278,12 +261,12 @@ solely as intended in Ethereum abiding by the protocol.
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| `chain_id` | [bytes](#bytes) | | destination EVM chain ID | | `chain_id` | [string](#string) | | destination EVM chain ID |
| `nonce` | [uint64](#uint64) | | nonce corresponds to the account nonce (transaction sequence). | | `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_price` | [string](#string) | | gas price defines the value for each gas unit |
| `gas` | [uint64](#uint64) | | gas defines the gas limit defined for the transaction. | | `gas` | [uint64](#uint64) | | gas defines the gas limit defined for the transaction. |
| `to` | [string](#string) | | hex formatted address of the recipient | | `to` | [string](#string) | | hex formatted address of the recipient |
| `value` | [bytes](#bytes) | | value defines the unsigned integer value of the transaction amount. | | `value` | [string](#string) | | value defines the unsigned integer value of the transaction amount. |
| `input` | [bytes](#bytes) | | input defines the data payload bytes of the transaction. | | `input` | [bytes](#bytes) | | input defines the data payload bytes of the transaction. |
| `accesses` | [AccessTuple](#ethermint.evm.v1alpha1.AccessTuple) | repeated | | | `accesses` | [AccessTuple](#ethermint.evm.v1alpha1.AccessTuple) | repeated | |
| `v` | [bytes](#bytes) | | v defines the signature value | | `v` | [bytes](#bytes) | | v defines the signature value |
@ -295,27 +278,6 @@ solely as intended in Ethereum abiding by the protocol.
<a name="ethermint.evm.v1alpha1.TxReceipt"></a>
### TxReceipt
TxReceipt defines the receipt type stored in KV for each EVM transaction.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `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` | [string](#string) | | |
<a name="ethermint.evm.v1alpha1.TxResult"></a> <a name="ethermint.evm.v1alpha1.TxResult"></a>
### TxResult ### TxResult
@ -428,7 +390,7 @@ QueryAccountResponse is the response type for the Query/Account RPC method.
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| `balance` | [string](#string) | | balance is the balance of the EVM denomination. | | `balance` | [int64](#int64) | | balance is the balance of the EVM denomination. |
| `code_hash` | [string](#string) | | code hash is the hex-formatted code bytes from the EOA. | | `code_hash` | [string](#string) | | code hash is the hex-formatted code bytes from the EOA. |
| `nonce` | [uint64](#uint64) | | nonce is the account's sequence number. | | `nonce` | [uint64](#uint64) | | nonce is the account's sequence number. |
@ -460,7 +422,7 @@ QueryBalanceResponse is the response type for the Query/Balance RPC method.
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| `balance` | [string](#string) | | balance is the balance of the EVM denomination. | | `balance` | [int64](#int64) | | balance is the balance of the EVM denomination. |

View File

@ -215,12 +215,7 @@ func (e *PublicAPI) GetBalance(address common.Address, blockNum rpctypes.BlockNu
return nil, err return nil, err
} }
val, err := ethermint.UnmarshalBigInt(res.Balance) return (*hexutil.Big)(big.NewInt(res.Balance)), nil
if err != nil {
return nil, err
}
return (*hexutil.Big)(val), nil
} }
// GetStorageAt returns the contract storage at the given address, block number, and key. // GetStorageAt returns the contract storage at the given address, block number, and key.
@ -997,15 +992,10 @@ func (e *PublicAPI) GetProof(address common.Address, storageKeys []string, block
accProofStr = proof.String() accProofStr = proof.String()
} }
balance, err := ethermint.UnmarshalBigInt(res.Balance)
if err != nil {
return nil, err
}
return &rpctypes.AccountResult{ return &rpctypes.AccountResult{
Address: address, Address: address,
AccountProof: []string{accProofStr}, AccountProof: []string{accProofStr},
Balance: (*hexutil.Big)(balance), Balance: (*hexutil.Big)(big.NewInt(res.Balance)),
CodeHash: common.HexToHash(res.CodeHash), CodeHash: common.HexToHash(res.CodeHash),
Nonce: hexutil.Uint64(res.Nonce), Nonce: hexutil.Uint64(res.Nonce),
StorageHash: common.Hash{}, // NOTE: Ethermint doesn't have a storage hash. TODO: implement? StorageHash: common.Hash{}, // NOTE: Ethermint doesn't have a storage hash. TODO: implement?

View File

@ -6,6 +6,9 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
ethtypes "github.com/ethereum/go-ethereum/core/types" ethtypes "github.com/ethereum/go-ethereum/core/types"
sdk "github.com/cosmos/cosmos-sdk/types"
evmtypes "github.com/tharsis/ethermint/x/evm/types" evmtypes "github.com/tharsis/ethermint/x/evm/types"
) )
@ -100,7 +103,7 @@ func (args *SendTxArgs) ToTransaction() *evmtypes.MsgEthereumTx {
} }
if args.ChainID != nil { if args.ChainID != nil {
data.ChainID = args.ChainID.ToInt().Bytes() data.ChainID = sdk.NewIntFromBigInt(args.ChainID.ToInt())
} }
if args.Nonce != nil { if args.Nonce != nil {
@ -112,11 +115,11 @@ func (args *SendTxArgs) ToTransaction() *evmtypes.MsgEthereumTx {
} }
if args.GasPrice != nil { if args.GasPrice != nil {
data.GasPrice = args.GasPrice.ToInt().Bytes() data.GasPrice = sdk.NewIntFromBigInt(args.GasPrice.ToInt())
} }
if args.Value != nil { if args.Value != nil {
data.Amount = args.Value.ToInt().Bytes() data.Amount = sdk.NewIntFromBigInt(args.Value.ToInt())
} }
if args.To != nil { if args.To != nil {

View File

@ -270,14 +270,15 @@ func NewTransactionFromData(
} }
rpcTx := &RPCTransaction{ rpcTx := &RPCTransaction{
Type: hexutil.Uint64(txData.Type()),
From: from, From: from,
Gas: hexutil.Uint64(txData.GasLimit), Gas: hexutil.Uint64(txData.GasLimit),
GasPrice: (*hexutil.Big)(new(big.Int).SetBytes(txData.GasPrice)), GasPrice: (*hexutil.Big)(txData.GasPrice.BigInt()),
Hash: txHash, Hash: txHash,
Input: hexutil.Bytes(txData.Input), Input: hexutil.Bytes(txData.Input),
Nonce: hexutil.Uint64(txData.Nonce), Nonce: hexutil.Uint64(txData.Nonce),
To: to, To: to,
Value: (*hexutil.Big)(new(big.Int).SetBytes(txData.Amount)), Value: (*hexutil.Big)(txData.Amount.BigInt()),
V: (*hexutil.Big)(new(big.Int).SetBytes(txData.V)), V: (*hexutil.Big)(new(big.Int).SetBytes(txData.V)),
R: (*hexutil.Big)(new(big.Int).SetBytes(txData.R)), R: (*hexutil.Big)(new(big.Int).SetBytes(txData.R)),
S: (*hexutil.Big)(new(big.Int).SetBytes(txData.S)), S: (*hexutil.Big)(new(big.Int).SetBytes(txData.S)),
@ -293,5 +294,10 @@ func NewTransactionFromData(
rpcTx.TransactionIndex = (*hexutil.Uint64)(&index) rpcTx.TransactionIndex = (*hexutil.Uint64)(&index)
} }
if txData.Type() == ethtypes.AccessListTxType {
rpcTx.Accesses = txData.Accesses.ToEthAccessList()
rpcTx.ChainID = (*hexutil.Big)(txData.ChainID.BigInt())
}
return rpcTx, nil return rpcTx, nil
} }

3
go.mod
View File

@ -45,9 +45,8 @@ require (
github.com/xlab/closer v0.0.0-20190328110542-03326addb7c2 github.com/xlab/closer v0.0.0-20190328110542-03326addb7c2
github.com/xlab/suplog v1.3.0 github.com/xlab/suplog v1.3.0
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84 google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151
google.golang.org/grpc v1.38.0 google.golang.org/grpc v1.38.0
google.golang.org/protobuf v1.27.0 // indirect
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
nhooyr.io/websocket v1.8.7 // indirect nhooyr.io/websocket v1.8.7 // indirect
) )

10
go.sum
View File

@ -1380,7 +1380,7 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@ -1473,8 +1473,8 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84 h1:R1r5J0u6Cx+RNl/6mezTw6oA14cmKC96FeUwL6A9bd4= google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc=
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
@ -1518,8 +1518,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.0 h1:KhgSLlr/moiqjv0qUsSnLvdUL7NH7PHW8aZGn7Jpjko= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610= gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

View File

@ -176,19 +176,6 @@ message Log {
bool removed = 9; bool removed = 9;
} }
// TxReceipt defines the receipt type stored in KV for each EVM transaction.
message TxReceipt {
option (gogoproto.goproto_getters) = false;
string hash = 1;
string from = 2;
TxData data = 3;
TxResult result = 4;
uint64 index = 5;
uint64 block_height = 6;
string block_hash = 7;
}
// TxResult stores results of Tx execution. // TxResult stores results of Tx execution.
message TxResult { message TxResult {
option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_getters) = false;
@ -216,17 +203,29 @@ message TxData {
option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_getters) = false;
// destination EVM chain ID // destination EVM chain ID
bytes chain_id = 1 [(gogoproto.customname) = "ChainID", (gogoproto.jsontag) = "chainID"]; string chain_id = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.customname) = "ChainID",
(gogoproto.jsontag) = "chainID",
(gogoproto.nullable) = false
];
// nonce corresponds to the account nonce (transaction sequence). // nonce corresponds to the account nonce (transaction sequence).
uint64 nonce = 2; uint64 nonce = 2;
// price defines the unsigned integer value of the gas price in bytes. // gas price defines the value for each gas unit
bytes gas_price = 3 [(gogoproto.customname) = "GasPrice"]; string gas_price = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// gas defines the gas limit defined for the transaction. // gas defines the gas limit defined for the transaction.
uint64 gas = 4 [(gogoproto.customname) = "GasLimit"]; uint64 gas = 4 [(gogoproto.customname) = "GasLimit"];
// hex formatted address of the recipient // hex formatted address of the recipient
string to = 5; string to = 5;
// value defines the unsigned integer value of the transaction amount. // value defines the unsigned integer value of the transaction amount.
bytes value = 6 [(gogoproto.customname) = "Amount"]; string value = 6 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.customname) = "Amount",
(gogoproto.nullable) = false
];
// input defines the data payload bytes of the transaction. // input defines the data payload bytes of the transaction.
bytes input = 7; bytes input = 7;
repeated AccessTuple accesses = 8 repeated AccessTuple accesses = 8
@ -239,12 +238,6 @@ message TxData {
bytes s = 11; bytes s = 11;
} }
message BytesList {
option (gogoproto.goproto_getters) = false;
repeated bytes bytes = 1;
}
// AccessTuple is the element type of an access list. // AccessTuple is the element type of an access list.
message AccessTuple { message AccessTuple {
option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_getters) = false;

View File

@ -79,7 +79,7 @@ message QueryAccountRequest {
// QueryAccountResponse is the response type for the Query/Account RPC method. // QueryAccountResponse is the response type for the Query/Account RPC method.
message QueryAccountResponse { message QueryAccountResponse {
// balance is the balance of the EVM denomination. // balance is the balance of the EVM denomination.
string balance = 1; int64 balance = 1;
// code hash is the hex-formatted code bytes from the EOA. // code hash is the hex-formatted code bytes from the EOA.
string code_hash = 2; string code_hash = 2;
// nonce is the account's sequence number. // nonce is the account's sequence number.
@ -136,7 +136,7 @@ message QueryBalanceRequest {
// QueryBalanceResponse is the response type for the Query/Balance RPC method. // QueryBalanceResponse is the response type for the Query/Balance RPC method.
message QueryBalanceResponse { message QueryBalanceResponse {
// balance is the balance of the EVM denomination. // balance is the balance of the EVM denomination.
string balance = 1; int64 balance = 1;
} }
// QueryStorageRequest is the request type for the Query/Storage RPC method. // QueryStorageRequest is the request type for the Query/Storage RPC method.

View File

@ -1,6 +1,8 @@
package types package types
import ( import (
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
ethaccounts "github.com/ethereum/go-ethereum/accounts" ethaccounts "github.com/ethereum/go-ethereum/accounts"
@ -30,6 +32,9 @@ const (
var ( var (
// BIP44HDPath is the BIP44 HD path used on Ethereum. // BIP44HDPath is the BIP44 HD path used on Ethereum.
BIP44HDPath = ethaccounts.DefaultBaseDerivationPath.String() BIP44HDPath = ethaccounts.DefaultBaseDerivationPath.String()
// PowerReduction defines the default power reduction value for staking
PowerReduction = sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil))
) )
// SetBech32Prefixes sets the global prefixes to be used when serializing addresses and public keys to Bech32 strings. // SetBech32Prefixes sets the global prefixes to be used when serializing addresses and public keys to Bech32 strings.

View File

@ -1,30 +0,0 @@
package types
import (
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
// PowerReduction defines the default power reduction value for staking
var PowerReduction = sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil))
// MarshalBigInt marshals big int into text string for consistent encoding
func MarshalBigInt(i *big.Int) (string, error) {
bz, err := i.MarshalText()
if err != nil {
return "", sdkerrors.Wrap(ErrMarshalBigInt, err.Error())
}
return string(bz), nil
}
// UnmarshalBigInt unmarshals string from *big.Int
func UnmarshalBigInt(s string) (*big.Int, error) {
ret := new(big.Int)
err := ret.UnmarshalText([]byte(s))
if err != nil {
return nil, sdkerrors.Wrap(ErrUnmarshalBigInt, err.Error())
}
return ret, nil
}

View File

@ -1,18 +0,0 @@
package types
import (
"math/big"
"testing"
"github.com/stretchr/testify/require"
)
func TestMarshalAndUnmarshalInt(t *testing.T) {
i := big.NewInt(3)
m, err := MarshalBigInt(i)
require.NoError(t, err)
i2, err := UnmarshalBigInt(m)
require.NoError(t, err)
require.Equal(t, i, i2)
}

View File

@ -36,7 +36,7 @@ func (k Keeper) Account(c context.Context, req *types.QueryAccountRequest) (*typ
k.WithContext(ctx) k.WithContext(ctx)
return &types.QueryAccountResponse{ return &types.QueryAccountResponse{
Balance: k.GetBalance(addr).String(), Balance: k.GetBalance(addr).Int64(),
CodeHash: k.GetCodeHash(addr).Hex(), CodeHash: k.GetCodeHash(addr).Hex(),
Nonce: k.GetNonce(addr), Nonce: k.GetNonce(addr),
}, nil }, nil
@ -125,16 +125,9 @@ func (k Keeper) Balance(c context.Context, req *types.QueryBalanceRequest) (*typ
k.WithContext(ctx) k.WithContext(ctx)
balanceInt := k.GetBalance(ethcmn.HexToAddress(req.Address)) balanceInt := k.GetBalance(ethcmn.HexToAddress(req.Address))
balance, err := ethermint.MarshalBigInt(balanceInt)
if err != nil {
return nil, status.Error(
codes.Internal,
"failed to marshal big.Int to string",
)
}
return &types.QueryBalanceResponse{ return &types.QueryBalanceResponse{
Balance: balance, Balance: balanceInt.Int64(),
}, nil }, nil
} }

View File

@ -32,10 +32,11 @@ func (suite *KeeperTestSuite) TestQueryAccount() {
malleate func() malleate func()
expPass bool expPass bool
}{ }{
{"invalid address", {
"invalid address",
func() { func() {
expAccount = &types.QueryAccountResponse{ expAccount = &types.QueryAccountResponse{
Balance: "0", Balance: 0,
CodeHash: common.BytesToHash(ethcrypto.Keccak256(nil)).Hex(), CodeHash: common.BytesToHash(ethcrypto.Keccak256(nil)).Hex(),
Nonce: 0, Nonce: 0,
} }
@ -49,10 +50,13 @@ func (suite *KeeperTestSuite) TestQueryAccount() {
"success", "success",
func() { func() {
amt := sdk.Coins{ethermint.NewPhotonCoinInt64(100)} amt := sdk.Coins{ethermint.NewPhotonCoinInt64(100)}
suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt) err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt)
suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt) suite.Require().NoError(err)
err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt)
suite.Require().NoError(err)
expAccount = &types.QueryAccountResponse{ expAccount = &types.QueryAccountResponse{
Balance: "100", Balance: 100,
CodeHash: common.BytesToHash(ethcrypto.Keccak256(nil)).Hex(), CodeHash: common.BytesToHash(ethcrypto.Keccak256(nil)).Hex(),
Nonce: 0, Nonce: 0,
} }
@ -164,7 +168,7 @@ func (suite *KeeperTestSuite) TestQueryCosmosAccount() {
func (suite *KeeperTestSuite) TestQueryBalance() { func (suite *KeeperTestSuite) TestQueryBalance() {
var ( var (
req *types.QueryBalanceRequest req *types.QueryBalanceRequest
expBalance string expBalance int64
) )
testCases := []struct { testCases := []struct {
@ -174,7 +178,7 @@ func (suite *KeeperTestSuite) TestQueryBalance() {
}{ }{
{"invalid address", {"invalid address",
func() { func() {
expBalance = "0" expBalance = 0
req = &types.QueryBalanceRequest{ req = &types.QueryBalanceRequest{
Address: invalidAddress, Address: invalidAddress,
} }
@ -185,9 +189,12 @@ func (suite *KeeperTestSuite) TestQueryBalance() {
"success", "success",
func() { func() {
amt := sdk.Coins{ethermint.NewPhotonCoinInt64(100)} amt := sdk.Coins{ethermint.NewPhotonCoinInt64(100)}
suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt) err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt)
suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt) suite.Require().NoError(err)
expBalance = "100" err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt)
suite.Require().NoError(err)
expBalance = 100
req = &types.QueryBalanceRequest{ req = &types.QueryBalanceRequest{
Address: suite.address.String(), Address: suite.address.String(),
} }

File diff suppressed because it is too large Load Diff

View File

@ -66,10 +66,10 @@ func (msg *MsgEthereumTx) FromEthereumTx(tx *ethtypes.Transaction) {
msg.Data.To = tx.To().Hex() msg.Data.To = tx.To().Hex()
} }
if tx.Value() != nil { if tx.Value() != nil {
msg.Data.Amount = tx.Value().Bytes() msg.Data.Amount = sdk.NewIntFromBigInt(tx.Value())
} }
if tx.GasPrice() != nil { if tx.GasPrice() != nil {
msg.Data.GasPrice = tx.GasPrice().Bytes() msg.Data.GasPrice = sdk.NewIntFromBigInt(tx.GasPrice())
} }
if tx.AccessList() != nil { if tx.AccessList() != nil {
al := tx.AccessList() al := tx.AccessList()

View File

@ -66,24 +66,24 @@ func (suite *MsgsTestSuite) TestMsgEthereumTx_ValidateBasic() {
testCases := []struct { testCases := []struct {
msg string msg string
to string to string
amount *big.Int amount sdk.Int
gasPrice *big.Int gasPrice sdk.Int
from string from string
accessList *ethtypes.AccessList accessList *ethtypes.AccessList
chainID *big.Int chainID sdk.Int
expectPass bool expectPass bool
}{ }{
{msg: "pass with recipient - Legacy Tx", to: suite.to.Hex(), amount: big.NewInt(100), gasPrice: big.NewInt(100000), expectPass: true}, {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: big.NewInt(100), gasPrice: big.NewInt(0), accessList: &ethtypes.AccessList{}, chainID: big.NewInt(1), 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: big.NewInt(100), gasPrice: big.NewInt(100000), expectPass: true}, {msg: "pass contract - Legacy Tx", to: "", amount: sdk.NewInt(100), gasPrice: sdk.NewInt(100000), expectPass: true},
{msg: "invalid recipient", to: invalidFromAddress, amount: big.NewInt(-1), gasPrice: big.NewInt(1000), expectPass: false}, {msg: "invalid recipient", to: invalidFromAddress, amount: sdk.NewInt(-1), gasPrice: sdk.NewInt(1000), expectPass: false},
{msg: "nil amount", to: suite.to.Hex(), amount: nil, gasPrice: big.NewInt(1000), expectPass: true}, {msg: "nil amount", to: suite.to.Hex(), amount: sdk.Int{}, gasPrice: sdk.NewInt(1000), expectPass: true},
{msg: "negative amount", to: suite.to.Hex(), amount: big.NewInt(-1), gasPrice: big.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: big.NewInt(100), gasPrice: nil, 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: big.NewInt(100), gasPrice: big.NewInt(-1), expectPass: true}, {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: big.NewInt(100), gasPrice: big.NewInt(0), expectPass: true}, {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: big.NewInt(100), gasPrice: big.NewInt(0), from: invalidFromAddress, expectPass: false}, {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: big.NewInt(100), gasPrice: big.NewInt(0), accessList: &ethtypes.AccessList{}, chainID: nil, 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},
} }
for i, tc := range testCases { for i, tc := range testCases {
@ -96,17 +96,17 @@ func (suite *MsgsTestSuite) TestMsgEthereumTx_ValidateBasic() {
if tc.accessList != nil { if tc.accessList != nil {
txData.Accesses = NewAccessList(tc.accessList) txData.Accesses = NewAccessList(tc.accessList)
if tc.chainID != nil { if !tc.chainID.IsNil() {
txData.ChainID = tc.chainID.Bytes() txData.ChainID = tc.chainID
} }
} }
if tc.amount != nil { if !tc.amount.IsNil() {
txData.Amount = tc.amount.Bytes() txData.Amount = tc.amount
} }
if tc.gasPrice != nil { if !tc.gasPrice.IsNil() {
txData.GasPrice = tc.gasPrice.Bytes() txData.GasPrice = tc.gasPrice
} }
msg := MsgEthereumTx{ msg := MsgEthereumTx{

View File

@ -72,7 +72,7 @@ var xxx_messageInfo_QueryAccountRequest proto.InternalMessageInfo
// QueryAccountResponse is the response type for the Query/Account RPC method. // QueryAccountResponse is the response type for the Query/Account RPC method.
type QueryAccountResponse struct { type QueryAccountResponse struct {
// balance is the balance of the EVM denomination. // balance is the balance of the EVM denomination.
Balance string `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"` Balance int64 `protobuf:"varint,1,opt,name=balance,proto3" json:"balance,omitempty"`
// code hash is the hex-formatted code bytes from the EOA. // code hash is the hex-formatted code bytes from the EOA.
CodeHash string `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` CodeHash string `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"`
// nonce is the account's sequence number. // nonce is the account's sequence number.
@ -112,11 +112,11 @@ func (m *QueryAccountResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryAccountResponse proto.InternalMessageInfo var xxx_messageInfo_QueryAccountResponse proto.InternalMessageInfo
func (m *QueryAccountResponse) GetBalance() string { func (m *QueryAccountResponse) GetBalance() int64 {
if m != nil { if m != nil {
return m.Balance return m.Balance
} }
return "" return 0
} }
func (m *QueryAccountResponse) GetCodeHash() string { func (m *QueryAccountResponse) GetCodeHash() string {
@ -381,7 +381,7 @@ var xxx_messageInfo_QueryBalanceRequest proto.InternalMessageInfo
// QueryBalanceResponse is the response type for the Query/Balance RPC method. // QueryBalanceResponse is the response type for the Query/Balance RPC method.
type QueryBalanceResponse struct { type QueryBalanceResponse struct {
// balance is the balance of the EVM denomination. // balance is the balance of the EVM denomination.
Balance string `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"` Balance int64 `protobuf:"varint,1,opt,name=balance,proto3" json:"balance,omitempty"`
} }
func (m *QueryBalanceResponse) Reset() { *m = QueryBalanceResponse{} } func (m *QueryBalanceResponse) Reset() { *m = QueryBalanceResponse{} }
@ -417,11 +417,11 @@ func (m *QueryBalanceResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryBalanceResponse proto.InternalMessageInfo var xxx_messageInfo_QueryBalanceResponse proto.InternalMessageInfo
func (m *QueryBalanceResponse) GetBalance() string { func (m *QueryBalanceResponse) GetBalance() int64 {
if m != nil { if m != nil {
return m.Balance return m.Balance
} }
return "" return 0
} }
// QueryStorageRequest is the request type for the Query/Storage RPC method. // QueryStorageRequest is the request type for the Query/Storage RPC method.
@ -1077,77 +1077,77 @@ func init() {
} }
var fileDescriptor_8bbc79ec2b6c5cb2 = []byte{ var fileDescriptor_8bbc79ec2b6c5cb2 = []byte{
// 1117 bytes of a gzipped FileDescriptorProto // 1119 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x97, 0x4d, 0x6f, 0x1b, 0x45, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x97, 0x4d, 0x6f, 0x1b, 0x45,
0x18, 0xc7, 0xbd, 0x8d, 0x13, 0x27, 0x4f, 0x12, 0x08, 0x83, 0x29, 0x61, 0x5b, 0x9c, 0xb0, 0xa8, 0x18, 0xc7, 0xbd, 0x8d, 0x13, 0x27, 0x4f, 0x12, 0x08, 0x83, 0x29, 0x61, 0x5b, 0x9c, 0xb0, 0xa8,
0xb1, 0xf3, 0xd2, 0x9d, 0xda, 0xbc, 0x95, 0x0a, 0x09, 0xe2, 0x4a, 0xa1, 0x52, 0x2b, 0x54, 0x9c, 0xb1, 0xf3, 0xd2, 0xdd, 0xda, 0xbc, 0x95, 0x0a, 0x09, 0xe2, 0x4a, 0xa1, 0x52, 0x2b, 0x54, 0x9c,
0x8a, 0x03, 0x17, 0x6b, 0xbc, 0x5e, 0xad, 0xad, 0xac, 0x77, 0xdc, 0x9d, 0xb5, 0x95, 0x28, 0xca, 0x8a, 0x03,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x85, 0xcc, 0xef,
0x7c, 0x5a, 0x72, 0xda, 0x41, 0xab, 0xd7, 0x30, 0x2d, 0xda, 0xc1, 0x41, 0x8b, 0xf8, 0xac, 0xcd, 0x17, 0x85, 0xcc, 0xa7, 0x25, 0xa7, 0x1d, 0xb4, 0x7a, 0x0d, 0xd3, 0xa6, 0x1d, 0x2b, 0x68, 0x61,
0x22, 0x01, 0x8f, 0x45, 0xc8, 0xe0, 0xa4, 0x6b, 0xb3, 0xc6, 0x82, 0xf8, 0x37, 0xf6, 0xc6, 0xbf, 0x9f, 0xb5, 0x59, 0x24, 0xe0, 0xb1, 0x08, 0x19, 0x9c, 0x74, 0x09, 0x6b, 0x2c, 0x88, 0x7f, 0x63,
0x01, 0x00, 0x00, 0xff, 0xff, 0x4e, 0x4f, 0xb9, 0xc4, 0x4d, 0x0e, 0x00, 0x00, 0x6f, 0xfc, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x62, 0xa4, 0x45, 0x4d, 0x0e, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -1676,12 +1676,10 @@ func (m *QueryAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i-- i--
dAtA[i] = 0x12 dAtA[i] = 0x12
} }
if len(m.Balance) > 0 { if m.Balance != 0 {
i -= len(m.Balance) i = encodeVarintQuery(dAtA, i, uint64(m.Balance))
copy(dAtA[i:], m.Balance)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Balance)))
i-- i--
dAtA[i] = 0xa dAtA[i] = 0x8
} }
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
@ -1876,12 +1874,10 @@ func (m *QueryBalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Balance) > 0 { if m.Balance != 0 {
i -= len(m.Balance) i = encodeVarintQuery(dAtA, i, uint64(m.Balance))
copy(dAtA[i:], m.Balance)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Balance)))
i-- i--
dAtA[i] = 0xa dAtA[i] = 0x8
} }
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
@ -2377,9 +2373,8 @@ func (m *QueryAccountResponse) Size() (n int) {
} }
var l int var l int
_ = l _ = l
l = len(m.Balance) if m.Balance != 0 {
if l > 0 { n += 1 + sovQuery(uint64(m.Balance))
n += 1 + l + sovQuery(uint64(l))
} }
l = len(m.CodeHash) l = len(m.CodeHash)
if l > 0 { if l > 0 {
@ -2474,9 +2469,8 @@ func (m *QueryBalanceResponse) Size() (n int) {
} }
var l int var l int
_ = l _ = l
l = len(m.Balance) if m.Balance != 0 {
if l > 0 { n += 1 + sovQuery(uint64(m.Balance))
n += 1 + l + sovQuery(uint64(l))
} }
return n return n
} }
@ -2794,10 +2788,10 @@ func (m *QueryAccountResponse) Unmarshal(dAtA []byte) error {
} }
switch fieldNum { switch fieldNum {
case 1: case 1:
if wireType != 2 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType)
} }
var stringLen uint64 m.Balance = 0
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowQuery return ErrIntOverflowQuery
@ -2807,24 +2801,11 @@ func (m *QueryAccountResponse) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
stringLen |= uint64(b&0x7F) << shift m.Balance |= int64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Balance = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType)
@ -3431,10 +3412,10 @@ func (m *QueryBalanceResponse) Unmarshal(dAtA []byte) error {
} }
switch fieldNum { switch fieldNum {
case 1: case 1:
if wireType != 2 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType)
} }
var stringLen uint64 m.Balance = 0
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowQuery return ErrIntOverflowQuery
@ -3444,24 +3425,11 @@ func (m *QueryBalanceResponse) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
stringLen |= uint64(b&0x7F) << shift m.Balance |= int64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Balance = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:]) skippy, err := skipQuery(dAtA[iNdEx:])

View File

@ -3,9 +3,12 @@ package types
import ( import (
"math/big" "math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types" ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/tharsis/ethermint/types" "github.com/tharsis/ethermint/types"
) )
@ -31,20 +34,25 @@ func newTxData(
// NOTE: we don't populate chain id on LegacyTx type // NOTE: we don't populate chain id on LegacyTx type
if chainID != nil { if chainID != nil {
txData.ChainID = chainID.Bytes() txData.ChainID = sdk.NewIntFromBigInt(chainID)
} }
} }
if amount != nil { if amount != nil {
txData.Amount = amount.Bytes() txData.Amount = sdk.NewIntFromBigInt(amount)
} }
if gasPrice != nil { if gasPrice != nil {
txData.GasPrice = gasPrice.Bytes() txData.GasPrice = sdk.NewIntFromBigInt(gasPrice)
} }
return txData return txData
} }
func (data *TxData) txType() byte { // Type returns the tx type
func (data TxData) Type() uint8 {
return data.txType()
}
func (data *TxData) txType() uint8 {
if data.Accesses == nil { if data.Accesses == nil {
return ethtypes.LegacyTxType return ethtypes.LegacyTxType
} }
@ -57,11 +65,7 @@ func (data *TxData) chainID() *big.Int {
return DeriveChainID(v) return DeriveChainID(v)
} }
if data.ChainID == nil { return data.ChainID.BigInt()
return nil
}
return new(big.Int).SetBytes(data.ChainID)
} }
func (data *TxData) accessList() ethtypes.AccessList { func (data *TxData) accessList() ethtypes.AccessList {
@ -80,17 +84,11 @@ func (data *TxData) gas() uint64 {
} }
func (data *TxData) gasPrice() *big.Int { func (data *TxData) gasPrice() *big.Int {
if data.GasPrice == nil { return data.GasPrice.BigInt()
return nil
}
return new(big.Int).SetBytes(data.GasPrice)
} }
func (data *TxData) amount() *big.Int { func (data *TxData) amount() *big.Int {
if data.Amount == nil { return data.Amount.BigInt()
return nil
}
return new(big.Int).SetBytes(data.Amount)
} }
func (data *TxData) nonce() uint64 { return data.Nonce } func (data *TxData) nonce() uint64 { return data.Nonce }
@ -162,7 +160,7 @@ func (data *TxData) setSignatureValues(chainID, v, r, s *big.Int) {
data.S = s.Bytes() data.S = s.Bytes()
} }
if data.txType() == ethtypes.AccessListTxType && chainID != nil { if data.txType() == ethtypes.AccessListTxType && chainID != nil {
data.ChainID = chainID.Bytes() data.ChainID = sdk.NewIntFromBigInt(chainID)
} }
} }

View File

@ -4,8 +4,11 @@ import (
"math/big" "math/big"
"testing" "testing"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"
"github.com/tharsis/ethermint/tests" "github.com/tharsis/ethermint/tests"
) )
@ -16,7 +19,7 @@ func TestTxData_chainID(t *testing.T) {
expChainID *big.Int expChainID *big.Int
}{ }{
{ {
"access list tx", TxData{Accesses: AccessList{}, ChainID: big.NewInt(1).Bytes()}, big.NewInt(1), "access list tx", TxData{Accesses: AccessList{}, ChainID: sdk.NewInt(1)}, big.NewInt(1),
}, },
{ {
"access list tx, nil chain ID", TxData{Accesses: AccessList{}}, nil, "access list tx, nil chain ID", TxData{Accesses: AccessList{}}, nil,