-
Notifications
You must be signed in to change notification settings - Fork 350
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
[Question]: TypeRegistry metadata #4293
Comments
Running into this same error. Any suggestions for a fix? |
I also got in this same issue but with a different magic number mismatch |
The metadata from registry is not the full metadata, it is a converted/as-lastest metadata. This is the difference -
So the failure above is expected - it cannot find the magic in the metadata that the registry exposes since it has been transformed. If you want to keep track of the original on-chain metadata, you need to do so yourself. The Registry only uses the transformed metadata (aka it works on a consistent interface with a single known latest version) See https://github.com/polkadot-js/api/blob/master/packages/types/src/types/registry.ts#L108 vs https://github.com/polkadot-js/api/blob/master/packages/types/src/types/registry.ts#L147 The set is Metadata construction would expect either a hex-representation of EDIT: EDIT2: The alternative (looking at your usage) is for registry TL;DR All expected, these are different types of the input to the registry via the output from the registry (Here is an old comment around the internal conversion - #4058 (comment)) |
@jacogr Thanks for the amazing explanation :) From a use case perspective, I don't see my above example being a proper implementation either, but it did make me think about the expendability of the metadata within the registry which I ended up learning a ton about residually.
This makes sense, while also looking back at the previous discussion we had via the comment you linked it's all coming full circle. In a case like this as well, there are so many options on how to handle the
That being said, I have been meaning and wanting to add meaningful contributions to polkadot-js for a while now, so whether it's something related to this (if I can find a good justifiable reason for our use case), or something else ill start jumping on it in my free time! Seriously thanks for taking your time for the great explanation, I left this with a much better understanding. Closing the issue as it's been resolved. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query. |
We have a library that constructs tx's "offline" (I put it in quotes because is it really ever offline? 🤷♂️ Not really)
I recently made an update where we construct the metadata, set it into the Registry, and set the the metadata used in the unsignedTx as
registry.metadata.toHex()
. A user found an edgecase where it fails to decode when using the metadata inside the unsigned tx in order to create a new registry.I wrote a reproducible example in pure polkadot-js to get some feedback on the behavior.
My main question is, is it expected behavior that after using
setMetadata
on the registry to not be able to use that metadata again to create a new TypeRegistry.Reproducible example
Error Message
Enviornment
Can confirm the above using both 6.10.3, 6.11.1 for
@polkadot/api
The text was updated successfully, but these errors were encountered: