From 734c397bbe173e884ccada61a089625b93cb599d Mon Sep 17 00:00:00 2001 From: Ilya Artemov Date: Tue, 21 Jan 2025 16:33:16 +0100 Subject: [PATCH] Addressing remarks from https://github.com/LedgerHQ/app-monero/pull/145 --- tests/monero_client/monero_cmd.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/monero_client/monero_cmd.py b/tests/monero_client/monero_cmd.py index bfd8f90..0510a5e 100644 --- a/tests/monero_client/monero_cmd.py +++ b/tests/monero_client/monero_cmd.py @@ -27,6 +27,7 @@ from .utils.varint import encode_varint from .utils.utils import get_nano_review_instructions from pathlib import Path +from ragger.firmware import Firmware from ragger.navigator import NavInsID, NavIns PROTOCOL_VERSION: int = 3 @@ -223,13 +224,13 @@ def prefix_hash_init(self, backend, test_name, firmware, navigator, version: int encode_varint(timelock) ]) - if firmware.device == "nanos": + if firmware == Firmware.NANOS: instructions = get_nano_review_instructions(1) - elif firmware.device.startswith("nano"): + elif firmware.is_nano: instructions = get_nano_review_instructions(1) else: instructions = [ - NavIns(NavInsID.SWIPE_CENTER_TO_LEFT) + NavInsID.SWIPE_CENTER_TO_LEFT ] with self.device.send_async(cla=PROTOCOL_VERSION, ins=ins, @@ -386,13 +387,13 @@ def validate_prehash_init(self, # txntype is skipped in the app payload: bytes = struct.pack("B", txntype) + encode_varint(txnfee) - if firmware.device == "nanos": + if firmware == Firmware.NANOS: instructions = get_nano_review_instructions(1) - elif firmware.device.startswith("nano"): + elif firmware.is_nano: instructions = get_nano_review_instructions(1) else: instructions = [ - NavIns(NavInsID.USE_CASE_REVIEW_TAP) + NavInsID.USE_CASE_REVIEW_TAP ] with self.device.send_async(cla=PROTOCOL_VERSION, @@ -402,7 +403,7 @@ def validate_prehash_init(self, option=0, payload=payload): - if firmware.device.startswith("nano"): + if firmware.is_nano: navigator.navigate_and_compare(TESTS_ROOT_DIR, test_name + "_prehash_init", instructions) @@ -450,12 +451,12 @@ def validate_prehash_update(self, blinded_amount )) - if firmware.device == "nanos": + if firmware == Firmware.NANOS: if is_last: instructions = get_nano_review_instructions(1) else: instructions = get_nano_review_instructions(7) - elif firmware.device.startswith("nano"): + elif firmware.is_nano: if is_last: instructions = get_nano_review_instructions(1) else: @@ -463,15 +464,14 @@ def validate_prehash_update(self, else: if is_last: instructions = [ -# NavIns(NavInsID.SWIPE_CENTER_TO_LEFT), - NavIns(NavInsID.USE_CASE_REVIEW_TAP), - NavIns(NavInsID.USE_CASE_REVIEW_CONFIRM) + NavInsID.USE_CASE_REVIEW_TAP, + NavInsID.USE_CASE_REVIEW_CONFIRM ] else: instructions = [ - NavIns(NavInsID.SWIPE_CENTER_TO_LEFT), - NavIns(NavInsID.SWIPE_CENTER_TO_LEFT), + NavInsID.SWIPE_CENTER_TO_LEFT, + NavInsID.SWIPE_CENTER_TO_LEFT, ] backend.wait_for_text_on_screen("Processing")