evm: change Hook
to use tx Receipt
(#849)
* Change evm_hook to use Transaction Receipt * use ethtypes.Receipt * wip changes * fix receipt creation * receipt fixes * check for contract addr * changelog * test Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Federico Kunze Küllmer <federico.kunze94@gmail.com>
This commit is contained in:
parent
9f4828e5bb
commit
b9804505a3
@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||||||
### API Breaking
|
### API Breaking
|
||||||
|
|
||||||
* (ante) [\#866](https://github.com/tharsis/ethermint/pull/866) `NewAnteHandler` constructor now receives a `HandlerOptions` field.
|
* (ante) [\#866](https://github.com/tharsis/ethermint/pull/866) `NewAnteHandler` constructor now receives a `HandlerOptions` field.
|
||||||
|
* (evm) [\#849](https://github.com/tharsis/ethermint/pull/849) `PostTxProcessing` hook now takes an Ethereum tx `Receipt` and a `from` `Address` as arguments.
|
||||||
|
|
||||||
### State Machine Breaking
|
### State Machine Breaking
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|
||||||
|
* (types) [tharsis#849](https://github.com/tharsis/ethermint/pull/849) Add `Type` function to distinguish EOAs from Contract accounts.
|
||||||
* (evm) [tharsis#826](https://github.com/tharsis/ethermint/issues/826) Improve allocation of bytes of `tx.To` address.
|
* (evm) [tharsis#826](https://github.com/tharsis/ethermint/issues/826) Improve allocation of bytes of `tx.To` address.
|
||||||
* (evm) [tharsis#827](https://github.com/tharsis/ethermint/issues/827) Speed up creation of event logs by using the slice insertion idiom with indices.
|
* (evm) [tharsis#827](https://github.com/tharsis/ethermint/issues/827) Speed up creation of event logs by using the slice insertion idiom with indices.
|
||||||
* (ante) [tharsis#819](https://github.com/tharsis/ethermint/pull/819) remove redundant ante handlers
|
* (ante) [tharsis#819](https://github.com/tharsis/ethermint/pull/819) remove redundant ante handlers
|
||||||
|
4
client/docs/statik/statik.go
vendored
4
client/docs/statik/statik.go
vendored
File diff suppressed because one or more lines are too long
1699
client/docs/swagger-ui/swagger.yaml
vendored
1699
client/docs/swagger-ui/swagger.yaml
vendored
File diff suppressed because it is too large
Load Diff
@ -491,6 +491,7 @@ MsgEthereumTxResponse defines the Msg/EthereumTx response type.
|
|||||||
| `ret` | [bytes](#bytes) | | returned data from evm function (result or data supplied with revert opcode) |
|
| `ret` | [bytes](#bytes) | | returned data from evm function (result or data supplied with revert opcode) |
|
||||||
| `vm_error` | [string](#string) | | vm error is the error returned by vm execution |
|
| `vm_error` | [string](#string) | | vm error is the error returned by vm execution |
|
||||||
| `gas_used` | [uint64](#uint64) | | gas consumed by the transaction |
|
| `gas_used` | [uint64](#uint64) | | gas consumed by the transaction |
|
||||||
|
| `contract_address` | [string](#string) | | hex address of the contract created / called |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
6
go.mod
6
go.mod
@ -35,8 +35,8 @@ require (
|
|||||||
github.com/tendermint/tm-db v0.6.4
|
github.com/tendermint/tm-db v0.6.4
|
||||||
github.com/tyler-smith/go-bip39 v1.1.0
|
github.com/tyler-smith/go-bip39 v1.1.0
|
||||||
go.etcd.io/bbolt v1.3.6 // indirect
|
go.etcd.io/bbolt v1.3.6 // indirect
|
||||||
golang.org/x/crypto v0.0.0-20211115234514-b4de73f9ece8 // indirect
|
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa
|
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb
|
||||||
google.golang.org/grpc v1.43.0
|
google.golang.org/grpc v1.43.0
|
||||||
google.golang.org/protobuf v1.27.1
|
google.golang.org/protobuf v1.27.1
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
@ -136,7 +136,7 @@ require (
|
|||||||
github.com/tklauser/go-sysconf v0.3.7 // indirect
|
github.com/tklauser/go-sysconf v0.3.7 // indirect
|
||||||
github.com/tklauser/numcpus v0.2.3 // indirect
|
github.com/tklauser/numcpus v0.2.3 // indirect
|
||||||
github.com/zondax/hid v0.9.0 // indirect
|
github.com/zondax/hid v0.9.0 // indirect
|
||||||
golang.org/x/net v0.0.0-20211111160137-58aab5ef257a // indirect
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
||||||
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect
|
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
|
||||||
|
11
go.sum
11
go.sum
@ -1125,8 +1125,8 @@ golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWP
|
|||||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||||
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.0.0-20211115234514-b4de73f9ece8 h1:5QRxNnVsaJP6NAse0UdkRgL3zHMvCRRkrDVLNdNpdy4=
|
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 h1:0es+/5331RGQPcXlMfP+WrnIIS6dNnNRe0WB02W0F4M=
|
||||||
golang.org/x/crypto v0.0.0-20211115234514-b4de73f9ece8/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
@ -1227,8 +1227,8 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx
|
|||||||
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20211111160137-58aab5ef257a h1:c83jeVQW0KGKNaKBRfelNYNHaev+qawl9yaA825s8XE=
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE=
|
||||||
golang.org/x/net v0.0.0-20211111160137-58aab5ef257a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
@ -1572,8 +1572,9 @@ google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ6
|
|||||||
google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa h1:I0YcKz0I7OAhddo7ya8kMnvprhcWM045PmkBdMO9zN0=
|
|
||||||
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
|
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb h1:ZrsicilzPCS/Xr8qtBZZLpy4P9TYXAfl49ctG1/5tgw=
|
||||||
|
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o=
|
google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o=
|
||||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
||||||
|
@ -169,4 +169,6 @@ message MsgEthereumTxResponse {
|
|||||||
string vm_error = 4;
|
string vm_error = 4;
|
||||||
// gas consumed by the transaction
|
// gas consumed by the transaction
|
||||||
uint64 gas_used = 5;
|
uint64 gas_used = 5;
|
||||||
|
// hex address of the contract created / called
|
||||||
|
string contract_address = 6;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
|
|
||||||
@ -14,6 +16,15 @@ var (
|
|||||||
_ codectypes.UnpackInterfacesMessage = (*EthAccount)(nil)
|
_ codectypes.UnpackInterfacesMessage = (*EthAccount)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var emptyCodeHash = crypto.Keccak256(nil)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// AccountTypeEOA defines the type for externally owned accounts (EOAs)
|
||||||
|
AccountTypeEOA = int8(iota + 1)
|
||||||
|
// AccountTypeContract defines the type for contract accounts
|
||||||
|
AccountTypeContract
|
||||||
|
)
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Main Ethermint account
|
// Main Ethermint account
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -23,7 +34,7 @@ var (
|
|||||||
func ProtoAccount() authtypes.AccountI {
|
func ProtoAccount() authtypes.AccountI {
|
||||||
return &EthAccount{
|
return &EthAccount{
|
||||||
BaseAccount: &authtypes.BaseAccount{},
|
BaseAccount: &authtypes.BaseAccount{},
|
||||||
CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(),
|
CodeHash: common.BytesToHash(emptyCodeHash).String(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,3 +47,11 @@ func (acc EthAccount) EthAddress() common.Address {
|
|||||||
func (acc EthAccount) GetCodeHash() common.Hash {
|
func (acc EthAccount) GetCodeHash() common.Hash {
|
||||||
return common.HexToHash(acc.CodeHash)
|
return common.HexToHash(acc.CodeHash)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Type returns the type of Ethereum Account (EOA or Contract)
|
||||||
|
func (acc EthAccount) Type() int8 {
|
||||||
|
if bytes.Equal(emptyCodeHash, common.Hex2Bytes(acc.CodeHash)) {
|
||||||
|
return AccountTypeEOA
|
||||||
|
}
|
||||||
|
return AccountTypeContract
|
||||||
|
}
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
@ -48,3 +49,10 @@ func (suite *AccountTestSuite) SetupTest() {
|
|||||||
func TestAccountTestSuite(t *testing.T) {
|
func TestAccountTestSuite(t *testing.T) {
|
||||||
suite.Run(t, new(AccountTestSuite))
|
suite.Run(t, new(AccountTestSuite))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *AccountTestSuite) TestAccountType() {
|
||||||
|
suite.account.CodeHash = common.Bytes2Hex(crypto.Keccak256(nil))
|
||||||
|
suite.Require().Equal(types.AccountTypeEOA, suite.account.Type())
|
||||||
|
suite.account.CodeHash = common.Bytes2Hex(crypto.Keccak256([]byte{1, 2, 3}))
|
||||||
|
suite.Require().Equal(types.AccountTypeContract, suite.account.Type())
|
||||||
|
}
|
||||||
|
@ -682,13 +682,13 @@ func (suite *EvmTestSuite) TestContractDeploymentRevert() {
|
|||||||
// DummyHook implements EvmHooks interface
|
// DummyHook implements EvmHooks interface
|
||||||
type DummyHook struct{}
|
type DummyHook struct{}
|
||||||
|
|
||||||
func (dh *DummyHook) PostTxProcessing(ctx sdk.Context, txHash common.Hash, logs []*ethtypes.Log) error {
|
func (dh *DummyHook) PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FailureHook implements EvmHooks interface
|
// FailureHook implements EvmHooks interface
|
||||||
type FailureHook struct{}
|
type FailureHook struct{}
|
||||||
|
|
||||||
func (dh *FailureHook) PostTxProcessing(ctx sdk.Context, txHash common.Hash, logs []*ethtypes.Log) error {
|
func (dh *FailureHook) PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error {
|
||||||
return errors.New("mock error")
|
return errors.New("mock error")
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,9 @@ func NewMultiEvmHooks(hooks ...types.EvmHooks) MultiEvmHooks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PostTxProcessing delegate the call to underlying hooks
|
// PostTxProcessing delegate the call to underlying hooks
|
||||||
func (mh MultiEvmHooks) PostTxProcessing(ctx sdk.Context, txHash common.Hash, logs []*ethtypes.Log) error {
|
func (mh MultiEvmHooks) PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error {
|
||||||
for i := range mh {
|
for i := range mh {
|
||||||
if err := mh[i].PostTxProcessing(ctx, txHash, logs); err != nil {
|
if err := mh[i].PostTxProcessing(ctx, from, to, receipt); err != nil {
|
||||||
return sdkerrors.Wrapf(err, "EVM hook %T failed", mh[i])
|
return sdkerrors.Wrapf(err, "EVM hook %T failed", mh[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,15 +17,15 @@ type LogRecordHook struct {
|
|||||||
Logs []*ethtypes.Log
|
Logs []*ethtypes.Log
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dh *LogRecordHook) PostTxProcessing(ctx sdk.Context, txHash common.Hash, logs []*ethtypes.Log) error {
|
func (dh *LogRecordHook) PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error {
|
||||||
dh.Logs = logs
|
dh.Logs = receipt.Logs
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FailureHook always fail
|
// FailureHook always fail
|
||||||
type FailureHook struct{}
|
type FailureHook struct{}
|
||||||
|
|
||||||
func (dh FailureHook) PostTxProcessing(ctx sdk.Context, txHash common.Hash, logs []*ethtypes.Log) error {
|
func (dh FailureHook) PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error {
|
||||||
return errors.New("post tx processing failed")
|
return errors.New("post tx processing failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,11 @@ func (suite *KeeperTestSuite) TestEvmHooks() {
|
|||||||
Address: suite.address,
|
Address: suite.address,
|
||||||
})
|
})
|
||||||
logs := k.GetTxLogsTransient(txHash)
|
logs := k.GetTxLogsTransient(txHash)
|
||||||
result := k.PostTxProcessing(txHash, logs)
|
receipt := ðtypes.Receipt{
|
||||||
|
TxHash: txHash,
|
||||||
|
Logs: logs,
|
||||||
|
}
|
||||||
|
result := k.PostTxProcessing(common.Address{}, nil, receipt)
|
||||||
|
|
||||||
tc.expFunc(hook, result)
|
tc.expFunc(hook, result)
|
||||||
}
|
}
|
||||||
|
@ -363,11 +363,11 @@ func (k *Keeper) SetHooks(eh types.EvmHooks) *Keeper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PostTxProcessing delegate the call to the hooks. If no hook has been registered, this function returns with a `nil` error
|
// PostTxProcessing delegate the call to the hooks. If no hook has been registered, this function returns with a `nil` error
|
||||||
func (k *Keeper) PostTxProcessing(txHash common.Hash, logs []*ethtypes.Log) error {
|
func (k *Keeper) PostTxProcessing(from common.Address, to *common.Address, receipt *ethtypes.Receipt) error {
|
||||||
if k.hooks == nil {
|
if k.hooks == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return k.hooks.PostTxProcessing(k.Ctx(), txHash, logs)
|
return k.hooks.PostTxProcessing(k.Ctx(), from, to, receipt)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tracer return a default vm.Tracer based on current keeper state
|
// Tracer return a default vm.Tracer based on current keeper state
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package keeper
|
package keeper
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
@ -208,22 +209,8 @@ func (k *Keeper) ApplyTransaction(tx *ethtypes.Transaction) (*types.MsgEthereumT
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.Hash = txHash.Hex()
|
res.Hash = txHash.Hex()
|
||||||
|
|
||||||
logs := k.GetTxLogsTransient(txHash)
|
logs := k.GetTxLogsTransient(txHash)
|
||||||
|
|
||||||
if !res.Failed() {
|
|
||||||
// Only call hooks if tx executed successfully.
|
|
||||||
if err = k.PostTxProcessing(txHash, logs); err != nil {
|
|
||||||
// If hooks return error, revert the whole tx.
|
|
||||||
res.VmError = types.ErrPostTxProcessing.Error()
|
|
||||||
k.Logger(k.Ctx()).Error("tx post processing failed", "error", err)
|
|
||||||
} else if commit != nil {
|
|
||||||
// PostTxProcessing is successful, commit the cache context
|
|
||||||
commit()
|
|
||||||
ctx.EventManager().EmitEvents(k.Ctx().EventManager().Events())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// change to original context
|
// change to original context
|
||||||
k.WithContext(ctx)
|
k.WithContext(ctx)
|
||||||
|
|
||||||
@ -232,16 +219,53 @@ func (k *Keeper) ApplyTransaction(tx *ethtypes.Transaction) (*types.MsgEthereumT
|
|||||||
return nil, sdkerrors.Wrapf(err, "failed to refund gas leftover gas to sender %s", msg.From())
|
return nil, sdkerrors.Wrapf(err, "failed to refund gas leftover gas to sender %s", msg.From())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var bloomReceipt ethtypes.Bloom
|
||||||
if len(logs) > 0 {
|
if len(logs) > 0 {
|
||||||
res.Logs = types.NewLogsFromEth(logs)
|
res.Logs = types.NewLogsFromEth(logs)
|
||||||
// Update transient block bloom filter
|
// Update transient block bloom filter
|
||||||
bloom := k.GetBlockBloomTransient()
|
bloom := k.GetBlockBloomTransient()
|
||||||
bloom.Or(bloom, big.NewInt(0).SetBytes(ethtypes.LogsBloom(logs)))
|
bloom.Or(bloom, big.NewInt(0).SetBytes(ethtypes.LogsBloom(logs)))
|
||||||
k.SetBlockBloomTransient(bloom)
|
k.SetBlockBloomTransient(bloom)
|
||||||
|
bloomReceipt = ethtypes.BytesToBloom(bloom.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
k.IncreaseTxIndexTransient()
|
k.IncreaseTxIndexTransient()
|
||||||
|
|
||||||
|
if !res.Failed() {
|
||||||
|
cumulativeGasUsed := res.GasUsed
|
||||||
|
if ctx.BlockGasMeter() != nil {
|
||||||
|
limit := ctx.BlockGasMeter().Limit()
|
||||||
|
consumed := ctx.BlockGasMeter().GasConsumed()
|
||||||
|
cumulativeGasUsed = uint64(math.Min(float64(cumulativeGasUsed+consumed), float64(limit)))
|
||||||
|
}
|
||||||
|
|
||||||
|
receipt := ðtypes.Receipt{
|
||||||
|
Type: tx.Type(),
|
||||||
|
PostState: nil, // TODO: intermediate state root
|
||||||
|
Status: ethtypes.ReceiptStatusSuccessful,
|
||||||
|
CumulativeGasUsed: cumulativeGasUsed,
|
||||||
|
Bloom: bloomReceipt,
|
||||||
|
Logs: logs,
|
||||||
|
TxHash: txHash,
|
||||||
|
ContractAddress: common.HexToAddress(res.ContractAddress),
|
||||||
|
GasUsed: res.GasUsed,
|
||||||
|
BlockHash: common.BytesToHash(ctx.HeaderHash()),
|
||||||
|
BlockNumber: big.NewInt(ctx.BlockHeight()),
|
||||||
|
TransactionIndex: uint(k.GetTxIndexTransient()),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only call hooks if tx executed successfully.
|
||||||
|
if err = k.PostTxProcessing(msg.From(), tx.To(), receipt); err != nil {
|
||||||
|
// If hooks return error, revert the whole tx.
|
||||||
|
res.VmError = types.ErrPostTxProcessing.Error()
|
||||||
|
k.Logger(ctx).Error("tx post processing failed", "error", err)
|
||||||
|
} else if commit != nil {
|
||||||
|
// PostTxProcessing is successful, commit the cache context
|
||||||
|
commit()
|
||||||
|
ctx.EventManager().EmitEvents(k.Ctx().EventManager().Events())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// update the gas used after refund
|
// update the gas used after refund
|
||||||
k.ResetGasMeterAndConsumeGas(res.GasUsed)
|
k.ResetGasMeterAndConsumeGas(res.GasUsed)
|
||||||
return res, nil
|
return res, nil
|
||||||
@ -290,6 +314,7 @@ func (k *Keeper) ApplyMessageWithConfig(msg core.Message, tracer vm.Tracer, comm
|
|||||||
var (
|
var (
|
||||||
ret []byte // return bytes from evm execution
|
ret []byte // return bytes from evm execution
|
||||||
vmErr error // vm errors do not effect consensus and are therefore not assigned to err
|
vmErr error // vm errors do not effect consensus and are therefore not assigned to err
|
||||||
|
contractAddr common.Address
|
||||||
)
|
)
|
||||||
|
|
||||||
if !k.ctxStack.IsEmpty() {
|
if !k.ctxStack.IsEmpty() {
|
||||||
@ -337,10 +362,17 @@ func (k *Keeper) ApplyMessageWithConfig(msg core.Message, tracer vm.Tracer, comm
|
|||||||
// - reset sender's nonce to msg.Nonce() before calling evm.
|
// - reset sender's nonce to msg.Nonce() before calling evm.
|
||||||
// - increase sender's nonce by one no matter the result.
|
// - increase sender's nonce by one no matter the result.
|
||||||
k.SetNonce(sender.Address(), msg.Nonce())
|
k.SetNonce(sender.Address(), msg.Nonce())
|
||||||
ret, _, leftoverGas, vmErr = evm.Create(sender, msg.Data(), leftoverGas, msg.Value())
|
ret, contractAddr, leftoverGas, vmErr = evm.Create(sender, msg.Data(), leftoverGas, msg.Value())
|
||||||
k.SetNonce(sender.Address(), msg.Nonce()+1)
|
k.SetNonce(sender.Address(), msg.Nonce()+1)
|
||||||
} else {
|
} else {
|
||||||
ret, leftoverGas, vmErr = evm.Call(sender, *msg.To(), msg.Data(), leftoverGas, msg.Value())
|
ret, leftoverGas, vmErr = evm.Call(sender, *msg.To(), msg.Data(), leftoverGas, msg.Value())
|
||||||
|
to := *msg.To()
|
||||||
|
acc := k.accountKeeper.GetAccount(k.Ctx(), sdk.AccAddress(to.Bytes()))
|
||||||
|
if acc != nil {
|
||||||
|
if ethAcc, ok := acc.(*ethermint.EthAccount); ok && ethAcc.Type() == ethermint.AccountTypeContract {
|
||||||
|
contractAddr = to
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
refundQuotient := params.RefundQuotient
|
refundQuotient := params.RefundQuotient
|
||||||
@ -379,6 +411,7 @@ func (k *Keeper) ApplyMessageWithConfig(msg core.Message, tracer vm.Tracer, comm
|
|||||||
GasUsed: gasUsed,
|
GasUsed: gasUsed,
|
||||||
VmError: vmError,
|
VmError: vmError,
|
||||||
Ret: ret,
|
Ret: ret,
|
||||||
|
ContractAddress: contractAddr.String(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,11 +6,10 @@ import (
|
|||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||||
|
|
||||||
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"
|
|
||||||
|
|
||||||
"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"
|
||||||
|
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AccountKeeper defines the expected account keeper interface
|
// AccountKeeper defines the expected account keeper interface
|
||||||
@ -54,5 +53,5 @@ type FeeMarketKeeper interface {
|
|||||||
// EvmHooks event hooks for evm tx processing
|
// EvmHooks event hooks for evm tx processing
|
||||||
type EvmHooks interface {
|
type EvmHooks interface {
|
||||||
// Must be called after tx is processed successfully, if return an error, the whole transaction is reverted.
|
// Must be called after tx is processed successfully, if return an error, the whole transaction is reverted.
|
||||||
PostTxProcessing(ctx sdk.Context, txHash common.Hash, logs []*ethtypes.Log) error
|
PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error
|
||||||
}
|
}
|
||||||
|
156
x/evm/types/tx.pb.go
generated
156
x/evm/types/tx.pb.go
generated
@ -305,6 +305,8 @@ type MsgEthereumTxResponse struct {
|
|||||||
VmError string `protobuf:"bytes,4,opt,name=vm_error,json=vmError,proto3" json:"vm_error,omitempty"`
|
VmError string `protobuf:"bytes,4,opt,name=vm_error,json=vmError,proto3" json:"vm_error,omitempty"`
|
||||||
// gas consumed by the transaction
|
// gas consumed by the transaction
|
||||||
GasUsed uint64 `protobuf:"varint,5,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"`
|
GasUsed uint64 `protobuf:"varint,5,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"`
|
||||||
|
// hex address of the contract created / called
|
||||||
|
ContractAddress string `protobuf:"bytes,6,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MsgEthereumTxResponse) Reset() { *m = MsgEthereumTxResponse{} }
|
func (m *MsgEthereumTxResponse) Reset() { *m = MsgEthereumTxResponse{} }
|
||||||
@ -352,61 +354,62 @@ func init() {
|
|||||||
func init() { proto.RegisterFile("ethermint/evm/v1/tx.proto", fileDescriptor_f75ac0a12d075f21) }
|
func init() { proto.RegisterFile("ethermint/evm/v1/tx.proto", fileDescriptor_f75ac0a12d075f21) }
|
||||||
|
|
||||||
var fileDescriptor_f75ac0a12d075f21 = []byte{
|
var fileDescriptor_f75ac0a12d075f21 = []byte{
|
||||||
// 853 bytes of a gzipped FileDescriptorProto
|
// 876 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x31, 0x8f, 0xe3, 0x44,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x41, 0x6f, 0x1b, 0x45,
|
||||||
0x14, 0xce, 0x24, 0x4e, 0xec, 0x4c, 0xc2, 0xe9, 0x64, 0xed, 0x49, 0x4e, 0xc4, 0xc5, 0x91, 0x25,
|
0x14, 0xf6, 0xd8, 0x6b, 0x7b, 0x3d, 0x36, 0x25, 0x1a, 0xa5, 0xd2, 0xc6, 0xa2, 0x5e, 0xcb, 0x12,
|
||||||
0x20, 0x20, 0xc5, 0xd6, 0x2d, 0x54, 0x5b, 0xb1, 0xbe, 0xdd, 0x3b, 0xdd, 0x29, 0x27, 0x90, 0x15,
|
0xe0, 0x22, 0x65, 0x57, 0x0d, 0x9c, 0x72, 0x22, 0x6e, 0xd2, 0xaa, 0x55, 0x2a, 0xd0, 0xca, 0x5c,
|
||||||
0x1a, 0xae, 0x88, 0x66, 0x9d, 0x59, 0x67, 0x44, 0xec, 0xb1, 0x3c, 0x13, 0xcb, 0x41, 0xa2, 0x41,
|
0xe8, 0xc1, 0x9a, 0xac, 0x27, 0xeb, 0x11, 0xde, 0x99, 0xd5, 0xce, 0x78, 0x65, 0x23, 0x71, 0x41,
|
||||||
0x14, 0x74, 0x20, 0xf1, 0x07, 0x28, 0xa8, 0x68, 0xe1, 0x07, 0x50, 0x5e, 0x79, 0x82, 0x06, 0x51,
|
0x1c, 0xb8, 0x81, 0xc4, 0x1f, 0xe0, 0xcc, 0x15, 0x7e, 0x00, 0xc7, 0xde, 0xa8, 0xe0, 0x82, 0x38,
|
||||||
0x18, 0x94, 0xa5, 0xda, 0x0e, 0x7e, 0x01, 0x9a, 0xb1, 0xb3, 0x9b, 0x10, 0xe5, 0x80, 0xe3, 0x10,
|
0x2c, 0xc8, 0xe1, 0x94, 0x1b, 0xfc, 0x02, 0x34, 0x33, 0xeb, 0x24, 0xc6, 0x4a, 0x81, 0x52, 0xc4,
|
||||||
0x55, 0xe6, 0xf9, 0x7b, 0xf3, 0xe6, 0xbd, 0xf7, 0x7d, 0x79, 0x0f, 0x76, 0x30, 0x9f, 0xe1, 0x24,
|
0xc9, 0xf3, 0xe6, 0x7b, 0xfb, 0xe6, 0xbd, 0xf7, 0x7d, 0x7e, 0x0f, 0xee, 0x10, 0x39, 0x21, 0x69,
|
||||||
0x24, 0x11, 0x77, 0x70, 0x1a, 0x3a, 0xe9, 0x1d, 0x87, 0x67, 0x76, 0x9c, 0x50, 0x4e, 0xf5, 0x9b,
|
0x4c, 0x99, 0xf4, 0x49, 0x16, 0xfb, 0xd9, 0x1d, 0x5f, 0xce, 0xbd, 0x24, 0xe5, 0x92, 0xa3, 0xad,
|
||||||
0x57, 0x90, 0x8d, 0xd3, 0xd0, 0x4e, 0xef, 0x74, 0x0f, 0x02, 0x1a, 0x50, 0x09, 0x3a, 0xe2, 0x54,
|
0x0b, 0xc8, 0x23, 0x59, 0xec, 0x65, 0x77, 0xda, 0xdb, 0x11, 0x8f, 0xb8, 0x06, 0x7d, 0x75, 0x32,
|
||||||
0xf8, 0x75, 0x5f, 0x0e, 0x28, 0x0d, 0xe6, 0xd8, 0x41, 0x31, 0x71, 0x50, 0x14, 0x51, 0x8e, 0x38,
|
0x7e, 0xed, 0x57, 0x22, 0xce, 0xa3, 0x29, 0xf1, 0x71, 0x42, 0x7d, 0xcc, 0x18, 0x97, 0x58, 0x52,
|
||||||
0xa1, 0x11, 0x2b, 0xd1, 0x4e, 0x89, 0x4a, 0xeb, 0x6c, 0x71, 0xee, 0xa0, 0x68, 0xb9, 0x86, 0x7c,
|
0xce, 0x44, 0x81, 0xee, 0x14, 0xa8, 0xb6, 0x4e, 0x66, 0xa7, 0x3e, 0x66, 0x8b, 0x15, 0x14, 0x72,
|
||||||
0xca, 0x42, 0xca, 0x26, 0x45, 0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, 0x7b, 0xb0, 0x16, 0x20, 0x26, 0xb3, 0x54, 0xdc, 0xf6, 0x2a, 0x37,
|
0xf1, 0xae, 0xfa, 0x16, 0x75, 0x60, 0x25, 0xc2, 0x42, 0x67, 0x69, 0x0d, 0x5a, 0xcb, 0xdc, 0xb5,
|
||||||
0xb5, 0xfb, 0x88, 0x8d, 0x48, 0x48, 0xb8, 0x27, 0x00, 0xfd, 0x06, 0xac, 0x72, 0x5a, 0xe6, 0x58,
|
0xef, 0x63, 0x71, 0x4c, 0x63, 0x2a, 0x03, 0x05, 0xa0, 0x1b, 0xb0, 0x2c, 0x79, 0x91, 0x63, 0x59,
|
||||||
0xe5, 0x54, 0x7f, 0x08, 0xeb, 0x29, 0x9a, 0x2f, 0xb0, 0x51, 0x97, 0x8f, 0xbe, 0xf5, 0xf7, 0x1f,
|
0x72, 0xf4, 0x10, 0x56, 0x33, 0x3c, 0x9d, 0x11, 0xa7, 0xaa, 0x1f, 0x7d, 0xeb, 0xef, 0x3f, 0xba,
|
||||||
0x5d, 0xe5, 0x66, 0xe3, 0x38, 0xa4, 0x8b, 0x88, 0x7b, 0x45, 0x08, 0xd1, 0x01, 0xd9, 0xe7, 0x46,
|
0xcc, 0xdd, 0xda, 0x41, 0xcc, 0x67, 0x4c, 0x06, 0x26, 0x84, 0xea, 0x80, 0xee, 0x73, 0xad, 0x0b,
|
||||||
0x1f, 0x0c, 0xda, 0x65, 0x47, 0xdb, 0x10, 0xa4, 0x86, 0x2a, 0x3f, 0x80, 0x54, 0x58, 0x89, 0xa1,
|
0xfa, 0xad, 0xa2, 0xa3, 0x2d, 0x08, 0x32, 0xa7, 0xae, 0x2f, 0x40, 0xa6, 0xac, 0xd4, 0xb1, 0x8d,
|
||||||
0x15, 0x56, 0x22, 0x2c, 0x66, 0x34, 0x0b, 0x8b, 0x1d, 0xdd, 0x10, 0xbd, 0xfa, 0xfe, 0xdb, 0x61,
|
0x95, 0x2a, 0x4b, 0x38, 0x0d, 0x63, 0x89, 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0xe8, 0x58, 0xd6, 0x73, 0xc5, 0xba, 0x47, 0x88, 0x8a, 0x55, 0x48,
|
||||||
0x42, 0xf5, 0x67, 0x4b, 0xa8, 0xb1, 0x2b, 0x21, 0xf5, 0xc5, 0x49, 0x48, 0xdb, 0x23, 0xa1, 0xe6,
|
0xa8, 0xfa, 0x6c, 0x09, 0xd5, 0x36, 0x25, 0x54, 0x7f, 0x71, 0x12, 0xb2, 0xaf, 0x91, 0x50, 0xe3,
|
||||||
0x7f, 0x22, 0x21, 0xb8, 0x25, 0xa1, 0xd6, 0x96, 0x84, 0xda, 0xfb, 0x24, 0x64, 0xc1, 0xee, 0x69,
|
0x3f, 0x91, 0x10, 0x5c, 0x93, 0x50, 0x73, 0x4d, 0x42, 0xad, 0xeb, 0x24, 0xd4, 0x83, 0xed, 0xa3,
|
||||||
0xc6, 0x71, 0xc4, 0x08, 0x8d, 0xde, 0x89, 0xe5, 0xaa, 0xb9, 0x5e, 0x05, 0xe5, 0x40, 0xfe, 0x0a,
|
0xb9, 0x24, 0x4c, 0x50, 0xce, 0xde, 0x49, 0xf4, 0xaa, 0xb9, 0x5c, 0x05, 0xc5, 0x40, 0xfe, 0x0e,
|
||||||
0xc0, 0x5b, 0x5b, 0x2b, 0xc2, 0xc3, 0x2c, 0xa6, 0x11, 0x93, 0x85, 0xca, 0x29, 0x0f, 0x8a, 0x21,
|
0xc0, 0x9b, 0x6b, 0x2b, 0x22, 0x20, 0x22, 0xe1, 0x4c, 0xe8, 0x42, 0xf5, 0x94, 0x07, 0x66, 0x88,
|
||||||
0x2e, 0x07, 0xfb, 0xeb, 0x50, 0x99, 0xd3, 0x80, 0x19, 0x55, 0x59, 0xe4, 0xad, 0xdd, 0x22, 0x47,
|
0xeb, 0xc1, 0x7e, 0x1b, 0x5a, 0x53, 0x1e, 0x09, 0xa7, 0xac, 0x8b, 0xbc, 0xb9, 0x59, 0xe4, 0x31,
|
||||||
0x34, 0xf0, 0xa4, 0x8b, 0x7e, 0x13, 0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 0x5f, 0xff, 0x0b, 0x87, 0x55, 0x5f, 0x7a, 0xaf,
|
||||||
0x57, 0x3d, 0xf0, 0xcb, 0xaa, 0x07, 0x3e, 0xbf, 0xe8, 0x55, 0x9e, 0x5e, 0xf4, 0x2a, 0x3f, 0x5e,
|
0x7e, 0xfc, 0xc3, 0xaf, 0x5f, 0x94, 0xdd, 0xde, 0x2d, 0x7f, 0x73, 0xf3, 0x16, 0xde, 0x23, 0x39,
|
||||||
0xf4, 0x2a, 0xef, 0x0f, 0x36, 0xf4, 0xc4, 0x67, 0x28, 0x61, 0x84, 0x6d, 0x84, 0xca, 0x64, 0x30,
|
0x1f, 0x0c, 0x9e, 0x2c, 0x3b, 0xe0, 0xe9, 0xb2, 0x03, 0x7e, 0x59, 0x76, 0xc0, 0xe7, 0x67, 0x9d,
|
||||||
0xa9, 0xaa, 0xb3, 0x86, 0x5c, 0xb6, 0x6f, 0xfe, 0x11, 0x00, 0x00, 0xff, 0xff, 0x4a, 0x54, 0xa7,
|
0xd2, 0xd3, 0xb3, 0x4e, 0xe9, 0xc7, 0xb3, 0x4e, 0xe9, 0xfd, 0xfe, 0x15, 0xe9, 0xc9, 0x09, 0x4e,
|
||||||
0x4c, 0x50, 0x08, 0x00, 0x00,
|
0x05, 0x15, 0x57, 0x42, 0xcd, 0x75, 0x30, 0x2d, 0xc0, 0x93, 0x9a, 0xde, 0xcb, 0x6f, 0xfe, 0x11,
|
||||||
|
0x00, 0x00, 0xff, 0xff, 0x5d, 0x97, 0x2d, 0xb6, 0x7b, 0x08, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
@ -929,6 +932,13 @@ func (m *MsgEthereumTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
|
if len(m.ContractAddress) > 0 {
|
||||||
|
i -= len(m.ContractAddress)
|
||||||
|
copy(dAtA[i:], m.ContractAddress)
|
||||||
|
i = encodeVarintTx(dAtA, i, uint64(len(m.ContractAddress)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x32
|
||||||
|
}
|
||||||
if m.GasUsed != 0 {
|
if m.GasUsed != 0 {
|
||||||
i = encodeVarintTx(dAtA, i, uint64(m.GasUsed))
|
i = encodeVarintTx(dAtA, i, uint64(m.GasUsed))
|
||||||
i--
|
i--
|
||||||
@ -1196,6 +1206,10 @@ func (m *MsgEthereumTxResponse) Size() (n int) {
|
|||||||
if m.GasUsed != 0 {
|
if m.GasUsed != 0 {
|
||||||
n += 1 + sovTx(uint64(m.GasUsed))
|
n += 1 + sovTx(uint64(m.GasUsed))
|
||||||
}
|
}
|
||||||
|
l = len(m.ContractAddress)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovTx(uint64(l))
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2756,6 +2770,38 @@ func (m *MsgEthereumTxResponse) Unmarshal(dAtA []byte) error {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case 6:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTx
|
||||||
|
}
|
||||||
|
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 ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.ContractAddress = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipTx(dAtA[iNdEx:])
|
skippy, err := skipTx(dAtA[iNdEx:])
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package keeper_test
|
package keeper_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/tharsis/ethermint/x/feemarket/types"
|
"github.com/tharsis/ethermint/x/feemarket/types"
|
||||||
)
|
)
|
||||||
@ -62,9 +60,6 @@ func (suite *KeeperTestSuite) TestQueryBaseFee() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
fee := suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx)
|
|
||||||
fmt.Printf("baseFee: %v", fee)
|
|
||||||
|
|
||||||
tc.malleate()
|
tc.malleate()
|
||||||
|
|
||||||
res, err := suite.queryClient.BaseFee(suite.ctx.Context(), &types.QueryBaseFeeRequest{})
|
res, err := suite.queryClient.BaseFee(suite.ctx.Context(), &types.QueryBaseFeeRequest{})
|
||||||
|
Loading…
Reference in New Issue
Block a user