dusk-network / plonk

Pure Rust implementation of the PLONK ZKProof System done by the Dusk team
https://dusk-network.github.io/plonk
Mozilla Public License 2.0
535 stars 148 forks source link

Refactor `Variable` type to be an enum which differenciates between JubJub & BlsScalar #341

Closed CPerezz closed 10 months ago

CPerezz commented 3 years ago

We have places in our code where the Variable type holds a value that can be mapped securely to a JubJubScalar. See for example: https://github.com/dusk-network/plonk/blob/master/src/constraint_system/ecc/scalar_mul/variable_base/mod.rs#L11-L34

Therefore it's important to be sure when we can or cannot use one of these variables for ECC ops purposes.

There is one thing which is actually not doable (directly using PLONK) which is the fact of transforming a BlsScalar into a JubJubScalar after hashing in order to use the result of the hash as the JubJubScalar used to perform the scalar mul.

To do so, we will need to refactor the Variable struct to differenciate between Bls and JubJub and also, implement a gate (without a commitment requirement) that will perform this operation returning a different variant of the enum.

The possible conversions are:

marta-belles commented 10 months ago

Outdated.