[serialization] safer serialization
In https://github.com/o1-labs/proof-systems/pull/160 I propose to use serde for serialization and deserialization.
There are a few problems with that:
- we skip some fields, because in our current logic we do not deserialize them. This means that when you deserialize these structs, the
Defaultimplementation of these fields is used. You thus have to remember to fill them yourself. A better alternative would be to have an enum that prevents you to use the field if it hasn't been set. For example:
or#[serde(skip)] pub fr_sponge_params: ArithmeticSpongeParams<F>,#[serde(skip)] pub srs: SRSValue<'a, G>, - we do not necessarily perform cryptographic validations on deserialization. For example, curve points might need to be checked to make sure they are on the curve. This is something that might not be relevant in the current use-case (caching structs to filesystem), but if we use this to serialize and deserialize types before sending them over the network this is something we need to be careful with.
Stale issue message
I don't think the validation matters for now. We should have separate functions for that if we ever deserialize from untrusted source. But we should have these skipped fields be options.
Stale issue message
In addition, we should remove serialization logic from the stubs in mina
Stale issue message
Stale issue message
Stale issue message
Stale issue message
Stale issue message
Stale issue message
Stale issue message