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

186 dont display swap #15

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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/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 -->
91 changes: 62 additions & 29 deletions .github/workflows/reusable_swap_functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,88 @@ on:
required: false
default: 'develop'
type: string

branch_for_stellar:
required: false
default: 'develop'
type: string
repo_for_stellar:
required: false
default: 'LedgerHQ/app-stellar'
type: string

branch_for_tezos:
required: false
default: 'develop'
type: string
repo_for_tezos:
required: false
default: 'LedgerHQ/app-tezos'
type: string

branch_for_xrp:
required: false
default: 'develop'
type: string
repo_for_xrp:
required: false
default: 'LedgerHQ/app-xrp'
type: string

branch_for_ethereum:
required: false
default: 'develop'
type: string
repo_for_ethereum:
required: false
default: 'LedgerHQ/app-ethereum'
type: string

branch_for_bitcoin_legacy:
required: false
default: 'master'
default: 'develop'
type: string
repo_for_bitcoin_legacy:
required: false
default: 'LedgerHQ/app-bitcoin'
type: string

branch_for_bitcoin:
required: false
default: 'develop'
type: string
repo_for_bitcoin:
required: false
default: 'LedgerHQ/app-bitcoin-new'
type: string

branch_for_solana:
required: false
default: 'develop'
type: string
repo_for_solana:
required: false
default: 'LedgerHQ/app-solana'
type: string

branch_for_polkadot:
required: false
default: 'develop'
type: string
repo_for_polkadot:
required: false
default: 'LedgerHQ/app-polkadot'
type: string

branch_for_tron:
required: false
default: 'develop'
type: string
repo_for_tron:
required: false
default: 'LedgerHQ/app-tron'
type: string

test_filter:
required: false
default: '""'
Expand All @@ -56,70 +102,57 @@ jobs:
matrix:
coin:
- name: stellar
repo: app-stellar
repo: ${{ inputs.repo_for_stellar }}
branch: ${{ inputs.branch_for_stellar }}
dir: .
- name: tezos
repo: app-tezos
repo: ${{ inputs.repo_for_tezos }}
branch: ${{ inputs.branch_for_tezos }}
dir: .
- name: xrp
repo: app-xrp
repo: ${{ inputs.repo_for_xrp }}
branch: ${{ inputs.branch_for_xrp }}
dir: .
- name: ethereum
repo: app-ethereum
repo: ${{ inputs.repo_for_ethereum }}
branch: ${{ inputs.branch_for_ethereum }}
dir: .
- name: ethereum_classic
repo: app-ethereum
repo: ${{ inputs.repo_for_ethereum }}
branch: ${{ inputs.branch_for_ethereum }}
dir: .
- name: litecoin
repo: app-bitcoin
repo: ${{ inputs.repo_for_bitcoin_legacy }}
branch: ${{ inputs.branch_for_bitcoin_legacy }}
dir: .
- name: bitcoin_legacy
repo: app-bitcoin
repo: ${{ inputs.repo_for_bitcoin_legacy }}
branch: ${{ inputs.branch_for_bitcoin_legacy }}
dir: .
- name: bitcoin
repo: app-bitcoin-new
repo: ${{ inputs.repo_for_bitcoin }}
branch: ${{ inputs.branch_for_bitcoin }}
dir: .
- name: solana
repo: app-solana
repo: ${{ inputs.repo_for_solana }}
branch: ${{ inputs.branch_for_solana }}
dir: .
- name: bsc
repo: app-ethereum
repo: ${{ inputs.repo_for_ethereum }}
branch: ${{ inputs.branch_for_ethereum }}
dir: .
- name: DOT
repo: app-polkadot
repo: ${{ inputs.repo_for_polkadot }}
branch: ${{ inputs.branch_for_polkadot }}
dir: ./app
- name: tron
repo: app-tron
repo: ${{ inputs.repo_for_tron }}
branch: ${{ inputs.branch_for_tron }}
dir: .

uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
app_repository: LedgerHQ/${{ matrix.coin.repo }}
app_repository: ${{ matrix.coin.repo }}
app_branch_name: ${{ matrix.coin.branch }}
flags: "COIN=${{ matrix.coin.name }} CHAIN=${{ matrix.coin.name }} DEBUG=1"
flags: "COIN=${{ matrix.coin.name }} CHAIN=${{ matrix.coin.name }}"
upload_app_binaries_artifact: libraries_binaries
upload_as_lib_artifact: ${{ matrix.coin.name }}
relative_app_directory: ${{ matrix.coin.dir }}

build_exchange_application:
name: Build application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
app_repository: LedgerHQ/app-exchange
app_branch_name: ${{ inputs.branch_for_exchange }}
flags: "TESTING=1 TEST_PUBLIC_KEY=1 DEBUG=1"
flags: "TESTING=1 TEST_PUBLIC_KEY=1"
upload_app_binaries_artifact: exchange_binaries

ragger_tests:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ APP_LOAD_PARAMS += $(COMMON_LOAD_PARAMS)
APPNAME = "Exchange"
APPVERSION_M = 3
APPVERSION_N = 3
APPVERSION_P = 2
APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)-dev
APPVERSION_P = 3
APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)

ifdef TESTING
$(info [INFO] TESTING enabled)
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;
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));
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
87 changes: 0 additions & 87 deletions test/python/apps/bsc.py

This file was deleted.

10 changes: 6 additions & 4 deletions test/python/apps/cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@

from .signing_authority import SigningAuthority, LEDGER_SIGNER

# Eth family
from .ethereum import ETH_PACKED_DERIVATION_PATH, ETH_CONF
from .ethereum_classic import ETC_PACKED_DERIVATION_PATH, ETC_CONF
from .ethereum import ETC_PACKED_DERIVATION_PATH, ETC_CONF
from .ethereum import BSC_PACKED_DERIVATION_PATH, BSC_CONF

from .litecoin import LTC_PACKED_DERIVATION_PATH, LTC_CONF
from .bitcoin import BTC_PACKED_DERIVATION_PATH, BTC_CONF
from .stellar import XLM_PACKED_DERIVATION_PATH, XLM_CONF
from .solana_utils import SOL_PACKED_DERIVATION_PATH, SOL_CONF
from .xrp import XRP_PACKED_DERIVATION_PATH, XRP_CONF
from .tezos import XTZ_PACKED_DERIVATION_PATH, XTZ_CONF
from .bsc import BSC_PACKED_DERIVATION_PATH, BSC_CONF
from .polkadot import DOT_PACKED_DERIVATION_PATH, DOT_CONF
from .tron import TRX_PACKED_DERIVATION_PATH, TRX_CONF
from .tron import TRX_USDT_CONF, TRX_USDC_CONF, TRX_TUSD_CONF, TRX_USDD_CONF
Expand All @@ -26,7 +28,7 @@
"SOL": SOL_CONF,
"XRP": XRP_CONF,
"XTZ": XTZ_CONF,
"BSC": BSC_CONF,
"BNB": BSC_CONF,
"DOT": DOT_CONF,
"TRX": TRX_CONF,
"USDT": TRX_USDT_CONF,
Expand All @@ -44,7 +46,7 @@
"SOL": SOL_PACKED_DERIVATION_PATH,
"XRP": XRP_PACKED_DERIVATION_PATH,
"XTZ": XTZ_PACKED_DERIVATION_PATH,
"BSC": BSC_PACKED_DERIVATION_PATH,
"BNB": BSC_PACKED_DERIVATION_PATH,
"DOT": DOT_PACKED_DERIVATION_PATH,
"TRX": TRX_PACKED_DERIVATION_PATH,
"USDT": TRX_PACKED_DERIVATION_PATH,
Expand Down
Loading