Skip to content

refactor(bhwi): isolate device interpreters from common types - #79

Open
trevarj wants to merge 4 commits into
wizardsardine:mainfrom
trevarj:trevarj/device_common_boundaries
Open

refactor(bhwi): isolate device interpreters from common types#79
trevarj wants to merge 4 commits into
wizardsardine:mainfrom
trevarj:trevarj/device_common_boundaries

Conversation

@trevarj

@trevarj trevarj commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • move conversions between common and device-native commands, responses, errors, and transmits into common::adapters
  • remove production common dependencies from the Ledger, Coldcard, Jade, and BitBox interpreters
  • model Ledger address display with LedgerDisplayAddress, allowing registered policies to start directly with the wallet-address APDU
  • add focused adapter coverage while retaining protocol-focused tests in each device module

Dependency

This is a draft pending #78. After it merges, this branch needs to be rebased and its detailed Ledger StoreError mapping preserved before final review.

Validation

Passed:

  • cargo fmt --all --check
  • cargo clippy --all --all-features --all-targets -- -A dead_code -D warnings
  • cargo test --verbose --no-default-features
  • cargo test --verbose --color always -- --nocapture
  • cargo test --all --exclude "bhwi-e2e-*" --verbose --color always -- --nocapture
  • Coldcard emulator startup and native e2e: 9/9
  • Coldcard CLI e2e: 6/6
  • Jade PIN server, QEMU startup, and initialization
  • Jade native e2e: 9/9
  • Jade CLI e2e: 8/8
  • BitBox simulator startup and native e2e: 8/8
  • BitBox restore lifecycle fixture: 1/1
  • BitBox CLI e2e: 4/4, with 2 intentionally ignored lifecycle tests

Closes #65

@edouardparis

Copy link
Copy Markdown
Member

Concept ACK.
We construct the common interface in common and we have clean directory per devices 👍

trevarj added 4 commits July 31, 2026 09:43
- model address display with Ledger-native requests
- move command, response, error, and transmit mappings to common
- skip redundant fingerprint lookup for registered policies
- keep multisig commands in protocol-native address formats
- move common command and response mappings to the adapter layer
- retain descriptor validation at the common boundary
- move command and descriptor shaping to the common boundary
- map Jade recipients, transmits, responses, and errors externally
- keep the CBOR interpreter focused on Jade-native types
- keep BitBox commands, responses, and transmits device-native
- move shared command and response mappings into the common layer
- preserve core and async behavior with focused adapter coverage
@trevarj
trevarj force-pushed the trevarj/device_common_boundaries branch from 91f045c to 582f241 Compare July 31, 2026 09:45
@trevarj
trevarj marked this pull request as ready for review August 4, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LedgerCommand and State should not rely on common::DisplayAddress

2 participants