substrate icon indicating copy to clipboard operation
substrate copied to clipboard

Metadata V15: Expose API to fetch metadata for version

Open lexnv opened this issue 2 years ago • 8 comments

This PR extends the Metadata API to fetch the metadata at a given provided version.

It lays the foundation for keeping the metadata V14 around and exposing the V15 for early adopters before making a major breaking change.

The runtime API comes with 2 new functions:

  • metadata_at_version - Fetch the metadata at a given version
  • metadata_versions - List the supported versions by metadata_at_version

At the current moment, substrate only supports V14. Soon, the V15 will be exposed as unstable under the u32::max value.

Users could then fetch the v15 metadata, allowing for an appropriate time to migrate their use cases.

Part of: https://github.com/paritytech/substrate/issues/12939.

polkadot companion: https://github.com/paritytech/polkadot/pull/6655 cumulus companion: https://github.com/paritytech/cumulus/pull/2155

CC: @paritytech/tools-team

lexnv avatar Jan 31 '23 17:01 lexnv

bot rebase

lexnv avatar Feb 02 '23 17:02 lexnv

Rebased

bot rebase

lexnv avatar Feb 07 '23 14:02 lexnv

Rebased

bot rebase

lexnv avatar Feb 14 '23 12:02 lexnv

Rebased

bot rebase

lexnv avatar Feb 17 '23 16:02 lexnv

Rebased

bot rebase

lexnv avatar Mar 13 '23 15:03 lexnv

Rebased

Error: "Check reviews" status is not passing for https://github.com/paritytech/polkadot/pull/6655

When we then have v15 as stable metadata, we can introduce metadata-v14.

But adding a feature for old metadata would only make sense if it this substantially reduces compiles times or code size, right? Features are quite annoying.

athei avatar Mar 14 '23 01:03 athei

When we then have v15 as stable metadata, we can introduce metadata-v14.

But adding a feature for old metadata would only make sense if it this substantially reduces compiles times or code size, right? Features are quite annoying.

Yes, this is then something we can find out while introducing v15. Another possible way could be that the last two versions are always exposed by the crate. So with the release of v15 you would need to enable v13 manually.

bkchr avatar Mar 14 '23 10:03 bkchr

Thank you for your work here @lexnv!!

bkchr avatar Mar 14 '23 20:03 bkchr

bot merge

lexnv avatar Mar 15 '23 16:03 lexnv

Error: "Check reviews" status is not passing for https://github.com/paritytech/polkadot/pull/6655

bot merge

lexnv avatar Mar 15 '23 17:03 lexnv

Error: "Check reviews" status is not passing for https://github.com/paritytech/polkadot/pull/6655

Cc @jacogr

bkchr avatar Mar 15 '23 17:03 bkchr

bot merge

lexnv avatar Mar 15 '23 17:03 lexnv

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/stablising-v15-metadata/2819/1

Polkadot-Forum avatar May 10 '23 15:05 Polkadot-Forum