Skip to content

Commit

Permalink
Merge pull request coderofstuff#61 from LedgerHQ/develop
Browse files Browse the repository at this point in the history
Merge in Ledger's changes in their "develop"
  • Loading branch information
coderofstuff authored Dec 18, 2023
2 parents 9eb1dce + 648c585 commit 34be8b0
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 111 deletions.
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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ APPNAME = "Kaspa"
# Application version
APPVERSION_M = 1
APPVERSION_N = 0
APPVERSION_P = 0
APPVERSION_P = 1
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)"

ifeq ($(TARGET_NAME),TARGET_NANOS)
Expand Down
1 change: 1 addition & 0 deletions src/apdu/dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#pragma once

#include "../types.h"
#include "parser.h"

/**
* Parameter 2 for last APDU to receive.
Expand Down
46 changes: 0 additions & 46 deletions src/apdu/parser.c

This file was deleted.

45 changes: 0 additions & 45 deletions src/apdu/parser.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "io.h"
#include "sw.h"
#include "ui/menu.h"
#include "apdu/parser.h"
#include "parser.h"
#include "apdu/dispatcher.h"

global_ctx_t G_context;
Expand Down
12 changes: 0 additions & 12 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,6 @@ typedef enum {
SIGN_MESSAGE = 0x07 /// sign a personal message with BIP32 path
} command_e;

/**
* Structure with fields of APDU command.
*/
typedef struct {
uint8_t cla; /// Instruction class
command_e ins; /// Instruction code
uint8_t p1; /// Instruction parameter 1
uint8_t p2; /// Instruction parameter 2
uint8_t lc; /// Length of command data
uint8_t *data; /// Command data
} command_t;

/**
* Enumeration with parsing state.
*/
Expand Down
Binary file modified tests/snapshots/nanos/test_app_mainmenu/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/nanosp/test_app_mainmenu/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/nanox/test_app_mainmenu/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_app_mainmenu/00001.png
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 tests/test_name_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ def test_get_app_and_version(backend, backend_name):
app_name, version = unpack_get_app_and_version_response(response.data)

assert app_name == "Kaspa"
assert version == "1.0.0"
assert version == "1.0.1"
2 changes: 1 addition & 1 deletion tests/test_version_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Taken from the Makefile, to update every time the Makefile version is bumped
MAJOR = 1
MINOR = 0
PATCH = 0
PATCH = 1

# In this test we check the behavior of the device when asked to provide the app version
def test_version(backend):
Expand Down
2 changes: 1 addition & 1 deletion unit-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ add_library(sighash SHARED ../src/sighash.c)
add_library(personal_message SHARED ../src/personal_message.c)
add_library(write SHARED /opt/ledger-secure-sdk/lib_standard_app/write.c)
add_library(format_local SHARED ../src/common/format_local.c)
add_library(apdu_parser SHARED ../src/apdu/parser.c)
add_library(apdu_parser SHARED /opt/ledger-secure-sdk/lib_standard_app/parser.c)
add_library(transaction_deserialize ../src/transaction/deserialize.c)
add_library(transaction_serialize ../src/transaction/serialize.c)
add_library(transaction_utils ../src/transaction/utils.c)
Expand Down
7 changes: 4 additions & 3 deletions unit-tests/test_apdu_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <cmocka.h>

#include "types.h"
#include "apdu/parser.h"
#include "parser.h"

static void test_apdu_parser(void **state) {
(void) state;
Expand All @@ -42,10 +42,11 @@ static void test_apdu_parser(void **state) {
command_t cmd;

memset(&cmd, 0, sizeof(cmd));
assert_false(apdu_parser(&cmd, apdu_bad_min_len, sizeof(apdu_bad_min_len)));
assert_true(apdu_parser(&cmd, apdu_bad_min_len, sizeof(apdu_bad_min_len)));
assert_int_equal(cmd.lc, 0);

memset(&cmd, 0, sizeof(cmd));
assert_false(apdu_parser(&cmd, apdu_bad_lc, sizeof(apdu_bad_min_len)));
assert_false(apdu_parser(&cmd, apdu_bad_lc, sizeof(apdu_bad_lc)));

memset(&cmd, 0, sizeof(cmd));
assert_true(apdu_parser(&cmd, apdu, sizeof(apdu)));
Expand Down

0 comments on commit 34be8b0

Please sign in to comment.