0

Problem statement: While indexing it's impossible to extract information from the Extrinsic call when Extrinsic has optional parameters (default if none).

Solutions:

  • storage lookup (seems suboptimal due to the direct chain access). Subsquid is used for indexing, and it doesn't support off-chain storage lookups;
  • extending the Event (it becomes big).

I assume it is not a common practice to have an Event with 10-15+ fields. The only downside I see - it takes up some space in the block. Another upside of Event extension - it simplifies indexing code since an Extrinsic handler or storage lookup is no longer needed.

Questions: Are there any other downsides to having "thick" Events? Trade-offs: big events vs. storage lookup?

Some related links:

8
  • Why are storage lookups suboptimal? As long as they are done offchain there are no problems with storage lookups.
    – bkchr
    Sep 19, 2022 at 21:34
  • We use Subsquid, which only works with the chain while querying the storage.
    – vovacha
    Sep 20, 2022 at 13:06
  • I don't get your answer.
    – bkchr
    Sep 20, 2022 at 14:02
  • An off-chain storage lookups are not supported by Subsquid, which is our Indexer. For every storage lookup, it goes to the chain directly. That's why I think it's suboptimal. Extending event also seems to be a bad choice. I assume this discussion is more about Subsquid and its features and less about Substrate. I just wanted to elaborate on the downsides of having big Events.
    – vovacha
    Sep 21, 2022 at 9:49
  • 1
    Perhaps someone can turn this into an answer: the main downside of Events with 10-20 fields is that each event incurs some storage overhead and computational overhead during cleanup. In practice, as Events are themselves stored (temporarily) in the state of the chain, there is little meaningful difference between emitting larger events versus emitting more smaller events.
    – rob
    Sep 23, 2022 at 5:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.