From 5ba56ccbb11d152267c785b7f271f16146002a7d Mon Sep 17 00:00:00 2001 From: beer-1 <147697694+beer-1@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:03:54 +0900 Subject: [PATCH] fix receipt indexing to include contract address if that is creation --- indexer/abci.go | 36 +++++- indexer/utils.go | 66 +++------- indexer/utils_test.go | 37 ++++++ jsonrpc/backend/tx.go | 6 +- proto/minievm/evm/v1/query.proto | 7 +- proto/minievm/evm/v1/tx.proto | 12 +- proto/minievm/evm/v1/types.proto | 2 +- x/evm/keeper/msg_server.go | 6 +- x/evm/types/tx.pb.go | 212 +++++++++++++++++++++++++------ 9 files changed, 276 insertions(+), 108 deletions(-) create mode 100644 indexer/utils_test.go diff --git a/indexer/abci.go b/indexer/abci.go index f9ebcf1..55b7247 100644 --- a/indexer/abci.go +++ b/indexer/abci.go @@ -61,15 +61,45 @@ func (e *EVMIndexerImpl) ListenFinalizeBlock(ctx context.Context, req abci.Reque } ethTxs = append(ethTxs, ethTx) - ethLogs := e.extractLogsFromEvents(txResults.Events) - receipts = append(receipts, &coretypes.Receipt{ + + // extract logs and contract address from tx results + var ethLogs []*coretypes.Log + var contractAddr *common.Address + if ethTx.To() == nil { + var resp types.MsgCreateResponse + if err := unpackData(txResults.Data, &resp); err != nil { + e.logger.Error("failed to unpack MsgCreateResponse", "err", err) + return err + } + + ethLogs = types.Logs(resp.Logs).ToEthLogs() + contractAddr_ := common.HexToAddress(resp.ContractAddr) + contractAddr = &contractAddr_ + } else { + var resp types.MsgCallResponse + if err := unpackData(txResults.Data, &resp); err != nil { + e.logger.Error("failed to unpack MsgCallResponse", "err", err) + return err + } + + ethLogs = types.Logs(resp.Logs).ToEthLogs() + } + + receipt := coretypes.Receipt{ PostState: nil, Status: txStatus, CumulativeGasUsed: usedGas, Bloom: coretypes.Bloom(coretypes.LogsBloom(ethLogs)), Logs: ethLogs, TransactionIndex: txIndex, - }) + } + + // fill in contract address if it's a contract creation + if contractAddr != nil { + receipt.ContractAddress = *contractAddr + } + + receipts = append(receipts, &receipt) } chainId := types.ConvertCosmosChainIDToEthereumChainID(sdkCtx.ChainID()) diff --git a/indexer/utils.go b/indexer/utils.go index 82f5894..e5e6054 100644 --- a/indexer/utils.go +++ b/indexer/utils.go @@ -3,65 +3,31 @@ package indexer import ( "encoding/json" "fmt" - "path/filepath" - - "github.com/spf13/cast" - - abci "github.com/cometbft/cometbft/abci/types" collcodec "cosmossdk.io/collections/codec" - dbm "github.com/cosmos/cosmos-db" - "github.com/cosmos/cosmos-sdk/server" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - - coretypes "github.com/ethereum/go-ethereum/core/types" - - "github.com/initia-labs/minievm/x/evm/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/gogoproto/proto" ) -// helper function to make config creation independent of root dir -func rootify(path, root string) string { - if filepath.IsAbs(path) { - return path +// unpackData extracts msg response from the data +func unpackData(data []byte, resp proto.Message) error { + var txMsgData sdk.TxMsgData + if err := proto.Unmarshal(data, &txMsgData); err != nil { + return err } - return filepath.Join(root, path) -} - -// getDBConfig returns the database configuration for the EVM indexer -func getDBConfig(appOpts servertypes.AppOptions) (string, dbm.BackendType) { - rootDir := cast.ToString(appOpts.Get("home")) - dbDir := cast.ToString(appOpts.Get("db_dir")) - dbBackend := server.GetAppDBBackend(appOpts) - return rootify(dbDir, rootDir), dbBackend -} + msgResp := txMsgData.MsgResponses[0] + expectedTypeUrl := sdk.MsgTypeURL(resp) + if msgResp.TypeUrl != expectedTypeUrl { + return fmt.Errorf("unexpected type URL; got: %s, expected: %s", msgResp.TypeUrl, expectedTypeUrl) + } -// extractLogsFromEvents extracts logs from the events -func (e *EVMIndexerImpl) extractLogsFromEvents(events []abci.Event) []*coretypes.Log { - var ethLogs []*coretypes.Log - for _, event := range events { - if event.Type == types.EventTypeEVM { - logs := make(types.Logs, 0, len(event.Attributes)) - - for _, attr := range event.Attributes { - if attr.Key == types.AttributeKeyLog { - var log types.Log - err := json.Unmarshal([]byte(attr.Value), &log) - if err != nil { - e.logger.Error("failed to unmarshal log", "err", err) - continue - } - - logs = append(logs, log) - } - } - - ethLogs = logs.ToEthLogs() - break - } + // Unpack the response + if err := proto.Unmarshal(msgResp.Value, resp); err != nil { + return err } - return ethLogs + return nil } // CollJsonVal is used for protobuf values of the newest google.golang.org/protobuf API. diff --git a/indexer/utils_test.go b/indexer/utils_test.go new file mode 100644 index 0000000..b96e9a8 --- /dev/null +++ b/indexer/utils_test.go @@ -0,0 +1,37 @@ +package indexer + +import ( + "testing" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/require" + + "github.com/initia-labs/minievm/x/evm/types" +) + +func Test_UnpackData(t *testing.T) { + resp := types.MsgCreateResponse{ + Result: "ret", + ContractAddr: types.StdAddress.Hex(), + Logs: []types.Log{ + { + Address: types.StdAddress.Hex(), + Topics: []string{"topic"}, + Data: "data", + }, + }, + } + + anyResp, err := codectypes.NewAnyWithValue(&resp) + require.NoError(t, err) + + data, err := proto.Marshal(&sdk.TxMsgData{MsgResponses: []*codectypes.Any{anyResp}}) + require.NoError(t, err) + + var respOut types.MsgCreateResponse + err = unpackData(data, &respOut) + require.NoError(t, err) + require.Equal(t, resp, respOut) +} diff --git a/jsonrpc/backend/tx.go b/jsonrpc/backend/tx.go index 240803b..89eea38 100644 --- a/jsonrpc/backend/tx.go +++ b/jsonrpc/backend/tx.go @@ -255,9 +255,9 @@ func (b *JSONRPCBackend) PendingTransactions() ([]*rpctypes.RPCTransaction, erro func marshalReceipt(receipt *coretypes.Receipt, tx *rpctypes.RPCTransaction) map[string]interface{} { fields := map[string]interface{}{ "blockHash": tx.BlockHash, - "blockNumber": hexutil.Big(*tx.BlockNumber), + "blockNumber": hexutil.Uint64(tx.BlockNumber.ToInt().Uint64()), "transactionHash": tx.Hash, - "transactionIndex": hexutil.Uint64(*tx.TransactionIndex), + "transactionIndex": *tx.TransactionIndex, "from": tx.From, "to": tx.To, "gasUsed": hexutil.Uint64(receipt.GasUsed), @@ -265,7 +265,7 @@ func marshalReceipt(receipt *coretypes.Receipt, tx *rpctypes.RPCTransaction) map "contractAddress": nil, "logs": receipt.Logs, "logsBloom": receipt.Bloom, - "type": hexutil.Uint(coretypes.LegacyTxType), + "type": hexutil.Uint(tx.Type), "effectiveGasPrice": (*hexutil.Big)(receipt.EffectiveGasPrice), } diff --git a/proto/minievm/evm/v1/query.proto b/proto/minievm/evm/v1/query.proto index 95ce6b6..b4fd682 100644 --- a/proto/minievm/evm/v1/query.proto +++ b/proto/minievm/evm/v1/query.proto @@ -87,11 +87,8 @@ message QueryCallRequest { // hex encoded call input string input = 3; // Value is the amount of fee denom token to transfer to the contract. - string value = 4 [ - (gogoproto.customtype) = "cosmossdk.io/math.Int", - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; + string value = 4 + [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // whether to trace the call // `nil` means no trace TraceOptions trace_options = 5; diff --git a/proto/minievm/evm/v1/tx.proto b/proto/minievm/evm/v1/tx.proto index bea777a..e8fdc91 100644 --- a/proto/minievm/evm/v1/tx.proto +++ b/proto/minievm/evm/v1/tx.proto @@ -50,6 +50,9 @@ message MsgCreateResponse { // hex encoded address string contract_addr = 2; + + // logs are the contract logs generated by the contract execution. + repeated Log logs = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgCreate2 is a message to create a contract with the CREATE2 opcode. @@ -81,6 +84,9 @@ message MsgCreate2Response { // hex encoded address string contract_addr = 2; + + // logs are the contract logs generated by the contract execution. + repeated Log logs = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgCall is a message to call an Ethereum contract. @@ -109,8 +115,10 @@ message MsgCall { // MsgCallResponse defines the Msg/Call response type. message MsgCallResponse { - string result = 1; - repeated Log logs = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + string result = 1; + + // logs are the contract logs generated by the contract execution. + repeated Log logs = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgUpdateParams defines a Msg for updating the x/evm module parameters. diff --git a/proto/minievm/evm/v1/types.proto b/proto/minievm/evm/v1/types.proto index b544752..c9ae532 100644 --- a/proto/minievm/evm/v1/types.proto +++ b/proto/minievm/evm/v1/types.proto @@ -30,7 +30,7 @@ message Params { (gogoproto.moretags) = "yaml:\"allowed_custom_erc20s\"", (amino.dont_omitempty) = true ]; - + // fee_denom defines the fee denom for the evm transactions string fee_denom = 5 [(gogoproto.moretags) = "yaml:\"fee_denom\""]; } diff --git a/x/evm/keeper/msg_server.go b/x/evm/keeper/msg_server.go index e785da5..019f1cb 100644 --- a/x/evm/keeper/msg_server.go +++ b/x/evm/keeper/msg_server.go @@ -67,7 +67,7 @@ func (ms *msgServerImpl) Create(ctx context.Context, msg *types.MsgCreate) (*typ } // deploy a contract - retBz, contractAddr, _, err := ms.EVMCreate(ctx, caller, codeBz, value) + retBz, contractAddr, logs, err := ms.EVMCreate(ctx, caller, codeBz, value) if err != nil { return nil, types.ErrEVMCallFailed.Wrap(err.Error()) } @@ -75,6 +75,7 @@ func (ms *msgServerImpl) Create(ctx context.Context, msg *types.MsgCreate) (*typ return &types.MsgCreateResponse{ Result: hexutil.Encode(retBz), ContractAddr: contractAddr.Hex(), + Logs: logs, }, nil } @@ -125,7 +126,7 @@ func (ms *msgServerImpl) Create2(ctx context.Context, msg *types.MsgCreate2) (*t } // deploy a contract - retBz, contractAddr, _, err := ms.EVMCreate2(ctx, caller, codeBz, value, msg.Salt) + retBz, contractAddr, logs, err := ms.EVMCreate2(ctx, caller, codeBz, value, msg.Salt) if err != nil { return nil, types.ErrEVMCallFailed.Wrap(err.Error()) } @@ -133,6 +134,7 @@ func (ms *msgServerImpl) Create2(ctx context.Context, msg *types.MsgCreate2) (*t return &types.MsgCreate2Response{ Result: hexutil.Encode(retBz), ContractAddr: contractAddr.Hex(), + Logs: logs, }, nil } diff --git a/x/evm/types/tx.pb.go b/x/evm/types/tx.pb.go index 6344352..83f02c6 100644 --- a/x/evm/types/tx.pb.go +++ b/x/evm/types/tx.pb.go @@ -94,6 +94,8 @@ type MsgCreateResponse struct { Result string `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` // hex encoded address ContractAddr string `protobuf:"bytes,2,opt,name=contract_addr,json=contractAddr,proto3" json:"contract_addr,omitempty"` + // logs are the contract logs generated by the contract execution. + Logs []Log `protobuf:"bytes,3,rep,name=logs,proto3" json:"logs"` } func (m *MsgCreateResponse) Reset() { *m = MsgCreateResponse{} } @@ -143,6 +145,13 @@ func (m *MsgCreateResponse) GetContractAddr() string { return "" } +func (m *MsgCreateResponse) GetLogs() []Log { + if m != nil { + return m.Logs + } + return nil +} + // MsgCreate2 is a message to create a contract with the CREATE2 opcode. type MsgCreate2 struct { // Sender is the that actor that signed the messages @@ -214,6 +223,8 @@ type MsgCreate2Response struct { Result string `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` // hex encoded address ContractAddr string `protobuf:"bytes,2,opt,name=contract_addr,json=contractAddr,proto3" json:"contract_addr,omitempty"` + // logs are the contract logs generated by the contract execution. + Logs []Log `protobuf:"bytes,3,rep,name=logs,proto3" json:"logs"` } func (m *MsgCreate2Response) Reset() { *m = MsgCreate2Response{} } @@ -263,6 +274,13 @@ func (m *MsgCreate2Response) GetContractAddr() string { return "" } +func (m *MsgCreate2Response) GetLogs() []Log { + if m != nil { + return m.Logs + } + return nil +} + // MsgCall is a message to call an Ethereum contract. type MsgCall struct { // Sender is the that actor that signed the messages @@ -333,7 +351,8 @@ func (m *MsgCall) GetInput() string { // MsgCallResponse defines the Msg/Call response type. type MsgCallResponse struct { Result string `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` - Logs []Log `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs"` + // logs are the contract logs generated by the contract execution. + Logs []Log `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs"` } func (m *MsgCallResponse) Reset() { *m = MsgCallResponse{} } @@ -493,47 +512,48 @@ func init() { func init() { proto.RegisterFile("minievm/evm/v1/tx.proto", fileDescriptor_d925564029372f6a) } var fileDescriptor_d925564029372f6a = []byte{ - // 639 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0xcf, 0x6b, 0xd4, 0x40, - 0x14, 0xc7, 0x37, 0x6d, 0xba, 0x65, 0x5f, 0x7f, 0x48, 0xc7, 0xda, 0xdd, 0x46, 0x4c, 0x6b, 0x3c, - 0x58, 0x16, 0x9a, 0xb4, 0x11, 0x04, 0x7b, 0xd2, 0x2a, 0x85, 0x82, 0x85, 0x1a, 0x11, 0x44, 0x90, - 0x32, 0xdd, 0x0c, 0x69, 0x30, 0xc9, 0x84, 0xcc, 0xec, 0xd2, 0xde, 0xc4, 0xa3, 0x27, 0x0f, 0xfe, - 0x11, 0x1e, 0x7b, 0xe8, 0x41, 0xf0, 0x1f, 0xe8, 0x49, 0x4a, 0x4f, 0xa2, 0x50, 0xa4, 0x3d, 0xf4, - 0xdf, 0x90, 0x4c, 0x26, 0xd9, 0x6e, 0xe8, 0xb2, 0xa2, 0x7b, 0xc8, 0x32, 0x6f, 0xde, 0x77, 0xbe, - 0xef, 0xcd, 0x67, 0x93, 0x07, 0xf5, 0xd0, 0x8f, 0x7c, 0xd2, 0x09, 0xad, 0xf4, 0xe9, 0xac, 0x5a, - 0x7c, 0xdf, 0x8c, 0x13, 0xca, 0x29, 0x9a, 0x96, 0x09, 0x33, 0x7d, 0x3a, 0xab, 0xda, 0x0c, 0x0e, - 0xfd, 0x88, 0x5a, 0xe2, 0x37, 0x93, 0x68, 0xf5, 0x16, 0x65, 0x21, 0x65, 0x56, 0xc8, 0xbc, 0xf4, - 0x68, 0xc8, 0x3c, 0x99, 0x98, 0xcf, 0x12, 0x3b, 0x22, 0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, 0x09, 0xe3, 0xf9, 0xe7, 0xa5, 0xf5, 0x55, 0xdb, - 0x9a, 0xd1, 0x3f, 0x57, 0x58, 0x3d, 0x06, 0x55, 0xbc, 0x85, 0xf5, 0xeb, 0xb4, 0x38, 0x08, 0xb4, - 0x85, 0x3e, 0x89, 0xc2, 0xe1, 0x35, 0x4c, 0xf6, 0xfc, 0x15, 0xd7, 0x1d, 0xb8, 0x2a, 0xd0, 0xee, - 0x0f, 0x10, 0xe4, 0xce, 0xda, 0xd8, 0xfb, 0x14, 0xf8, 0xfa, 0xb3, 0xe3, 0x73, 0x5d, 0x39, 0x39, - 0xd7, 0x95, 0xdf, 0xe7, 0xba, 0xf2, 0xe9, 0x42, 0xaf, 0x9c, 0x5c, 0xe8, 0x95, 0x1f, 0x17, 0x7a, - 0xe5, 0x4d, 0xd3, 0xf3, 0xf9, 0x5e, 0x7b, 0xd7, 0x6c, 0xd1, 0xd0, 0xf2, 0x23, 0x9f, 0xfb, 0x78, - 0x39, 0xc0, 0xbb, 0xcc, 0xca, 0x47, 0xf5, 0xbe, 0x18, 0xd6, 0x62, 0x52, 0xef, 0x56, 0xc5, 0xa8, - 0x7e, 0xf0, 0x27, 0x00, 0x00, 0xff, 0xff, 0xde, 0xd9, 0x38, 0x3b, 0x4e, 0x06, 0x00, 0x00, + // 650 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x95, 0xcf, 0x6b, 0xd4, 0x40, + 0x14, 0xc7, 0x77, 0xba, 0xdb, 0x2d, 0xfb, 0xfa, 0x43, 0x3a, 0xd6, 0xee, 0x36, 0x62, 0x5a, 0xe3, + 0xc1, 0xb2, 0xd0, 0xa4, 0x8d, 0x20, 0xd8, 0x93, 0x56, 0x29, 0x14, 0x2c, 0x48, 0x44, 0x10, 0x41, + 0xca, 0x74, 0x33, 0xa4, 0xc1, 0x24, 0xb3, 0x64, 0x66, 0x97, 0xf6,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0xea, + 0x6c, 0x9a, 0x2d, 0x16, 0x5a, 0x7e, 0xe4, 0x0b, 0x9f, 0x2c, 0x04, 0x64, 0x93, 0x5b, 0xd9, 0xa5, + 0xb0, 0x2d, 0xaf, 0x05, 0x79, 0x27, 0x6c, 0x56, 0xe5, 0xa5, 0x70, 0xe7, 0x57, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x00, 0xbc, 0xa3, 0x7e, 0xb8, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -801,6 +821,20 @@ func (m *MsgCreateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Logs) > 0 { + for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } if len(m.ContractAddr) > 0 { i -= len(m.ContractAddr) copy(dAtA[i:], m.ContractAddr) @@ -890,6 +924,20 @@ func (m *MsgCreate2Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Logs) > 0 { + for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } if len(m.ContractAddr) > 0 { i -= len(m.ContractAddr) copy(dAtA[i:], m.ContractAddr) @@ -1112,6 +1160,12 @@ func (m *MsgCreateResponse) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + if len(m.Logs) > 0 { + for _, e := range m.Logs { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } return n } @@ -1151,6 +1205,12 @@ func (m *MsgCreate2Response) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + if len(m.Logs) > 0 { + for _, e := range m.Logs { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } return n } @@ -1467,6 +1527,40 @@ func (m *MsgCreateResponse) Unmarshal(dAtA []byte) error { } m.ContractAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logs = append(m.Logs, Log{}) + if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -1748,6 +1842,40 @@ func (m *MsgCreate2Response) Unmarshal(dAtA []byte) error { } m.ContractAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logs = append(m.Logs, Log{}) + if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])