Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7ab9495
[auto]: add PR template
sgliner-ledger Nov 29, 2023
2555f87
[auto] Update screenshot
Jan 10, 2024
57eb57c
ledger_app.toml: add manifest
sgliner-ledger Jan 11, 2024
25ef4b0
Merge pull request #40 from LedgerHQ/auto-update-screenshots
sgliner-ledger Jan 11, 2024
104f640
[auto] Update screenshot
Feb 21, 2024
2c40675
Merge pull request #41 from LedgerHQ/auto-update-screenshots
sgliner-ledger Feb 21, 2024
f45c9fa
[auto] Update screenshot
sgliner-ledger Feb 27, 2024
9f5211f
[auto] Update screenshot
Apr 8, 2024
9f8d72b
Merge pull request #42 from LedgerHQ/auto-update-screenshots
sgliner-ledger Apr 9, 2024
4fcdbe5
add relayer support for usertx
AdoAdoAdo Jun 14, 2024
477d0b5
update nanos snapshots - partial
AdoAdoAdo Jun 14, 2024
17071cb
fix indentation
AdoAdoAdo Jun 14, 2024
ff41c92
some more fixes
AdoAdoAdo Jun 14, 2024
0a90850
update raise policy for user rejected tests
AdoAdoAdo Jul 2, 2024
5dac9c1
update nanosp snapshots
AdoAdoAdo Jul 2, 2024
1fd6515
add nanosp snapshots for new tests
AdoAdoAdo Jul 2, 2024
c506dbc
add ledger_app.toml and fix tests
AdoAdoAdo Jul 2, 2024
35a5dbe
update snapshots for nanox new tests
AdoAdoAdo Jul 2, 2024
33d1ddd
update snapshots for stax
AdoAdoAdo Jul 2, 2024
6078d1a
remove flex from supported devices
AdoAdoAdo Jul 3, 2024
a385f71
fix warnings
AdoAdoAdo Jul 3, 2024
d979da4
fix formatting
AdoAdoAdo Jul 3, 2024
dd7ad27
fix thrown exceptions
AdoAdoAdo Jul 4, 2024
536757d
remove unused import
AdoAdoAdo Jul 4, 2024
52b362f
change app version - minor
AdoAdoAdo Jul 5, 2024
b8fe4be
remove variable & add test assertion
AdoAdoAdo Jul 11, 2024
080efea
format
AdoAdoAdo Jul 11, 2024
9e78aa4
regenerate stax golden snapshots
AdoAdoAdo Jul 12, 2024
e26beed
update tests after lib changes
AdoAdoAdo Jul 18, 2024
516cd69
add missing snapshot images for stax
AdoAdoAdo Jul 18, 2024
12955e0
Merge branch 'develop' into relayed-v3-support-app-multiversx
AdoAdoAdo Sep 25, 2024
f9c6cff
update stax golden
AdoAdoAdo Sep 25, 2024
d7b55d7
update clang linter version
AdoAdoAdo Sep 25, 2024
0960858
Merge pull request #94 from multiversx/relayed-v3-support-app-multiversx
AdoAdoAdo Sep 30, 2024
9d423bc
updated snapshots for nanox, nanosp
mradian1 Jan 13, 2025
a19fdad
replaced deprecated functions
mradian1 Jan 14, 2025
d978184
fix lint check error
mradian1 Jan 14, 2025
719365d
fix lint problems
mradian1 Jan 14, 2025
f73a376
usage.md updated
mradian1 Jan 14, 2025
8a348b0
linting fixes
mradian1 Jan 14, 2025
c5eda84
fixes after review
mradian1 Jan 15, 2025
10095ac
lint fix
mradian1 Jan 15, 2025
42e6056
Merge pull request #96 from multiversx/fix-deprecated-fuctions
mradian1 Jan 15, 2025
61cccbb
Adjust MAX_VALUE_LEN.
andreibancioiu Jan 15, 2025
39deb2f
Adjust constants, instead.
andreibancioiu Jan 15, 2025
717e1e0
Fix readme.
andreibancioiu Jan 15, 2025
3488706
Undo change.
andreibancioiu Jan 15, 2025
569c319
Merge pull request #97 from multiversx/stax-limits
andreibancioiu Jan 17, 2025
38f48ee
Alter workflows.
andreibancioiu Feb 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Checklist
<!-- Put an `x` in each box when you have completed the items. -->
- [ ] App update process has been followed <!-- See comment below -->
- [ ] Target branch is `develop` <!-- unless you have a very good reason -->
- [ ] Application version has been bumped <!-- required if your changes are to be deployed -->

<!-- Make sure you followed the process described in https://developers.ledger.com/docs/device-app/deliver/maintenance before opening your Pull Request.
Don't hesitate to contact us directly on Discord if you have any questions ! https://developers.ledger.com/discord -->
11 changes: 5 additions & 6 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Compilation & tests

on:
workflow_dispatch:
push:
branches:
- master
- develop
pull_request:
# push:
# branches:
# - master
# - develop
# pull_request:

jobs:
build_application:
Expand All @@ -21,4 +21,3 @@ jobs:
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
with:
download_app_binaries_artifact: compiled_app_binaries
test_dir: tests
12 changes: 6 additions & 6 deletions .github/workflows/guidelines_enforcer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ name: Ensure compliance with Ledger guidelines

on:
workflow_dispatch:
push:
branches:
- master
- main
- develop
pull_request:
# push:
# branches:
# - master
# - main
# - develop
# pull_request:

jobs:
guidelines_enforcer:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/lint-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Code style check

on:
workflow_dispatch:
push:
branches:
- master
- develop
pull_request:
# push:
# branches:
# - master
# - develop
# pull_request:

jobs:
job_lint:
Expand All @@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v3

- name: Lint
uses: DoozyX/clang-format-lint-action@v0.11
uses: DoozyX/clang-format-lint-action@v0.18.2
with:
source: './src'
extensions: 'h,c'
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ APP_LOAD_PARAMS += $(COMMON_LOAD_PARAMS)

APPNAME = "MultiversX"
APPVERSION_M = 1
APPVERSION_N = 0
APPVERSION_P = 23
APPVERSION_N = 1
APPVERSION_P = 0
APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)

ifeq ($(TARGET_NAME),TARGET_NANOS)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ Or this to remove it:
```$ make delete```

If you want to check the build process for a specific device:
- Nano S: `$make load && make BOLOS_SDK=$NANOS_SDK`
- Nano X `$make load && make BOLOS_SDK=$NANOX_SDK`
- Stax: `$make load && make BOLOS_SDK=$STAX_SDK`
- Nano S: `make && BOLOS_SDK=$NANOS_SDK make load`
- Nano X `make && BOLOS_SDK=$NANOX_SDK make load`
- Stax: `make && BOLOS_SDK=$STAX_SDK make load`

Reference: https://github.com/LedgerHQ/ledger-app-builder

Expand Down
8 changes: 8 additions & 0 deletions ledger_app.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[app]
build_directory = "./"
sdk = "C"
devices = ["nanos", "nanox", "nanos+", "stax"]

[tests]
unit_directory = "./unit-tests/"
pytest_directory = "./tests/"
8 changes: 5 additions & 3 deletions src/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ typedef enum { CONTRACT_DATA_ENABLED = true, CONTRACT_DATA_DISABLED = false } co
#ifdef HAVE_BAGL
#define MAX_DISPLAY_DATA_SIZE 64UL // must be multiple of 4
#else
#define MAX_DISPLAY_DATA_SIZE 256UL // must be multiple of 4
// must be multiple of 4
// must be <= MAX_VALUE_LEN
#define MAX_DISPLAY_DATA_SIZE 128UL
#endif
#define DATA_SIZE_LEN 17
#define MAX_CHAINID_LEN 4
Expand Down Expand Up @@ -88,8 +90,8 @@ typedef enum { CONTRACT_DATA_ENABLED = true, CONTRACT_DATA_DISABLED = false } co
#define SHA3_KECCAK_BITS 256
#define PUBLIC_KEY_LEN 32
#define BASE_10 10
#define TX_SIGN_FLOW_SIZE 9
#define ESDT_TRANSFER_FLOW_SIZE 9
#define TX_SIGN_FLOW_SIZE 10
#define ESDT_TRANSFER_FLOW_SIZE 10
#define BASE_64_INVALID_CHAR '?'
#define SC_ARGS_SEPARATOR '@'
#define MAX_ESDT_VALUE_HEX_COUNT 32
Expand Down
16 changes: 6 additions & 10 deletions src/get_address.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,13 @@ static void callback_choice(bool match) {
}
}

static void display_addr(void) {
nbgl_useCaseAddressConfirmation(address, callback_choice);
}

static void ui_get_public_key_nbgl(void) {
nbgl_useCaseReviewStart(&C_icon_multiversx_logo_64x64,
"Verify " APPNAME "\naddress",
NULL,
"Cancel",
display_addr,
address_verification_cancelled);
nbgl_useCaseAddressReview(address,
NULL,
&C_icon_multiversx_logo_64x64,
"Verify " APPNAME "\naddress",
NULL,
callback_choice);
}

#else
Expand Down
70 changes: 34 additions & 36 deletions src/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,9 @@ enum {
};

#define SETTINGS_PAGE_NUMBER 2
static bool settings_nav_callback(uint8_t page, nbgl_pageContent_t* content) {
if (page == 0) {
content->type = INFOS_LIST;
content->infosList.nbInfos = ARRAY_COUNT(info_types);
content->infosList.infoTypes = info_types;
content->infosList.infoContents = info_contents;
} else if (page == 1) {
content->type = SWITCHES_LIST;
content->switchesList.nbSwitches = NB_SETTINGS_SWITCHES;
content->switchesList.switches = G_switches;
} else {
return false;
}

return true;
}

static void ui_menu_main(void);
static void ui_menu_settings(void);

static void settings_controls_callback(int token, uint8_t index) {
static void settings_controls_callback(int token, uint8_t index, int action) {
UNUSED(action);
uint8_t new_setting;
UNUSED(index);
switch (token) {
Expand All @@ -64,7 +46,28 @@ static void settings_controls_callback(int token, uint8_t index) {
}
}

static void ui_menu_settings(void) {
static void ui_menu_main(void);

nbgl_contentInfoList_t app_info;
nbgl_content_t settings_page_content;
nbgl_genericContents_t settings_contents;

static void initialize_settings_contents(void) {
app_info.nbInfos = ARRAY_COUNT(info_types);
app_info.infoTypes = info_types;
app_info.infoContents = info_contents;

settings_page_content.type = SWITCHES_LIST;
settings_page_content.content.switchesList.nbSwitches = NB_SETTINGS_SWITCHES;
settings_page_content.content.switchesList.switches = G_switches;
settings_page_content.contentActionCallback = settings_controls_callback;

settings_contents.callbackCallNeeded = false;
settings_contents.contentsList = &settings_page_content;
settings_contents.nbContents = NB_SETTINGS_SWITCHES;
}

static void ui_menu_main(void) {
G_switches[CONTRACT_DATA_IDX].text = "Contract data";
G_switches[CONTRACT_DATA_IDX].subText = "Enable contract data";
G_switches[CONTRACT_DATA_IDX].token = SWITCH_CONTRACT_DATA_SET_TOKEN;
Expand All @@ -74,22 +77,17 @@ static void ui_menu_settings(void) {
} else {
G_switches[CONTRACT_DATA_IDX].initState = ON_STATE;
}
nbgl_useCaseSettings(APPNAME " settings",
0,
SETTINGS_PAGE_NUMBER,
false,
ui_menu_main,
settings_nav_callback,
settings_controls_callback);
}

static void ui_menu_main(void) {
nbgl_useCaseHome(APPNAME,
&C_icon_multiversx_logo_64x64,
NULL,
true,
ui_menu_settings,
quit_app_callback);
initialize_settings_contents();

nbgl_useCaseHomeAndSettings(APPNAME,
&C_icon_multiversx_logo_64x64,
NULL,
INIT_HOME_PAGE,
&settings_contents,
&app_info,
NULL,
quit_app_callback);
}

#else
Expand Down
17 changes: 17 additions & 0 deletions src/parse_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,19 @@ uint16_t verify_guardian(bool *valid) {
return MSG_OK;
}

uint16_t verify_relayer(bool *valid) {
if (strncmp(tx_hash_context.current_field, RELAYER_FIELD, strlen(RELAYER_FIELD)) == 0) {
if (tx_hash_context.current_value_len >= sizeof(tx_context.relayer)) {
return ERR_INVALID_MESSAGE;
}
memmove(tx_context.relayer,
tx_hash_context.current_value,
tx_hash_context.current_value_len);
*valid = true;
}
return MSG_OK;
}

// verifies if the field and value are valid and stores them
uint16_t process_field(void) {
if (tx_hash_context.current_field_len == 0 || tx_hash_context.current_value_len == 0) {
Expand Down Expand Up @@ -452,6 +465,10 @@ uint16_t process_field(void) {
if (err != MSG_OK) {
return err;
}
err = verify_relayer(&valid_field);
if (err != MSG_OK) {
return err;
}

// verify the rest of the fields that are not displayed
valid_field |= strncmp(tx_hash_context.current_field, NONCE_FIELD, strlen(NONCE_FIELD)) == 0;
Expand Down
1 change: 1 addition & 0 deletions src/parse_tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ typedef struct {
char esdt_value[MAX_ESDT_VALUE_HEX_COUNT + PRETTY_SIZE];
char network[8];
char guardian[FULL_ADDRESS_LENGTH];
char relayer[FULL_ADDRESS_LENGTH];
} tx_context_t;

extern tx_context_t tx_context;
Expand Down
29 changes: 17 additions & 12 deletions src/provide_ESDT_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,28 @@ static bool verify_signature(const uint8_t *data_buffer,
uint8_t hash[HASH_LEN];
cx_sha256_t sha256;
cx_ecfp_public_key_t tokenKey;
int err;

cx_sha256_init(&sha256);
cx_hash_no_throw((cx_hash_t *) &sha256, CX_LAST, data_buffer, required_len, hash, 32);
err = cx_hash_no_throw((cx_hash_t *) &sha256, CX_LAST, data_buffer, required_len, hash, 32);
if (err != CX_OK) {
return false;
}

cx_ecfp_init_public_key_no_throw(CX_CURVE_256K1,
LEDGER_SIGNATURE_PUBLIC_KEY,
sizeof(LEDGER_SIGNATURE_PUBLIC_KEY),
&tokenKey);
err = cx_ecfp_init_public_key_no_throw(CX_CURVE_256K1,
LEDGER_SIGNATURE_PUBLIC_KEY,
sizeof(LEDGER_SIGNATURE_PUBLIC_KEY),
&tokenKey);
if (err != CX_OK) {
return false;
}

int signature_size = data_length - required_len;
return cx_ecdsa_verify(&tokenKey,
CX_LAST,
CX_SHA256,
hash,
32,
data_buffer + required_len,
signature_size);
return cx_ecdsa_verify_no_throw(&tokenKey,
hash,
32,
data_buffer + required_len,
signature_size);
}
#endif

Expand Down
Loading