celo-org / celo-bls-snark-rs

Implements SNARK-friendly BLS signatures
https://celo.org
Apache License 2.0
83 stars 24 forks source link

Fixes the build #225

Closed gtank closed 2 years ago

gtank commented 2 years ago

These seem recent as of (variously) Rust 1.53 and 1.54. They were causing the style check to break the build.

gtank commented 2 years ago

Oh, come on!

gtank commented 2 years ago

The code needs several fixes.

Upgrading to anything past our pinned version also causes a build error I can't figure out how to fix at the moment:

error[E0277]: the trait bound `ark_bls12_377::Parameters: Bls12Parameters` is not satisfied
  --> crates/bls-crypto/src/hash_to_curve/try_and_increment.rs:31:43
   |
31 |     TryAndIncrement<CompositeHasher<CRH>, <Parameters as Bls12Parameters>::G1Parameters>,
   |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bls12Parameters` is not implemented for `ark_bls12_377::Parameters`
   |
  ::: /Users/gtank/.cargo/git/checkouts/algebra-7e23afa68841b66e/344b27d/ec/src/models/bls12/mod.rs:30:1
   |
30 | pub trait Bls12Parameters: 'static {
   | ---------------------------------- required by this bound in `Bls12Parameters`

error[E0277]: the trait bound `ark_bls12_377::Parameters: Bls12Parameters` is not satisfied
  --> crates/bls-crypto/src/hash_to_curve/try_and_increment.rs:37:35
   |
37 |     TryAndIncrement<DirectHasher, <Parameters as Bls12Parameters>::G1Parameters>,
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bls12Parameters` is not implemented for `ark_bls12_377::Parameters`
   |
  ::: /Users/gtank/.cargo/git/checkouts/algebra-7e23afa68841b66e/344b27d/ec/src/models/bls12/mod.rs:30:1
   |
30 | pub trait Bls12Parameters: 'static {
   | ---------------------------------- required by this bound in `Bls12Parameters`

error[E0277]: the trait bound `ark_bls12_377::Parameters: Bls12Parameters` is not satisfied
  --> crates/bls-crypto/src/hash_to_curve/try_and_increment_cip22.rs:31:48
   |
31 |     TryAndIncrementCIP22<CompositeHasher<CRH>, <Parameters as Bls12Parameters>::G1Parameters>,
   |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bls12Parameters` is not implemented for `ark_bls12_377::Parameters`
   |
  ::: /Users/gtank/.cargo/git/checkouts/algebra-7e23afa68841b66e/344b27d/ec/src/models/bls12/mod.rs:30:1
   |
30 | pub trait Bls12Parameters: 'static {
   | ---------------------------------- required by this bound in `Bls12Parameters`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `bls-crypto` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed
gtank commented 2 years ago

Due to the risk of semantically important circuit changes, we're going to hang on to our 0.1.0 arkworks version. Conversation elsewhere with @kobigurk established that RUSTSEC-2021-0075 doesn't affect us here.

kobigurk commented 2 years ago

To be concrete, the commit we have in Cargo.lock is the one that we used for creating the circuit and that we've matched against.

On Wed, Sep 15, 2021 at 7:59 PM George Tankersley @.***> wrote:

Due to the risk of semantically important circuit changes, we're going to hang on to our 0.1.0 arkworks version. Conversation elsewhere with @kobigurk https://github.com/kobigurk established that RUSTSEC-2021-0075 doesn't affect us here.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/celo-org/celo-bls-snark-rs/pull/225#issuecomment-920201504, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA23MGG2WZCPBB6HTSFSHH3UCDGILANCNFSM5EBJ2HIQ .

gtank commented 2 years ago

To be even more concrete, our pinned version predates the bug addressed in RUSTSEC-2021-0075, which was introduced in https://github.com/arkworks-rs/r1cs-std/commit/f88d7c6ea336d4b71e52f53c6ae2934e29accf43 and resolved in https://github.com/arkworks-rs/r1cs-std/commit/b6e7e94521854edd7a4892a61419202b0784eb0b.

Further discussion (h/t @kobigurk):