From 474310e5288d2918a5e7b374936f9b6e46d63555 Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Sun, 2 Jun 2024 23:22:30 -0500 Subject: [PATCH] ci(speculos): set version to sha-f430e51, fix clippy --- .github/workflows/main.yml | 17 ++++------------- ci/Dockerfile.ledger | 2 +- clippy.toml | 2 +- src/lib.rs | 16 ++++++++-------- 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dab5ea7..d8e385a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,8 +40,8 @@ jobs: strategy: matrix: rust: - - version: stable # STABLE - features: miniscript +# - version: stable # STABLE +# features: miniscript - version: 1.63.0 # MSRV features: miniscript emulator: @@ -58,17 +58,8 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Build and push - uses: docker/build-push-action@v3 - with: - context: ci/ - file: ci/Dockerfile.${{ matrix.emulator.name }} - tags: hwi/${{ matrix.emulator.name }}_emulator:latest - load: true - cache-from: type=gha - cache-to: type=gha + - name: Build simulator image + run: docker build -t hwi/${{ matrix.emulator.name }}_emulator:latest ./ci -f ci/Dockerfile.${{ matrix.emulator.name }} - name: Run simulator image run: docker run --name simulator --network=host hwi/${{ matrix.emulator.name }}_emulator & - name: Install Python diff --git a/ci/Dockerfile.ledger b/ci/Dockerfile.ledger index b593664..5c76716 100644 --- a/ci/Dockerfile.ledger +++ b/ci/Dockerfile.ledger @@ -1,4 +1,4 @@ -FROM ghcr.io/ledgerhq/speculos +FROM ghcr.io/ledgerhq/speculos:sha-f430e51 RUN apt-get update RUN apt-get install wget -y diff --git a/clippy.toml b/clippy.toml index 516ad1f..69478ce 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1 +1 @@ -msrv="1.48.0" +msrv="1.63.0" diff --git a/src/lib.rs b/src/lib.rs index fa47492..69c00cc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -59,7 +59,7 @@ mod tests { #[serial] fn test_enumerate() { let devices = HWIClient::enumerate().unwrap(); - assert!(devices.len() > 0); + assert!(!devices.is_empty()); } #[test] @@ -83,7 +83,7 @@ mod tests { .expect("No devices found. Either plug in a hardware wallet, or start a simulator.") .as_ref() .expect("Error when opening the first device"); - HWIClient::get_client(&device, true, TESTNET).unwrap() + HWIClient::get_client(device, true, TESTNET).unwrap() } #[test] @@ -119,8 +119,8 @@ mod tests { let client = get_first_device(); let account = Some(10); let descriptor = client.get_descriptors::(account).unwrap(); - assert!(descriptor.internal.len() > 0); - assert!(descriptor.receive.len() > 0); + assert!(!descriptor.internal.is_empty()); + assert!(!descriptor.receive.is_empty()); } #[test] @@ -141,8 +141,8 @@ mod tests { let descriptor = client .get_descriptors::>(account) .unwrap(); - assert!(descriptor.internal.len() > 0); - assert!(descriptor.receive.len() > 0); + assert!(!descriptor.internal.is_empty()); + assert!(!descriptor.receive.is_empty()); } #[test] @@ -199,7 +199,7 @@ mod tests { fn test_sign_tx() { let devices = HWIClient::enumerate().unwrap(); let device = devices.first().unwrap().as_ref().unwrap(); - let client = HWIClient::get_client(&device, true, TESTNET).unwrap(); + let client = HWIClient::get_client(device, true, TESTNET).unwrap(); let derivation_path = DerivationPath::from_str("m/44'/1'/0'/0/0").unwrap(); let address = client @@ -237,7 +237,7 @@ mod tests { input: vec![previous_txin], output: vec![TxOut { value: Amount::from_sat(50), - script_pubkey: script_pubkey, + script_pubkey, }], }, xpub: Default::default(),