Skip to content

Commit

Permalink
Addressing remarks from #145
Browse files Browse the repository at this point in the history
  • Loading branch information
iartemov-ledger committed Jan 21, 2025
1 parent f35a861 commit 734c397
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tests/monero_client/monero_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -450,28 +451,27 @@ 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:
instructions = get_nano_review_instructions(3)
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")
Expand Down

0 comments on commit 734c397

Please sign in to comment.