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:
Ramiro Carlucho
2022-01-03 17:18:13 +01:00
committed by GitHub
co-authored by Federico Kunze Küllmer Federico Kunze Küllmer
parent 9f4828e5bb
commit b9804505a3
17 changed files with 287 additions and 1734 deletions
+2 -2
View File
@@ -682,13 +682,13 @@ func (suite *EvmTestSuite) TestContractDeploymentRevert() {
// DummyHook implements EvmHooks interface
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
}
// FailureHook implements EvmHooks interface
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")
}
+2 -2
View File
@@ -19,9 +19,9 @@ func NewMultiEvmHooks(hooks ...types.EvmHooks) MultiEvmHooks {
}
// 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 {
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])
}
}
+8 -4
View File
@@ -17,15 +17,15 @@ type LogRecordHook struct {
Logs []*ethtypes.Log
}
func (dh *LogRecordHook) PostTxProcessing(ctx sdk.Context, txHash common.Hash, logs []*ethtypes.Log) error {
dh.Logs = logs
func (dh *LogRecordHook) PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error {
dh.Logs = receipt.Logs
return nil
}
// FailureHook always fail
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")
}
@@ -69,7 +69,11 @@ func (suite *KeeperTestSuite) TestEvmHooks() {
Address: suite.address,
})
logs := k.GetTxLogsTransient(txHash)
result := k.PostTxProcessing(txHash, logs)
receipt := &ethtypes.Receipt{
TxHash: txHash,
Logs: logs,
}
result := k.PostTxProcessing(common.Address{}, nil, receipt)
tc.expFunc(hook, result)
}
+2 -2
View File
@@ -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
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 {
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
+53 -20
View File
@@ -1,6 +1,7 @@
package keeper
import (
"math"
"math/big"
tmtypes "github.com/tendermint/tendermint/types"
@@ -208,22 +209,8 @@ func (k *Keeper) ApplyTransaction(tx *ethtypes.Transaction) (*types.MsgEthereumT
}
res.Hash = txHash.Hex()
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
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())
}
var bloomReceipt ethtypes.Bloom
if len(logs) > 0 {
res.Logs = types.NewLogsFromEth(logs)
// Update transient block bloom filter
bloom := k.GetBlockBloomTransient()
bloom.Or(bloom, big.NewInt(0).SetBytes(ethtypes.LogsBloom(logs)))
k.SetBlockBloomTransient(bloom)
bloomReceipt = ethtypes.BytesToBloom(bloom.Bytes())
}
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 := &ethtypes.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
k.ResetGasMeterAndConsumeGas(res.GasUsed)
return res, nil
@@ -288,8 +312,9 @@ func (k *Keeper) ApplyTransaction(tx *ethtypes.Transaction) (*types.MsgEthereumT
// If commit is true, the cache context stack will be committed, otherwise discarded.
func (k *Keeper) ApplyMessageWithConfig(msg core.Message, tracer vm.Tracer, commit bool, cfg *types.EVMConfig) (*types.MsgEthereumTxResponse, error) {
var (
ret []byte // return bytes from evm execution
vmErr error // vm errors do not effect consensus and are therefore not assigned to err
ret []byte // return bytes from evm execution
vmErr error // vm errors do not effect consensus and are therefore not assigned to err
contractAddr common.Address
)
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.
// - increase sender's nonce by one no matter the result.
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)
} else {
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
@@ -376,9 +408,10 @@ func (k *Keeper) ApplyMessageWithConfig(msg core.Message, tracer vm.Tracer, comm
}
return &types.MsgEthereumTxResponse{
GasUsed: gasUsed,
VmError: vmError,
Ret: ret,
GasUsed: gasUsed,
VmError: vmError,
Ret: ret,
ContractAddress: contractAddr.String(),
}, nil
}
+3 -4
View File
@@ -6,11 +6,10 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"
)
// AccountKeeper defines the expected account keeper interface
@@ -54,5 +53,5 @@ type FeeMarketKeeper interface {
// EvmHooks event hooks for evm tx processing
type EvmHooks interface {
// 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
}
+101 -55
View File
@@ -305,6 +305,8 @@ type MsgEthereumTxResponse struct {
VmError string `protobuf:"bytes,4,opt,name=vm_error,json=vmError,proto3" json:"vm_error,omitempty"`
// gas consumed by the transaction
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{} }
@@ -352,61 +354,62 @@ func init() {
func init() { proto.RegisterFile("ethermint/evm/v1/tx.proto", fileDescriptor_f75ac0a12d075f21) }
var fileDescriptor_f75ac0a12d075f21 = []byte{
// 853 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x31, 0x8f, 0xe3, 0x44,
0x14, 0xce, 0x24, 0x4e, 0xec, 0x4c, 0xc2, 0xe9, 0x64, 0xed, 0x49, 0x4e, 0xc4, 0xc5, 0x91, 0x25,
0x20, 0x20, 0xc5, 0xd6, 0x2d, 0x54, 0x5b, 0xb1, 0xbe, 0xdd, 0x3b, 0xdd, 0x29, 0x27, 0x90, 0x15,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 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.
@@ -929,6 +932,13 @@ func (m *MsgEthereumTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = 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 {
i = encodeVarintTx(dAtA, i, uint64(m.GasUsed))
i--
@@ -1196,6 +1206,10 @@ func (m *MsgEthereumTxResponse) Size() (n int) {
if m.GasUsed != 0 {
n += 1 + sovTx(uint64(m.GasUsed))
}
l = len(m.ContractAddress)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
@@ -2756,6 +2770,38 @@ func (m *MsgEthereumTxResponse) Unmarshal(dAtA []byte) error {
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:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
-5
View File
@@ -1,8 +1,6 @@
package keeper_test
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tharsis/ethermint/x/feemarket/types"
)
@@ -62,9 +60,6 @@ func (suite *KeeperTestSuite) TestQueryBaseFee() {
},
}
for _, tc := range testCases {
fee := suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx)
fmt.Printf("baseFee: %v", fee)
tc.malleate()
res, err := suite.queryClient.BaseFee(suite.ctx.Context(), &types.QueryBaseFeeRequest{})