Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update apps #9

Merged
merged 9 commits into from
Dec 4, 2023
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/embedded-app/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 -->
2 changes: 1 addition & 1 deletion .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
uses: ./.github/workflows/reusable_swap_functional_tests.yml
with:
branch_for_exchange: ${{ github.ref }}
branch_for_tezos: 'palmer@functori@add-swap-stax-test-to-CI'
branch_for_tezos: 'main'
run_for_devices: '["nanos", "nanosp", "stax"]'
test_filter: '"tezos_new"'
5 changes: 1 addition & 4 deletions .github/workflows/reusable_swap_functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
type: string
branch_for_ethereum:
required: false
default: 'stax_1.3.0_1.10.4-dev_sdk_969427eeb6b3b209ef71ee94c60a06b6c897717a'
default: '93712e2928656f3bece573dac4f3fefa27e0a6c5'
type: string
run_for_devices:
description: 'The list of device(s) on which the test will run (defaults to ["nanos", "nanox", "nanosp", "stax"])'
Expand All @@ -39,17 +39,14 @@ jobs:
- name: tezos_new
repo: trilitech/ledger-app-tezos-wallet
branch: ${{ inputs.branch_for_tezos }}
relative_app_directory: 'app'
- name: ethereum
repo: LedgerHQ/app-ethereum
branch: ${{ inputs.branch_for_ethereum }}
relative_app_directory: '.'

uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
app_repository: ${{ matrix.coin.repo }}
app_branch_name: ${{ matrix.coin.branch }}
relative_app_directory: ${{ matrix.coin.relative_app_directory }}
flags: "COIN=${{ matrix.coin.name }} CHAIN=${{ matrix.coin.name }} DEBUG=1"
upload_app_binaries_artifact: libraries_binaries
upload_as_lib_artifact: ${{ matrix.coin.name }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ APP_LOAD_PARAMS += $(COMMON_LOAD_PARAMS)
APPNAME = "Exchange"
APPVERSION_M = 3
APPVERSION_N = 3
APPVERSION_P = 2
APPVERSION_P = 3
APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)-dev

ifdef TESTING
Expand Down
14 changes: 1 addition & 13 deletions src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,11 @@ extern uint8_t G_io_seproxyhal_spi_buffer[IO_SEPROXYHAL_BUFFER_SIZE_B];
#define MAX_PARTNER_NAME_LENGHT 15

#define PARTNER_NAME_PREFIX_FOR_FUND "To "
#define PARTNER_NAME_PREFIX_SIZE (sizeof(PARTNER_NAME_PREFIX_FOR_FUND) - 1) // Remove trailing '\0'

#pragma pack(push, 1)
typedef struct partner_data_s {
uint8_t name_length;
ajinkyaraj-23 marked this conversation as resolved.
Show resolved Hide resolved
union {
// SELL and SWAP flows display nothing
// FUND flow displays "To xyz"
struct {
char prefix[PARTNER_NAME_PREFIX_SIZE];
char name[MAX_PARTNER_NAME_LENGHT + 1];
};
char prefixed_name[PARTNER_NAME_PREFIX_SIZE + MAX_PARTNER_NAME_LENGHT + 1];
};
char prefixed_name[sizeof(PARTNER_NAME_PREFIX_FOR_FUND) - 1 + MAX_PARTNER_NAME_LENGHT + 1];
cx_ecfp_256_public_key_t public_key;
} partner_data_t;
#pragma pack(pop)

typedef struct swap_app_context_s {
union {
Expand Down
6 changes: 1 addition & 5 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ int init_application_context(void) {

#endif
memset(&G_swap_ctx, 0, sizeof(G_swap_ctx));
// Prepare the prefixed name for FUND display, don't copy the trailing '\0' on purpose
// as we want the second part of the string to be concatenated automatically
memcpy(&G_swap_ctx.partner.prefix,
PARTNER_NAME_PREFIX_FOR_FUND,
sizeof(G_swap_ctx.partner.prefix));

if (cx_ecfp_init_public_key_no_throw(CX_CURVE_SECP256K1,
LedgerPubKey,
sizeof(LedgerPubKey),
Expand Down
13 changes: 8 additions & 5 deletions src/set_partner_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,14 @@ int set_partner_key(const command_t *cmd) {
return reply_error(err);
}

// The incoming partner name is NOT NULL terminated, so we use memcpy and
// manually NULL terminate the buffer
memset(G_swap_ctx.partner.name, 0, sizeof(G_swap_ctx.partner.name));
ajinkyaraj-23 marked this conversation as resolved.
Show resolved Hide resolved
memcpy(G_swap_ctx.partner.name, partner.bytes, partner.size);
G_swap_ctx.partner.name_length = partner.size;
memset(G_swap_ctx.partner.prefixed_name, 0, sizeof(G_swap_ctx.partner.prefixed_name));
// Prepare the prefix for FUND display
strlcpy(G_swap_ctx.partner.prefixed_name,
PARTNER_NAME_PREFIX_FOR_FUND,
sizeof(G_swap_ctx.partner.prefixed_name));
// The incoming partner name is NOT NULL terminated, so we use strncat
// Don't erase the prefix copied above
strncat(G_swap_ctx.partner.prefixed_name, (char *) partner.bytes, partner.size);

// Create the verifying key from the raw public key
if (cx_ecfp_init_public_key_no_throw(curve,
Expand Down
Loading