-
Notifications
You must be signed in to change notification settings - Fork 254
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
EventSubscription
decodes all events in block
#201
Comments
The example above uses a single client. However, this also occurs when using different clients, using separate accounts in different processes. Crucially, the more active a blockchain is used, the more likely these decoding errors will occur. This makes scaling up really problematic. This is, in my opinion, a critical bug.. |
I'm investigating this |
The fundamental problem is this: the raw Because of SCALE encoding we don't know up front the size of each encoded So unless the events related to your extrinsic are first in the list in the storage changeset, and if any of the preceding events contain any types whose size in unknown then we are unable to skip over them to arrive at the events you are interested in. We are extremely aware of this limitation and in fact the focus of my work currently is the integration of However this is some months away from being ready for production, although we are working flat out to have it ready as soon as possible. In the meantime, the simple but extremely imperfect workaround is simply to register all the unknown type sizes from your runtime on intialization of the events decoder.. I haven't done this in a while but it is worth looking at the mappings in https://github.com/polkadot-js/api. I can investigate whether there is an easy way to precompute any missing types from this. |
Thanks for looking into this. Embedding metadata (specifically, the length of the event) seems indeed to be the best way forward. As an aside, using some kind of framing (e.g. COBS) would also work to be able to skip over events that fail to decode. Anyway, I'm afraid your workaround is not sufficient - we do this already for explicit event listeners, but the problem is that subxt calls (the |
Yes that is a problem, I will look at ways of improving the API to allow registering of global type sizes on Monday. |
@gregdhill @sander2 please have a look at #227, and let me know whether that is an acceptable solution for now. |
Looks good @ascjones, when do you think this will be ready? |
It just needs to be reviewed and merged now, so should be this week hopefully. |
@gregdhill It would be good if someone from Interlay could take a look at the proposed code and try it out with your code to make sure it addresses the issues you have reported. Is that possible? |
Polling
next()
on theEventSubscription
first decodes all events in theStorageChangeSet
before filtering by the extrinsic index which means that if it encounters a type it does not know how to decode the method willErr(TypeSizeUnavailable)
.The following example will panic:
The text was updated successfully, but these errors were encountered: