-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[blind] remove the too many screen flow
- no more limit of screens (even in Blind mode ON) - no more warning screens for too many screen - large tx option acts like Blind mode OFF Co-authored-by: Ajinkya <[email protected]>
- Loading branch information
1 parent
ec8c4c2
commit 5886bac
Showing
62 changed files
with
53 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-16.1 KB
...hots/flex/test_blindsign_different_modes/blindsign_warning_too_many_screens.png
Binary file not shown.
Binary file removed
BIN
-18.9 KB
...tion/touch/snapshots/flex/test_blindsign_different_modes/tbdm_op_0_screen_9.png
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added
BIN
+19.7 KB
...on/touch/snapshots/flex/test_blindsign_different_modes/tbdm_screen_skip_3_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added
BIN
+19 KB
...on/touch/snapshots/flex/test_blindsign_different_modes/tbdm_screen_skip_3_3.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 added
BIN
+19.6 KB
...on/touch/snapshots/flex/test_blindsign_different_modes/tbdm_screen_skip_3_4.png
Oops, something went wrong.
Binary file added
BIN
+19.7 KB
...on/touch/snapshots/flex/test_blindsign_different_modes/tbdm_screen_skip_3_5.png
Oops, something went wrong.
Binary file added
BIN
+19.9 KB
...on/touch/snapshots/flex/test_blindsign_different_modes/tbdm_screen_skip_4_1.png
Oops, something went wrong.
Binary file added
BIN
+20.8 KB
...on/touch/snapshots/flex/test_blindsign_different_modes/tbdm_screen_skip_4_2.png
Oops, something went wrong.
Binary file added
BIN
+8.97 KB
...on/touch/snapshots/flex/test_blindsign_different_modes/tbdm_screen_skip_4_3.png
Oops, something went wrong.
Binary file removed
BIN
-12.8 KB
...on/touch/snapshots/flex/test_blindsign_different_modes/tbdm_skip_screen_2_3.png
Diff not rendered.
Binary file removed
BIN
-14.5 KB
...hots/stax/test_blindsign_different_modes/blindsign_warning_too_many_screens.png
Diff not rendered.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added
BIN
+19.7 KB
...on/touch/snapshots/stax/test_blindsign_different_modes/tbdm_screen_skip_3_1.png
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added
BIN
+17.8 KB
...on/touch/snapshots/stax/test_blindsign_different_modes/tbdm_screen_skip_3_5.png
Oops, something went wrong.
Binary file added
BIN
+17.7 KB
...on/touch/snapshots/stax/test_blindsign_different_modes/tbdm_screen_skip_3_6.png
Oops, something went wrong.
Binary file added
BIN
+18 KB
...on/touch/snapshots/stax/test_blindsign_different_modes/tbdm_screen_skip_4_1.png
Oops, something went wrong.
Binary file added
BIN
+15.7 KB
...on/touch/snapshots/stax/test_blindsign_different_modes/tbdm_screen_skip_4_2.png
Oops, something went wrong.
Binary file removed
BIN
-17.2 KB
...on/touch/snapshots/stax/test_blindsign_different_modes/tbdm_skip_screen_2_2.png
Diff not rendered.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright 2023 Trilitech <[email protected]> | ||
# Copyright 2024 Functori <[email protected]> | ||
|
||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
|
@@ -16,39 +17,41 @@ | |
from utils import ( | ||
tezos_app, | ||
TezosAppScreen, | ||
send_payload, BlindsigningStatus | ||
send_payload, | ||
BlindsigningStatus, | ||
) | ||
|
||
from ragger.firmware import Firmware | ||
#Response: c9fc57555a59876454427adadeb62cf365bf936e346def12f0729e6a1c9d0eed81e1acced76fddb6ec90619a12d8904dd9ba07f64a9f2c4e05a692224ec7bdb1d357b90a03a0d8f441b048d0cff72e997aac00d657725f67afb68c76eacb79029000 | ||
|
||
def blindsign_common(app: TezosAppScreen): | ||
def navigate_screens(app: TezosAppScreen, group: int, screen_count: int, suffix: str): | ||
for i in range(screen_count): | ||
app.assert_screen("tbdm_screen_" + suffix + str(group) + "_" + str(i+1)) | ||
app.review.next() | ||
|
||
|
||
def navigate_common(app: TezosAppScreen, skip: bool =False, group_counts: list = []): | ||
suffix = "" | ||
if skip: | ||
suffix = "skip_" | ||
app.send_initialize_msg( "800f000011048000002c800006c18000000080000000") | ||
send_payload(app, "800f01ffeb0300000000000000000000000000000000000000000000000000000000000000006b00ffdd6102321bc251e4a5190ad5b12b251069d9b4c0843d0b0104020320182716513907b6bab33f905396d031931c07e01bddd780780c1a56b9c086da6c00ffdd6102321bc251e4a5190ad5b12b251069d9b480897a0c0107c08db701000278eb8b6ab9a768579cd5146b480789650c83f28effff0d7570646174655f636f6e6669670000000607070005030a6e00ffdd6102321bc251e4a5190ad5b12b251069d9b4c08db7010d0105ff01ee572f02e5be5d097ba17369789582882e8abb87c900ffdd6102321bc2") | ||
app.assert_screen("review_transaction") | ||
app.review.next() | ||
app.assert_screen("tbdm_op_0_screen_1") | ||
app.review.next() | ||
app.assert_screen("tbdm_op_0_screen_2") | ||
app.review.next() | ||
app.assert_screen("tbdm_op_0_screen_3") | ||
app.review.next() | ||
if(app.firmware == Firmware.FLEX): | ||
app.assert_screen("tbdm_op_0_screen_3_flex_1") | ||
app.review.next() | ||
navigate_screens(app, group= 1, screen_count = group_counts[1 - 1 ], suffix=suffix) | ||
app.assert_screen("expert_mode_splash") | ||
app.review.next() | ||
app.assert_screen("tbdm_op_0_screen_4") | ||
app.review.next() | ||
if(app.firmware == Firmware.FLEX): | ||
app.assert_screen("tbdm_op_0_screen_4_flex_1") | ||
app.review.next() | ||
navigate_screens(app, group= 2, screen_count= group_counts[2 - 1 ], suffix=suffix) | ||
app.expect_apdu_return("9000") | ||
app.send_apdu("800f01ffeb51e4a5190ad5b12b251069d9b48092f4010e0106000000fa000000086d65737361676530000000086d65737361676531000000086d65737361676532000000086d65737361676533000000086d65737361676534000000086d65737361676535000000086d65737361676536000000086d65737361676537000000086d65737361676538000000086d65737361676539000000096d6573736167653130000000096d6573736167653131000000096d6573736167653132000000096d6573736167653133000000096d6573736167653134000000096d6573736167653135000000096d6573736167653136") | ||
if app.firmware == Firmware.FLEX: | ||
app.assert_screen("tbdm_op_0_screen_4_flex_2") | ||
app.review.next() | ||
app.assert_screen("tbdm_op_0_screen_5") | ||
navigate_screens(app, group= 3, screen_count= group_counts[3 - 1 ], suffix=suffix) | ||
app.expect_apdu_return("9000") | ||
app.send_apdu("800f81ff48000000096d6573736167653137000000096d6573736167653138000000096d65737361676531397000ffdd6102321bc251e4a5190ad5b12b251069d9b4c0843d0f0103ff80ade204") | ||
navigate_screens(app, group= 4, screen_count= group_counts[4 - 1 ], suffix=suffix) | ||
app.review.next() | ||
expected_apdu = "a2ef5aec1ad8cc9b35dee48e8a47e418108dec7652159f3a4314c29d91f172f4645db9554b5a8a565307d9a9e65260957409efef54835573b8fc43d6162f99b8e17a557f7f82c46a53ca7c2be7aa540239d394cd5e9dbf14312c8e1e331a2b099000" | ||
app.review_confirm_signing(expected_apdu) | ||
|
||
|
||
|
||
def blindsign_review_sign(app: TezosAppScreen): | ||
|
@@ -65,54 +68,31 @@ def blindsign_review_sign(app: TezosAppScreen): | |
if __name__ == "__main__": | ||
app = tezos_app(__file__) | ||
|
||
app.assert_home() | ||
app.set_expert_mode(initial_status=False) | ||
|
||
# Blindsign status OFF | ||
app.assert_home() | ||
app.set_expert_mode(initial_status= False) # need to know the current status of expert mode | ||
app.set_blindsigning_status(BlindsigningStatus.OFF) | ||
blindsign_common(app) | ||
app.assert_screen("tbdm_op_0_screen_6") | ||
app.review.next() | ||
app.assert_screen("tbdm_op_0_screen_7") | ||
app.review.next() | ||
app.assert_screen("tbdm_op_0_screen_8") | ||
app.review.next() | ||
app.assert_screen("tbdm_op_0_screen_9") | ||
app.review.next() | ||
if app.firmware == Firmware.FLEX: | ||
app.expect_apdu_return("9000") | ||
app.send_apdu("800f81ff48000000096d6573736167653137000000096d6573736167653138000000096d65737361676531397000ffdd6102321bc251e4a5190ad5b12b251069d9b4c0843d0f0103ff80ade204") | ||
app.assert_screen("tbdm_op_0_screen_10") | ||
app.review.next() | ||
if app.firmware == Firmware.STAX: | ||
app.expect_apdu_return("9000") | ||
app.send_apdu("800f81ff48000000096d6573736167653137000000096d6573736167653138000000096d65737361676531397000ffdd6102321bc251e4a5190ad5b12b251069d9b4c0843d0f0103ff80ade204") | ||
app.assert_screen("tbdm_op_0_screen_11") | ||
app.review.next() | ||
app.assert_screen("tbdm_op_0_screen_12") | ||
expected_apdu = "a2ef5aec1ad8cc9b35dee48e8a47e418108dec7652159f3a4314c29d91f172f4645db9554b5a8a565307d9a9e65260957409efef54835573b8fc43d6162f99b8e17a557f7f82c46a53ca7c2be7aa540239d394cd5e9dbf14312c8e1e331a2b099000" | ||
app.review_confirm_signing(expected_apdu) | ||
# | ||
|
||
if(app.firmware == Firmware.STAX): | ||
navigate_common(app, skip=False, group_counts=[3, 1, 6, 2]) | ||
else: | ||
navigate_common(app, skip=False, group_counts=[4, 2, 5, 3]) | ||
|
||
# Blindsign status For Large Tx only | ||
app.assert_home() | ||
app.set_blindsigning_status(BlindsigningStatus.Large_Tx_only) | ||
|
||
blindsign_common(app) | ||
if app.firmware == Firmware.STAX: | ||
app.assert_screen("tbdm_op_0_screen_6") | ||
app.review.next() | ||
app.assert_screen("tbdm_op_0_screen_7") | ||
app.review.next() | ||
app.assert_screen("tbdm_op_0_screen_8") | ||
app.review.next() | ||
app.assert_screen("blindsign_warning_too_many_screens") | ||
app.review.back_to_safety.reject() | ||
app.expect_apdu_return("9000") | ||
app.send_apdu("800f81ff48000000096d6573736167653137000000096d6573736167653138000000096d65737361676531397000ffdd6102321bc251e4a5190ad5b12b251069d9b4c0843d0f0103ff80ade204") | ||
blindsign_review_sign(app) | ||
if(app.firmware == Firmware.STAX): | ||
navigate_common(app, skip=False, group_counts=[3, 1, 6, 2]) | ||
else: | ||
navigate_common(app, skip=False, group_counts=[4, 2, 5, 3]) | ||
|
||
# Blindsign status ON | ||
app.assert_home() | ||
app.set_blindsigning_status(BlindsigningStatus.ON) | ||
|
||
app.send_initialize_msg( "800f000011048000002c800006c18000000080000000") | ||
send_payload(app, "800f01ffeb0300000000000000000000000000000000000000000000000000000000000000006b00ffdd6102321bc251e4a5190ad5b12b251069d9b4c0843d0b0104020320182716513907b6bab33f905396d031931c07e01bddd780780c1a56b9c086da6c00ffdd6102321bc251e4a5190ad5b12b251069d9b480897a0c0107c08db701000278eb8b6ab9a768579cd5146b480789650c83f28effff0d7570646174655f636f6e6669670000000607070005030a6e00ffdd6102321bc251e4a5190ad5b12b251069d9b4c08db7010d0105ff01ee572f02e5be5d097ba17369789582882e8abb87c900ffdd6102321bc2") | ||
app.review.next() | ||
|
@@ -126,35 +106,11 @@ def blindsign_review_sign(app: TezosAppScreen): | |
app.send_apdu("800f81ff48000000096d6573736167653137000000096d6573736167653138000000096d65737361676531397000ffdd6102321bc251e4a5190ad5b12b251069d9b4c0843d0f0103ff80ade204") | ||
blindsign_review_sign(app) | ||
|
||
# # Blindsign status ON but continue clear signing | ||
# Blindsign status ON but continue clear signing | ||
app.assert_home() | ||
app.set_blindsigning_status(BlindsigningStatus.ON) | ||
app.send_initialize_msg( "800f000011048000002c800006c18000000080000000") | ||
send_payload(app, "800f01ffeb0300000000000000000000000000000000000000000000000000000000000000006b00ffdd6102321bc251e4a5190ad5b12b251069d9b4c0843d0b0104020320182716513907b6bab33f905396d031931c07e01bddd780780c1a56b9c086da6c00ffdd6102321bc251e4a5190ad5b12b251069d9b480897a0c0107c08db701000278eb8b6ab9a768579cd5146b480789650c83f28effff0d7570646174655f636f6e6669670000000607070005030a6e00ffdd6102321bc251e4a5190ad5b12b251069d9b4c08db7010d0105ff01ee572f02e5be5d097ba17369789582882e8abb87c900ffdd6102321bc2") | ||
app.assert_screen("review_transaction") | ||
app.review.next() | ||
group_1_screen_count= app.firmware == Firmware.STAX and 3 or 4 | ||
for i in range(group_1_screen_count): | ||
app.assert_screen("tbdm_skip_screen_1_" + str(i+1)) | ||
app.review.next() | ||
app.assert_screen("expert_mode_splash") | ||
group_2_screen_count= app.firmware == Firmware.STAX and 2 or 3 | ||
for i in range(group_2_screen_count): | ||
app.review.next() | ||
app.assert_screen("tbdm_skip_screen_2_" + str(i+1)) | ||
app.expect_apdu_return("9000") | ||
app.send_apdu("800f01ffeb51e4a5190ad5b12b251069d9b48092f4010e0106000000fa000000086d65737361676530000000086d65737361676531000000086d65737361676532000000086d65737361676533000000086d65737361676534000000086d65737361676535000000086d65737361676536000000086d65737361676537000000086d65737361676538000000086d65737361676539000000096d6573736167653130000000096d6573736167653131000000096d6573736167653132000000096d6573736167653133000000096d6573736167653134000000096d6573736167653135000000096d6573736167653136") | ||
group_3_screen_count= app.firmware == Firmware.STAX and 3 or 1 | ||
for i in range(group_3_screen_count): | ||
app.review.next() | ||
app.assert_screen("tbdm_skip_screen_3_" + str(i+1)) | ||
app.review.next() | ||
app.assert_screen("blindsign_warning_too_many_screens") | ||
app.review.back_to_safety.reject() | ||
app.expect_apdu_return("9000") | ||
app.send_apdu("800f81ff48000000096d6573736167653137000000096d6573736167653138000000096d65737361676531397000ffdd6102321bc251e4a5190ad5b12b251069d9b4c0843d0f0103ff80ade204") | ||
blindsign_review_sign(app) | ||
|
||
app.set_expert_mode(initial_status=True) | ||
app.set_blindsigning_status(BlindsigningStatus.Large_Tx_only) | ||
app.assert_home() | ||
if(app.firmware == Firmware.STAX): | ||
navigate_common(app, skip=True, group_counts=[3, 1, 6, 2]) | ||
else: | ||
navigate_common(app, skip=True, group_counts=[4, 2, 5, 3]) |