Skip to content

Commit

Permalink
Merge pull request #127 from LedgerHQ/xch/remove-unused-snapshots
Browse files Browse the repository at this point in the history
Tests snapshots
  • Loading branch information
xchapron-ledger authored Feb 27, 2024
2 parents 5489201 + 0f71b19 commit 8e38482
Show file tree
Hide file tree
Showing 33 changed files with 30 additions and 3 deletions.
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

0 comments on commit 8e38482

Please sign in to comment.