-
Notifications
You must be signed in to change notification settings - Fork 29
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
Armored Slates #53
Armored Slates #53
Conversation
Looks good! Couple of questions
|
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.
Great job @j01tz ! Very readable and detailed RFC.
I did a quick typo check. Other than that I have few questions (maybe already answered on Keybase during the previous discussions).
- Any reason why we want to break the slate pack into chunk? I don't see anyone checking manually the characters for a typo.
- Why the need for the dot notation (or at least the third dot)?
- Finally, and that's just an idea, why not use bech32 encoding for the slate? We would have the error detection properties? The example slate would be:
grin1qqzqqqmc6zlet7v4fuug399m4tfhwflhqyrqqqqqqp8mzqzqqqqqqqqqdt8uqqgqqdxp6tf8j72q5xvckmadcxkk5k4yak6rug5qathu5wvw8ejxjznhvqmldvulrxdcachv95q3yfguffx9y3nlqfwwah8h9mr7d3tqkktn0qqq74c4hu
which is a bit larger than the example (183 vs 152 characters).
Thanks @yeastplume
This was discussed to an extent to be included at the armor layer j01tz/slatepack#2 but after feedback seems to be a better fit for the slate object or the serialization layer. It wasn't planned for inclusion as I was trying to keep things as simple as possible and add features only as necessary. The serialization layer does seem to be the most natural fit (though adds some complexity at serialization that could otherwise be fairly simple). To accomplish this at serialization layer we may need something like a
Similar to above, if we complicate serialization a bit by breaking the data up into multiple packets ( If the above features make sense to add, we may need to add a fair amount of complexity to serialization (which I'm not entirely opposed to- it would essentially be the original SlatePack proposal using our custom binary serialization instead of MessagePack serialization). Thanks @quentinlesceller
This is done for human aesthetics when viewing on screens. It (subjectively) looks better when using big blocks of text across large and small screen sizes. If slates are compact enough though the word spacing might not be as helpful here. Is your intuition that armored slates might look and handle better without spacing?
This is mostly for convenience to accurately capture the framing and payload for sanitizing. The third dot helps with trailing characters that sometimes attach when copying long strings in various applications that could be confused as part of the footer. They are not strictly necessary though, just a convenience. Do you think the format would be cleaner and as easy to handle without the dots?
One of the reasons Bech32 would also provide much better error checking (base58check doesn't actually have any error detection guarantees, I should probably clarify this in the RFC). Unfortunately we don't gain the same QR efficiency benefits because QR slates would be encoded directly from the serialized slate and not the armored slate (as currently envisioned). However this means that the efficiency losses from I want to spend some time thinking about bech32, it seems to have potential here and after looking at the rust implementation is less complex than I remember. My initial thought is that the added complexity and length do not give us the same benefits as bitcoin receives by adopting this, but I really like the possibility of condensing slates into "bech32 strings" instead of the clunkier feeling "ascii armor strings". A concern is that the "framing" in this case is not robust enough to handle multi part messages (though we may ultimately not want to support multi part slate messages at all). |
Comparison between encoding the same slate with
or
Note that formally We should probably do some more formal reasoning here about error correction anyway because in |
@j01tz Thanks, apologies that I've been so deep into the slate compacting that I might have missed a few conversations, but since that's hopefully coming to a close I hope to spend a bit more time focusing on this. After some thought, I agree that armoring should concentrate on armoring and nothing more. I also think the slate object should remain focused on the details needed at each stage of a transaction, and we should resist bloating there. So I think that leaves us wanting an optional layer between the slate and the armoring. At the moment, I'm thinking about a slatepack like the following, similar to the original serialized slates RFC. Like slates, the JSON is still the first-order version, but serialized to binary for armoring/QR very similarly to how the slate itself is serialized.
Haven't put hours of thought into this just yet or what the exact fields should be, but do you think this kind of approach makes sense? |
The overall approach of avoiding complexity in the slate object and armor by building this from a new first-order JSON seems to align with the general direction of the previous work. In that lens it feels better than building custom binary packets as in the original slate-serialization RFC draft 👍
Why not require slatepacking as you described for all offline/async methods? It may reduce overall complexity (is this is slate or a slatepack?) and wouldn't add much size if most of the fields are optional (maybe a word or two for armor?). Some thoughts on overall scope: if we are adding a new layer here between the slate objects and the armoring, it sounds like it will probably need its own RFC? As I'm looking at what we have and what we are trying to cover, I'm wondering between A bit of a reach, but just thinking out loud: if we go the route of requiring that all offline/async slates that leave the wallet in any form (string/QR/file) to be first serialized as binary, slatepacked and armored (or at least serialized as binary and slatepacked), we could end up with a simpler overall standard for offline/async slate handling. These "raw slatepack/armored slatepack" slates could then be exchanged as a string, a file or encoded directly to QR: all possible methods of representing offline/async slate data would decode back into the same format: binary serialized, slatepacked and potentially ascii armored. Though it might just be simpler to add a |
Just wanted to share this thought as an extension to my comment above: Instead of expecting wallets and services to support many possible transaction types:
To improve the way users and developers can think about transactions we might be able to simplify transaction options into two basic options:
Choice of armor, serialization, metadata inclusion could all be reduced to a single default A
The main differences to how things are currently done:
The main negative I can see is the extra data required to build the Note that these thoughts are mostly from a UX/external DX lens, I'm not sure if this would actually make the codebase as written today any simpler or not. Curious for any thoughts from those that have spent more time in this area, if this would make things easier for users and wallet developers to grok and adopt. |
Another point to mention: if QR codes are expected to be serialized from and deserialzied to a Both encodings to QR would be done with the QR byte encoding mode and more bytes would be required to represent the ascii armored data bytes than the raw pre-armor bytes. As a result we may lose ability to encode small slates to static QR codes. A possible solution is to use a This would allow the ascii armored string representing the This is because If the above "default" |
Yes, I think I can get behind all of this.
Worth experimenting with the
Implementing this shouldn't affect any current send/recieve functionality, since the slatepacking would be handled at the extremities. The core libs would continue to work exclusively on VersionedSlates as they currently do. We'd likely provide some OwnerAPI functions to create and read slatepack and any encryption, then just call them at the points where we're currently reading/writing slate files (actually all nicely factored into a single location in the code at the moment). |
Closing in favor of #55 |
Rendered link to RFC document