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

Rebase on ledgerhq/app-tezos-new #232

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
930b423
Merge pull request #3 from trilitech/main
fbeutin-ledger Jan 22, 2024
f9eec5c
[auto] Update screenshot
sgliner-ledger Feb 27, 2024
45457c7
[auto] Update screenshot
sgliner-ledger Feb 27, 2024
a4e5775
Change "Expert Mode Enabled" screen to match "TRANSACTION SIGNED" format
ajinkyaraj-23 Jan 24, 2024
fd3f1ec
Docker: fix ledger app-builder version to 3.14.0
spalmer25 Feb 12, 2024
101ae3b
Style: name parameters in function prototype
spalmer25 Feb 13, 2024
0d8bbea
Style: suffix unsigned type constants with 'u'
spalmer25 Feb 13, 2024
646b4ef
Style: make tz_string_to_mutez clearer
spalmer25 Feb 13, 2024
64ebf50
Style: avoid one-line `if`, `while`, `for`, ...
spalmer25 Feb 13, 2024
389ee57
Style: explicit the precedence of operators
spalmer25 Feb 13, 2024
36aef28
Header guard: add the missing header guard to handle_swap.h
spalmer25 Feb 13, 2024
1af0de9
Remove unused Ledger flags
ajinkyaraj-23 Feb 13, 2024
e2abf49
Add new Oxford2 entrypoints
ajinkyaraj-23 Feb 14, 2024
8a498c9
Remove unnecessary comments
ajinkyaraj-23 Feb 12, 2024
6da3923
Reset entire buffer not just its size
ajinkyaraj-23 Feb 9, 2024
26e8721
- Initialize pressed_right to 0.
ajinkyaraj-23 Feb 12, 2024
e6b4200
Remove redundant global.step check
ajinkyaraj-23 Feb 12, 2024
9a4ca9f
Fix unsigned int treated as int.
ajinkyaraj-23 Feb 12, 2024
9b12e71
Parser: reduce TZ_FIELD_NAME_SIZE size to a more appropriate size
spalmer25 Feb 14, 2024
904f73d
Makefile: build the app with the latest app-builder version
spalmer25 Feb 14, 2024
e03d17e
Bump up the ledger-sdk in CI
spalmer25 Feb 14, 2024
79728a7
CodeQL: make strlcpy explicit
spalmer25 Feb 14, 2024
16df304
CodeQL: make all the enumeration items explicit
spalmer25 Feb 14, 2024
e26d259
CodeQL: short tz_step_read_num switch case
spalmer25 Feb 14, 2024
8f0e585
Documentation: add documentation for formatting.(c|h)
spalmer25 Feb 15, 2024
c372074
Documentation: add documentation for parser_state.(c|h)
spalmer25 Feb 15, 2024
0281844
Documentation: add documentation for number parser
spalmer25 Feb 15, 2024
dc79169
Documentation: add documentation for micheline parser
spalmer25 Feb 15, 2024
ea7fb72
Documentation: add documentation for operations parser
spalmer25 Feb 15, 2024
8c4a42b
Parser: add the riscv SORU_KIND
spalmer25 Feb 16, 2024
d94afaf
Parser: remove the `Proof` field of soru origination fields
spalmer25 Feb 16, 2024
59cd89a
Parser: add the `Whitelist` field to soru origination fields
spalmer25 Feb 16, 2024
330ffd2
Michelson: adding missing operations
spalmer25 Feb 20, 2024
46de0bd
Tests: update the version of test generation to Oxford
spalmer25 Feb 16, 2024
fe39fcd
Test: fix unit-test parser for transaction
spalmer25 Feb 16, 2024
f412b07
Add documentation for ui_stream and ui_string files.
ajinkyaraj-23 Feb 14, 2024
aa8e845
Document data structures used
ajinkyaraj-23 Feb 20, 2024
e944e12
tests: Fix scripts/run_tests.sh to run stax tests.
ajinkyaraj-23 Mar 15, 2024
935500d
Update splash screen for blindsign enabled due to SDK change
ajinkyaraj-23 Mar 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ IndentWidth: 4
ColumnLimit: 78
UseTab: Never
IndentCaseLabels: false
InsertBraces: false
InsertBraces: true
PointerAlignment: Right

AlwaysBreakAfterReturnType: TopLevelDefinitions
Expand Down Expand Up @@ -36,4 +36,5 @@ AlignArrayOfStructures: Left
SortIncludes: Never
SpaceAfterCStyleCast: false
AllowShortEnumsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: Never
...
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 -->
38 changes: 20 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,43 +175,36 @@ re-run the test normally afterwards, to ensure the snapshots have been set corre

#### Preparation

First, start a container for running individual tests:
First start the app in a terminal using following command:

```sh
docker run --rm -it --entrypoint /bin/bash -v $(pwd):/app --network host \
ledger-app-tezos-integration-tests

cd /app/tests/integration/stax
export PORT=5000

git config --global --add safe.directory /app
. ../app_vars.sh
make app_stax_dbg.tgz
TARGET=stax ./scripts/run_app.sh
```
You should be able to see the stax display on your screen.

Before running the test, start the app in a separate container (as each test will quit the app):
Open a new terminal for running tests, run following commands to setup test environment

```sh
make app_stax_dbg.tgz

TARGET=stax ./scripts/run_app.sh
$ docker exec -it ledger-app-tezos-integration-tests bash;
<docker>$ export PORT=5000
<docker>$ . tests/integration/app_vars.sh
```

You can view/interact with the app using a vnc client on port `41000`.

#### Running

You can run an individual test from the test container. You should see the app progress on the vnc viewer.
You can run an individual test from the test container. You should see the app progress on the display.

```sh
./<test_name>.py
./tests/integration/stax/<test_name>.py
```

#### Setting goldimages

You can reset/set goldimages using the following:

```sh
GOLDEN=1 ./<test_name>.py
GOLDEN=1 ./tests/integration/stax/<test_name>.py
```

If you are resetting goldimages for multiple tests, you can also use `export NOQUIT=1` to keep the app
Expand Down Expand Up @@ -263,3 +256,12 @@ You can run :
./scripts/test_swap.sh update $DEVICE
```
to perform all snapshot update steps based on your current Tezos repository.

## Contributing

The version of the app must be updated after every change. Following files need to be updated
with a new version
1. app/Makefile
2. tests/integration/app_vars.sh
3. tests/integration/nano/utils/app.py
4. the snapshots (nano and stax)
6 changes: 1 addition & 5 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ APPNAME = "Tezos Wallet"
# Application version
APPVERSION_M=3
APPVERSION_N=0
APPVERSION_P=2
APPVERSION_P=3
APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)

# COMMIT
Expand Down Expand Up @@ -135,10 +135,6 @@ CFLAGS += -Wwrite-strings
########################################
# See SDK `include/appflags.h` for the purpose of each permission
#HAVE_APPLICATION_FLAG_DERIVE_MASTER = 1
ifneq ($(TARGET_NAME), TARGET_NANOS)
HAVE_APPLICATION_FLAG_GLOBAL_PIN = 1
HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
endif
HAVE_APPLICATION_FLAG_LIBRARY = 1

########################################
Expand Down
2 changes: 0 additions & 2 deletions app/src/apdu.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* Tezos Ledger application - Some common primitives and some command handlers

TODO: split this file (apdu primitives and apdu handlers)

Copyright 2023 Nomadic Labs <[email protected]>
Copyright 2023 Trilitech <[email protected]>

Expand Down
24 changes: 18 additions & 6 deletions app/src/apdu.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* Tezos Ledger application - Some common primitives and some command handlers

TODO: split this file (apdu primitives and apdu handlers)

Copyright 2023 Nomadic Labs <[email protected]>

With code excerpts from:
Expand Down Expand Up @@ -82,11 +80,25 @@
*
*/

typedef void(tz_handler)(command_t *);
typedef void(tz_handler)(command_t *cmd);
typedef tz_handler *tz_handler_t;

tz_handler handle_unimplemented;
tz_handler handle_apdu_version;
tz_handler handle_apdu_git;
tz_handler handle_unimplemented; /// handler for unknown commands
tz_handler handle_apdu_version; /// handle version enquiry apdu
tz_handler handle_apdu_git; /// handle git commit enquiry apdu
/**
* @brief Function to handle apdu request for public key. The public key is
* derived only once and stored in the RAM, in order to avoid repeated
* derivation calculations. This function can be called with or without
* prompt.
*
*/
tz_handler handle_apdu_get_public_key;
/**
* @brief Parse the received command and prompt user for appropriate action.
* Triggers blindsigning and/or expert mode workflows based on transaction
* involved. Stream based parser helps decode arbitararily large transaction,
* screen by screen.
*
*/
tz_handler handle_apdu_sign;
14 changes: 8 additions & 6 deletions app/src/apdu_pubkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@

static void provide_pubkey(void);
static void prompt_address(void);
static void format_pkh(cx_ecfp_public_key_t *, char *, size_t);
static void stream_cb(tz_ui_cb_type_t);
static void format_pkh(cx_ecfp_public_key_t *pubkey, char *buffer,
size_t len);
static void stream_cb(tz_ui_cb_type_t cb_type);

static void
provide_pubkey(void)
Expand Down Expand Up @@ -171,13 +172,13 @@ handle_apdu_get_public_key(command_t *cmd)
TZ_PREAMBLE(("cmd=%p", cmd));

TZ_ASSERT(EXC_UNEXPECTED_STATE,
global.step == ST_IDLE || global.step == ST_SWAP_SIGN);
(global.step == ST_IDLE) || (global.step == ST_SWAP_SIGN));
TZ_ASSERT(EXC_WRONG_PARAM, cmd->p1 == 0);

// do not expose pks without prompt through U2F (permissionless legacy
// comm in browser)
TZ_ASSERT(EXC_HID_REQUIRED,
prompt || G_io_apdu_media != IO_APDU_MEDIA_U2F);
prompt || (G_io_apdu_media != IO_APDU_MEDIA_U2F));

global.path_with_curve.derivation_type = cmd->p2;
TZ_ASSERT(EXC_WRONG_PARAM,
Expand All @@ -190,10 +191,11 @@ handle_apdu_get_public_key(command_t *cmd)
TZ_LIB_CHECK(derive_pk(&global.keys.pubkey,
global.path_with_curve.derivation_type,
&global.path_with_curve.bip32_path));
if (prompt)
if (prompt) {
prompt_address();
else
} else {
provide_pubkey();
}

TZ_POSTAMBLE;
}
Loading
Loading