Browse Source

Merge updates manually

checkpoints
DenioD 5 years ago
parent
commit
3fb483aa08
  1. 80
      .github/workflows/rust.yml
  2. 23
      Cargo.toml
  3. 6
      bip39bug.md
  4. 18
      cli/Cargo.toml
  5. 0
      cli/src/main.rs
  6. 6
      docker/Dockerfile
  7. 3
      lib/Cargo.toml
  8. 6
      lib/src/commands.rs
  9. 2
      lib/src/lightclient.rs
  10. 6
      lib/src/lightwallet.rs
  11. 2
      lib/src/lightwallet/bugs.rs
  12. 2
      mkrelease.sh

80
.github/workflows/rust.yml

@ -0,0 +1,80 @@
name: Rust
on: [push, pull_request]
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.38.0
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --release --all
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --release --all
- name: Upload
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.os }}-silentdragonlite-cli
path: target/release/silentdragonlite-cli
linux_arm7:
name: Linux ARMv7
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: armv7-unknown-linux-gnueabihf
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target armv7-unknown-linux-gnueabihf
- name: Upload
uses: actions/upload-artifact@v1
with:
name: linux_armv7-silentdragonlite-cli
path: target/armv7-unknown-linux-gnueabihf/release/silentdragonlite-cli
linux_aarch64:
name: Linux ARM64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-unknown-linux-gnu
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target aarch64-unknown-linux-gnu
- name: Upload
uses: actions/upload-artifact@v1
with:
name: linux_aarch64-silentdragonlite-cli
path: target/aarch64-unknown-linux-gnu/release/silentdragonlite-cli

23
Cargo.toml

@ -1,21 +1,8 @@
[package]
name = "silentdragonlite-cli"
version = "1.1.0"
edition = "2018"
[dependencies]
rustyline = "5.0.2"
clap = "2.33"
log = "0.4"
log4rs = "0.8.3"
shellwords = "1.0.0"
json = "0.12.0"
http = "0.1"
byteorder = "1"
tiny-bip39 = "0.6.2"
silentdragonlitelib = { path = "./lib/" }
[workspace]
members = [
"lib",
"cli",
]
[profile.release]
debug = false

6
bip39bug.md

@ -1,6 +1,6 @@
## Zecwallet-cli BIP39 derivation bug
## silentdragonlite-cli BIP39 derivation bug
In v1.0 of zecwallet-cli, there was a bug that incorrectly derived HD wallet keys after the first key. That is, the first key, address was correct, but subsequent ones were not.
In v1.0 of silentdragonlite-cli, there was a bug that incorrectly derived HD wallet keys after the first key. That is, the first key, address was correct, but subsequent ones were not.
The issue was that the 32-byte seed was directly being used to derive then subsequent addresses instead of the 64-byte pkdf2(seed). The issue affected both t and z addresses.
@ -8,6 +8,6 @@ Note that no funds are at risk. The issue is that, if in the future, you import
## Fix
If you start a wallet that has this bug, you'll be notified.
The bug can be automatically fixed by the wallet by running the `fixbip39bug` command. Just start `zecwallet-cli` and type `fixbip39bug`.
The bug can be automatically fixed by the wallet by running the `fixbip39bug` command. Just start `silentdragonlite-cli` and type `fixbip39bug`.
If you have any funds in the incorrect addresses, they'll be sent to yourself, and the correct addresses re-derived.

18
cli/Cargo.toml

@ -0,0 +1,18 @@
[package]
name = "silentdragonlite-cli"
version = "1.1.0"
edition = "2018"
[dependencies]
rustyline = "5.0.2"
clap = "2.33"
log = "0.4"
log4rs = "0.8.3"
shellwords = "1.0.0"
json = "0.12.0"
http = "0.1"
byteorder = "1"
tiny-bip39 = "0.6.2"
silentdragonlitelib = { path = "../lib/" }

0
src/main.rs → cli/src/main.rs

6
docker/Dockerfile

@ -31,7 +31,7 @@ RUN cd /opt && wget https://download.libsodium.org/libsodium/releases/libsodium-
tar xvf libsodium-1.0.17-mingw.tar.gz
# Cargo fetch the dependencies so we don't download them over and over again
RUN cd /tmp && git clone https://github.com/adityapk00/zecwallet-light-cli.git && \
cd zecwallet-light-cli && \
RUN cd /tmp && git clone https://github.com/adityapk00/silentdragonlite-light-cli.git && \
cd silentdragonlite-light-cli && \
cargo fetch && \
cd /tmp && rm -rf zecwallet-light-cli
cd /tmp && rm -rf silentdragonlite-light-cli

3
lib/Cargo.toml

@ -73,6 +73,3 @@ tower-grpc-build = { git = "https://github.com/tower-rs/tower-grpc", features =
[dev-dependencies]
tempdir = "0.3.7"
[profile.release]
debug = true

6
lib/src/commands.rs

@ -356,7 +356,11 @@ impl Command for LockCommand {
fn exec(&self, args: &[&str], lightclient: &LightClient) -> String {
if args.len() != 0 {
return self.help();
let mut h = vec![];
h.push("Extra arguments to lock. Did you mean 'encrypt'?");
h.push("");
return format!("{}\n{}", h.join("\n"), self.help());
}
match lightclient.wallet.write().unwrap().lock() {

2
lib/src/lightclient.rs

@ -319,7 +319,7 @@ impl LightClient {
info!("Created LightClient to {}", &config.server);
if crate::lightwallet::bugs::BugBip39Derivation::has_bug(&lc) {
let m = format!("WARNING!!!\nYour wallet has a bip39derivation bug that's showing incorrect addresses.\nPlease run 'fixbip39bug' to automatically fix the address derivation in your wallet!\nPlease see: https://github.com/adityapk00/zecwallet-light-cli/blob/master/bip39bug.md");
let m = format!("WARNING!!!\nYour wallet has a bip39derivation bug that's showing incorrect addresses.\nPlease run 'fixbip39bug' to automatically fix the address derivation in your wallet!\nPlease see: https://github.com/adityapk00/silentdragonlite-light-cli/blob/master/bip39bug.md");
info!("{}", m);
println!("{}", m);
}

6
lib/src/lightwallet.rs

@ -1388,10 +1388,10 @@ impl LightWallet {
let mut builder = Builder::new(height);
// A note on t addresses
// Funds received by t-addresses can't be explicitly spent in ZecWallet.
// ZecWallet will lazily consolidate all t address funds into your shielded addresses.
// Funds received by t-addresses can't be explicitly spent in silentdragonlite.
// silentdragonlite will lazily consolidate all t address funds into your shielded addresses.
// Specifically, if you send an outgoing transaction that is sent to a shielded address,
// ZecWallet will add all your t-address funds into that transaction, and send them to your shielded
// silentdragonlite will add all your t-address funds into that transaction, and send them to your shielded
// address as change.
let tinputs: Vec<_> = self.get_utxos().iter()
.filter(|utxo| utxo.unconfirmed_spent.is_none()) // Remove any unconfirmed spends

2
lib/src/lightwallet/bugs.rs

@ -1,5 +1,5 @@
///
/// In v1.0 of zecwallet-cli, there was a bug that incorrectly derived HD wallet keys after the first key. That is, the
/// In v1.0 of silentdragonlite-cli, there was a bug that incorrectly derived HD wallet keys after the first key. That is, the
/// first key, address was correct, but subsequent ones were not.
///
/// The issue was that the 32-byte seed was directly being used to derive then subsequent addresses instead of the

2
mkrelease.sh

@ -43,7 +43,7 @@ mkdir -p target/macOS-silentdragonlite-cli-v$APP_VERSION
cp target/release/silentdragonlite-cli target/macOS-silentdragonlite-cli-v$APP_VERSION/
# For Windows and Linux, build via docker
docker run --rm -v $(pwd)/:/opt/zecwallet-light-cli rustbuild:latest bash -c "cd /opt/zecwallet-light-cli && cargo build --release && SODIUM_LIB_DIR='/opt/libsodium-win64/lib/' cargo build --release --target x86_64-pc-windows-gnu"
docker run --rm -v $(pwd)/:/opt/silentdragonlite-light-cli rustbuild:latest bash -c "cd /opt/silentdragonlite-light-cli && cargo build --release && SODIUM_LIB_DIR='/opt/libsodium-win64/lib/' cargo build --release --target x86_64-pc-windows-gnu"
# Now sign and zip the binaries
# macOS

Loading…
Cancel
Save