The metadata version is specified as an enum variant in the frame_metadata
crate, which all runtime pallets use. When a runtime gets compiled to Wasm, the most reliable way to know its metadata information is by inspecting it.
So the on-chain source of truth for which metadata version a chain is running can be found by looking at a chain's Wasm binary. You can verify this using subwasm
(go here to follow instructions on installing it). For example:
- Get Polkadot's Wasm binary (replace
polkadot
with local
if you're running a chain you want to check locally).
subwasm get --chain polkadot -o polkadot.wasm
- Save the metadata in a JSON file.
subwasm --json meta polkadot.wasm > polkadot-metadata.json
- Look at the second line of
polkadot-metadata.json
you've created and you'll see the version:
{
"V14": {
//--snip--
Yes, one day this may change to V15 to add more features to the metadata system, but this is a much bigger undertaking than any other kind of version bump, such as a runtime version bump which is chain-specific. Adding to Jaco's point, the versioning is more like a universal format in this way.