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

Allow importing and resolving of chain specific types #2

Closed
jsdw opened this issue May 3, 2024 · 1 comment
Closed

Allow importing and resolving of chain specific types #2

jsdw opened this issue May 3, 2024 · 1 comment

Comments

@jsdw
Copy link
Collaborator

jsdw commented May 3, 2024

After #1 merges, we'll have the foundations in place, which is to say, we'll have a TypeRegistry that we can insert named types into and resolve them, possible in the scope of a specific pallet.

The next step, I think, should be to allow ingestion of some JSON file containing all of the necessary chain specific type information. So soemthing like:

  • Define a struct eg TypeDescriptions which accepts all of the relevant type information for a specific chain, eg:
    • A list of types which are globally relevant (Name -> Shape).
    • A list of types scoped to specific pallets (pallet, Name -> Shape).
    • Any of the above which are relevant only between certain spec versions.
    • (There is a typesSpec thing too in PJS but need to ask Tarik about this and work out if it's needed)
  • Have this format be deserializable from JSON. See about keeping the format similar to PJS if possible.
  • Allow default "substrate" types to exist and then be extended by such a JSON document. This means either:
    • Allow the TypeDescriptions type to be built/extended from more than one such JSON document
    • Allow the resulting type registry (below, TypeRegistrySet) to be built from multiple such documents.
  • Define something like a TypeRegistrySet which can be created by taking TypeDescriptions+ a spec version. This is internally a list of TypeRegistrys wherein we will try one at a time to locate some type. TypeRegistrySet will impl TypeResolver.
  • Start cobbling together a JSON doc with basic Substrate/Polkadot types, and write an example which takes some bytes of such types and decodes them (being able to somewhat manually decode a historic block would be ideal).
@jsdw
Copy link
Collaborator Author

jsdw commented May 21, 2024

Closed by #3

@jsdw jsdw closed this as completed May 21, 2024
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

1 participant