howardwu / wagyu

A Rust library for generating cryptocurrency wallets
https://wagyu.dev
Apache License 2.0
610 stars 106 forks source link

Update bitvec dependency to 0.17.4 #174

Closed BlinkyStitt closed 4 years ago

BlinkyStitt commented 4 years ago

cargo update is giving me an error about bitvec.

cargo update
    Updating crates.io index
error: failed to select a version for the requirement `bitvec = "^0.15.2"`
  candidate versions found which didn't match: 0.17.4
  location searched: crates.io index
required by package `wagyu-ethereum v0.6.2`
    ... which is depended on by `myproject v0.1.0 (/home/ski/code/myproject)`

Importantly, 0.17.2's changelog says "This crash is considered a severe bug, as it indicates memory unsafety. Users are strongly encouraged to update to 0.17.2 immediately."

I haven't tested this yet, but I will soon.

BlinkyStitt commented 4 years ago

There needs to be some changes to the code, too.

$ cargo check
...

warning: use of deprecated item 'bitvec::cursor::BigEndian': This type was renamed to `order::Msb0`, and will be removed in the next release.
  --> ethereum/src/mnemonic.rs:11:5
   |
11 | use bitvec::cursor::BigEndian;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

warning: use of deprecated item 'bitvec::cursor::BigEndian': This type was renamed to `order::Msb0`, and will be removed in the next release.
  --> ethereum/src/mnemonic.rs:84:33
   |
84 |         let mut entropy: BitVec<BigEndian> = BitVec::new();
   |                                 ^^^^^^^^^

warning: use of deprecated item 'bitvec::cursor::BigEndian': This type was renamed to `order::Msb0`, and will be removed in the next release.
  --> ethereum/src/mnemonic.rs:91:42
   |
91 |             entropy.append(&mut BitVec::<BigEndian, u8>::from_bitslice(index_slice));
   |                                          ^^^^^^^^^

warning: use of deprecated item 'bitvec::cursor::BigEndian': This type was renamed to `order::Msb0`, and will be removed in the next release.
   --> ethereum/src/mnemonic.rs:123:47
    |
123 |         let checksum = &hash[0].as_bitslice::<BigEndian>()[..length.div(3) as usize];
    |                                               ^^^^^^^^^

warning: use of deprecated item 'bitvec::cursor::BigEndian': This type was renamed to `order::Msb0`, and will be removed in the next release.
   --> ethereum/src/mnemonic.rs:126:37
    |
126 |         let mut encoding = BitVec::<BigEndian, u8>::from_vec(self.entropy.clone());
    |                                     ^^^^^^^^^

error[E0308]: mismatched types
  --> ethereum/src/mnemonic.rs:95:22
   |
95 |             entropy: entropy[..length].as_slice().to_vec(),
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `usize`
   |
   = note: expected struct `std::vec::Vec<u8>`
              found struct `std::vec::Vec<usize>`

error[E0599]: no method named `as_bitslice` found for type `u8` in the current scope
   --> ethereum/src/mnemonic.rs:123:33
    |
123 |         let checksum = &hash[0].as_bitslice::<BigEndian>()[..length.div(3) as usize];
    |                                 ^^^^^^^^^^^ method not found in `u8`

error[E0606]: casting `&bool` as `u16` is invalid
   --> ethereum/src/mnemonic.rs:138:37
    |
138 |                     .map(|(i, bit)| (bit as u16) * 2u16.pow(10 - i as u32))
    |                                     ^^^^^^^^^^^^
    |
    = help: cast through a raw pointer first

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0308, E0599, E0606.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `wagyu-ethereum`.
warning: build failed, waiting for other jobs to finish...
error: build failed
howardwu commented 4 years ago

177

BlinkyStitt commented 4 years ago

Thank you! Closing in favor of #177