w3f / polkadot-spec

The Polkadot Protocol Specification
https://spec.polkadot.network
Creative Commons Attribution Share Alike 4.0 International
179 stars 70 forks source link

Runtime custom sections missing mention of `runtime_apis` #646

Open tomaka opened 1 year ago

tomaka commented 1 year ago

Section 2.6.3.4 mentions:

For newer Runtimes, the Runtime version (Section C.4.1.) can be read directly from the Wasm custom section with the name runtime_version. The content is a SCALE encoded structure as described in Section C.4.1..

However there are actually two sections, one runtime_version for the version with an empty list of APIs, and one section runtime_apis with just the list of APIs (the content of the apis field of the struct in section C.4.1.). This was done so for implementation difficulty reasons.

Additionally, due to accidents, some runtimes have one custom section but not the other. When that is the case, the custom section must be ignored, and the host should fall back to calling Core_version.