Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Implement serde derivations also in no_std #12994

Closed
2 tasks done
haerdib opened this issue Dec 21, 2022 · 4 comments · Fixed by #13027
Closed
2 tasks done

Implement serde derivations also in no_std #12994

haerdib opened this issue Dec 21, 2022 · 4 comments · Fixed by #13027
Labels
J2-unconfirmed Issue might be valid, but it’s not yet known.

Comments

@haerdib
Copy link
Contributor

haerdib commented Dec 21, 2022

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

Many core primitives of substrate only implement serde in std mode. The reason being the efficiency, so I was told. However, in a no_std environment, this forces a lot of workarounds if serde is needed. Is there any chance that you would accept a PR introducing an additional compiler feature that allows to derive serialization also in no_std mode?
(such as here: https://github.com/paritytech/parity-common/blob/master/primitive-types/Cargo.toml#L26)

Steps to reproduce

No response

@github-actions github-actions bot added the J2-unconfirmed Issue might be valid, but it’s not yet known. label Dec 21, 2022
@bkchr
Copy link
Member

bkchr commented Dec 23, 2022

Yes that would be okay.

@nazar-pc
Copy link
Contributor

Replacing feature = "std" with feature = "serde" should be sufficient, so users can decide whether to enable it or not separately from std.

@haerdib
Copy link
Contributor Author

haerdib commented Dec 29, 2022

"serde" or "serde_full", as it's called in frame-metadata ?

@bkchr
Copy link
Member

bkchr commented Dec 29, 2022

Please call it serde. For this you only need to make serde an optional dependency. An optional dependency is directly exposed as feature in cargo.

michalkucharczyk added a commit to paritytech/parity-common that referenced this issue Apr 28, 2023
Support for serde derivations in no_std.

Part of: paritytech/substrate#12994
michalkucharczyk added a commit to paritytech/parity-common that referenced this issue May 8, 2023
* serde feature added

Support for serde derivations in no_std.

Part of: paritytech/substrate#12994

* fixes

* CI tests for serde, CHANGELOG updated

* version changed to 0.1.7

* fix for ci command

* Update bounded-collections/Cargo.toml

Co-authored-by: Bastian Köcher <git@kchr.de>

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J2-unconfirmed Issue might be valid, but it’s not yet known.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants