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

[WIP] Slate Serialization #48

Closed
wants to merge 2 commits into from

Conversation

j01tz
Copy link
Member

@j01tz j01tz commented Apr 3, 2020

Rendered link to RFC document

This is a proposal for standardizing slate-serialization for Grin.

@j01tz
Copy link
Member Author

j01tz commented Apr 4, 2020

The proposed SlatePack serialization method adds a nontrivial amount of complexity. An alternative serialization option with some tradeoffs to reduce this complexity that may be worth considering is simply using MessagePack directly on slate objects:

  • Reduces complexity while retaining efficiency benefits
  • Does not support encrypted slates without breaking compatibility
  • Can't ensure integrity of slate data in transit
  • Some of the complexity to support extendable features could be added at the armoring layer instead of serialization layer
    • In this case we lose some efficiency in ability to encode for QR

I wanted to propose the SlatePack option to show what is possible for future extensions to support encrypted slates, more robust payment proofs and more. However we may decide that the added complexity is not worth the feature benefits and refocus toward a bare minimum serialization scheme.

@j01tz
Copy link
Member Author

j01tz commented Apr 7, 2020

Based on the keybase chat, here are some updated considerations based on my current understanding of serialization options. After more discussion I'll take another pass at the RFC to update it with current thinking.

grin/../ser.rs:

pros

  • most compact option by a few bytes
  • no new dependencies
  • already used in serialization in other areas

cons

  • non libwallet implementations must do a custom implementation of grin-serialization rather than using existing library
  • non libwallet implementations can't infer the types and so must know the spec well to implement
  • is not easily extendable at this layer

MessagePack:

pros

  • reasonably compact
  • well-defined, clear and commonly used serialization standard
  • libraries available in many languages
  • easy to implement
  • provides types

cons

  • requires additional library to use
  • does not provide versioning
  • is not easily extendable at this layer

SlatePack:

pros

  • reasonably compact
  • not much more complex than msgpack to implement
  • extendable to support future slate features: encryption, robust payment proofs
  • provides robustness to a feature that will be commonly used by humans

cons

  • the most complex option from the perspective of implementing in libwallet
  • the least compact option by a few bytes

@j01tz
Copy link
Member Author

j01tz commented Apr 22, 2020

The RFC has been significantly reworked based on feedback over the last weeks. It still needs proper examples and links but otherwise nearly ready for review. It may still need an iteration or two depending on feedback. Please let me know if you see anything that should be clarified, added or removed.

Depending on the outcome of mimblewimble/grin-wallet#385 some details will need to be added to the Binary Serialization section.

@lehnberg lehnberg added the wallet dev Related to wallet dev team label May 4, 2020
@j01tz j01tz mentioned this pull request May 8, 2020
@j01tz
Copy link
Member Author

j01tz commented May 12, 2020

Closing in favor of #55

@j01tz j01tz closed this May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wallet dev Related to wallet dev team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants