diff --git a/tests/monero_client/monero_cmd.py b/tests/monero_client/monero_cmd.py index ea16c87..ffde497 100644 --- a/tests/monero_client/monero_cmd.py +++ b/tests/monero_client/monero_cmd.py @@ -35,6 +35,7 @@ class MoneroCmd(MoneroCryptoCmd): def __init__(self, debug, backend) -> None: + self.backend = backend MoneroCryptoCmd.__init__(self, backend, debug) def reset_and_get_version(self, @@ -79,6 +80,8 @@ def set_signature_mode(self, sig_type: SigType) -> int: sw, response = self.device.recv() # type: int, bytes + # No screen change expected + if not sw & 0x9000: raise DeviceError(error_code=sw, ins=ins) @@ -106,6 +109,9 @@ def open_tx(self) -> Tuple[bytes, bytes, bytes, bytes]: sw, response = self.device.recv() # type: int, bytes + # Wait for internal backend screen to be up to date before continuing + self.backend.wait_for_screen_change() + if not sw & 0x9000: raise DeviceError(error_code=sw, ins=ins) @@ -147,6 +153,9 @@ def close_tx(self) -> None: sw, response = self.device.recv() # type: int, bytes + # Wait for internal backend screen to be up to date before continuing + self.backend.wait_for_screen_change() + if not sw & 0x9000: raise DeviceError(error_code=sw, ins=ins) @@ -189,6 +198,8 @@ def gen_txout_keys(self, sw, response = self.device.recv() # type: int, bytes + # No screen change expected + if not sw & 0x9000: raise DeviceError(error_code=sw, ins=ins) @@ -230,10 +241,12 @@ def prefix_hash_init(self, backend, test_name, firmware, navigator, version: int navigator.navigate_and_compare(TESTS_ROOT_DIR, test_name + "_hash_init", - instructions, screen_change_after_last_instruction=False) + instructions) sw, response = self.device.async_response() # type: int, bytes + # Screen change already waited in navigate_and_compare() above + if not sw & 0x9000: raise DeviceError(error_code=sw, ins=ins, message="P1=1 (init)") @@ -251,6 +264,8 @@ def prefix_hash_update(self, index: int, payload: bytes, is_last: bool) -> bytes sw, response = self.device.recv() # type: int, bytes + # No screen change expected + if not sw & 0x9000: raise DeviceError(error_code=sw, ins=ins, message="P1=2 (update)") @@ -279,6 +294,8 @@ def gen_commitment_mask(self, _ak_amount: bytes) -> bytes: sw, response = self.device.recv() # type: int, bytes + # No screen change expected + if not sw & 0x9000: raise DeviceError(error_code=sw, ins=ins) @@ -311,6 +328,8 @@ def blind(self, sw, response = self.device.recv() # type: int, bytes + # No screen change expected + if not sw & 0x9000: raise DeviceError(error_code=sw, ins=ins) @@ -345,6 +364,8 @@ def unblind(self, sw, response = self.device.recv() # type: int, bytes + # No screen change expected + if not sw & 0x9000: raise DeviceError(error_code=sw, ins=ins) @@ -386,12 +407,14 @@ def validate_prehash_init(self, if firmware.device.startswith("nano"): navigator.navigate_and_compare(TESTS_ROOT_DIR, test_name + "_prehash_init", - instructions, screen_change_after_last_instruction=False) + instructions) else: pass sw, response = self.device.async_response() # type: int, bytes + # Screen change already waited in navigate_and_compare() above + if not sw & 0x9000: raise DeviceError(error_code=sw, ins=ins, message="P1=1 (init)") @@ -452,10 +475,12 @@ def validate_prehash_update(self, backend.wait_for_text_not_on_screen("Processing") navigator.navigate_and_compare(TESTS_ROOT_DIR, test_name + "_prehash_update", - instructions, screen_change_after_last_instruction=False, screen_change_before_first_instruction=False) + instructions, screen_change_before_first_instruction=False) sw, response = self.device.async_response() # type: int, bytes + # Screen change already waited in navigate_and_compare() above + if not sw & 0x9000: raise DeviceError(error_code=sw, ins=ins, message="P1=2 (update)") @@ -498,6 +523,8 @@ def validate_prehash_finalize(self, sw, response = self.device.recv() # type: int, bytes + # No screen change expected + if not sw & 0x9000: raise DeviceError(error_code=sw, ins=ins, message="P1=3 (finalize)") diff --git a/tests/snapshots/nanos/test_prefix_hash_hash_init/00002.png b/tests/snapshots/nanos/test_prefix_hash_hash_init/00002.png index 9c7e704..2360dfb 100644 Binary files a/tests/snapshots/nanos/test_prefix_hash_hash_init/00002.png and b/tests/snapshots/nanos/test_prefix_hash_hash_init/00002.png differ diff --git a/tests/snapshots/nanos/test_prefix_hashhash_init/00000.png b/tests/snapshots/nanos/test_prefix_hashhash_init/00000.png deleted file mode 100644 index 6e08000..0000000 Binary files a/tests/snapshots/nanos/test_prefix_hashhash_init/00000.png and /dev/null differ diff --git a/tests/snapshots/nanos/test_prefix_hashhash_init/00001.png b/tests/snapshots/nanos/test_prefix_hashhash_init/00001.png deleted file mode 100644 index 4b33233..0000000 Binary files a/tests/snapshots/nanos/test_prefix_hashhash_init/00001.png and /dev/null differ diff --git a/tests/snapshots/nanos/test_prefix_hashhash_init/00002.png b/tests/snapshots/nanos/test_prefix_hashhash_init/00002.png deleted file mode 100644 index cb243a7..0000000 Binary files a/tests/snapshots/nanos/test_prefix_hashhash_init/00002.png and /dev/null differ diff --git a/tests/snapshots/nanos/test_prefix_hashhash_init/00003.png b/tests/snapshots/nanos/test_prefix_hashhash_init/00003.png deleted file mode 100644 index 0830ee5..0000000 Binary files a/tests/snapshots/nanos/test_prefix_hashhash_init/00003.png and /dev/null differ diff --git a/tests/snapshots/nanos/test_validate_prehash_init/00002.png b/tests/snapshots/nanos/test_validate_prehash_init/00002.png index 9c7e704..2360dfb 100644 Binary files a/tests/snapshots/nanos/test_validate_prehash_init/00002.png and b/tests/snapshots/nanos/test_validate_prehash_init/00002.png differ diff --git a/tests/snapshots/nanos/test_validate_prehash_update/00008.png b/tests/snapshots/nanos/test_validate_prehash_update/00008.png new file mode 100644 index 0000000..2360dfb Binary files /dev/null and b/tests/snapshots/nanos/test_validate_prehash_update/00008.png differ diff --git a/tests/snapshots/nanos/test_validateprehash_init/00000.png b/tests/snapshots/nanos/test_validateprehash_init/00000.png deleted file mode 100644 index b3351db..0000000 Binary files a/tests/snapshots/nanos/test_validateprehash_init/00000.png and /dev/null differ diff --git a/tests/snapshots/nanos/test_validateprehash_init/00001.png b/tests/snapshots/nanos/test_validateprehash_init/00001.png deleted file mode 100644 index fba575a..0000000 Binary files a/tests/snapshots/nanos/test_validateprehash_init/00001.png and /dev/null differ diff --git a/tests/snapshots/nanos/test_validateprehash_init/00002.png b/tests/snapshots/nanos/test_validateprehash_init/00002.png deleted file mode 100644 index a65895a..0000000 Binary files a/tests/snapshots/nanos/test_validateprehash_init/00002.png and /dev/null differ diff --git a/tests/snapshots/nanos/test_validateprehash_init/00003.png b/tests/snapshots/nanos/test_validateprehash_init/00003.png deleted file mode 100644 index 0830ee5..0000000 Binary files a/tests/snapshots/nanos/test_validateprehash_init/00003.png and /dev/null differ diff --git a/tests/snapshots/nanosp/test_prefix_hash_hash_init/00002.png b/tests/snapshots/nanosp/test_prefix_hash_hash_init/00002.png new file mode 100644 index 0000000..b1a8fd9 Binary files /dev/null and b/tests/snapshots/nanosp/test_prefix_hash_hash_init/00002.png differ diff --git a/tests/snapshots/nanosp/test_prefix_hashhash_init/00000.png b/tests/snapshots/nanosp/test_prefix_hashhash_init/00000.png deleted file mode 100644 index b02564f..0000000 Binary files a/tests/snapshots/nanosp/test_prefix_hashhash_init/00000.png and /dev/null differ diff --git a/tests/snapshots/nanosp/test_prefix_hashhash_init/00001.png b/tests/snapshots/nanosp/test_prefix_hashhash_init/00001.png deleted file mode 100644 index 0a22ed9..0000000 Binary files a/tests/snapshots/nanosp/test_prefix_hashhash_init/00001.png and /dev/null differ diff --git a/tests/snapshots/nanosp/test_prefix_hashhash_init/00002.png b/tests/snapshots/nanosp/test_prefix_hashhash_init/00002.png deleted file mode 100644 index 1eed799..0000000 Binary files a/tests/snapshots/nanosp/test_prefix_hashhash_init/00002.png and /dev/null differ diff --git a/tests/snapshots/nanosp/test_validate_prehash_init/00002.png b/tests/snapshots/nanosp/test_validate_prehash_init/00002.png new file mode 100644 index 0000000..b1a8fd9 Binary files /dev/null and b/tests/snapshots/nanosp/test_validate_prehash_init/00002.png differ diff --git a/tests/snapshots/nanosp/test_validate_prehash_update/00004.png b/tests/snapshots/nanosp/test_validate_prehash_update/00004.png new file mode 100644 index 0000000..b1a8fd9 Binary files /dev/null and b/tests/snapshots/nanosp/test_validate_prehash_update/00004.png differ diff --git a/tests/snapshots/nanosp/test_validateprehash_init/00000.png b/tests/snapshots/nanosp/test_validateprehash_init/00000.png deleted file mode 100644 index 7013ca3..0000000 Binary files a/tests/snapshots/nanosp/test_validateprehash_init/00000.png and /dev/null differ diff --git a/tests/snapshots/nanosp/test_validateprehash_init/00001.png b/tests/snapshots/nanosp/test_validateprehash_init/00001.png deleted file mode 100644 index 0a22ed9..0000000 Binary files a/tests/snapshots/nanosp/test_validateprehash_init/00001.png and /dev/null differ diff --git a/tests/snapshots/nanosp/test_validateprehash_init/00002.png b/tests/snapshots/nanosp/test_validateprehash_init/00002.png deleted file mode 100644 index 1eed799..0000000 Binary files a/tests/snapshots/nanosp/test_validateprehash_init/00002.png and /dev/null differ diff --git a/tests/snapshots/nanox/test_prefix_hash_hash_init/00002.png b/tests/snapshots/nanox/test_prefix_hash_hash_init/00002.png new file mode 100644 index 0000000..b1a8fd9 Binary files /dev/null and b/tests/snapshots/nanox/test_prefix_hash_hash_init/00002.png differ diff --git a/tests/snapshots/nanox/test_prefix_hashhash_init/00000.png b/tests/snapshots/nanox/test_prefix_hashhash_init/00000.png deleted file mode 100644 index b02564f..0000000 Binary files a/tests/snapshots/nanox/test_prefix_hashhash_init/00000.png and /dev/null differ diff --git a/tests/snapshots/nanox/test_prefix_hashhash_init/00001.png b/tests/snapshots/nanox/test_prefix_hashhash_init/00001.png deleted file mode 100644 index 0a22ed9..0000000 Binary files a/tests/snapshots/nanox/test_prefix_hashhash_init/00001.png and /dev/null differ diff --git a/tests/snapshots/nanox/test_prefix_hashhash_init/00002.png b/tests/snapshots/nanox/test_prefix_hashhash_init/00002.png deleted file mode 100644 index 1eed799..0000000 Binary files a/tests/snapshots/nanox/test_prefix_hashhash_init/00002.png and /dev/null differ diff --git a/tests/snapshots/nanox/test_validate_prehash_init/00002.png b/tests/snapshots/nanox/test_validate_prehash_init/00002.png new file mode 100644 index 0000000..b1a8fd9 Binary files /dev/null and b/tests/snapshots/nanox/test_validate_prehash_init/00002.png differ diff --git a/tests/snapshots/nanox/test_validate_prehash_update/00004.png b/tests/snapshots/nanox/test_validate_prehash_update/00004.png new file mode 100644 index 0000000..b1a8fd9 Binary files /dev/null and b/tests/snapshots/nanox/test_validate_prehash_update/00004.png differ diff --git a/tests/snapshots/nanox/test_validateprehash_init/00000.png b/tests/snapshots/nanox/test_validateprehash_init/00000.png deleted file mode 100644 index 7013ca3..0000000 Binary files a/tests/snapshots/nanox/test_validateprehash_init/00000.png and /dev/null differ diff --git a/tests/snapshots/nanox/test_validateprehash_init/00001.png b/tests/snapshots/nanox/test_validateprehash_init/00001.png deleted file mode 100644 index 0a22ed9..0000000 Binary files a/tests/snapshots/nanox/test_validateprehash_init/00001.png and /dev/null differ diff --git a/tests/snapshots/nanox/test_validateprehash_init/00002.png b/tests/snapshots/nanox/test_validateprehash_init/00002.png deleted file mode 100644 index 1eed799..0000000 Binary files a/tests/snapshots/nanox/test_validateprehash_init/00002.png and /dev/null differ diff --git a/tests/snapshots/stax/test_prefix_hash_hash_init/00000.png b/tests/snapshots/stax/test_prefix_hash_hash_init/00000.png index cfb9942..b77c0a4 100644 Binary files a/tests/snapshots/stax/test_prefix_hash_hash_init/00000.png and b/tests/snapshots/stax/test_prefix_hash_hash_init/00000.png differ diff --git a/tests/snapshots/stax/test_prefix_hash_hash_init/00001.png b/tests/snapshots/stax/test_prefix_hash_hash_init/00001.png new file mode 100644 index 0000000..cfb9942 Binary files /dev/null and b/tests/snapshots/stax/test_prefix_hash_hash_init/00001.png differ diff --git a/tests/snapshots/stax/test_validate_prehash_update/00003.png b/tests/snapshots/stax/test_validate_prehash_update/00003.png new file mode 100644 index 0000000..264824a Binary files /dev/null and b/tests/snapshots/stax/test_validate_prehash_update/00003.png differ