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
Fix LeafVersion serde #1523
Fix LeafVersion serde #1523
Conversation
The default implementation maps to visit_u64. The current implementation does not roundtrip with many deserializers, including serde_json. See failing test in the subsequent commit
This still fails on Anyways, input from people using serde is appreciated. My intention is to fix #1327. |
Heh, I'm surprised we're using |
Having said this, okay, I'm fine deserializing u64s like this but IMO it's a bug in serde(_json) that you cannot actually roundtrip u8s by using serialize_u8 and deserialize_u8. |
This looks like robustness principle on the surface but actually isn't so concept ACK.
Yeah, looks like one. |
Looks like the CI failure is an actual code breakage of some sort. |
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.
tACK a400757
Checked that the test is failing before the fix.
You meant "IMO", right? Can you expand on this? I ask because we use it in a few places and I added tests using it thinking it was useful, I'm interested to know if I was wrong? |
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 a400757
I meant "IME". This is one such case. The other I remember had to do with all of the types in rust-secp that wrap bytestrings. It is trivial to create things that serde_test will round-trip but actual de/serializers will not. I went to search the git history for the removal of these tests but I actually it looks like we just left them in...presumably to avoid a json dependency, and because (hopefully) downstream users have round-trip tests of their own. |
lol, as my kids are fond of telling me "I'm such a boomer" I had to look up the definition of IME (In My Experience) :) We have a |
I think |
@sanket1729 yes, serde_json has a bug around u64 and i64. But I have also run into trouble with its handling of byteslices (or at least, Maybe I'm just upset about some old long-fixed bug. But it made me distrust serde_test. |
The default implementation maps to visit_u64. The current implementation
does not roundtrip with many deserializers, including serde_json. See
the failing test in the second commit