penumbra-zone / decaf377

decaf377 is a prime-order group designed for use in SNARKs over BLS12-377
https://protocol.penumbra.zone/main/crypto/decaf377.html
12 stars 12 forks source link

arkworks independent projective arithmetic ops #77

Closed redshiftzero closed 8 months ago

redshiftzero commented 8 months ago

Adding projective operations for #63

cronokirby commented 8 months ago

What's the difference between ops and projective/ops?

redshiftzero commented 8 months ago

Currently nothing, my thinking was to mirror the structure from the previous code (now under the arkworks feature) where we have a projective.rs and affine.rs for implementing arithmetic operations on Element and AffineElement respectively

cronokirby commented 8 months ago

It surprises me that the code even compiles; shouldn't Rust complain about there being two implementations of the same trait for Element?

Also, I think we should just not expose arithmetic on Affine. Like, the reason Affine exists is only for compatability with arkworks, and as a "I know what I'm doing" button that people can press to convert from the Affine representation to the Element.

redshiftzero commented 8 months ago

ah, so it compiles because the projective arithmetic implementations in the arkworks feature are on the Element that holds an inner arkworks EdwardsProjective point, but the projective arithmetic implementations added in this PR are on the arkworks independent Element in the smol_curve module

Also, I think we should just not expose arithmetic on Affine. Like, the reason Affine exists is only for compatability with arkworks, and as a "I know what I'm doing" button that people can press to convert from the Affine representation to the Element.

agreed 100%!

cronokirby commented 8 months ago

I think that second Element type will not exist in the near future, because we won't have the arkworks EdwardsProjective appear anywhere; instead I imagine we'll just implement the Arkworks traits on Element and AffineElement.