Skip to content

Commit

Permalink
flex porting
Browse files Browse the repository at this point in the history
  • Loading branch information
tdejoigny-ledger committed May 3, 2024
1 parent 6dd470c commit 5e14555
Show file tree
Hide file tree
Showing 39 changed files with 30 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## 2.0.0 - 2024-05-01

- Support of Flex device

## 1.7.6 - 2021-03-30

- Support of Monero client version `0.17.2.*`
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ include $(BOLOS_SDK)/Makefile.defines
APPNAME = "Monero"

# Application version
APPVERSION_M = 1
APPVERSION_N = 9
APPVERSION_M = 2
APPVERSION_N = 0
APPVERSION_P = 0
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)"

Expand All @@ -43,6 +43,7 @@ ICON_NANOS = icons/app_monero_16px.gif
ICON_NANOX = icons/app_monero_14px.gif
ICON_NANOSP = icons/app_monero_14px.gif
ICON_STAX = icons/app_monero_32px.gif
ICON_FLEX = icons/app_monero_40px.gif

# Application allowed derivation curves.
CURVE_APP_LOAD_PARAMS = secp256k1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Monero Ledger App

Monero wallet application for Ledger Nano S and Nano X.
Monero wallet application for all Ledger devices.

## Install

Expand Down
Binary file added icons/app_monero_40px.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ledger_app.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[app]
build_directory = "./"
sdk = "C"
devices = ["nanos", "nanox", "nanos+", "stax"]
devices = ["nanos", "nanox", "nanos+", "stax", "flex"]

[tests]
pytest_directory = "./tests/"
2 changes: 1 addition & 1 deletion src/monero_nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "monero_api.h"
#include "monero_vars.h"

#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX)
#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX) || defined(TARGET_FLEX)
const monero_nv_state_t N_state_pic;
#else
monero_nv_state_t N_state_pic;
Expand Down
16 changes: 8 additions & 8 deletions src/monero_ux_stax.c → src/monero_ux_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static void release_context(void) {
/* -------------------------------- INFO UX --------------------------------- */

void ui_menu_show_tx_aborted(void) {
nbgl_useCaseStatus("Transaction\ncancelled", false, ui_menu_main_display);
nbgl_useCaseReviewStatus(STATUS_TYPE_TRANSACTION_REJECTED, ui_menu_main_display);
}

void ui_menu_show_security_error(void) {
Expand Down Expand Up @@ -103,7 +103,7 @@ unsigned int ui_menu_transaction_start(void) {
}

unsigned int ui_menu_transaction_signed(void) {
nbgl_useCaseStatus("TRANSACTION\nSIGNED", true, ui_menu_main_display);
nbgl_useCaseReviewStatus(STATUS_TYPE_TRANSACTION_SIGNED, ui_menu_main_display);
return 0;
}

Expand Down Expand Up @@ -315,7 +315,7 @@ static void ui_menu_pubaddr_action_cancelled(void) {
monero_io_do(IO_RETURN_AFTER_TX);
}
G_monero_vstate.disp_addr_mode = 0;
nbgl_useCaseStatus("Address display\ncancelled", false, ui_menu_main_display);
nbgl_useCaseReviewStatus(STATUS_TYPE_ADDRESS_REJECTED, ui_menu_main_display);
}

void ui_menu_pubaddr_action(bool confirm) {
Expand All @@ -325,7 +325,7 @@ void ui_menu_pubaddr_action(bool confirm) {
monero_io_do(IO_RETURN_AFTER_TX);
}
G_monero_vstate.disp_addr_mode = 0;
nbgl_useCaseStatus("ADDRESS\nVERIFIED", true, ui_menu_main_display);
nbgl_useCaseReviewStatus(STATUS_TYPE_ADDRESS_VERIFIED, ui_menu_main_display);
} else {
ui_menu_pubaddr_action_cancelled();
}
Expand Down Expand Up @@ -372,8 +372,8 @@ void display_account(void) {

transactionContext.tagValueList.pairs = transactionContext.tagValuePair;

nbgl_useCaseAddressConfirmationExt(G_monero_vstate.ux_address, ui_menu_pubaddr_action,
&transactionContext.tagValueList);
nbgl_useCaseAddressReview(G_monero_vstate.ux_address, &transactionContext.tagValueList,
&C_Monero_64px, "Review Address", NULL, ui_menu_pubaddr_action);
}

int ui_menu_any_pubaddr_display(unsigned int value __attribute__((unused)), unsigned char* pub_view,
Expand All @@ -388,8 +388,8 @@ int ui_menu_any_pubaddr_display(unsigned int value __attribute__((unused)), unsi
return error;
}

nbgl_useCaseReviewStart(&C_Monero_64px, "Review Address", "", "Cancel", display_account,
ui_menu_pubaddr_action_cancelled);
display_account();

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/monero_ux_stax_menu.c → src/monero_ux_nbgl_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ enum { MAIN_NET, STAGE_NET, TEST_NET, MAX_NET };

static const char* const infoTypes[] = {"Spec", "Version", "Developer", "Copyright"};
static const char* const infoContents[] = {XSTR(SPEC_VERSION), APPVERSION, "Ledger",
"(c) 2022 Ledger"};
"(c) 2024 Ledger"};

static const char* const barTexts[] = {"Select Account", "Select Network", "Reset"};
static const uint8_t tokens[] = {ACCOUNT_TOKEN, NETWORK_TOKEN, RESET_TOKEN};
Expand Down
2 changes: 1 addition & 1 deletion src/monero_vars.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

extern monero_v_state_t G_monero_vstate;

#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX)
#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX) || defined(TARGET_FLEX)
extern const monero_nv_state_t N_state_pic;
#define N_monero_pstate ((volatile monero_nv_state_t *)PIC(&N_state_pic))
#else
Expand Down
9 changes: 9 additions & 0 deletions tests/monero_client/monero_crypto_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ def display_address(self, test_name, firmware, navigator, derivation: bytes, out
instructions = get_nano_review_instructions(8)
elif firmware.device.startswith("nano"):
instructions = get_nano_review_instructions(4)
elif firmware.device == "flex":
instructions = [
NavIns(NavInsID.USE_CASE_REVIEW_TAP ),
NavIns(NavInsID.TOUCH, (200, 350)),
NavIns(NavInsID.USE_CASE_ADDRESS_CONFIRMATION_EXIT_QR),
NavIns(NavInsID.USE_CASE_REVIEW_TAP),
NavIns(NavInsID.USE_CASE_ADDRESS_CONFIRMATION_CONFIRM),
NavIns(NavInsID.USE_CASE_STATUS_DISMISS)
]
else:
instructions = [
NavIns(NavInsID.USE_CASE_CHOICE_CONFIRM),
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/stax/test_display_address/00000.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 modified tests/snapshots/stax/test_display_address/00001.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 modified tests/snapshots/stax/test_display_address/00003.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 modified tests/snapshots/stax/test_display_address/00004.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 modified tests/snapshots/stax/test_display_address/00005.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 modified tests/snapshots/stax/test_display_subaddress/00000.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 modified tests/snapshots/stax/test_display_subaddress/00001.png
Binary file modified tests/snapshots/stax/test_display_subaddress/00003.png
Binary file modified tests/snapshots/stax/test_display_subaddress/00004.png
Binary file modified tests/snapshots/stax/test_display_subaddress/00005.png
2 changes: 1 addition & 1 deletion tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def check_accepted_version(monero, valid_version: bytes):
major, minor, patch = monero.reset_and_get_version(
monero_client_version=valid_version
) # type: int, int, int
assert (major, minor, patch) == (1, 9, 0) # version of the Monero app
assert (major, minor, patch) == (2, 0, 0) # version of the Monero app


def check_refused_version(monero, invalid_version: bytes):
Expand Down

0 comments on commit 5e14555

Please sign in to comment.