-
-
Notifications
You must be signed in to change notification settings - Fork 7
change Variant serde (de|)serialization #48
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
change Variant serde (de|)serialization #48
Conversation
dr-orlovsky
left a comment
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.
Approach NACK
-
This PR ignores the fact that serde is not only for string serialization, but also for binary. Binary serialization must not happen through
Display/FromStrand in this way the PR puts in regression to the existing functionality. -
The issue of
key must be a stringshould be solved by modifyingVariantserde implementation to beserde(transparent)(if needed, also for upstream types) -
Even after 2 this will be a breaking change requiring to move to v3 and release all dependent crates in order to be used in RGB. I doubt this worth the effort; just implement custom consignment serde serialization doing type system as a Base85-ASCII encoding, as was before.
563d005 to
189a345
Compare
You are right, I thought we didn't care about serde binary serialization since for that we already have strict encoding, but I agree it's still better to keep that door open (note: it would have worked but it would just have been less efficient). |
dr-orlovsky
left a comment
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.
You just need to fix serde for VariantName, and leave Variant intact
|
Specifically, you need to go to |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #48 +/- ##
==========================================
- Coverage 51.57% 50.09% -1.49%
==========================================
Files 18 18
Lines 2220 2134 -86
==========================================
- Hits 1145 1069 -76
+ Misses 1075 1065 -10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
dr-orlovsky
left a comment
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.
Ok, I see now, sorry. I was under impression that it is VariantName which is used as a key.
Anyway, pls see my comments. We also need to add roundtrip serde string and binary test in order to make sure that the change actually works,
189a345 to
9db2177
Compare
Comments addressed and test added. |
dr-orlovsky
left a comment
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.
Thank you! Two more things and seems we are done
9db2177 to
33f08f5
Compare
Great, thank you. This should be ready, the only thing that's missing is a branch for P.S. I've also bumped the MSRV since |
dr-orlovsky
left a comment
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.
Thank you!
I wish I could merge, but the reality that MSRV bump is a breaking change and the problem need to be handled differently (pls see my comment)
I have also created v2.7 branch so you can do a PR there (additionally to this one; please keep this PR against master and just do another one with a backport)
33f08f5 to
ac23647
Compare
dr-orlovsky
left a comment
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.
ACK ac23647
|
Thank you. The version was reverted, but not pinned in Cargo.toml; but (a) this is fine and (b) we can do it in some other PR if you'd like. Merging, since it already takes forever :) |
Fixed and rebased on top of master
You created it in strict-types but this PR is on strict-encoding, could you please create the branch here as well? Thanks |
Not sure what you mean, I have fixed the unwanted MSRV bump by adding |
Done
Sorry, my eyes are betraying me |
This PR fixes
ConsignmentJSON serialization (in detail itstypes: TypeSystemfield).Without this fix the serialization fails with a "key must be a string" error due to
UnionVariantshaving aNonEmptyOrdMapwith theVariantstruct as key.There are other possible solutions, like changing the
Union(UnionVariants<Ref>)variant or theUnionVariantsstruct, but we would like @dr-orlovsky opinion on which solution is more appropriate.P.S. I would like to open this on top of v2.7.2 since in RGB 0.11.1 we are still using that version, but there is no branch there (so for now I'm opening this on master)