Serialization format #21
Replies: 2 comments
-
I think its best if we prioritize a mechanism to allow customization/interruption of the parsing since this will be a critical point to avoid attack vectors. AFAIK, we don't have a performant, safe way to inject user exceptions into any of these libraries, suggesting the deserialization might have to be done either manually or based on some generic framework. As for serialization, considering this wouldn't be critical, we can go with any performant, reliable, and maintained option such as borsh. It uses only hashbrown as dependency, and this is a big plus for this option as we don't need to worry too much about increasing our stack risk by adding third-party deps. Alternatively, we can implement our own serialization/deserialization with nom, if we are up to sacrifice additional effort to manually implement everything. This is analogous to not using any library at all (as we might just end reading bytes and parsing field elements), but nom provides a heavily maintained, reliable and reputable library. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/0xPolygonMiden/miden-node is using tonic, which is built on top of protobuf |
Beta Was this translation helpful? Give feedback.
-
Serialization format discussion
Main points on our discussion:
I think we should have two points in this discussion:
These are orthogonal to one another, i.e. we can define our own data format and use a serialization/deserialization library or we can do neither.
standardard format
Pros:
Cons:
Example formats:
library for serialization
Pros:
Cons:
Libraries
nom:
Pros:
Cons:
serde:
Pros:
Cons:
Some benchmarks:
Beta Was this translation helpful? Give feedback.
All reactions