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
It is quite typical, at least in my experience, for code using pasta_curves crate to have the necessity to persist or transfer structs with fields of types Fp and Fq, which requires (de)serialization.
As Rust doesn't allow implementing traits for imported structs, we have to manually write (de)serializers for every struct that contains Fp or Fq fields instead of being able to just do a simple #[derive].
Would you consider adding serialization impl's to these types? At least for some popular serialization libraries such as serde and borsh. The implementations could be behind a feature flag. The change, I believe, would be as much as adding a #[derive(Serialize,Deserialize,BorshSerialize,BorshDeserialize)] to the struct declaration.
I can do a PR, if you prefer.
The text was updated successfully, but these errors were encountered:
I don't know why it took me so long to realize that pasta_curves actually does have a serde feature.
Is there a reason why you implement ser/de functions manually instead of deriving them?
And do you think it would be possible to also add impl's for borsh? It seems to gain quite a popularity in crypto space.
It is quite typical, at least in my experience, for code using
pasta_curves
crate to have the necessity to persist or transfer structs with fields of typesFp
andFq
, which requires (de)serialization.As Rust doesn't allow implementing traits for imported structs, we have to manually write (de)serializers for every struct that contains
Fp
orFq
fields instead of being able to just do a simple#[derive]
.Would you consider adding serialization impl's to these types? At least for some popular serialization libraries such as serde and borsh. The implementations could be behind a feature flag. The change, I believe, would be as much as adding a
#[derive(Serialize,Deserialize,BorshSerialize,BorshDeserialize)]
to the struct declaration.I can do a PR, if you prefer.
The text was updated successfully, but these errors were encountered: