diff --git a/proto/ethermint/evm/v1/tx.proto b/proto/ethermint/evm/v1/tx.proto index 737b29493d..dbfb0dd2bb 100644 --- a/proto/ethermint/evm/v1/tx.proto +++ b/proto/ethermint/evm/v1/tx.proto @@ -161,6 +161,8 @@ message MsgEthereumTxResponse { string vm_error = 4; // gas_used specifies how much gas was consumed by the transaction uint64 gas_used = 5; + // include the block hash for json-rpc to use + bytes block_hash = 6; } // MsgUpdateParams defines a Msg for updating the x/evm module parameters. diff --git a/rpc/backend/client_test.go b/rpc/backend/client_test.go index d694ff49c7..0e16719bda 100644 --- a/rpc/backend/client_test.go +++ b/rpc/backend/client_test.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" errortypes "github.com/cosmos/cosmos-sdk/types/errors" abci "github.com/cometbft/cometbft/abci/types" @@ -18,6 +19,7 @@ import ( "github.com/evmos/ethermint/rpc/backend/mocks" rpc "github.com/evmos/ethermint/rpc/types" evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/gogo/protobuf/proto" mock "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" ) @@ -178,19 +180,26 @@ func TestRegisterConsensusParams(t *testing.T) { // BlockResults func RegisterBlockResultsWithEventLog(client *mocks.Client, height int64) (*tmrpctypes.ResultBlockResults, error) { + any, err := codectypes.NewAnyWithValue(&evmtypes.MsgEthereumTxResponse{ + Logs: []*evmtypes.Log{ + {Data: []byte("data")}, + }, + }) + if err != nil { + return nil, err + } + data, err := proto.Marshal(&sdk.TxMsgData{MsgResponses: []*codectypes.Any{any}}) + if err != nil { + return nil, err + } + res := &tmrpctypes.ResultBlockResults{ Height: height, TxsResults: []*abci.ResponseDeliverTx{ - {Code: 0, GasUsed: 0, Events: []abci.Event{{ - Type: evmtypes.EventTypeTxLog, - Attributes: []abci.EventAttribute{{ - Key: evmtypes.AttributeKeyTxLog, - Value: "{\"test\": \"hello\"}", - Index: true, - }}, - }}}, + {Code: 0, GasUsed: 0, Data: data}, }, } + client.On("BlockResults", rpc.ContextWithHeight(height), mock.AnythingOfType("*int64")). Return(res, nil) return res, nil diff --git a/rpc/backend/filters_test.go b/rpc/backend/filters_test.go index d053f9b470..062d501099 100644 --- a/rpc/backend/filters_test.go +++ b/rpc/backend/filters_test.go @@ -1,8 +1,6 @@ package backend import ( - "encoding/json" - tmtypes "github.com/cometbft/cometbft/types" "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" @@ -15,9 +13,10 @@ func (suite *BackendTestSuite) TestGetLogs() { _, bz := suite.buildEthereumTx() block := tmtypes.MakeBlock(1, []tmtypes.Tx{bz}, nil, nil) logs := make([]*evmtypes.Log, 0, 1) - var log evmtypes.Log - json.Unmarshal([]byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x7d}, &log) - logs = append(logs, &log) + logs = append(logs, &evmtypes.Log{ + Data: []byte("data"), + BlockNumber: 1, + }) testCases := []struct { name string diff --git a/rpc/backend/tx_info.go b/rpc/backend/tx_info.go index 93c355c20b..b47f59bff2 100644 --- a/rpc/backend/tx_info.go +++ b/rpc/backend/tx_info.go @@ -200,7 +200,7 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{ } // parse tx logs from events - logs, err := TxLogsFromEvents(blockRes.TxsResults[res.TxIndex].Events, int(res.MsgIndex)) + logs, err := evmtypes.DecodeMsgLogsFromEvents(blockRes.TxsResults[res.TxIndex].Data, int(res.MsgIndex), uint64(blockRes.Height)) if err != nil { b.logger.Debug("failed to parse logs", "hash", hexTx, "error", err.Error()) } diff --git a/rpc/backend/utils.go b/rpc/backend/utils.go index 4a32e42d53..9512623be2 100644 --- a/rpc/backend/utils.go +++ b/rpc/backend/utils.go @@ -16,7 +16,6 @@ package backend import ( - "encoding/json" "fmt" "math/big" "sort" @@ -277,57 +276,6 @@ func (b *Backend) processBlock( return nil } -// AllTxLogsFromEvents parses all ethereum logs from cosmos events -func AllTxLogsFromEvents(events []abci.Event) ([][]*ethtypes.Log, error) { - allLogs := make([][]*ethtypes.Log, 0, 4) - for _, event := range events { - if event.Type != evmtypes.EventTypeTxLog { - continue - } - - logs, err := ParseTxLogsFromEvent(event) - if err != nil { - return nil, err - } - - allLogs = append(allLogs, logs) - } - return allLogs, nil -} - -// TxLogsFromEvents parses ethereum logs from cosmos events for specific msg index -func TxLogsFromEvents(events []abci.Event, msgIndex int) ([]*ethtypes.Log, error) { - for _, event := range events { - if event.Type != evmtypes.EventTypeTxLog { - continue - } - - if msgIndex > 0 { - // not the eth tx we want - msgIndex-- - continue - } - - return ParseTxLogsFromEvent(event) - } - return nil, fmt.Errorf("eth tx logs not found for message index %d", msgIndex) -} - -// ParseTxLogsFromEvent parse tx logs from one event -func ParseTxLogsFromEvent(event abci.Event) ([]*ethtypes.Log, error) { - var ethLogs []*ethtypes.Log - for _, attr := range event.Attributes { - var log evmtypes.Log - if attr.Key == evmtypes.AttributeKeyTxLog { - if err := json.Unmarshal([]byte(attr.Value), &log); err != nil { - return nil, err - } - ethLogs = append(ethLogs, log.ToEthereum()) - } - } - return ethLogs, nil -} - // ShouldIgnoreGasUsed returns true if the gasUsed in result should be ignored // workaround for issue: https://github.com/cosmos/cosmos-sdk/issues/10832 func ShouldIgnoreGasUsed(res *abci.ResponseDeliverTx) bool { @@ -338,12 +286,11 @@ func ShouldIgnoreGasUsed(res *abci.ResponseDeliverTx) bool { func GetLogsFromBlockResults(blockRes *tmrpctypes.ResultBlockResults) ([][]*ethtypes.Log, error) { blockLogs := [][]*ethtypes.Log{} for _, txResult := range blockRes.TxsResults { - logs, err := AllTxLogsFromEvents(txResult.Events) + logs, err := evmtypes.DecodeTxLogsFromEvents(txResult.Data, uint64(blockRes.Height)) if err != nil { return nil, err } - - blockLogs = append(blockLogs, logs...) + blockLogs = append(blockLogs, logs) } return blockLogs, nil } diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index f1bacf1301..1f13f77549 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -445,7 +445,13 @@ func (e *PublicAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, err } // parse tx logs from events - return backend.TxLogsFromEvents(resBlockResult.TxsResults[res.TxIndex].Events, int(res.MsgIndex)) + logs, err := evmtypes.DecodeMsgLogsFromEvents(resBlockResult.TxsResults[res.TxIndex].Data, int(res.MsgIndex), uint64(resBlockResult.Height)) + if err != nil { + e.logger.Debug("failed to parse tx logs", "error", err.Error()) + return nil, nil + } + + return logs, nil } // SignTypedData signs EIP-712 conformant typed data diff --git a/rpc/namespaces/ethereum/eth/filters/api.go b/rpc/namespaces/ethereum/eth/filters/api.go index d73075811d..421dd08401 100644 --- a/rpc/namespaces/ethereum/eth/filters/api.go +++ b/rpc/namespaces/ethereum/eth/filters/api.go @@ -414,7 +414,7 @@ func (api *PublicFilterAPI) Logs(ctx context.Context, crit filters.FilterCriteri api.logger.Debug("event data type mismatch", "type", fmt.Sprintf("%T", ev.Data)) continue } - txLogs, err := evmtypes.DecodeTxLogsFromEvents(dataTx.TxResult.Result.Data) + txLogs, err := evmtypes.DecodeTxLogsFromEvents(dataTx.TxResult.Result.Data, uint64(dataTx.TxResult.Height)) if err != nil { api.logger.Error("fail to decode tx response", "error", err.Error()) return @@ -494,7 +494,7 @@ func (api *PublicFilterAPI) NewFilter(criteria filters.FilterCriteria) (rpc.ID, api.logger.Debug("event data type mismatch", "type", fmt.Sprintf("%T", ev.Data)) continue } - txLogs, err := evmtypes.DecodeTxLogsFromEvents(dataTx.TxResult.Result.Data) + txLogs, err := evmtypes.DecodeTxLogsFromEvents(dataTx.TxResult.Result.Data, uint64(dataTx.TxResult.Height)) if err != nil { api.logger.Error("fail to decode tx response", "error", err.Error()) return diff --git a/rpc/types/events_test.go b/rpc/types/events_test.go index 2e869d6dda..5b252be6b4 100644 --- a/rpc/types/events_test.go +++ b/rpc/types/events_test.go @@ -56,7 +56,6 @@ func TestParseTxResult(t *testing.T) { {Key: "recipient", Value: "0x775b87ef5D82ca211811C1a02CE0fE0CA3a455d7"}, {Key: "ethereumTxFailed", Value: "contract reverted"}, }}, - {Type: evmtypes.EventTypeTxLog, Attributes: []abci.EventAttribute{}}, }, }, []*ParsedTx{ @@ -141,7 +140,6 @@ func TestParseTxResult(t *testing.T) { {Key: "recipient", Value: "0x775b87ef5D82ca211811C1a02CE0fE0CA3a455d7"}, {Key: "ethereumTxFailed", Value: "contract reverted"}, }}, - {Type: evmtypes.EventTypeTxLog, Attributes: []abci.EventAttribute{}}, }, }, nil, @@ -168,7 +166,6 @@ func TestParseTxResult(t *testing.T) { {Key: "recipient", Value: "0x775b87ef5D82ca211811C1a02CE0fE0CA3a455d7"}, {Key: "ethereumTxFailed", Value: "contract reverted"}, }}, - {Type: evmtypes.EventTypeTxLog, Attributes: []abci.EventAttribute{}}, }, }, nil, diff --git a/rpc/websockets.go b/rpc/websockets.go index c0f73c1322..a800825732 100644 --- a/rpc/websockets.go +++ b/rpc/websockets.go @@ -589,7 +589,7 @@ func (api *pubSubAPI) subscribeLogs(wsConn *wsConn, subID rpc.ID, extra interfac api.logger.Debug("event data type mismatch", "type", fmt.Sprintf("%T", event.Data)) continue } - txLogs, err := evmtypes.DecodeTxLogsFromEvents(dataTx.TxResult.Result.Data) + txLogs, err := evmtypes.DecodeTxLogsFromEvents(dataTx.TxResult.Result.Data, uint64(dataTx.TxResult.Height)) if err != nil { api.logger.Error("failed to decode tx response", "error", err.Error()) return diff --git a/x/evm/keeper/msg_server.go b/x/evm/keeper/msg_server.go index 15c51f9158..5c58bb8363 100644 --- a/x/evm/keeper/msg_server.go +++ b/x/evm/keeper/msg_server.go @@ -17,7 +17,6 @@ package keeper import ( "context" - "encoding/json" "fmt" "strconv" @@ -113,25 +112,12 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t attrs = append(attrs, sdk.NewAttribute(types.AttributeKeyEthereumTxFailed, response.VmError)) } - txLogAttrs := make([]sdk.Attribute, len(response.Logs)) - for i, log := range response.Logs { - value, err := json.Marshal(log) - if err != nil { - return nil, errorsmod.Wrap(err, "failed to encode log") - } - txLogAttrs[i] = sdk.NewAttribute(types.AttributeKeyTxLog, string(value)) - } - // emit events ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeEthereumTx, attrs..., ), - sdk.NewEvent( - types.EventTypeTxLog, - txLogAttrs..., - ), sdk.NewEvent( sdk.EventTypeMessage, sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index 59d2992dee..9144e4346a 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -438,10 +438,11 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, leftoverGas = msg.Gas() - gasUsed return &types.MsgEthereumTxResponse{ - GasUsed: gasUsed, - VmError: vmError, - Ret: ret, - Logs: types.NewLogsFromEth(stateDB.Logs()), - Hash: txConfig.TxHash.Hex(), + GasUsed: gasUsed, + VmError: vmError, + Ret: ret, + Logs: types.NewLogsFromEth(stateDB.Logs()), + Hash: txConfig.TxHash.Hex(), + BlockHash: ctx.HeaderHash().Bytes(), }, nil } diff --git a/x/evm/keeper/statedb_test.go b/x/evm/keeper/statedb_test.go index b12d0dd460..9b4fbac52f 100644 --- a/x/evm/keeper/statedb_test.go +++ b/x/evm/keeper/statedb_test.go @@ -666,7 +666,6 @@ func (suite *KeeperTestSuite) TestAddLog() { }, ðtypes.Log{ Address: addr, - TxHash: txHash, Topics: make([]common.Hash, 0), }, func(vm.StateDB) {}, @@ -680,7 +679,6 @@ func (suite *KeeperTestSuite) TestAddLog() { }, ðtypes.Log{ Address: addr, - TxHash: txHash3, Topics: make([]common.Hash, 0), }, func(vm.StateDB) {}, diff --git a/x/evm/statedb/statedb.go b/x/evm/statedb/statedb.go index 78ba71b270..d10debac90 100644 --- a/x/evm/statedb/statedb.go +++ b/x/evm/statedb/statedb.go @@ -116,8 +116,6 @@ func (s *StateDB) Keeper() Keeper { func (s *StateDB) AddLog(log *ethtypes.Log) { s.journal.append(addLogChange{}) - log.TxHash = s.txConfig.TxHash - log.BlockHash = s.txConfig.BlockHash log.TxIndex = s.txConfig.TxIndex log.Index = s.txConfig.LogIndex + uint(len(s.logs)) s.logs = append(s.logs, log) diff --git a/x/evm/statedb/statedb_test.go b/x/evm/statedb/statedb_test.go index a1f3014e1a..9258f270ff 100644 --- a/x/evm/statedb/statedb_test.go +++ b/x/evm/statedb/statedb_test.go @@ -36,6 +36,8 @@ func (suite *StateDBTestSuite) TestAccount() { value1 := common.BigToHash(big.NewInt(2)) key2 := common.BigToHash(big.NewInt(3)) value2 := common.BigToHash(big.NewInt(4)) + txConfig := emptyTxConfig + txConfig.TxHash = common.BigToHash(big.NewInt(100)) testCases := []struct { name string malleate func(*statedb.StateDB) @@ -58,7 +60,7 @@ func (suite *StateDBTestSuite) TestAccount() { suite.Require().Empty(acct.states) suite.Require().False(acct.account.IsContract()) - db = statedb.New(sdk.Context{}, keeper, emptyTxConfig) + db = statedb.New(sdk.Context{}, keeper, txConfig) suite.Require().Equal(true, db.Exist(address)) suite.Require().Equal(true, db.Empty(address)) suite.Require().Equal(big.NewInt(0), db.GetBalance(address)) @@ -80,7 +82,7 @@ func (suite *StateDBTestSuite) TestAccount() { suite.Require().NoError(db.Commit()) // suicide - db = statedb.New(sdk.Context{}, db.Keeper(), emptyTxConfig) + db = statedb.New(sdk.Context{}, db.Keeper(), txConfig) suite.Require().False(db.HasSuicided(address)) suite.Require().True(db.Suicide(address)) @@ -95,7 +97,7 @@ func (suite *StateDBTestSuite) TestAccount() { suite.Require().NoError(db.Commit()) // not accessible from StateDB anymore - db = statedb.New(sdk.Context{}, db.Keeper(), emptyTxConfig) + db = statedb.New(sdk.Context{}, db.Keeper(), txConfig) suite.Require().False(db.Exist(address)) // and cleared in keeper too @@ -107,7 +109,7 @@ func (suite *StateDBTestSuite) TestAccount() { for _, tc := range testCases { suite.Run(tc.name, func() { keeper := NewMockKeeper() - db := statedb.New(sdk.Context{}, keeper, emptyTxConfig) + db := statedb.New(sdk.Context{}, keeper, txConfig) tc.malleate(db) }) } @@ -492,8 +494,6 @@ func (suite *StateDBTestSuite) TestLog() { Topics: []common.Hash{}, Data: data, BlockNumber: 1, - BlockHash: blockHash, - TxHash: txHash, TxIndex: 1, Index: 1, } @@ -627,10 +627,8 @@ func (suite *StateDBTestSuite) TestNativeAction() { // check events suite.Require().Equal(sdk.Events{{Type: "success1"}}, stateDB.NativeEvents()) suite.Require().Equal([]*ethtypes.Log{{ - Address: contract, - BlockHash: emptyTxConfig.BlockHash, - TxHash: emptyTxConfig.TxHash, - Data: []byte("success1"), + Address: contract, + Data: []byte("success1"), }}, stateDB.Logs()) // test query @@ -658,16 +656,12 @@ func (suite *StateDBTestSuite) TestNativeAction() { // check events suite.Require().Equal(sdk.Events{{Type: "success1"}, {Type: "success2"}}, stateDB.NativeEvents()) suite.Require().Equal([]*ethtypes.Log{{ - Address: contract, - BlockHash: emptyTxConfig.BlockHash, - TxHash: emptyTxConfig.TxHash, - Data: []byte("success1"), + Address: contract, + Data: []byte("success1"), }, { - Index: 1, - Address: contract, - BlockHash: emptyTxConfig.BlockHash, - TxHash: emptyTxConfig.TxHash, - Data: []byte("success2"), + Index: 1, + Address: contract, + Data: []byte("success2"), }}, stateDB.Logs()) // test query stateDB.ExecuteNativeAction(contract, func(ctx sdk.Context) error { @@ -683,10 +677,8 @@ func (suite *StateDBTestSuite) TestNativeAction() { // check events suite.Require().Equal(sdk.Events{{Type: "success1"}}, stateDB.NativeEvents()) suite.Require().Equal([]*ethtypes.Log{{ - Address: contract, - BlockHash: emptyTxConfig.BlockHash, - TxHash: emptyTxConfig.TxHash, - Data: []byte("success1"), + Address: contract, + Data: []byte("success1"), }}, stateDB.Logs()) _ = stateDB.Snapshot() diff --git a/x/evm/types/events.go b/x/evm/types/events.go index 909ac2973f..39451cf494 100644 --- a/x/evm/types/events.go +++ b/x/evm/types/events.go @@ -19,7 +19,6 @@ package types const ( EventTypeEthereumTx = TypeMsgEthereumTx EventTypeBlockBloom = "block_bloom" - EventTypeTxLog = "tx_log" AttributeKeyContractAddress = "contract" AttributeKeyRecipient = "recipient" diff --git a/x/evm/types/tx.pb.go b/x/evm/types/tx.pb.go index afeba133a3..285f143227 100644 --- a/x/evm/types/tx.pb.go +++ b/x/evm/types/tx.pb.go @@ -311,6 +311,8 @@ type MsgEthereumTxResponse struct { VmError string `protobuf:"bytes,4,opt,name=vm_error,json=vmError,proto3" json:"vm_error,omitempty"` // gas_used specifies how much gas was consumed by the transaction GasUsed uint64 `protobuf:"varint,5,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` + // include the block hash for json-rpc to use + BlockHash []byte `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` } func (m *MsgEthereumTxResponse) Reset() { *m = MsgEthereumTxResponse{} } @@ -454,68 +456,70 @@ func init() { func init() { proto.RegisterFile("ethermint/evm/v1/tx.proto", fileDescriptor_f75ac0a12d075f21) } var fileDescriptor_f75ac0a12d075f21 = []byte{ - // 975 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x8f, 0xdb, 0xc4, - 0x17, 0x8f, 0x13, 0xe7, 0xd7, 0x24, 0xdf, 0xfd, 0x56, 0xa3, 0xad, 0xea, 0x44, 0x34, 0x0e, 0x96, - 0x80, 0x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xad, 0x65, 0x9b, 0x13, 0xd9, 0xa8, 0x3c, 0x60, 0x87, 0x25, 0xf9, 0xdf, 0xf1, - 0xe6, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8d, 0xf3, 0xe0, 0xc6, 0x74, 0x09, 0x00, 0x00, + // 994 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0xda, 0xeb, 0x5f, 0xcf, 0xfe, 0xe6, 0x5b, 0x8d, 0x52, 0x75, 0x6d, 0x11, 0xaf, 0xb1, + 0x04, 0xb8, 0x95, 0xbc, 0xab, 0x06, 0xd4, 0x43, 0x4e, 0x8d, 0x9b, 0xb4, 0xb4, 0x4a, 0x44, 0xb5, + 0xb8, 0x17, 0x8a, 0x64, 0x4d, 0xd6, 0x93, 0xf5, 0xaa, 0xde, 0x9d, 0xd5, 0xce, 0x78, 0x65, 0x23, + 0x71, 0xe9, 0x89, 0x1b, 0x20, 0xfe, 0x01, 0xce, 0x9c, 0x90, 0xe8, 0x1f, 0x80, 0xc4, 0xa5, 0xe2, + 0x54, 0xc1, 0x05, 0x71, 0x30, 0xc8, 0x41, 0x42, 0xca, 0x0d, 0xfe, 0x02, 0x34, 0x33, 0xeb, 0x38, + 0xae, 0x49, 0x0b, 0xa5, 0x88, 0xd3, 0xce, 0x9b, 0xf7, 0xe6, 0xf3, 0xde, 0xbc, 0xcf, 0x67, 0x66, + 0x16, 0xaa, 0x84, 0x0f, 0x48, 0x1c, 0xf8, 0x21, 0xb7, 0x49, 0x12, 0xd8, 0xc9, 0x55, 0x9b, 0x8f, + 0xad, 0x28, 0xa6, 0x9c, 0xa2, 0x0b, 0xa7, 0x2e, 0x8b, 0x24, 0x81, 0x95, 0x5c, 0xad, 0x5d, 0x72, + 0x29, 0x0b, 0x28, 0xb3, 0x03, 0xe6, 0x89, 0xc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0, 0x87, 0x00, 0x67, 0xde, 0x66, 0x73, 0x35, 0xd1, 0x12, 0x33, 0xb5, 0x37, 0x9e, 0x13, 0x30, + 0xc7, 0x6f, 0xbe, 0xf6, 0xf0, 0xfb, 0x5f, 0x3e, 0xcb, 0x98, 0xcd, 0x4d, 0x7b, 0xf5, 0x5f, 0x23, + 0x8d, 0xee, 0xf1, 0x31, 0x7a, 0x1f, 0x2a, 0x4b, 0x1d, 0x7b, 0xf5, 0x4f, 0xf1, 0xcf, 0x86, 0xd4, + 0x2e, 0x3f, 0x37, 0x64, 0x5e, 0x44, 0xe7, 0xfa, 0xe3, 0x59, 0x5d, 0x7b, 0x32, 0xab, 0x6b, 0x3f, + 0xcf, 0xea, 0xda, 0x27, 0xc7, 0xf5, 0xb5, 0x27, 0xc7, 0xf5, 0xb5, 0x1f, 0x8e, 0xeb, 0x6b, 0xef, + 0x9d, 0x3d, 0x7b, 0x24, 0x11, 0x47, 0x6f, 0x51, 0xe6, 0x58, 0x16, 0x2a, 0xcf, 0xdf, 0x61, 0x5e, + 0xfe, 0x96, 0xbc, 0xf9, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbf, 0xdd, 0x24, 0x44, 0x93, 0x09, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1078,6 +1082,13 @@ func (m *MsgEthereumTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.BlockHash) > 0 { + i -= len(m.BlockHash) + copy(dAtA[i:], m.BlockHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.BlockHash))) + i-- + dAtA[i] = 0x32 + } if m.GasUsed != 0 { i = encodeVarintTx(dAtA, i, uint64(m.GasUsed)) i-- @@ -1408,6 +1419,10 @@ func (m *MsgEthereumTxResponse) Size() (n int) { if m.GasUsed != 0 { n += 1 + sovTx(uint64(m.GasUsed)) } + l = len(m.BlockHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -2992,6 +3007,40 @@ func (m *MsgEthereumTxResponse) Unmarshal(dAtA []byte) error { break } } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...) + if m.BlockHash == nil { + m.BlockHash = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/evm/types/utils.go b/x/evm/types/utils.go index f46a2ac594..a0f34fd105 100644 --- a/x/evm/types/utils.go +++ b/x/evm/types/utils.go @@ -67,17 +67,54 @@ func DecodeTxResponses(in []byte) ([]*MsgEthereumTxResponse, error) { return responses, nil } +func logsFromTxResponse(dst []*ethtypes.Log, rsp *MsgEthereumTxResponse, blockNumber uint64) []*ethtypes.Log { + if len(rsp.Logs) == 0 { + return nil + } + + if dst == nil { + dst = make([]*ethtypes.Log, 0, len(rsp.Logs)) + } + + txHash := common.HexToHash(rsp.Hash) + for _, log := range rsp.Logs { + // fill in the tx/block informations + l := log.ToEthereum() + l.TxHash = txHash + l.BlockNumber = blockNumber + if len(rsp.BlockHash) > 0 { + l.BlockHash = common.BytesToHash(rsp.BlockHash) + } + dst = append(dst, l) + } + return dst +} + +// DecodeMsgLogsFromEvents decodes a protobuf-encoded byte slice into ethereum logs, for a single message. +func DecodeMsgLogsFromEvents(in []byte, msgIndex int, blockNumber uint64) ([]*ethtypes.Log, error) { + txResponses, err := DecodeTxResponses(in) + if err != nil { + return nil, err + } + + if msgIndex >= len(txResponses) { + return nil, fmt.Errorf("invalid message index: %d", msgIndex) + } + + return logsFromTxResponse(nil, txResponses[msgIndex], blockNumber), nil +} + // DecodeTxLogsFromEvents decodes a protobuf-encoded byte slice into ethereum logs -func DecodeTxLogsFromEvents(in []byte) ([]*ethtypes.Log, error) { +func DecodeTxLogsFromEvents(in []byte, blockNumber uint64) ([]*ethtypes.Log, error) { txResponses, err := DecodeTxResponses(in) if err != nil { return nil, err } - var txLogs []*Log + var logs []*ethtypes.Log for _, response := range txResponses { - txLogs = append(txLogs, response.Logs...) + logs = logsFromTxResponse(logs, response, blockNumber) } - return LogsToEthereum(txLogs), nil + return logs, nil } // EncodeTransactionLogs encodes TransactionLogs slice into a protobuf-encoded byte slice.