-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Description
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/movementlabsxyz/aptos-core/ && cd aptos-core
cargo build -p movement
(generates the target/debug/movement executable)
Expected behavior
Command should be executed without any error
Desktop (please complete the following information):
- OS: MacOS
Additional context
I am trying to install movement CLI like it explained in this link. But I throws this error.
error[E0308]: mismatched types
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/diesel-2.2.4/src/pg/types/numeric.rs:68:42
|
68 | ...result = BigDecimal::new(BigInt::from_biguint(sign, result), -correction_exp)
| --------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `BigInt`, found a different `BigInt`
| |
| arguments to this function are incorrect
|
= note: `BigInt` and `BigInt` have similar names, but are actually distinct types
note: `BigInt` is defined in crate `num_bigint`
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.2.6/src/bigint.rs:115:1
|
115 | pub struct BigInt {
| ^^^^^^^^^^^^^^^^^
note: `BigInt` is defined in crate `num_bigint`
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.4.4/src/bigint.rs:62:1
|
62 | pub struct BigInt {
| ^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate `num_bigint` are being used?
note: associated function defined here
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bigdecimal-0.4.2/src/lib.rs:191:12
|
191 | pub fn new(digits: BigInt, scale: i64) -> BigDecimal {
| ^^^
error[E0308]: mismatched types
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/diesel-2.2.4/src/pg/types/numeric.rs:116:47
|
116 | let mut digits = ToBase10000(Some(integer)).collect::<Vec<_>>();
| ---- ^^^^^^^ expected `BigUint`, found a different `BigUint`
| |
| arguments to this enum variant are incorrect
|
= note: `BigUint` and `BigUint` have similar names, but are actually distinct types
note: `BigUint` is defined in crate `num_bigint`
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.4.4/src/biguint.rs:38:1
|
38 | pub struct BigUint {
| ^^^^^^^^^^^^^^^^^^
note: `BigUint` is defined in crate `num_bigint`
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.2.6/src/biguint.rs:50:1
|
50 | pub struct BigUint {
| ^^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate `num_bigint` are being used?
help: the type constructed contains `decimal::bigdecimal::bigdecimal::num_bigint::BigUint` due to the type of the argument passed
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/diesel-2.2.4/src/pg/types/numeric.rs:116:42
|
116 | let mut digits = ToBase10000(Some(integer)).collect::<Vec<_>>();
| ^^^^^-------^
| |
| this argument influences the type of `Some`
note: tuple variant defined here
--> /Users/user/.rustup/toolchains/1.78.0-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:580:5
|
580 | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| ^^^^
error[E0308]: mismatched types
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/diesel-2.2.4/src/pg/types/numeric.rs:131:17
|
130 | match decimal.sign() {
| -------------- this expression has type `decimal::bigdecimal::bigdecimal::num_bigint::Sign`
131 | Sign::Plus => PgNumeric::Positive {
| ^^^^^^^^^^ expected `Sign`, found a different `Sign`
|
= note: `Sign` and `Sign` have similar names, but are actually distinct types
note: `Sign` is defined in crate `num_bigint`
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.2.6/src/bigint.rs:42:1
|
42 | pub enum Sign {
| ^^^^^^^^^^^^^
note: `Sign` is defined in crate `num_bigint`
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.4.4/src/bigint.rs:41:1
|
41 | pub enum Sign {
| ^^^^^^^^^^^^^
= note: perhaps two different versions of crate `num_bigint` are being used?
error[E0308]: mismatched types
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/diesel-2.2.4/src/pg/types/numeric.rs:136:17
|
130 | match decimal.sign() {
| -------------- this expression has type `decimal::bigdecimal::bigdecimal::num_bigint::Sign`
...
136 | Sign::Minus => PgNumeric::Negative {
| ^^^^^^^^^^^ expected `Sign`, found a different `Sign`
|
= note: `Sign` and `Sign` have similar names, but are actually distinct types
note: `Sign` is defined in crate `num_bigint`
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.2.6/src/bigint.rs:42:1
|
42 | pub enum Sign {
| ^^^^^^^^^^^^^
note: `Sign` is defined in crate `num_bigint`
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.4.4/src/bigint.rs:41:1
|
41 | pub enum Sign {
| ^^^^^^^^^^^^^
= note: perhaps two different versions of crate `num_bigint` are being used?
error[E0308]: mismatched types
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/diesel-2.2.4/src/pg/types/numeric.rs:141:17
|
130 | match decimal.sign() {
| -------------- this expression has type `decimal::bigdecimal::bigdecimal::num_bigint::Sign`
...
141 | Sign::NoSign => PgNumeric::Positive {
| ^^^^^^^^^^^^ expected `Sign`, found a different `Sign`
|
= note: `Sign` and `Sign` have similar names, but are actually distinct types
note: `Sign` is defined in crate `num_bigint`
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.2.6/src/bigint.rs:42:1
|
42 | pub enum Sign {
| ^^^^^^^^^^^^^
note: `Sign` is defined in crate `num_bigint`
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.4.4/src/bigint.rs:41:1
|
41 | pub enum Sign {
| ^^^^^^^^^^^^^
= note: perhaps two different versions of crate `num_bigint` are being used?
When I print the cargo tree
i see that ark's num-bigint
is using v0.4.4
but movement use v0.3.3
. So I updated num-bigint
in Cargo.toml
but then i throws error in the crates/aptos-dkg/src/utils/random.rs
file - specifically random_scalar_internal
. So I changed that function with the slower way comment explained.
pub fn random_scalar_internal<R>(rng: &mut R, exclude_zero: bool) -> Scalar
where
R: rand_core::RngCore + rand::Rng + rand_core::CryptoRng + rand::CryptoRng,
{
let mut big_uint;
loop {
// NOTE(Alin): This uses rejection-sampling (e.g., https://cs.stackexchange.com/a/2578/54866)
// An alternative would be to sample twice the size of the scalar field and use
// `random_scalar_from_uniform_bytes`, but that is actually slower (950ns vs 623ns)
let mut bytes = [0u8; 2 * SCALAR_NUM_BYTES];
rng.fill(&mut bytes);
big_uint = random_scalar_from_uniform_bytes(&bytes);
// Some key material cannot be zero since it needs to have an inverse in the scalar field.
break;
}
big_uint
}
This solves the building problem but it's weird that main doesn't build directly.
batikankutluer
Metadata
Metadata
Assignees
Labels
No labels