diff --git a/src/config.c b/src/config.c index f3bf843..fca00d3 100644 --- a/src/config.c +++ b/src/config.c @@ -17,7 +17,7 @@ #include "os.h" typedef struct internalStorage_t { - uint8_t dataAllowed; + uint8_t unknownActionAllowed; uint8_t initialized; } internalStorage_t; @@ -27,17 +27,17 @@ const internalStorage_t N_storage_real; void config_init(void) { if (N_storage.initialized != 0x01) { internalStorage_t storage; - storage.dataAllowed = 0x00; + storage.unknownActionAllowed = 0x00; storage.initialized = 0x01; nvm_write((void *) &N_storage, (void *) &storage, sizeof(internalStorage_t)); } } -bool is_data_allowed(void) { - return N_storage.dataAllowed == 1; +bool is_unknown_action_allowed(void) { + return N_storage.unknownActionAllowed == 1; } -void toogle_data_allowed(void) { - uint8_t value = (is_data_allowed() ? 0 : 1); - nvm_write((void *) &N_storage.dataAllowed, (void *) &value, sizeof(uint8_t)); +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)); } diff --git a/src/config.h b/src/config.h index daf0ab7..0d64ae7 100644 --- a/src/config.h +++ b/src/config.h @@ -20,7 +20,7 @@ #include "os.h" void config_init(void); -bool is_data_allowed(void); -void toogle_data_allowed(void); +bool is_unknown_action_allowed(void); +void toogle_unknown_action_allowed(void); #endif diff --git a/src/eos_stream.c b/src/eos_stream.c index 259d2cd..9e072f9 100644 --- a/src/eos_stream.c +++ b/src/eos_stream.c @@ -53,13 +53,13 @@ void initTxContext(txProcessingContext_t *context, cx_sha256_t *sha256, cx_sha256_t *dataSha256, txProcessingContent_t *processingContent, - uint8_t dataAllowed) { + uint8_t allowUnknownAction) { memset(context, 0, sizeof(txProcessingContext_t)); context->sha256 = sha256; context->dataSha256 = dataSha256; context->content = processingContent; context->state = TLV_CHAIN_ID; - context->dataAllowed = dataAllowed; + context->unknownActionAllowed = allowUnknownAction; cx_sha256_init(context->sha256); cx_sha256_init(context->dataSha256); } @@ -348,7 +348,7 @@ void printArgument(uint8_t argNum, txProcessingContext_t *context) { parseNewAccount(buffer, bufferLength, argNum, arg); break; default: - if (context->dataAllowed == 1) { + if (context->unknownActionAllowed == 1) { parseUnknownAction(context->dataChecksum, sizeof(context->dataChecksum), argNum, @@ -358,7 +358,7 @@ void printArgument(uint8_t argNum, txProcessingContext_t *context) { return; } - if (context->dataAllowed == 1) { + if (context->unknownActionAllowed == 1) { parseUnknownAction(context->dataChecksum, sizeof(context->dataChecksum), argNum, arg); } } @@ -894,7 +894,7 @@ static parserStatus_e processTxInternal(txProcessingContext_t *context) { break; case TLV_ACTION_DATA_SIZE: - if (isKnownAction(context) || context->dataAllowed == 0) { + if (isKnownAction(context) || context->unknownActionAllowed == 0) { processField(context); } else { processUnknownActionDataSize(context); @@ -904,7 +904,7 @@ static parserStatus_e processTxInternal(txProcessingContext_t *context) { case TLV_ACTION_DATA: if (isKnownAction(context)) { processActionData(context); - } else if (context->dataAllowed == 1) { + } else if (context->unknownActionAllowed == 1) { processUnknownActionData(context); } else { PRINTF("UNKNOWN ACTION"); diff --git a/src/eos_stream.h b/src/eos_stream.h index 970c5ff..d9c2d32 100644 --- a/src/eos_stream.h +++ b/src/eos_stream.h @@ -76,7 +76,7 @@ typedef struct txProcessingContext_t { name_t contractActionName; uint8_t sizeBuffer[12]; uint8_t actionDataBuffer[512]; - uint8_t dataAllowed; + uint8_t unknownActionAllowed; checksum256 dataChecksum; txProcessingContent_t *content; } txProcessingContext_t; @@ -93,7 +93,7 @@ void initTxContext(txProcessingContext_t *context, cx_sha256_t *sha256, cx_sha256_t *dataSha256, txProcessingContent_t *processingContent, - uint8_t dataAllowed); + uint8_t unknownActionAllowed); parserStatus_e parseTx(txProcessingContext_t *context, uint8_t *buffer, uint32_t length); void printArgument(uint8_t argNum, txProcessingContext_t *processingContext); diff --git a/src/main.c b/src/main.c index 22f5b5d..fcd856e 100644 --- a/src/main.c +++ b/src/main.c @@ -193,7 +193,7 @@ uint32_t handleGetAppConfiguration(uint8_t p1, UNUSED(workBuffer); UNUSED(dataLength); UNUSED(flags); - G_io_apdu_buffer[0] = (is_data_allowed() ? 0x01 : 0x00); + 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; @@ -302,7 +302,7 @@ uint32_t handleSign(uint8_t p1, &sha256, &dataSha256, &txContent, - is_data_allowed() ? 0x01 : 0x00); + is_unknown_action_allowed() ? 0x01 : 0x00); } else if (p1 != P1_MORE) { return 0x6B00; } diff --git a/src/ui_bagl.c b/src/ui_bagl.c index b7f86b9..d660d77 100644 --- a/src/ui_bagl.c +++ b/src/ui_bagl.c @@ -87,30 +87,16 @@ void ui_idle(void) { /////////////////////////////////////////////////////////////////////////////// -#if defined(TARGET_NANOS) - -UX_STEP_CB(ux_settings_flow_1_step, - bnnn_paging, - switch_settings_contract_data(), - { - .title = "Contract data", - .text = confirmLabel, - }); - -#else - UX_STEP_CB(ux_settings_flow_1_step, bnnn, switch_settings_contract_data(), { "Contract data", - "Allow contract data", + "Unknown Action", "in transactions", confirmLabel, }); -#endif - UX_STEP_CB(ux_settings_flow_2_step, pb, ui_idle(), @@ -122,12 +108,14 @@ UX_STEP_CB(ux_settings_flow_2_step, UX_FLOW(ux_settings_flow, &ux_settings_flow_1_step, &ux_settings_flow_2_step); static void display_settings(void) { - strlcpy(confirmLabel, (is_data_allowed() ? "Allowed" : "NOT Allowed"), sizeof(confirmLabel)); + strlcpy(confirmLabel, + (is_unknown_action_allowed() ? "Allowed" : "NOT Allowed"), + sizeof(confirmLabel)); ux_flow_init(0, ux_settings_flow, NULL); } static void switch_settings_contract_data(void) { - toogle_data_allowed(); + toogle_unknown_action_allowed(); display_settings(); } diff --git a/src/ui_nbgl.c b/src/ui_nbgl.c index eb98e47..6bdabd8 100644 --- a/src/ui_nbgl.c +++ b/src/ui_nbgl.c @@ -45,8 +45,8 @@ static void controlsCallback(int token, uint8_t index, int page) { if (token != FIRST_USER_TOKEN) { return; } - toogle_data_allowed(); - switches[0].initState = is_data_allowed(); + toogle_unknown_action_allowed(); + switches[0].initState = is_unknown_action_allowed(); } void ui_idle(void) { @@ -54,9 +54,9 @@ void ui_idle(void) { static nbgl_content_t contents[1] = {0}; static nbgl_genericContents_t settingContents = {0}; - switches[0].initState = is_data_allowed(); + switches[0].initState = is_unknown_action_allowed(); switches[0].text = "Contract data"; - switches[0].subText = "Allow contract data in transactions"; + switches[0].subText = "Allow unknown action in transactions"; switches[0].token = FIRST_USER_TOKEN; contents[0].type = SWITCHES_LIST; diff --git a/tests/functional/apps/eos.py b/tests/functional/apps/eos.py index 645ed25..a991dc0 100644 --- a/tests/functional/apps/eos.py +++ b/tests/functional/apps/eos.py @@ -74,7 +74,7 @@ def __init__(self, client): def send_get_app_configuration(self) -> Tuple[bool, Tuple[int, int, int]]: rapdu: RAPDU = self._client.exchange(CLA, INS.INS_GET_APP_CONFIGURATION, 0, 0, b"") response = rapdu.data - # response = dataAllowed (1) || + # response = unknownActionAllowed (1) || # MAJOR_VERSION (1) || # MINOR_VERSION (1) || # PATCH_VERSION (1) diff --git a/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00001.png b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00001.png index 3d16136..274440e 100644 Binary files a/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00001.png and b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00001.png differ diff --git a/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00002.png b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00002.png index 80debd7..4f76442 100644 Binary files a/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00002.png and b/tests/functional/snapshots/flex/test_app_mainmenu_settings_cfg/00002.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 80debd7..4f76442 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/nanosp/test_app_mainmenu_settings_cfg/00005.png b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00005.png index 5f80c30..6f5e0f9 100644 Binary files a/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00005.png and b/tests/functional/snapshots/nanosp/test_app_mainmenu_settings_cfg/00005.png 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 02ab856..8b6fe3f 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/nanox/test_app_mainmenu_settings_cfg/00005.png b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00005.png index 5f80c30..6f5e0f9 100644 Binary files a/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00005.png and b/tests/functional/snapshots/nanox/test_app_mainmenu_settings_cfg/00005.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 02ab856..8b6fe3f 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/stax/test_app_mainmenu_settings_cfg/00001.png b/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00001.png index 768c693..88de6c1 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 cb9dac9..15c1bcc 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/00004.png b/tests/functional/snapshots/stax/test_app_mainmenu_settings_cfg/00004.png index cb9dac9..15c1bcc 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/test_sign_cmd.py b/tests/functional/test_sign_cmd.py index b4c1088..1dcc255 100644 --- a/tests/functional/test_sign_cmd.py +++ b/tests/functional/test_sign_cmd.py @@ -1,7 +1,7 @@ from json import load import pytest -from ledgered.devices import Device, DeviceType +from ledgered.devices import Device, DeviceType # type: ignore from ragger.backend.interface import RaisePolicy from ragger.bip import pack_derivation_path from ragger.navigator import NavInsID