Skip to content
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

Implement SCALE encoding and serde deserialization #19

Merged
merged 18 commits into from
Aug 18, 2020

Conversation

ascjones
Copy link
Contributor

@ascjones ascjones commented Aug 7, 2020

Closes #4 (rel type-metadata/type-metadata#38).

Introduces OwnedForm and RegistryReadOnly to allow SCALE decoding and JSON deserialization.

  • Consider adding features for scale and serde, maybe decoding specific for no_std

@ascjones ascjones marked this pull request as ready for review August 10, 2020 10:13
@ascjones ascjones requested a review from Robbepop August 10, 2020 10:18
Cargo.toml Show resolved Hide resolved
Comment on lines +45 to +46
/// The string type.
type String: Serialize + PartialEq + Eq + PartialOrd + Ord + Clone + core::fmt::Debug;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I like the overall idea I think it is better in this case to opt-into KISS (keep it simple stupid) and instead convert all &'static str simply into String. The &'static str was used in the beginning when we did not need deserialization in ink!. Now that we want to support Substrate we need it. However, if we do not generate metadata in any performance critical code section we don't need to opt-in for maximum performance and can instead opt-into simple code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the OwnedForm now, but kept MetaForm as & 'static str, and changed CompactForm to String. Let me know what you think.

src/form.rs Outdated Show resolved Hide resolved
src/registry.rs Outdated Show resolved Hide resolved
src/ty/mod.rs Outdated Show resolved Hide resolved
test_suite/derive_tests_no_std/src/main.rs Show resolved Hide resolved
Copy link
Contributor

@Robbepop Robbepop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes LGTM now

@ascjones ascjones merged commit 118c3b8 into master Aug 18, 2020
@ascjones ascjones deleted the aj-scale-encoding branch August 18, 2020 16:21
@ascjones ascjones mentioned this pull request Oct 5, 2020
ascjones added a commit that referenced this pull request Dec 7, 2020
Potentially in future reintroduce OwnedForm #19 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Registry Deserialization
2 participants