diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..52af80e --- /dev/null +++ b/.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 + diff --git a/Cargo.toml b/Cargo.toml index f625e9a..1e7b3f0 100644 --- a/Cargo.toml +++ b/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 \ No newline at end of file diff --git a/bip39bug.md b/bip39bug.md index bb62319..314fff9 100644 --- a/bip39bug.md +++ b/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. \ No newline at end of file diff --git a/cli/Cargo.toml b/cli/Cargo.toml new file mode 100644 index 0000000..495b019 --- /dev/null +++ b/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/" } + diff --git a/src/main.rs b/cli/src/main.rs similarity index 100% rename from src/main.rs rename to cli/src/main.rs diff --git a/docker/Dockerfile b/docker/Dockerfile index abe4b05..5a88d0f 100644 --- a/docker/Dockerfile +++ b/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 diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 0552d25..157bdce 100644 --- a/lib/Cargo.toml +++ b/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 \ No newline at end of file diff --git a/lib/src/commands.rs b/lib/src/commands.rs index 7477c93..f25ab6c 100644 --- a/lib/src/commands.rs +++ b/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() { diff --git a/lib/src/lightclient.rs b/lib/src/lightclient.rs index ea41b10..ff6f8d9 100644 --- a/lib/src/lightclient.rs +++ b/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); } diff --git a/lib/src/lightwallet.rs b/lib/src/lightwallet.rs index d48b959..f54eb64 100644 --- a/lib/src/lightwallet.rs +++ b/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 diff --git a/lib/src/lightwallet/bugs.rs b/lib/src/lightwallet/bugs.rs index 8a88170..cd85f29 100644 --- a/lib/src/lightwallet/bugs.rs +++ b/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 diff --git a/mkrelease.sh b/mkrelease.sh index 23bec1c..dfafaf0 100755 --- a/mkrelease.sh +++ b/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