You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
contains rmd160, pub, pubsecp, sig fields which are bytes sequence encoded in hex - it makes the message almost 2x larger not providing any real benefit.
So switching to some binary format might help us to decrease the message sizes significantly which will be the most important for mobile users.
The requirements are:
we will have full control of serialization lib, easy to extend by ourselves.
cons
Extension will require some effort from us
The data structures won't be cross-compatible with other languages, we will need to reinvent the wheel every time (e.g. for browser-only client or if someone would like to create MM2 client on different language).
We're using a bit of https://en.wikipedia.org/wiki/Bencode with libtorrent and I like the compactness and the nice property of it having a single binary representation (the bijection property), useful for duplicate detection and caching. Though it's a bit more restrictive than JSON.
For simple stuff there are also netstrings, e.g. the example above might be encoded as a list of key-value pairs: 6:method,6:notify,6:rmd160,11:...,3:pub:,32:...,
I should also mention zstandard compression which we're now using with HTTP fallback. It supports a static dictionary, allowing us to remove the overhead of keys (like the "method", "notify", "rmd" and "pub" keys above). zstandard allows us to use JSON (to which CRDTs in HTTP fallback are limited) with a close-to-binary size efficiency. P.S. Though zstandard isn't readily portable.
I think we should consider switching from rmp_serde to either another binary protocol like protobuf or some human-readable text protocol like Json.
It becomes hard to add new fields to messages, and sometimes it requires the use of crutches like this #1487
JSON is too "fat" for such purpose, e.g.
notify
messagecontains
rmd160
,pub
,pubsecp
,sig
fields which are bytes sequence encoded in hex - it makes the message almost2x
larger not providing any real benefit.So switching to some
binary
format might help us to decrease the message sizes significantly which will be the most important for mobile users.The requirements are:
As of now I see following options:
proto
structs to Rust, e.g.libp2p
is full of such scriptsThe text was updated successfully, but these errors were encountered: