dalek-cryptography / bulletproofs

A pure-Rust implementation of Bulletproofs using Ristretto.
MIT License
1.02k stars 216 forks source link

Issue: Downloading multiple versions of the same dependency simultaneously. #371

Closed On0n0k1 closed 7 months ago

On0n0k1 commented 1 year ago

Hello. I'm looking forward to using bulletproofs more in the future. Great work so far.

I tried your example in the documentation and am having errors due to versions. Somehow, the crate is downloading merlin-3.0.0 and merlin-2.0.0 at the same time. Resulting in type conflicts.

It is also downloading curve25519-dalek-2.1.3 and curve25519-dalek-ng-4.1.1 together as dependencies.

I made sure to look at your Cargo.toml file to download the same versions for crates required by your dependencies. Maybe you could make them public within the library so we can simply call use bulletproofs::merlin::transcript::Transcript instead?

To clarify before showing the error messages, it has a conflict with the types merlin::transcript::Transcript and curve25519_dalek_ng::scalar::Scalar

I believe many other newcomers might be having the same problem.

Look at the errors it is generating:


error[E0308]: arguments to this function are incorrect
   --> src/main.rs:33:36
    |
33  |     let (proof, committed_value) = RangeProof::prove_single(
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^
...
36  |         &mut prover_transcript,
    |         ---------------------- expected `merlin::transcript::Transcript`, found `Transcript`
37  |         secret_value,
38  |         &blinding,
    |         --------- expected `curve25519_dalek_ng::scalar::Scalar`, found `Scalar`
    |
    = note: `Transcript` and `merlin::transcript::Transcript` have similar names, but are actually distinct types
note: `Transcript` is defined in crate `merlin`
   --> /home/clarund/.cargo/registry/src/index.crates.io-6f17d22bba15001f/merlin-2.0.1/src/transcript.rs:54:1
    |
54  | pub struct Transcript {
    | ^^^^^^^^^^^^^^^^^^^^^
note: `merlin::transcript::Transcript` is defined in crate `merlin`
   --> /home/clarund/.cargo/registry/src/index.crates.io-6f17d22bba15001f/merlin-3.0.0/src/transcript.rs:54:1
    |
54  | pub struct Transcript {
    | ^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `merlin` are being used?
    = note: `Scalar` and `curve25519_dalek_ng::scalar::Scalar` have similar names, but are actually distinct types
note: `Scalar` is defined in crate `curve25519_dalek`
   --> /home/clarund/.cargo/registry/src/index.crates.io-6f17d22bba15001f/curve25519-dalek-2.1.3/src/scalar.rs:186:1
    |
186 | pub struct Scalar {
    | ^^^^^^^^^^^^^^^^^
note: `curve25519_dalek_ng::scalar::Scalar` is defined in crate `curve25519_dalek_ng`
   --> /home/clarund/.cargo/registry/src/index.crates.io-6f17d22bba15001f/curve25519-dalek-ng-4.1.1/src/scalar.rs:186:1
    |
186 | pub struct Scalar {
    | ^^^^^^^^^^^^^^^^^
note: associated function defined here
   --> /home/clarund/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bulletproofs-4.0.0/src/range_proof/mod.rs:161:12
    |
161 |     pub fn prove_single(
    |            ^^^^^^^^^^^^

error[E0308]: mismatched types
   --> src/main.rs:49:13
    |
46  |         .verify_single(
    |          ------------- arguments to this method are incorrect
...
49  |             &mut verifier_transcript,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^ expected `merlin::transcript::Transcript`, found `Transcript`
    |
    = note: `Transcript` and `merlin::transcript::Transcript` have similar names, but are actually distinct types
note: `Transcript` is defined in crate `merlin`
   --> /home/clarund/.cargo/registry/src/index.crates.io-6f17d22bba15001f/merlin-2.0.1/src/transcript.rs:54:1
    |
54  | pub struct Transcript {
    | ^^^^^^^^^^^^^^^^^^^^^
note: `merlin::transcript::Transcript` is defined in crate `merlin`
   --> /home/clarund/.cargo/registry/src/index.crates.io-6f17d22bba15001f/merlin-3.0.0/src/transcript.rs:54:1
    |
54  | pub struct Transcript {
    | ^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `merlin` are being used?
note: method defined here
   --> /home/clarund/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bulletproofs-4.0.0/src/range_proof/mod.rs:333:12
    |
333 |     pub fn verify_single(
    |            ^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `bulletproofpractice` (bin "bulletproofpractice") due to 2 previous errors
Stentonian commented 7 months ago

Related https://github.com/zkcrypto/bulletproofs/issues/15