-
Notifications
You must be signed in to change notification settings - Fork 99
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
Implement serde for PoseidonConstants #165
Conversation
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.
Things look good to me, once the obvious TODOs are fixed.
src/serde_impl.rs
Outdated
state.serialize_field("fr", &self.full_rounds)?; | ||
state.serialize_field("pr", &self.partial_rounds)?; |
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.
I don't know how important the actual names are. I recently looked into the poseidon paper. There those are named r_f
and r_p
, so perhaps naming them rf
and rp
would make sense.
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.
This looks great, @samuelburnham, thank you. I think it also closes #146. Can you confirm, and if so, comment/close once this merges?
* (WIP) Implement serde for PoseidonConstants * Compress struct field names, format * Formatting, clippy * Add serde hashing tests * Remove pasta patch * Remove comments
Manual serialization is needed for
PoseidonConstants
due toArity
'stypenum
parameter, which doesn't have an easy serde implementation but is only used inCType
. Serialization is thus skipped forArity
and easily calculablePoseidonConstants
fields likedomain_tag
andhalf_full_rounds
.Once const generics are workable and #125 is merged, we could instead derive serde automatically.