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

Expose Tendermint EventBus interface. #2770

Closed
4 tasks
hleb-albau opened this issue Nov 12, 2018 · 13 comments
Closed
4 tasks

Expose Tendermint EventBus interface. #2770

hleb-albau opened this issue Nov 12, 2018 · 13 comments

Comments

@hleb-albau
Copy link
Contributor

hleb-albau commented Nov 12, 2018

Summary

Expose Tendermint EventBus.

Problem Definition

Some apps can produce own set of events, instead of raw txes indexed by tags. Also, one tx can produce N events. So introducing this feature will open new possibilities to developers to create more fancy rpc endpoints.
Dis: Only will be supported by started in process nodes.

PC: Seems, tendermint can be responsible this. Than TxResult will contain addition field events. May be we should discuss it in tendermint repo first.


For Admin Use

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

@hleb-albau agreed in that this should be discussed in Tendermint first. Can we move the issue there please?

@hleb-albau
Copy link
Contributor Author

@alexanderbez Sure.

@hleb-albau
Copy link
Contributor Author

hleb-albau commented Nov 14, 2018

@alexanderbez @cwgoes Start to think, that cosmos should be responsible for this. Raw tendermint should know only about Raw txes. But events is some kind of application stuff (like internal transactions and etc). Also, it is not complicated to implement events in cosmos-sdk. Just store events from msg processing results indexed by tag in same ways as tendermint does and publishing them on default tendermint event bus.

I can create a prototype.

@alexanderbez
Copy link
Contributor

Ahhh yes, fair point. I'm just saying we have to keep both components in mind.

@alexanderbez
Copy link
Contributor

Also, this might have some overlap with #2448. Care to comment there?

@hleb-albau
Copy link
Contributor Author

@alexanderbez @cwgoes I am ready to try to implement events indexed on cosmos-sdk side, just need your approval.

@alexanderbez
Copy link
Contributor

@hleb-albau do you have a PR open?

@hleb-albau hleb-albau changed the title Expose Tendermint EventBus.PublishWithTabs() interface. Expose Tendermint EventBus interface. Nov 16, 2018
@hleb-albau
Copy link
Contributor Author

hleb-albau commented Nov 16, 2018

@melekes @ebuchman Currently tmtypes.EventBus does not expose PublishWithTags method. Is it possible(right) to open this method? If so, I will provide PR.

func (b *EventBus) PublishWithTags(eventData TMEventData, tags TagMap) error {
	// no explicit deadline for publishing events
	ctx := context.Background()
	b.pubsub.PublishWithTags(ctx, eventData, tags)
	return nil
}

Edit: It will provide subscription extension point for all apps using Tendermint as lib.

@melekes
Copy link
Contributor

melekes commented Nov 19, 2018

Note: early versions of Tendermint had this feature (ability to send & subscribe to application events via RPC). We removed it because nobody was using it. Maybe it's time to reconsider.

@hleb-albau can you share your use-case with us?

@hleb-albau
Copy link
Contributor Author

@melekes For example, cosmos-sdk itself can use such functionality for #2805. Sdk can create own kv index for query routines + publish notifications on default tdm bus (or may be create own bus and subscribe endpoint subscribeEvents).

@cwgoes
Copy link
Contributor

cwgoes commented Nov 19, 2018

Is there a way to do this which fits your use case and is uniform (e.g. anyone interested in subscribing to events doesn't need to fork the codebase and add their own events to each module)? How about optionally publishing events on the event bus for all tags in a transaction, when we run a transaction?

@melekes
Copy link
Contributor

melekes commented Nov 27, 2018

@hleb-albau Why did you close?

@hleb-albau
Copy link
Contributor Author

hleb-albau commented Nov 27, 2018

@cwgoes @melekes I agree with @ebuchman, that We should be wary for now of special privileges for Go apps. So, now I think it is bad idea, to use tendermint event bus for cosmos events for 2 reasons:

  1. Such events should be indexed too .
  2. It will work only for in-process tendermint.

Generally, either tdm should provide spec for events(list of list tags), either cosmos should implements it's own event bus similarly to tdm one. For me, cosmos own bus sees more clear way. It provide more flexibility and do not touch raw-tx tendermint protocol.

chillyvee pushed a commit to chillyvee/cosmos-sdk that referenced this issue Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants