As described in https://github.com/paritytech/polkadot-sdk/issues/4001RuntimeVersion was not encoded consistently using serde. Turned out it was a remnant of old times and no longer actually needed. As such I removed it completely in this PR and replaced with Cow<'static, str> for spec/impl names and String for error cases.
SCALE encoding/decoding remains the same as before, but serde encoding in runtime has changed from bytes to string (it was like this in std environment already), which most projects shouldn't have issues with. I consider the impact of serde encoding here low due to the type only being used in runtime version struct and mostly limited to runtime internals, where serde encoding/decoding of this data structure is quite unlikely (though we did hit exactly this edge-case ourselves :sweat_smile:).
Review Notes
Most of the changes are trivial and mechanical, the only non-trivial change is in substrate/primitives/version/proc-macro/src/decl_runtime_version.rs where macro call expectation in sp_version::runtime_version implementation was replaced with function call expectation.
Checklist
[x] My PR includes a detailed description as outlined in the "Description" and its two subsections above.
[ ] My PR follows the labeling requirements of this project (at minimum one label for T required)
External contributors: ask maintainers to put the right label on your PR.
[ ] I have made corresponding changes to the documentation (if applicable)
Description
As described in https://github.com/paritytech/polkadot-sdk/issues/4001
RuntimeVersion
was not encoded consistently using serde. Turned out it was a remnant of old times and no longer actually needed. As such I removed it completely in this PR and replaced withCow<'static, str>
for spec/impl names andString
for error cases.Fixes https://github.com/paritytech/polkadot-sdk/issues/4001.
Integration
For downstream projects the upgrade will primarily consist of following two changes:
SCALE encoding/decoding remains the same as before, but serde encoding in runtime has changed from bytes to string (it was like this in
std
environment already), which most projects shouldn't have issues with. I consider the impact of serde encoding here low due to the type only being used in runtime version struct and mostly limited to runtime internals, where serde encoding/decoding of this data structure is quite unlikely (though we did hit exactly this edge-case ourselves :sweat_smile:).Review Notes
Most of the changes are trivial and mechanical, the only non-trivial change is in
substrate/primitives/version/proc-macro/src/decl_runtime_version.rs
where macro call expectation insp_version::runtime_version
implementation was replaced with function call expectation.Checklist
T
required)