cosmos-sdk: Implement a query for `EndBlock` msg events

Summary

Implement a CLI query for EndBlocker emitted events. When debugging an integration issue associated with #13389 I faced the problem of having no simple way to query for events associated with msgs exec’d by x/gov.

Problem Definition

We currently have a means of querying msg events associated with transactions.

For example, we can query a tx by: hash|acc_seq|signature. We can also query for associated events like below:

simd q txs --events 'send_packet.packet_sequence=1'

However, for messages executed by modules such as x/gov or x/group we can’t seem to use the same approach.

Proposal

Add a similar CLI query for events associated with those executed by x/gov and x/group.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (15 by maintainers)

Most upvoted comments

@alexanderbez - you can assign it to me - I’ll get started

Awesome, thanks for this @alexanderbez!

I figured this was the case with tx search alright, but just noticed the case of no way to get at events via the CLI for blocks. I think simd q block --events could be a good home for it if you guys choose to implement this.

@alexanderbez - working through this right now. Could you give me some feedback on

  • Are the files in the correct dir(s) given the cosmos conventions?
  • some pointers on how to write the proto structures for the tendermint response
  • Am I pointed in the right direction?

Thanks!

I’d like to upvote this topic, am also looking for a way of accessing the EndBlocker events (gRPC).

One caveat: The data returned by tendermint’s block_search (both the RPC end point linked above and the implementation in ResultBlockSearch) does not currently include these events either. The block_results end point ( https://cosmos-rpc.quickapi.com/block_results?height=_ / ResultBlockResults ) does, <strike>except it apparently only returns the first 364 begin_block_events and no end_block_events</strike>.

If this is reliant on events we can’t make guarantees that the events will be there in the long run. If events are removed from being stored in the node then it could break our api.

There’s already a query for this -> https://cosmos-rpc.quickapi.com/block_search?query=_&page=_&per_page=_&order_by=_

We could add a proxy to this in the SDK’s gRPC query layer, but just noting this already exists. In fact, tx searching also proxies directly to Tendermint (https://cosmos-rpc.quickapi.com/tx_search?query=_&prove=_&page=_&per_page=_&order_by=_)