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

refactor(arkworks): feature-gated Arkworks compatibility #67

Closed TalDerei closed 8 months ago

TalDerei commented 9 months ago

References #62. WIP

The Implementation may target a generic approach on the Fp, Fq, Fr type aliases, rather than on the backend types.

hdevalence commented 9 months ago

Two high-level comments:

  1. We should avoid making changes to the currently-existing wrapper.rs code. We'll want to keep the minimal wrapper API separate from the Arkworks compatibility. As you've noticed, the Arkworks finite field traits are ... not particularly ergonomic (or, more charitably, are solving a more complex problem), and we should keep that code isolated from the code that will become the minimal, self-contained implementation
  2. We should avoid building a generic implementation, and just duplicate and adjust the code across the six field implementations as needed. (Let's start with one, get it finished, and only then copy it over to the other five). This will be considerably simpler to build and maintain, rather than adding another layer to a giant tower of abstraction.
cronokirby commented 9 months ago

Some of the methods can use the impl provided generically by arkworks for the trait, as long as we don't need a more performant specialization.