Function sp_io::misc::runtime_version

source ·
pub fn runtime_version(wasm: &[u8]) -> Option<Vec<u8>>
Expand description

Extract the runtime version of the given wasm blob by calling Core_version.

Returns None if calling the function failed for any reason or Some(Vec<u8>) where the Vec<u8> holds the SCALE encoded runtime version.

Performance

This function may be very expensive to call depending on the wasm binary. It may be relatively cheap if the wasm binary contains version information. In that case, uncompression of the wasm blob is the dominating factor.

If the wasm binary does not have the version information attached, then a legacy mechanism may be involved. This means that a runtime call will be performed to query the version.

Calling into the runtime may be incredible expensive and should be approached with care.