Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some crates use path to reference other creates, others do not: leading to "two version" problem #9

Closed
haroldcarr opened this issue Mar 16, 2023 · 1 comment

Comments

@haroldcarr
Copy link

I am compiling some code I added to a custom crate (here called xxxx).
It has been compiling fine until I rebased to f5b61cd.
Now I am getting several errors like:

error[E0308]: arguments to this function are incorrect
   --> xxxx/src/proofsystem_algo.rs:102:20
    |
102 |     statements.add(PoKSignatureBBSG1Stmt::new_statement_from_params(
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: expected struct `bbs_plus::setup::SignatureParamsG1`, found struct `SignatureParamsG1`
   --> xxxx/src/proofsystem_algo.rs:103:9
    |
103 |         sig_params.clone(),
    |         ^^^^^^^^^^^^^^^^^^
    = note: struct `SignatureParamsG1` and struct `bbs_plus::setup::SignatureParamsG1` have similar names, but are actually distinct types
note: struct `SignatureParamsG1` is defined in crate `bbs_plus`
   --> /Users/me/ws/OLABS/github-docknetwork-crypto-NEW-f5b61cd/bbs_plus/src/setup.rs:343:1
    |
343 | impl_sig_params!(SignatureParamsG1, G1Affine, G1, G2Affine, G2);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: struct `bbs_plus::setup::SignatureParamsG1` is defined in crate `bbs_plus`
   --> /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bbs_plus-0.11.0/src/setup.rs:343:1
    |
343 | impl_sig_params!(SignatureParamsG1, G1Affine, G1, G2Affine, G2);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `bbs_plus` are being used?

This might be related to a cargo issue: rust-lang/cargo#11490

Note, the top-level Cargo.lock file does have two versions of bbs_plus in it:

name = "bbs_plus"
version = "0.11.0"
dependencies = [
 "ark-bls12-381",
 "ark-ec 0.4.1",
 "ark-ff 0.4.1",
 "ark-serialize 0.4.1",
 "ark-std 0.4.0",
 "blake2",
 "digest 0.10.6",
 "dock_crypto_utils 0.9.0",
 "rayon",
 "rmp-serde",
 "schnorr_pok 0.9.0",
 "serde",
 "serde_json",
 "serde_with",
 "zeroize",
]

[[package]]
name = "bbs_plus"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9007b7a0f5ce3fe4b22e3acbbd05d7fbb13e722cb6380254ed0ae3684764602"
dependencies = [
 "ark-ec 0.4.1",
 "ark-ff 0.4.1",
 "ark-serialize 0.4.1",
 "ark-std 0.4.0",
 "digest 0.10.6",
 "dock_crypto_utils 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "rayon",
 "schnorr_pok 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "serde",
 "serde_with",
 "zeroize",
]

I also note that some of the docknetwork/crypto crate's Cargo.toml include a path to other crates in the repo while others do not.
For example: see proof_system compared to bbs_plus below.

The following output is editted and formatted for readability:

find . -type f -exec grep --color=auto -nH --null -e "version =" \{\} +

./compressed_sigma/Cargo.toml�17:dock_crypto_utils = { version = "0.9.0", default-features = false }

./test_utils/Cargo.toml�9:bbs_plus = { version = "0.11.0", default-features = false }
./test_utils/Cargo.toml�10:schnorr_pok = { version = "0.9.0", default-features = false }
./test_utils/Cargo.toml�11:vb_accumulator = { version = "0.12.0", default-features = false }
./test_utils/Cargo.toml�18:proof_system = { version = "0.18.0", default-features = false, path = "../proof_system" }

./saver/Cargo.toml�20:dock_crypto_utils = { version = "0.9.0", default-features = false }

./proof_system/Cargo.toml�21:bbs_plus = { version = "0.11.0", default-features = false }
./proof_system/Cargo.toml�22:schnorr_pok = { version = "0.9.0", default-features = false }
./proof_system/Cargo.toml�23:vb_accumulator = { version = "0.12.0", default-features = false }
./proof_system/Cargo.toml�24:dock_crypto_utils = { version = "0.9.0", default-features = false }
./proof_system/Cargo.toml�25:saver = { version = "0.9.0", default-features = false }

./delegatable_credentials/Cargo.toml�20:dock_crypto_utils = { version = "0.9.0", default-features = false }
./delegatable_credentials/Cargo.toml�23:schnorr_pok = { version = "0.9.0", default-features = false }

./schnorr_pok/Cargo.toml�21:dock_crypto_utils = { version = "0.9.0", default-features = false, path = "../utils" }

./vb_accumulator/Cargo.toml�25:schnorr_pok = { version = "0.9.0", default-features = false, path = "../schnorr_pok" }
./vb_accumulator/Cargo.toml�26:dock_crypto_utils = { version = "0.9.0", default-features = false, path = "../utils" }

./benches/Cargo.toml�9:bbs_plus = { version = "0.11.0", default-features = false, path = "../bbs_plus" }
./benches/Cargo.toml�10:schnorr_pok = { version = "0.9.0", default-features = false, path = "../schnorr_pok" }
./benches/Cargo.toml�11:vb_accumulator = { version = "0.12.0", default-features = false, path = "../vb_accumulator" }
./benches/Cargo.toml�12:test_utils = { version = "0.1.0", default-features = false, path = "../test_utils" }

./secret_sharing_and_dkg/Cargo.toml�21:dock_crypto_utils = { version = "0.9.0", default-features = false }
./secret_sharing_and_dkg/Cargo.toml�22:schnorr_pok = { version = "0.9.0", default-features = false }

./bbs_plus/Cargo.toml�21:schnorr_pok = { version = "0.9.0", default-features = false, path = "../schnorr_pok" }
./bbs_plus/Cargo.toml�22:dock_crypto_utils = { version = "0.9.0", default-features = false, path = "../utils" }

One last thing. `saver/Cargo.toml' seems to indicate the need for paths:

./saver/Cargo.toml�33:#proof_system = { path = "../proof_system" }
./saver/Cargo.toml�34:#bbs_plus = { path = "../bbs_plus" }

Bottom line: the rust compiler can't tell the difference between what is in the local registry and what is available via path.

I am assuming that is my problem, but maybe not.

Thank you,
H

> cargo --version
cargo 1.67.1 (8ecd4f20a 2023-01-10)
> rustc --version
rustc 1.67.1 (d5a82bbd2 2023-02-07)
@haroldcarr
Copy link
Author

Solution: build my crate in its own repo and only depend on public docknetwork crypto crates.

FWIW: I am experimenting with building a C API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant