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

Add feature-gated Arkworks compatibility #62

Closed hdevalence closed 8 months ago

hdevalence commented 9 months ago

Blocked by https://github.com/penumbra-zone/decaf377/issues/65

TalDerei commented 9 months ago

Unblocked by #66.

@hdevalence Implementing the arkworks PrimeField trait seems to require satisfying many trait bounds. PrimeField further includes type BigInt: BigInteger with even more trait bounds. I thought about using type BigInt = BigInt<N> since an existing BigInt already implements the BigInteger trait, but BigInteger is a smart wrapper around hard-coded u64-bit limbs, which wouldn't work for our context.

I'm wondering what the optimal approach to implementing the PrimeField trait is, and if it's in fact simpler than I suspect?

hdevalence commented 9 months ago

Yes, there are lots of trait bounds. I think it makes sense to start with just one impl — say Fq, u32 — and see about filling that in. For the BigInt bound we can just use the arkworks type. It's not used for operations that are on the critical path so it doesn't have to be fast. I think it's used for stuff like debug impls.

cronokirby commented 8 months ago

This isn't optional yet though, so not closing quite yet.