[v0.50] Convert historic metadata to subxt::Metadata #2120
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The goal of this is to convert historic metadata formats to
subxt_metadata::Metadata. This will make it much easier to extend Subxt to work at historic blocks, as we no longer have to abstract over modern vs "old" metadatas or deal with legacy types. Things like codegen at historic blocks for instance will hopefully "Just Work" (though we will see if that holds up in practise!).The main thing involved here is taking a
scale_info_legacy::TypeRegistrySetwhich contains definitions for historic types, and converting these definitions across to entries in the modernscale_info::PortableRegistryas needed, updating the corresponding type IDs across metadata as we convert it over.The original plan was to convert things to
frame_metadata::v15::Metadata, but there was a blocker: v15 metadata has a single "index" per pallet, but older metadatas have a different index for errors, calls and events in each pallet, which cannot be represented in v15 metadata. Thus, the easier initial route is to make the necessary changes to our internalsubxt::Metadatato support this and any other differences.The hope is that we can iterate on this and tweak/refine the
Metadatastruct as needed, and then apply our learnings from that and create an external format which can be shared more widely and act as a target which any metadata version (+ types where needed) can be converted into. PAPI and Subxt could both rely on this new target if they liked.