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

fix bincode deserialization #110

Merged
merged 1 commit into from
Apr 20, 2022
Merged

fix bincode deserialization #110

merged 1 commit into from
Apr 20, 2022

Conversation

steverusso
Copy link
Contributor

Currently, the current bincode de/serialization has a bug:

  • When serializing, a byte array is used from the PublicKey::serialize method.
  • Then when deserializing, the attempt is made by default to deserialize directly into a PublicKey instead of calling the corresponding PublicKey::parse_slice function.

Additionally, bincode serialization isn't covered in the tests.

Therefore, this PR does the following:

* implement and use a new PublicKeyBytesVisitor for deserializing bytes to a PublicKey
* add a test to cover bincode serialization / deserialization
* return the base64 decoding error instead of unwrapping
@sorpaas sorpaas merged commit a95288e into paritytech:master Apr 20, 2022
@Parth
Copy link

Parth commented Apr 20, 2022

Hey @sorpaas,

when will we see this deployed to crates?

trevor-crypto pushed a commit to monacohq/libsecp256k1 that referenced this pull request May 31, 2022
* implement and use a new PublicKeyBytesVisitor for deserializing bytes to a PublicKey
* add a test to cover bincode serialization / deserialization
* return the base64 decoding error instead of unwrapping
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.

needless panic during deserialization? Bincode Serialization Broken For PublicKey
3 participants