Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing error message when calling GetTxsEvent #8681

Closed
4 tasks
pacmessica opened this issue Feb 24, 2021 · 1 comment · Fixed by #8732 or #8734
Closed
4 tasks

missing error message when calling GetTxsEvent #8681

pacmessica opened this issue Feb 24, 2021 · 1 comment · Fixed by #8732 or #8734
Labels
C: gRPC Issues and PRs related to the gRPC service and HTTP gateway. T:Bug
Milestone

Comments

@pacmessica
Copy link

Summary of Bug

When calling grpc method GetTxsEvent, error logs are always empty. You only include ABCILogs in the types.TxResponse, so if log is an error string then it's never part of the response. Might need to add RawLog field?

from here

func txResultToTxResponse(respTx *abci.ResponseDeliverTx) *sdk.TxResponse {
	logs, _ := sdk.ParseABCILogs(respTx.Log)
	return &sdk.TxResponse{
		Code:      respTx.Code,
		Codespace: respTx.Codespace,
		GasUsed:   respTx.GasUsed,
		GasWanted: respTx.GasWanted,
		Info:      respTx.Info,
		Logs:      logs,
	}
}

using rpc /tx_search?query="tx.height=5201364" I can see the error log as string (whereas this error is completely missing in grpc response):

                "tx_result": {
                    "code": 5,
                    "data": null,
                    "log": "failed to execute message; message index: 0: failed to delegate; 4044574uatom is smaller than 4047074uatom: insufficient funds",
                    "info": "",
                    "gas_wanted": "250000",
                    "gas_used": "78452",
                    "events": [],
                    "codespace": "sdk"
                },

Version

v0.41.3

Steps to Reproduce

github.com/cosmos/cosmos-sdk/types/tx

Create a tx.NewServiceClient(cli) where cli is a *grpc.ClientConn to a cosmoshub-4 node. Call GetTxsEvent with service client for a height with a known error, something like:

		grpcRes, err := c.txServiceClient.GetTxsEvent(nctx, &tx.GetTxsEventRequest{
			Events:     []string{"tx.height=5201364"},
		}

I expect to see the error message in types.TxResponse

		for i, trans := range grpcRes.Txs {
			resp := grpcRes.TxResponses[i]  // missing RawLog, no sign of error string
		}

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@amaury1093
Copy link
Contributor

amaury1093 commented Feb 24, 2021

Might need to add RawLog field?

Sounds right to me. Would you like to create a PR?

Edit: The other fields on sdk.TxResponse should also be populated, e.g. #8680

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: gRPC Issues and PRs related to the gRPC service and HTTP gateway. T:Bug
Projects
None yet
4 participants