Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests snapshots #127

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions tests/monero_client/monero_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)")

Expand All @@ -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)")

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)")

Expand Down Expand Up @@ -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)")

Expand Down Expand Up @@ -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)")

Expand Down
Binary file modified tests/snapshots/nanos/test_prefix_hash_hash_init/00002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/snapshots/nanos/test_validate_prehash_init/00002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified tests/snapshots/stax/test_prefix_hash_hash_init/00000.png
Loading