Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Zcash-style serialization for BLS12-381 #129

Merged
merged 21 commits into from
Oct 19, 2022

Conversation

mmagician
Copy link
Member

Description

Adapted from https://github.com/crate-crypto/small-powers-of-tau/blob/master/src/interop_point_encoding.rs to take advantage of flexible serialization for curves.

Question: should we maybe have this mode of serialization feature-gated, e.g.:

...
#[cfg(feature = "zcash_serialization")]
fn serialized_size(_compress: ark_serialize::Compress) -> usize {
    G2_SERIALISED_SIZE
}
...

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to Github issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

Co-Authored-By: kevaundray <37423678+kevaundray@users.noreply.github.com>
@mmagician mmagician requested review from weikengchen and Pratyush and removed request for weikengchen October 11, 2022 12:31
@mmagician
Copy link
Member Author

@Pratyush Thanks for the review, these are of course valid points 😉
As you've seen, I've opened another fix for get_point_from_x_unchecked - this PR depends on it for the tests to pass.

@Pratyush
Copy link
Member

btw I think there's no need to feature-gate the new compression. We can just leave a note in the CHANGELOG about this being a breaking change.

@mmagician mmagician mentioned this pull request Oct 17, 2022
6 tasks
bls12_381/src/curves/g1.rs Outdated Show resolved Hide resolved
if compress == Compress::Yes {
G1_SERIALISED_SIZE
} else {
G1_SERIALISED_SIZE * 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that Zcash always uses compressed point encodings, so the uncompressed version should not be referred to as Zcash-style encoding in documentation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daira Noted, thanks. So far it's not mentioned in the docs, but will go into the CHANGELOG. I've just reworded it there, I hope it's fine like that?

@Pratyush Pratyush changed the title zcash-style serialization for BLS12-381 Zcash-style serialization for BLS12-381 Oct 19, 2022
@Pratyush Pratyush merged commit 138b23f into arkworks-rs:master Oct 19, 2022
@mmagician mmagician deleted the zcash-deser branch October 19, 2022 05:57
@Pratyush Pratyush linked an issue Oct 20, 2022 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serialization of GroupAffine
3 participants