diff --git a/Dockerfile b/Dockerfile index 4fd1a39ec..48054e2fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -77,7 +77,7 @@ RUN pip3 install pyserial==3.4 ############ # build-software -# copy vendor, firmware and Kurx (src) files +# copy vendor, firmware and Krux (src) files # install embit dependency ############ FROM build-base AS build-software diff --git a/simulator/generate-device-screenshots.sh b/simulator/generate-device-screenshots.sh index b741b88a4..0df186dd8 100755 --- a/simulator/generate-device-screenshots.sh +++ b/simulator/generate-device-screenshots.sh @@ -52,9 +52,8 @@ poetry run python simulator.py --sequence sequences/home-options.txt --device $ poetry run python simulator.py --sequence sequences/encrypt-mnemonic.txt --sd --device $device poetry run python simulator.py --sequence sequences/extended-public-key-wpkh.txt --device $device poetry run python simulator.py --sequence sequences/extended-public-key-wsh.txt --device $device -poetry run python simulator.py --sequence sequences/wallet-wsh.txt --device $device -poetry run python simulator.py --sequence sequences/wallet-wpkh.txt --device $device -poetry run python simulator.py --sequence sequences/wallet-type-options.txt --device $device +poetry run python simulator.py --sequence sequences/wallet-descriptor-wsh.txt --device $device +poetry run python simulator.py --sequence sequences/wallet-descriptor-wpkh.txt --device $device poetry run python simulator.py --sequence sequences/scan-address.txt --device $device poetry run python simulator.py --sequence sequences/list-address.txt --device $device poetry run python simulator.py --sequence sequences/sign-psbt.txt --sd --device $device diff --git a/simulator/kruxsim/mocks/sensor.py b/simulator/kruxsim/mocks/sensor.py index 53a518cfe..cc1a85843 100644 --- a/simulator/kruxsim/mocks/sensor.py +++ b/simulator/kruxsim/mocks/sensor.py @@ -25,6 +25,9 @@ from cv2 import split, VideoCapture, cvtColor, COLOR_BGR2RGB, COLOR_BGR2LAB from numpy import std from PIL import Image +import time + +THREAD_DROP_PERIOD = 0.01 sequence_executor = None @@ -97,6 +100,9 @@ def find_qrcodes(img): def snapshot(): + # Temporarily yield execution to allow other threads to run + time.sleep(THREAD_DROP_PERIOD) + m = mock.MagicMock() if sequence_executor: if sequence_executor.camera_image is not None: @@ -127,7 +133,6 @@ def snapshot(): m.get_statistics.return_value = MockStatistics(lab_frame) m.width.return_value = frame.shape[1] m.height.return_value = frame.shape[0] - return m diff --git a/simulator/kruxsim/sequence.py b/simulator/kruxsim/sequence.py index bd15c2910..48b0903ba 100644 --- a/simulator/kruxsim/sequence.py +++ b/simulator/kruxsim/sequence.py @@ -28,7 +28,7 @@ from kruxsim.mocks.board import BOARD_CONFIG COMMANDS = ["press", "press_amigo_only", "touch", "qrcode", "screenshot", "wait", "include", "x"] -THREAD_PERIOD = 0.1 +THREAD_PERIOD = 0.05 class SequenceExecutor: @@ -78,6 +78,9 @@ def execute(self): self.command_timer += float(params[0]) self.command_fn = self.wait + # Pause this thread to give other threads time to execute + time.sleep(THREAD_PERIOD) + def press_key(self): key = self.command_params[0] self.key = None diff --git a/simulator/sequences/all-settings.txt b/simulator/sequences/all-settings.txt index 36f003a78..3ca251dcf 100644 --- a/simulator/sequences/all-settings.txt +++ b/simulator/sequences/all-settings.txt @@ -12,6 +12,8 @@ screenshot settings-options.png # Navigate to Bitcoin press BUTTON_A +press BUTTON_B +press BUTTON_A screenshot network-options.png @@ -19,6 +21,8 @@ screenshot network-options.png # Return press BUTTON_A +press BUTTON_B +press BUTTON_A # Navigate to Encryption press BUTTON_B @@ -57,7 +61,7 @@ press_amigo_only BUTTON_C press_amigo_only BUTTON_A # Move to printer -press_amigo_only BUTTON_B +x2 press_amigo_only BUTTON_B press_amigo_only BUTTON_A screenshot printer-options.png @@ -100,7 +104,7 @@ screenshot persist-options.png press BUTTON_A # Navigate to Appearance -press BUTTON_B +x2 press BUTTON_B press BUTTON_A screenshot settings-options-appearance.png diff --git a/simulator/sequences/amigo/_load-12-word-mnemonic.txt b/simulator/sequences/amigo/_load-12-word-mnemonic.txt index 67fe6743d..07fbdcaef 100644 --- a/simulator/sequences/amigo/_load-12-word-mnemonic.txt +++ b/simulator/sequences/amigo/_load-12-word-mnemonic.txt @@ -9,9 +9,5 @@ wait 0.5 # Confirm words press BUTTON_A -# Don't add a passphrase -press BUTTON_C -press BUTTON_A - -# Confirm fingerprint +# Confirm wallet press BUTTON_A diff --git a/simulator/sequences/amigo/_load-12-word-mnemonic_b.txt b/simulator/sequences/amigo/_load-12-word-mnemonic_b.txt index b1fbdc29c..eed425155 100644 --- a/simulator/sequences/amigo/_load-12-word-mnemonic_b.txt +++ b/simulator/sequences/amigo/_load-12-word-mnemonic_b.txt @@ -9,9 +9,5 @@ wait 0.5 # Confirm words press BUTTON_A -# Don't add a passphrase -press BUTTON_C -press BUTTON_A - -# Confirm fingerprint +# Confirm wallet press BUTTON_A diff --git a/simulator/sequences/amigo/_load-24-word-mnemonic.txt b/simulator/sequences/amigo/_load-24-word-mnemonic.txt index dc5fbcdfc..e33333e8e 100644 --- a/simulator/sequences/amigo/_load-24-word-mnemonic.txt +++ b/simulator/sequences/amigo/_load-24-word-mnemonic.txt @@ -9,9 +9,5 @@ wait 0.5 # Confirm words press BUTTON_A -# Don't add a passphrase -press BUTTON_C -press BUTTON_A - -# Confirm fingerprint +# Confirm wallet press BUTTON_A diff --git a/simulator/sequences/extended-public-key-wpkh.txt b/simulator/sequences/extended-public-key-wpkh.txt index ea295d3c1..5eaac1f12 100644 --- a/simulator/sequences/extended-public-key-wpkh.txt +++ b/simulator/sequences/extended-public-key-wpkh.txt @@ -1,10 +1,7 @@ include _load-12-word-mnemonic.txt -wait 1 -press BUTTON_A -wait 1 # Navigate to Extended Public Key -x2 press BUTTON_B +press BUTTON_B press BUTTON_A screenshot extended-public-key-menu.png diff --git a/simulator/sequences/extended-public-key-wsh.txt b/simulator/sequences/extended-public-key-wsh.txt index a9db4c74f..e4f5b3fd0 100644 --- a/simulator/sequences/extended-public-key-wsh.txt +++ b/simulator/sequences/extended-public-key-wsh.txt @@ -1,11 +1,10 @@ include _load-12-word-mnemonic.txt + +# Navigate to Extended Public Key press BUTTON_B press BUTTON_A -wait 1 -# Navigate to Extended Public Key -x2 press BUTTON_B -x2 press BUTTON_A +press BUTTON_A screenshot extended-public-key-wsh-xpub-text.png diff --git a/simulator/sequences/home-options.txt b/simulator/sequences/home-options.txt index 664315feb..6761ee1b3 100644 --- a/simulator/sequences/home-options.txt +++ b/simulator/sequences/home-options.txt @@ -1,24 +1,23 @@ include _load-12-word-mnemonic_b.txt -press BUTTON_A -wait 1 screenshot home-options.png - -# Mnemonic Backup options - press BUTTON_A screenshot backup-options.png -press BUTTON_A +x3 press BUTTON_A -screenshot backup-mnemonic-words.png +screenshot backup-qr-plain-text.png press BUTTON_A + +# Re-enable Amigo's physical buttons +press_amigo_only BUTTON_B + press BUTTON_B -x2 press BUTTON_A +press BUTTON_A -screenshot backup-mnemonic-numbers.png +screenshot backup-compact-qr.png press BUTTON_A press BUTTON_C @@ -26,25 +25,26 @@ press BUTTON_A press BUTTON_B press BUTTON_A -screenshot backup-qr-plain-text.png +screenshot backup-seed-qr.png +press BUTTON_A +press BUTTON_C +press BUTTON_A +x2 press BUTTON_B press BUTTON_A -# Re-enable Amigo's physical buttons -press_amigo_only BUTTON_B +# Go to "Other" options -press BUTTON_B -press BUTTON_A +x2 press BUTTON_B +x2 press BUTTON_A -screenshot backup-compact-qr.png +screenshot backup-mnemonic-words.png -press BUTTON_A -press BUTTON_C press BUTTON_A press BUTTON_B -press BUTTON_A +x2 press BUTTON_A -screenshot backup-seed-qr.png +screenshot backup-mnemonic-numbers.png press BUTTON_A press BUTTON_C diff --git a/simulator/sequences/list-address.txt b/simulator/sequences/list-address.txt index 1ef23a18c..b3094799a 100644 --- a/simulator/sequences/list-address.txt +++ b/simulator/sequences/list-address.txt @@ -1,9 +1,7 @@ include _load-12-word-mnemonic.txt -press BUTTON_A -wait 1 # Navigate to Scan Address -x4 press BUTTON_B +x3 press BUTTON_B press BUTTON_A screenshot address-menu.png diff --git a/simulator/sequences/load-mnemonic-sequence.txt b/simulator/sequences/load-mnemonic-sequence.txt index 65a68b1d7..214cb2b75 100644 --- a/simulator/sequences/load-mnemonic-sequence.txt +++ b/simulator/sequences/load-mnemonic-sequence.txt @@ -10,16 +10,10 @@ screenshot load-mnemonic-seq-mnemonic.png press BUTTON_A -screenshot load-mnemonic-seq-passphrase.png +screenshot load-mnemonic-seq-overview.png # No passphrase -press BUTTON_C +x2 press BUTTON_B press BUTTON_A -screenshot load-mnemonic-seq-fingerprint.png - -press BUTTON_A - -wait 0.1 -screenshot load-mnemonic-seq-single-multi.png - +screenshot wallet-customization-options.png diff --git a/simulator/sequences/m5stickv/_load-12-word-mnemonic.txt b/simulator/sequences/m5stickv/_load-12-word-mnemonic.txt index 67fe6743d..07fbdcaef 100644 --- a/simulator/sequences/m5stickv/_load-12-word-mnemonic.txt +++ b/simulator/sequences/m5stickv/_load-12-word-mnemonic.txt @@ -9,9 +9,5 @@ wait 0.5 # Confirm words press BUTTON_A -# Don't add a passphrase -press BUTTON_C -press BUTTON_A - -# Confirm fingerprint +# Confirm wallet press BUTTON_A diff --git a/simulator/sequences/m5stickv/_load-12-word-mnemonic_b.txt b/simulator/sequences/m5stickv/_load-12-word-mnemonic_b.txt index b1fbdc29c..eed425155 100644 --- a/simulator/sequences/m5stickv/_load-12-word-mnemonic_b.txt +++ b/simulator/sequences/m5stickv/_load-12-word-mnemonic_b.txt @@ -9,9 +9,5 @@ wait 0.5 # Confirm words press BUTTON_A -# Don't add a passphrase -press BUTTON_C -press BUTTON_A - -# Confirm fingerprint +# Confirm wallet press BUTTON_A diff --git a/simulator/sequences/m5stickv/_load-24-word-mnemonic.txt b/simulator/sequences/m5stickv/_load-24-word-mnemonic.txt index c798eca0a..a6c01f122 100644 --- a/simulator/sequences/m5stickv/_load-24-word-mnemonic.txt +++ b/simulator/sequences/m5stickv/_load-24-word-mnemonic.txt @@ -10,9 +10,5 @@ wait 0.5 press BUTTON_A press BUTTON_A -# Don't add a passphrase -press BUTTON_C -press BUTTON_A - -# Confirm fingerprint +# Confirm wallet press BUTTON_A diff --git a/simulator/sequences/new-mnemonic-options.txt b/simulator/sequences/new-mnemonic-options.txt index 06b7c3446..da70a9d13 100644 --- a/simulator/sequences/new-mnemonic-options.txt +++ b/simulator/sequences/new-mnemonic-options.txt @@ -20,7 +20,7 @@ qrcode arara.png screenshot new-mnemonic-via-snapshot-capturing.png -wait 0.5 +wait 0.3 press BUTTON_A @@ -36,7 +36,7 @@ press BUTTON_B press_amigo_only BUTTON_A # Move to D6 -press BUTTON_B +x2 press BUTTON_B press BUTTON_A # 12 words - intro ok diff --git a/simulator/sequences/print-qr.txt b/simulator/sequences/print-qr.txt index 9fcc29500..0e02e6e5c 100644 --- a/simulator/sequences/print-qr.txt +++ b/simulator/sequences/print-qr.txt @@ -1,13 +1,15 @@ include _load-12-word-mnemonic.txt -press BUTTON_A -wait 1 -# Navigate to Mnemonic Words print promt -x3 press BUTTON_A -wait 1 +# Navigate to Mnemonic Plain Text QR print promt +x5 press BUTTON_A +wait 0.1 screenshot print-qr-prompt.png +# Re-enable buttons on Amigo +press_amigo_only BUTTON_A + +# Confirm print press BUTTON_A screenshot print-qr-printing.png \ No newline at end of file diff --git a/simulator/sequences/scan-address.txt b/simulator/sequences/scan-address.txt index 7e4b5988e..3c27b82de 100644 --- a/simulator/sequences/scan-address.txt +++ b/simulator/sequences/scan-address.txt @@ -1,13 +1,11 @@ include _load-12-word-mnemonic.txt -press BUTTON_A -wait 1 # Navigate to Scan Address -x4 press BUTTON_B +x3 press BUTTON_B x3 press BUTTON_A qrcode specter-desktop-singlesig-wallet-receive-address.png -wait 0.5 +wait 0.1 screenshot scan-address-scanned-address.png @@ -15,7 +13,7 @@ press BUTTON_A press BUTTON_A -wait 1 +wait 0.1 # screenshot scan-address-valid-address.png press BUTTON_A @@ -23,7 +21,7 @@ press BUTTON_A press BUTTON_A qrcode invalid-receive-address.png -wait 0.5 +wait 0.1 press BUTTON_A @@ -32,6 +30,7 @@ press BUTTON_A # screenshot scan-address-searching.png press BUTTON_B +press_amigo_only BUTTON_A # screenshot scan-address-invalid-address.png diff --git a/simulator/sequences/set_to_multisig.txt b/simulator/sequences/set_to_multisig.txt new file mode 100644 index 000000000..9f5ea3bac --- /dev/null +++ b/simulator/sequences/set_to_multisig.txt @@ -0,0 +1,20 @@ +# Navigate to wallet +x2 press BUTTON_B +press BUTTON_A + +# Customize +x2 press BUTTON_B +x2 press BUTTON_A + +# Multisig +press BUTTON_B +press BUTTON_A +press BUTTON_B +press BUTTON_A + +# Return to initial state +press BUTTON_C +press BUTTON_A +x2 press BUTTON_B +press BUTTON_A +x2 press BUTTON_C \ No newline at end of file diff --git a/simulator/sequences/sign-message-at-address.txt b/simulator/sequences/sign-message-at-address.txt index 87f78fc37..67b02e354 100644 --- a/simulator/sequences/sign-message-at-address.txt +++ b/simulator/sequences/sign-message-at-address.txt @@ -1,6 +1,4 @@ include _load-12-word-mnemonic.txt -press BUTTON_A -wait 1 # Navigate to Sign x2 press BUTTON_C @@ -12,6 +10,6 @@ press BUTTON_B x2 press BUTTON_A qrcode message-at-address.png -wait 0.5 +wait 0.1 screenshot sign-message-at-address-prompt.png diff --git a/simulator/sequences/sign-message.txt b/simulator/sequences/sign-message.txt index dcd729b3c..18066d10a 100644 --- a/simulator/sequences/sign-message.txt +++ b/simulator/sequences/sign-message.txt @@ -1,6 +1,4 @@ include _load-12-word-mnemonic.txt -press BUTTON_A -wait 1 # Navigate to Sign x2 press BUTTON_C @@ -12,7 +10,7 @@ press BUTTON_B x2 press BUTTON_A qrcode message-sha256.png -wait 0.5 +wait 0.1 screenshot sign-message-sha256-sign-prompt.png @@ -20,8 +18,7 @@ press BUTTON_A # screenshot sign-message-signed-message-text.png -press BUTTON_A -press BUTTON_B +x2 press BUTTON_A # screenshot sign-message-signed-message-qr.png diff --git a/simulator/sequences/sign-psbt.txt b/simulator/sequences/sign-psbt.txt index cd47927d2..95c13bca8 100644 --- a/simulator/sequences/sign-psbt.txt +++ b/simulator/sequences/sign-psbt.txt @@ -1,6 +1,4 @@ include _load-12-word-mnemonic.txt -press BUTTON_A -wait 1 # Navigate to Sign x2 press BUTTON_C @@ -12,15 +10,15 @@ screenshot sign-options.png x2 press BUTTON_A qrcode singlesig-psbt-p1of5.png -wait 0.5 +wait 0.1 qrcode singlesig-psbt-p2of5.png -wait 0.5 +wait 0.1 qrcode singlesig-psbt-p3of5.png -wait 0.5 +wait 0.1 qrcode singlesig-psbt-p4of5.png -wait 0.5 +wait 0.1 qrcode singlesig-psbt-p5of5.png -wait 0.5 +wait 0.1 # screenshot sign-psbt-info-1.png @@ -34,6 +32,10 @@ press BUTTON_A press BUTTON_A +# screenshot sign-psbt-info-4.png + +press BUTTON_A + screenshot sign-psbt-sign-prompt.png press BUTTON_A diff --git a/simulator/sequences/tools-mnemonic.txt b/simulator/sequences/tools-mnemonic.txt index a77b96f49..98bde570a 100644 --- a/simulator/sequences/tools-mnemonic.txt +++ b/simulator/sequences/tools-mnemonic.txt @@ -5,7 +5,7 @@ x3 press BUTTON_B press BUTTON_A # Delete Mnemonic -x3 press BUTTON_B +x4 press BUTTON_B press BUTTON_A screenshot delete-mnemonic.png diff --git a/simulator/sequences/tools-wipe-device.txt b/simulator/sequences/tools-wipe-device.txt index e5173f371..bfc21ca95 100644 --- a/simulator/sequences/tools-wipe-device.txt +++ b/simulator/sequences/tools-wipe-device.txt @@ -5,7 +5,7 @@ x3 press BUTTON_B press BUTTON_A # Wipe Device -x4 press BUTTON_B +x5 press BUTTON_B press BUTTON_A screenshot wipe-device.png diff --git a/simulator/sequences/wallet-wpkh.txt b/simulator/sequences/wallet-descriptor-wpkh.txt similarity index 64% rename from simulator/sequences/wallet-wpkh.txt rename to simulator/sequences/wallet-descriptor-wpkh.txt index b33efceac..01caa2682 100644 --- a/simulator/sequences/wallet-wpkh.txt +++ b/simulator/sequences/wallet-descriptor-wpkh.txt @@ -1,16 +1,15 @@ include _load-12-word-mnemonic.txt -press BUTTON_A -wait 1 -# Navigate to Wallet -x3 press BUTTON_B -press BUTTON_A +# Navigate to Wallet Descriptor +x2 press BUTTON_B +x2 press BUTTON_A screenshot wallet-load-prompt.png -press BUTTON_A +#Load from QR code +x2 press BUTTON_A qrcode specter-desktop-singlesig-wallet.png -wait 0.5 +wait 0.1 screenshot wallet-wpkh-load-prompt.png diff --git a/simulator/sequences/wallet-wsh.txt b/simulator/sequences/wallet-descriptor-wsh.txt similarity index 73% rename from simulator/sequences/wallet-wsh.txt rename to simulator/sequences/wallet-descriptor-wsh.txt index 89068f395..75d55e81c 100644 --- a/simulator/sequences/wallet-wsh.txt +++ b/simulator/sequences/wallet-descriptor-wsh.txt @@ -1,31 +1,32 @@ include _load-12-word-mnemonic.txt -press BUTTON_B -press BUTTON_A -wait 1 -# Navigate to Wallet -x3 press BUTTON_B -press BUTTON_A +include set_to_multisig.txt + +# Navigate to Wallet Descriptor +x2 press BUTTON_B +x2 press BUTTON_A screenshot wallet-load-prompt.png -press BUTTON_A +#Load from QR code +x2 press BUTTON_A + qrcode specter-desktop-multisig-wallet-p1of8.png -wait 0.5 +wait 0.1 qrcode specter-desktop-multisig-wallet-p2of8.png -wait 0.5 +wait 0.1 qrcode specter-desktop-multisig-wallet-p3of8.png -wait 0.5 +wait 0.1 qrcode specter-desktop-multisig-wallet-p4of8.png -wait 0.5 +wait 0.1 qrcode specter-desktop-multisig-wallet-p5of8.png -wait 0.5 +wait 0.1 qrcode specter-desktop-multisig-wallet-p6of8.png -wait 0.5 +wait 0.1 qrcode specter-desktop-multisig-wallet-p7of8.png -wait 0.5 +wait 0.1 qrcode specter-desktop-multisig-wallet-p8of8.png -wait 1 +wait 0.1 screenshot wallet-wsh-load-prompt-fingerprints.png diff --git a/simulator/sequences/wallet-type-options.txt b/simulator/sequences/wallet-type-options.txt deleted file mode 100644 index c86b8ac81..000000000 --- a/simulator/sequences/wallet-type-options.txt +++ /dev/null @@ -1,9 +0,0 @@ -include _load-12-word-mnemonic.txt - -screenshot wallet-type-options.png - -# screenshot wallet-type-options-single-sig.png - -press BUTTON_B - -screenshot wallet-type-options-multisig.png \ No newline at end of file