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

[rpc] we need the rpc to subscribe or filter the event for substrate chain. #1532

Open
atenjin opened this issue Sep 13, 2023 · 5 comments
Open

Comments

@atenjin
Copy link
Contributor

atenjin commented Sep 13, 2023

For now, due the event is a storage in frame-system, for 3rd parties, we can only fetch all event for a block, then parse the event in logic.

I know the event is related with the runtime metadata info, but for 3rd party, we really do no need other events, which will waste lots of network traffic for we do not need them.

In fact in the production env, the event is already nearly largest storage for every block, but the useful information for the developer is very small.

So I think polkadot-sdk for now, can design a protocol to describe how to subscribe or filter the event in node part rather then in the client part.

The rpc can be optional, and it parses the runtime metadata in node part, so user/developer just need to provide the information for the event name or other thing, node will know the info and return the event data if it appears in blocks.

@xlc
Copy link
Contributor

xlc commented Sep 13, 2023

duplicate to #278?

@atenjin
Copy link
Contributor Author

atenjin commented Sep 13, 2023

duplicate to #278?

part of it, but we just need the rpc, do not modify the structure or migration the events storage.

maybe the design in #278 need lots of work and cooperate with many 3-rd parties?

@bkchr
Copy link
Member

bkchr commented Sep 13, 2023

The rpc can be optional, and it parses the runtime metadata in node part, so user/developer just need to provide the information for the event name or other thing, node will know the info and return the event data if it appears in blocks.

The node will never start to interpret the metadata. Metadata is an opaque blob for the node. We also want to prevent to add more non-light-client friendly RPCs.

@yjhmelody
Copy link
Contributor

yjhmelody commented Sep 13, 2023

I think rpc need a way to filter event by pallet index at least. Using pallet index is not related to metadata, and it's good enough to reduce too many network IO about events.

@bkchr
Copy link
Member

bkchr commented Sep 25, 2023

You can just add a runtime api for doing this on your chain.

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