-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parameterize CompactForm String for optional SCALE impl #35
Conversation
By default, parity-scale-codec does not provide Encode/Decode impls for an owned String. This is only provided under the "full" feature which is not used by the substrate runtime, because it should not be used for consensus critical code. So in order for the CompactForm to be integrated into the substrate runtime, or wherever the "full" feature cannot be used, then we must parameterize the `String` type so that it can be both an `&'static str` on the runtime side where it is encoded, and a `String` in client/consuming code where it is decoded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't say I fully understand the code surrounding your change here; the docs are a bit "academic" and I have a hard time following them at times.
The changes in this PR are straight forward and seems like a no-brainer per se.
I'd like @Robbepop to approve this too before merging, because he disagreed with my previous approach #19 (comment) |
Merged since other work already based on this |
By default, parity-scale-codec does not provide Encode/Decode impls for an owned String.
This is only provided under the "full" feature which is not used by the substrate runtime,
because it should not be used for consensus critical code. So in order for the CompactForm
to be integrated into the substrate runtime, or wherever the "full" feature cannot be used,
then we must parameterize the
String
type so that it can be both an&'static str
on theruntime side where it is encoded, and a
String
in client/consuming code where it is decoded.Note that previously I had done something similar with
OwnedForm
discussed with @Robbepop here. But this or something similar is now required in case we want to generate the metadata directly inside the substrate runtime whereString
s are not allowed.