diff --git a/README.md b/README.md index 92c9185..ad98937 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ sudo docker run --rm -ti -v "$(pwd -P):/app" --user $(id -u):$(id -g) -v "/tmp/. cd /app python3 -m venv private_app_env --system-site-packages source private_app_env/bin/activate -speculos build/nanosp/bin/app.elf --model nanosp +speculos build/nanos2/bin/app.elf --model nanosp ``` ## Compilation Options diff --git a/doc/eosapp.asc b/doc/eosapp.asc index 35b72c3..5669b4e 100644 --- a/doc/eosapp.asc +++ b/doc/eosapp.asc @@ -195,8 +195,8 @@ None |============================================================================================================================== | *Description* | *Length* | Flags - 0x01 : arbitrary data signature enabled by user - | 01 + 0x01 : arbitrary data signature enabled by user | 01 + 0x01 : arbitrary data signature enabled by user | 01 | Application major version | 01 | Application minor version | 01 | Application patch version | 01 diff --git a/src/config.c b/src/config.c index fca00d3..1be8429 100644 --- a/src/config.c +++ b/src/config.c @@ -18,6 +18,7 @@ typedef struct internalStorage_t { uint8_t unknownActionAllowed; + uint8_t verbose; uint8_t initialized; } internalStorage_t; @@ -28,11 +29,19 @@ void config_init(void) { if (N_storage.initialized != 0x01) { internalStorage_t storage; storage.unknownActionAllowed = 0x00; + storage.verbose = 0x00; storage.initialized = 0x01; nvm_write((void *) &N_storage, (void *) &storage, sizeof(internalStorage_t)); } } +/* + * Allow unknown actions + * This app contains a fixed list of supported contracts + * Contracts not matching this list are considered "unknown" + * This setting allows for review and signing of unknown contracts + * By default Off + */ bool is_unknown_action_allowed(void) { return N_storage.unknownActionAllowed == 1; } @@ -41,3 +50,18 @@ void toogle_unknown_action_allowed(void) { uint8_t value = (is_unknown_action_allowed() ? 0 : 1); nvm_write((void *) &N_storage.unknownActionAllowed, (void *) &value, sizeof(uint8_t)); } + +/* + * Show verbose settings + * Presents null.vaulta actions for review otherwise signed blind + * Shows checksums on unknown actions + * Shows authorities on actions + */ +bool is_verbose(void) { + return N_storage.verbose == 1; +} + +void toogle_verbose_config(void) { + uint8_t value = (is_verbose() ? 0 : 1); + nvm_write((void *) &N_storage.verbose, (void *) &value, sizeof(uint8_t)); +} diff --git a/src/config.h b/src/config.h index 0d64ae7..611fcce 100644 --- a/src/config.h +++ b/src/config.h @@ -22,5 +22,7 @@ void config_init(void); bool is_unknown_action_allowed(void); void toogle_unknown_action_allowed(void); +bool is_verbose(void); +void toogle_verbose_config(void); #endif diff --git a/src/main.c b/src/main.c index b7bf89d..42fd787 100644 --- a/src/main.c +++ b/src/main.c @@ -200,10 +200,11 @@ uint32_t handleGetAppConfiguration(uint8_t p1, UNUSED(dataLength); UNUSED(flags); G_io_apdu_buffer[0] = (is_unknown_action_allowed() ? 0x01 : 0x00); - G_io_apdu_buffer[1] = MAJOR_VERSION; - G_io_apdu_buffer[2] = MINOR_VERSION; - G_io_apdu_buffer[3] = PATCH_VERSION; - *tx = 4; + G_io_apdu_buffer[1] = (is_verbose() ? 0x01 : 0x00); + G_io_apdu_buffer[2] = MAJOR_VERSION; + G_io_apdu_buffer[3] = MINOR_VERSION; + G_io_apdu_buffer[4] = PATCH_VERSION; + *tx = 5; return SWO_SUCCESS; } diff --git a/src/ui_bagl.c b/src/ui_bagl.c index cdc0828..59a234e 100644 --- a/src/ui_bagl.c +++ b/src/ui_bagl.c @@ -29,6 +29,7 @@ static char actionCounter[32]; static char confirmLabel[32]; +static char smallConfirmLabel[16]; // display stepped screens static unsigned int ux_step; @@ -37,32 +38,42 @@ static unsigned int ux_step_count; static char confirm_text1[16]; static char confirm_text2[16]; -static void display_settings(void); +static void display_settings_flow(void); static void switch_settings_contract_data(void); +static void switch_settings_verbose_config(void); static void display_next_state(uint8_t state); +static void maybe_push_stack(void); + +///////////////////////////COMMON FUNCTIONS//////////////////////////// +static void maybe_push_stack(void) { + // reserve a display stack slot if none yet + if (G_ux.stack_count == 0) { + ux_stack_push(); + } +} /////////////////////////////////////////////////////////////////////////////// -UX_STEP_NOCB(ux_idle_flow_1_step, +UX_STEP_NOCB(ux_idle_ready_step, nn, // pnn, { "Application", "is ready", }); -UX_STEP_NOCB(ux_idle_flow_2_step, +UX_STEP_NOCB(ux_display_version_step, bn, { "Version", APPVERSION, }); -UX_STEP_CB(ux_idle_flow_3_step, +UX_STEP_CB(ux_settings_step, pb, - display_settings(), + display_settings_flow(), { &C_icon_coggle, "Settings", }); -UX_STEP_CB(ux_idle_flow_4_step, +UX_STEP_CB(ux_quit_step, pb, os_sched_exit(-1), { @@ -71,37 +82,33 @@ UX_STEP_CB(ux_idle_flow_4_step, }); UX_FLOW(ux_idle_flow, - &ux_idle_flow_1_step, - &ux_idle_flow_2_step, - &ux_idle_flow_3_step, - &ux_idle_flow_4_step); + &ux_idle_ready_step, + &ux_display_version_step, + &ux_settings_step, + &ux_quit_step); void ui_idle(void) { // reserve a display stack slot if none yet - if (G_ux.stack_count == 0) { - ux_stack_push(); - } + maybe_push_stack(); ux_flow_init(0, ux_idle_flow, NULL); } //////////////////////////////////////////////////////////////////////////////// -UX_STEP_NOCB(ux_abort_flow_1_step, - nn, // pnn, - {"Aborting: Detected", "Unknown Trx"}); +UX_STEP_NOCB(ux_abort_warning_step, + bnn, // pnn, + {"Aborting", "Detected", "Unknown Trx"}); UX_FLOW(ux_abort_flow, - &ux_abort_flow_1_step, - &ux_idle_flow_2_step, - &ux_idle_flow_3_step, - &ux_idle_flow_4_step); + &ux_abort_warning_step, + &ux_display_version_step, + &ux_display_version_step, + &ux_quit_step); void ui_abort_unknown_action(void) { // reserve a display stack slot if none yet - if (G_ux.stack_count == 0) { - ux_stack_push(); - } + maybe_push_stack(); ux_flow_init(0, ux_abort_flow, NULL); } @@ -119,6 +126,16 @@ UX_STEP_CB(ux_settings_flow_1_step, }); UX_STEP_CB(ux_settings_flow_2_step, + bnnn, + switch_settings_verbose_config(), + { + "Verbose", + "Show Details", + "in transactions", + smallConfirmLabel, + }); + +UX_STEP_CB(ux_settings_flow_3_step, pb, ui_idle(), { @@ -126,18 +143,29 @@ UX_STEP_CB(ux_settings_flow_2_step, "Back", }); -UX_FLOW(ux_settings_flow, &ux_settings_flow_1_step, &ux_settings_flow_2_step); +UX_FLOW(ux_settings_flow, + &ux_settings_flow_1_step, + &ux_settings_flow_2_step, + &ux_settings_flow_3_step); -static void display_settings(void) { +static void display_settings_flow(void) { strlcpy(confirmLabel, (is_unknown_action_allowed() ? "Allowed" : "NOT Allowed"), sizeof(confirmLabel)); + + strlcpy(smallConfirmLabel, (is_verbose() ? "On" : "Off"), sizeof(smallConfirmLabel)); + ux_flow_init(0, ux_settings_flow, NULL); } static void switch_settings_contract_data(void) { toogle_unknown_action_allowed(); - display_settings(); + display_settings_flow(); +} + +static void switch_settings_verbose_config(void) { + toogle_verbose_config(); + display_settings_flow(); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/ui_nbgl.c b/src/ui_nbgl.c index 31af43f..a255233 100644 --- a/src/ui_nbgl.c +++ b/src/ui_nbgl.c @@ -34,19 +34,34 @@ void app_exit(void); -static nbgl_contentSwitch_t switches[1] = {0}; +static nbgl_contentSwitch_t switches[2] = {0}; static const char* const INFO_TYPES[] = {"Version"}; static const char* const INFO_CONTENTS[] = {APPVERSION}; +#define SWITCH_COUNT 2 +enum { SWITCH_UNKNOWN_ACTION = 0, SWITCH_VERBOSE = 1 }; +#define TOKEN_OFFSET FIRST_USER_TOKEN + static void controlsCallback(int token, uint8_t index, int page) { UNUSED(index); UNUSED(page); - if (token != FIRST_USER_TOKEN) { - return; + int switchIndex = token - TOKEN_OFFSET; + + if (switchIndex < 0 || switchIndex >= SWITCH_COUNT) { + return; // Invalid token, do nothing + } + + switch (switchIndex) { + case SWITCH_UNKNOWN_ACTION: + toogle_unknown_action_allowed(); + switches[SWITCH_UNKNOWN_ACTION].initState = is_unknown_action_allowed(); + break; + case SWITCH_VERBOSE: + toogle_verbose_config(); + switches[SWITCH_VERBOSE].initState = is_verbose(); + break; } - toogle_unknown_action_allowed(); - switches[0].initState = is_unknown_action_allowed(); } void ui_idle(void) { @@ -57,10 +72,15 @@ void ui_idle(void) { switches[0].initState = is_unknown_action_allowed(); switches[0].text = "Contract data"; switches[0].subText = "Allow unknown action in transactions"; - switches[0].token = FIRST_USER_TOKEN; + switches[0].token = TOKEN_OFFSET + SWITCH_UNKNOWN_ACTION; + + switches[1].initState = is_verbose(); + switches[1].text = "Verbose"; + switches[1].subText = "Review Null.Vaulta transactions\nShow authorizations\nShow checksums"; + switches[1].token = TOKEN_OFFSET + SWITCH_VERBOSE; contents[0].type = SWITCHES_LIST; - contents[0].content.switchesList.nbSwitches = 1; + contents[0].content.switchesList.nbSwitches = 2; contents[0].content.switchesList.switches = switches; contents[0].contentActionCallback = controlsCallback; diff --git a/tests/functional/apps/eos.py b/tests/functional/apps/eos.py index a991dc0..36e93f3 100644 --- a/tests/functional/apps/eos.py +++ b/tests/functional/apps/eos.py @@ -71,20 +71,22 @@ class EosClient: def __init__(self, client): self._client = client - def send_get_app_configuration(self) -> Tuple[bool, Tuple[int, int, int]]: + def send_get_app_configuration(self) -> Tuple[bool, bool, Tuple[int, int, int]]: rapdu: RAPDU = self._client.exchange(CLA, INS.INS_GET_APP_CONFIGURATION, 0, 0, b"") response = rapdu.data # response = unknownActionAllowed (1) || + #. verbose (1) || # MAJOR_VERSION (1) || # MINOR_VERSION (1) || # PATCH_VERSION (1) - assert len(response) == 4 + assert len(response) == 5 data_allowed = int(response[0]) == 1 - major = int(response[1]) - minor = int(response[2]) - patch = int(response[3]) - return data_allowed, (major, minor, patch) + is_verbose = int(response[1]) == 1 + major = int(response[2]) + minor = int(response[3]) + patch = int(response[4]) + return data_allowed, is_verbose, (major, minor, patch) def compute_adress_from_public_key(self, public_key: bytes) -> str: return EosAddrEncoder.EncodeKey(public_key) diff --git a/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00003.png b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00003.png index cc58d10..a71b4dc 100644 Binary files a/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00003.png and b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00003.png differ diff --git a/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00004.png b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00004.png index 4f76442..ae0c89c 100644 Binary files a/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00004.png and b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00004.png differ diff --git a/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00005.png b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00005.png index a7a59db..4f76442 100644 Binary files a/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00005.png and b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00005.png differ diff --git a/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00006.png b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00006.png new file mode 100644 index 0000000..ae0c89c Binary files /dev/null and b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00006.png differ diff --git a/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00007.png b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00007.png new file mode 100644 index 0000000..cc58d10 Binary files /dev/null and b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00007.png differ diff --git a/tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00005.png b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00008.png similarity index 100% rename from tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00005.png rename to tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00008.png diff --git a/tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00001.png b/tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00001.png deleted file mode 100644 index 3e49b07..0000000 Binary files a/tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00001.png and /dev/null differ diff --git a/tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00002.png b/tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00002.png deleted file mode 100644 index dc74f6f..0000000 Binary files a/tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00002.png and /dev/null differ diff --git a/tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00003.png b/tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00003.png deleted file mode 100644 index bd763f9..0000000 Binary files a/tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00003.png and /dev/null differ diff --git a/tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00004.png b/tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00004.png deleted file mode 100644 index be51a9d..0000000 Binary files a/tests/functional/snapshots/flex/test_sign_transaction_accepted/wampus/transaction_valid/00004.png and /dev/null differ diff --git a/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00006.png b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00006.png index 8b6fe3f..4c45da1 100644 Binary files a/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00006.png and b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00006.png differ diff --git a/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00007.png b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00007.png index 61861f2..6f5e0f9 100644 Binary files a/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00007.png and b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00007.png differ diff --git a/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00008.png b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00008.png index 9088cec..4b3af92 100644 Binary files a/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00008.png and b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00008.png differ diff --git a/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00009.png b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00009.png new file mode 100644 index 0000000..6f5e0f9 Binary files /dev/null and b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00009.png differ diff --git a/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00010.png b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00010.png new file mode 100644 index 0000000..8b6fe3f Binary files /dev/null and b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00010.png differ diff --git a/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00011.png b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00011.png new file mode 100644 index 0000000..4b3af92 Binary files /dev/null and b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00011.png differ diff --git a/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00012.png b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00012.png new file mode 100644 index 0000000..61861f2 Binary files /dev/null and b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00012.png differ diff --git a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00008.png b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00013.png similarity index 100% rename from tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00008.png rename to tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00013.png diff --git a/tests/functional/snapshots/nanosp/test_sign_mixed_actions_unknown_not_allowed/mixed_transactions_known_unknown/00010.png b/tests/functional/snapshots/nanosp/test_sign_mixed_actions_unknown_not_allowed/mixed_transactions_known_unknown/00010.png index 59644fa..2ae397a 100644 Binary files a/tests/functional/snapshots/nanosp/test_sign_mixed_actions_unknown_not_allowed/mixed_transactions_known_unknown/00010.png and b/tests/functional/snapshots/nanosp/test_sign_mixed_actions_unknown_not_allowed/mixed_transactions_known_unknown/00010.png differ diff --git a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00000.png b/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00000.png index 59644fa..2ae397a 100644 Binary files a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00000.png and b/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00000.png differ diff --git a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00001.png b/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00001.png deleted file mode 100644 index a92ffe7..0000000 Binary files a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00001.png and /dev/null differ diff --git a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00002.png b/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00002.png deleted file mode 100644 index 5dfe950..0000000 Binary files a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00002.png and /dev/null differ diff --git a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00003.png b/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00003.png deleted file mode 100644 index c84ea97..0000000 Binary files a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00003.png and /dev/null differ diff --git a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00004.png b/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00004.png deleted file mode 100644 index 4a52a3b..0000000 Binary files a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00004.png and /dev/null differ diff --git a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00005.png b/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00005.png deleted file mode 100644 index 40873aa..0000000 Binary files a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00005.png and /dev/null differ diff --git a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00006.png b/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00006.png deleted file mode 100644 index c1f5a48..0000000 Binary files a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00006.png and /dev/null differ diff --git a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00007.png b/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00007.png deleted file mode 100644 index 1366e8d..0000000 Binary files a/tests/functional/snapshots/nanosp/test_sign_transaction_accepted/wampus/transaction_valid/00007.png and /dev/null differ diff --git a/tests/functional/snapshots/nanosp/test_sign_transaction_multiple_actions/transaction_unknown/00003.png b/tests/functional/snapshots/nanosp/test_sign_transaction_multiple_actions/transaction_unknown/00003.png index 59644fa..2ae397a 100644 Binary files a/tests/functional/snapshots/nanosp/test_sign_transaction_multiple_actions/transaction_unknown/00003.png and b/tests/functional/snapshots/nanosp/test_sign_transaction_multiple_actions/transaction_unknown/00003.png differ diff --git a/tests/functional/snapshots/nanosp/test_unknown_action_not_allowed/wampus/transaction_unknown/00000.png b/tests/functional/snapshots/nanosp/test_unknown_action_not_allowed/wampus/transaction_unknown/00000.png index 59644fa..2ae397a 100644 Binary files a/tests/functional/snapshots/nanosp/test_unknown_action_not_allowed/wampus/transaction_unknown/00000.png and b/tests/functional/snapshots/nanosp/test_unknown_action_not_allowed/wampus/transaction_unknown/00000.png differ diff --git a/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00006.png b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00006.png index 8b6fe3f..4c45da1 100644 Binary files a/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00006.png and b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00006.png differ diff --git a/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00007.png b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00007.png index 61861f2..6f5e0f9 100644 Binary files a/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00007.png and b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00007.png differ diff --git a/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00008.png b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00008.png index 9088cec..4b3af92 100644 Binary files a/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00008.png and b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00008.png differ diff --git a/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00009.png b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00009.png new file mode 100644 index 0000000..6f5e0f9 Binary files /dev/null and b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00009.png differ diff --git a/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00010.png b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00010.png new file mode 100644 index 0000000..8b6fe3f Binary files /dev/null and b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00010.png differ diff --git a/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00011.png b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00011.png new file mode 100644 index 0000000..4b3af92 Binary files /dev/null and b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00011.png differ diff --git a/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00012.png b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00012.png new file mode 100644 index 0000000..61861f2 Binary files /dev/null and b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00012.png differ diff --git a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00008.png b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00013.png similarity index 100% rename from tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00008.png rename to tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00013.png diff --git a/tests/functional/snapshots/nanox/test_sign_mixed_actions_unknown_not_allowed/mixed_transactions_known_unknown/00010.png b/tests/functional/snapshots/nanox/test_sign_mixed_actions_unknown_not_allowed/mixed_transactions_known_unknown/00010.png index 59644fa..2ae397a 100644 Binary files a/tests/functional/snapshots/nanox/test_sign_mixed_actions_unknown_not_allowed/mixed_transactions_known_unknown/00010.png and b/tests/functional/snapshots/nanox/test_sign_mixed_actions_unknown_not_allowed/mixed_transactions_known_unknown/00010.png differ diff --git a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00000.png b/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00000.png index 59644fa..2ae397a 100644 Binary files a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00000.png and b/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00000.png differ diff --git a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00001.png b/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00001.png deleted file mode 100644 index a92ffe7..0000000 Binary files a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00001.png and /dev/null differ diff --git a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00002.png b/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00002.png deleted file mode 100644 index 5dfe950..0000000 Binary files a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00002.png and /dev/null differ diff --git a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00003.png b/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00003.png deleted file mode 100644 index c84ea97..0000000 Binary files a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00003.png and /dev/null differ diff --git a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00004.png b/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00004.png deleted file mode 100644 index 4a52a3b..0000000 Binary files a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00004.png and /dev/null differ diff --git a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00005.png b/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00005.png deleted file mode 100644 index 40873aa..0000000 Binary files a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00005.png and /dev/null differ diff --git a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00006.png b/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00006.png deleted file mode 100644 index c1f5a48..0000000 Binary files a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00006.png and /dev/null differ diff --git a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00007.png b/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00007.png deleted file mode 100644 index 1366e8d..0000000 Binary files a/tests/functional/snapshots/nanox/test_sign_transaction_accepted/wampus/transaction_valid/00007.png and /dev/null differ diff --git a/tests/functional/snapshots/nanox/test_sign_transaction_multiple_actions/transaction_unknown/00003.png b/tests/functional/snapshots/nanox/test_sign_transaction_multiple_actions/transaction_unknown/00003.png index 59644fa..2ae397a 100644 Binary files a/tests/functional/snapshots/nanox/test_sign_transaction_multiple_actions/transaction_unknown/00003.png and b/tests/functional/snapshots/nanox/test_sign_transaction_multiple_actions/transaction_unknown/00003.png differ diff --git a/tests/functional/snapshots/nanox/test_unknown_action_not_allowed/wampus/transaction_unknown/00000.png b/tests/functional/snapshots/nanox/test_unknown_action_not_allowed/wampus/transaction_unknown/00000.png index 59644fa..2ae397a 100644 Binary files a/tests/functional/snapshots/nanox/test_unknown_action_not_allowed/wampus/transaction_unknown/00000.png and b/tests/functional/snapshots/nanox/test_unknown_action_not_allowed/wampus/transaction_unknown/00000.png differ diff --git a/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00001.png b/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00001.png index 88de6c1..95cf602 100644 Binary files a/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00001.png and b/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00001.png differ diff --git a/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00002.png b/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00002.png index 15c1bcc..9ffd290 100644 Binary files a/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00002.png and b/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00002.png differ diff --git a/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00003.png b/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00003.png index 6a50f47..7519d84 100644 Binary files a/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00003.png and b/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00003.png differ diff --git a/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00004.png b/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00004.png index 15c1bcc..6a50f47 100644 Binary files a/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00004.png and b/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00004.png differ diff --git a/tests/functional/snapshots/stax/test_sign_transaction_accepted/wampus/transaction_valid/00001.png b/tests/functional/snapshots/stax/test_sign_transaction_accepted/wampus/transaction_valid/00001.png deleted file mode 100644 index 2ee9a86..0000000 Binary files a/tests/functional/snapshots/stax/test_sign_transaction_accepted/wampus/transaction_valid/00001.png and /dev/null differ diff --git a/tests/functional/snapshots/stax/test_sign_transaction_accepted/wampus/transaction_valid/00002.png b/tests/functional/snapshots/stax/test_sign_transaction_accepted/wampus/transaction_valid/00002.png deleted file mode 100644 index 2a06c39..0000000 Binary files a/tests/functional/snapshots/stax/test_sign_transaction_accepted/wampus/transaction_valid/00002.png and /dev/null differ diff --git a/tests/functional/snapshots/stax/test_sign_transaction_accepted/wampus/transaction_valid/00003.png b/tests/functional/snapshots/stax/test_sign_transaction_accepted/wampus/transaction_valid/00003.png deleted file mode 100644 index 392165d..0000000 Binary files a/tests/functional/snapshots/stax/test_sign_transaction_accepted/wampus/transaction_valid/00003.png and /dev/null differ diff --git a/tests/functional/snapshots/stax/test_sign_transaction_accepted/wampus/transaction_valid/00004.png b/tests/functional/snapshots/stax/test_sign_transaction_accepted/wampus/transaction_valid/00004.png deleted file mode 100644 index 5be01b3..0000000 Binary files a/tests/functional/snapshots/stax/test_sign_transaction_accepted/wampus/transaction_valid/00004.png and /dev/null differ diff --git a/tests/functional/test_app_mainmenu_settings_cfg.py b/tests/functional/test_app_mainmenu_settings_cfg.py index a4ff614..140d265 100644 --- a/tests/functional/test_app_mainmenu_settings_cfg.py +++ b/tests/functional/test_app_mainmenu_settings_cfg.py @@ -3,6 +3,7 @@ import re from ragger.backend import SpeculosBackend from ragger.navigator import NavInsID, NavIns +from ledgered.devices import DeviceType from apps.eos import EosClient from utils import ROOT_SCREENSHOT_PATH @@ -39,13 +40,12 @@ def _verify_version(version: str) -> None: pass assert version == vers_str - -def test_app_mainmenu_settings_cfg(device, backend, navigator, test_name=None): +def test_app_mainmenu_settings_cfg(device, backend, navigator, test_name="test_app_mainmenu_settings_cfg"): client = EosClient(backend) # Get appversion and "data_allowed parameter" # This works on both the emulator and a physical device - unknown_allowed, version = client.send_get_app_configuration() + unknown_allowed, is_verbose, version = client.send_get_app_configuration() assert unknown_allowed is False _verify_version(version) @@ -63,16 +63,32 @@ def test_app_mainmenu_settings_cfg(device, backend, navigator, test_name=None): NavInsID.RIGHT_CLICK, NavInsID.LEFT_CLICK, NavInsID.BOTH_CLICK, + NavInsID.RIGHT_CLICK, + NavInsID.BOTH_CLICK, + NavInsID.RIGHT_CLICK, + NavInsID.LEFT_CLICK, NavInsID.BOTH_CLICK, NavInsID.RIGHT_CLICK, + NavInsID.RIGHT_CLICK, NavInsID.BOTH_CLICK ] - else: + elif device.type == DeviceType.FLEX: instructions = [ NavInsID.USE_CASE_HOME_INFO, NavIns(NavInsID.TOUCH, (200, 190)), # Change setting value NavInsID.USE_CASE_SETTINGS_NEXT, + NavIns(NavInsID.TOUCH, (200, 190)), # Change setting value NavInsID.USE_CASE_SETTINGS_PREVIOUS, + NavInsID.USE_CASE_SETTINGS_NEXT, + NavInsID.USE_CASE_SETTINGS_NEXT, + NavInsID.USE_CASE_SETTINGS_MULTI_PAGE_EXIT + ] + else: + instructions = [ + NavInsID.USE_CASE_HOME_INFO, + NavIns(NavInsID.TOUCH, (200, 190)), # Change setting value + NavIns(NavInsID.TOUCH, (200, 360)), # Change setting value + NavInsID.USE_CASE_SETTINGS_NEXT, NavInsID.USE_CASE_SETTINGS_MULTI_PAGE_EXIT ] # test_name null means this is a config change event, not a test @@ -83,6 +99,7 @@ def test_app_mainmenu_settings_cfg(device, backend, navigator, test_name=None): navigator.navigate(instructions,screen_change_before_first_instruction=False) # Check that "data_allowed parameter" changed - unknown_allowed, version = client.send_get_app_configuration() + unknown_allowed, is_verbose, version = client.send_get_app_configuration() assert unknown_allowed is True + assert is_verbose is True _verify_version(version) diff --git a/tests/functional/test_unknown_transactions.py b/tests/functional/test_unknown_transactions.py index 02ca838..defeb27 100644 --- a/tests/functional/test_unknown_transactions.py +++ b/tests/functional/test_unknown_transactions.py @@ -81,7 +81,7 @@ def test_sign_transaction_mixed_actions(test_name: str, transaction_filename: str): # Allow Unknown Actions: navigate and turn on settings - test_app_mainmenu_settings_cfg(device, backend, scenario_navigator.navigator) + test_app_mainmenu_settings_cfg(device, backend, scenario_navigator.navigator,"") snapshot_folder_name = test_name + "/" + transaction_filename.replace(".json", "") @@ -163,7 +163,7 @@ def test_malformed_transfer(test_name: str, transaction_filename: str): # Allow Unknown Actions: navigate and turn on settings - test_app_mainmenu_settings_cfg(device, backend, scenario_navigator.navigator) + test_app_mainmenu_settings_cfg(device, backend, scenario_navigator.navigator,"") snapshot_folder_name = assemble_snapshot_folder_name(test_name, subdir ,transaction_filename)