Skip to content

Commit

Permalink
ci(speculos): set version to 0.8.3, fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
notmandatory committed Jun 4, 2024
1 parent 0cbd532 commit dd3e6d9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 25 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,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
Expand Down
2 changes: 1 addition & 1 deletion ci/Dockerfile.ledger
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/ledgerhq/speculos
FROM ghcr.io/ledgerhq/speculos:0.8.3

RUN apt-get update
RUN apt-get install wget -y
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msrv="1.48.0"
msrv="1.63.0"
17 changes: 9 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#[cfg(test)]
#[macro_use]
extern crate serial_test;
extern crate core;

pub use interface::HWIClient;

Expand Down Expand Up @@ -58,7 +59,7 @@ mod tests {
#[serial]
fn test_enumerate() {
let devices = HWIClient::enumerate().unwrap();
assert!(devices.len() > 0);
assert!(!devices.is_empty());
}

#[test]
Expand All @@ -82,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]
Expand Down Expand Up @@ -118,8 +119,8 @@ mod tests {
let client = get_first_device();
let account = Some(10);
let descriptor = client.get_descriptors::<String>(account).unwrap();
assert!(descriptor.internal.len() > 0);
assert!(descriptor.receive.len() > 0);
assert!(!descriptor.internal.is_empty());
assert!(!descriptor.receive.is_empty());
}

#[test]
Expand All @@ -140,8 +141,8 @@ mod tests {
let descriptor = client
.get_descriptors::<Descriptor<DescriptorPublicKey>>(account)
.unwrap();
assert!(descriptor.internal.len() > 0);
assert!(descriptor.receive.len() > 0);
assert!(!descriptor.internal.is_empty());
assert!(!descriptor.receive.is_empty());
}

#[test]
Expand Down Expand Up @@ -198,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
Expand Down Expand Up @@ -236,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(),
Expand Down
11 changes: 7 additions & 4 deletions src/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use core::fmt;
use std::convert::TryFrom;
use std::fmt::{Display, Formatter};
use std::ops::Deref;
use std::str::FromStr;

Expand Down Expand Up @@ -260,9 +262,9 @@ where
}
}

impl ToString for HWIDeviceType {
fn to_string(&self) -> String {
match self {
impl Display for HWIDeviceType {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let name = match self {
Self::Ledger => String::from("ledger"),
Self::Trezor => String::from("trezor"),
Self::BitBox01 => String::from("digitalbitbox"),
Expand All @@ -271,7 +273,8 @@ impl ToString for HWIDeviceType {
Self::Coldcard => String::from("coldcard"),
Self::Jade => String::from("jade"),
Self::Other(name) => name.to_string(),
}
};
fmt::Display::fmt(&name, f)
}
}

Expand Down

0 comments on commit dd3e6d9

Please sign in to comment.