paritytech/polkadot-sdk

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

Opened this issue · 5 comments

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 commented

duplicate to #278?

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 commented

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.

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 commented

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