Skip to content

Commit

Permalink
Merge pull request #32 from Zondax/dev
Browse files Browse the repository at this point in the history
New Release
  • Loading branch information
emmanuelm41 authored Oct 23, 2024
2 parents 4f8da8b + ee6032c commit 2b19672
Show file tree
Hide file tree
Showing 53 changed files with 385 additions and 331 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ file(GLOB_RECURSE LIB_SRC
${CMAKE_CURRENT_SOURCE_DIR}/app/src/parser_impl.c
${CMAKE_CURRENT_SOURCE_DIR}/app/src/parser_impl_common.c
${CMAKE_CURRENT_SOURCE_DIR}/app/src/crypto_helper.c
${CMAKE_CURRENT_SOURCE_DIR}/app/src/crypto_helper/chacha.c

# ###
${CMAKE_CURRENT_SOURCE_DIR}/deps/blake2/ref/blake2b-ref.c
Expand All @@ -150,7 +149,6 @@ target_include_directories(app_lib PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/deps/ledger-zxlib/include
${CMAKE_CURRENT_SOURCE_DIR}/app/src
${CMAKE_CURRENT_SOURCE_DIR}/app/src/lib
${CMAKE_CURRENT_SOURCE_DIR}/app/src/crypto_helper
${CMAKE_CURRENT_SOURCE_DIR}/app/src/common
${CMAKE_CURRENT_SOURCE_DIR}/app/rust/include
${CMAKE_CURRENT_SOURCE_DIR}/deps/blake2/ref
Expand Down
42 changes: 25 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Ledger Ironfish app

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![GithubActions](https://github.com/Zondax/ledger-ironfish/actions/workflows/main.yml/badge.svg)](https://github.com/Zondax/ledger-ironfish/blob/main/.github/workflows/main.yaml)

Expand Down Expand Up @@ -26,15 +27,15 @@ Please:
- **Do not use a Ledger device with funds for development purposes.**
- **Have a separate and marked device that is used ONLY for development and testing**


## Download and install a prerelease

*Once the app is approved by Ledger, it will be available in their app store (Ledger Live).
You can get builds generated by Github Actions from the release tab. THESE ARE UNVETTED DEVELOPMENT RELEASES*
_Once the app is approved by Ledger, it will be available in their app store (Ledger Live).
You can get builds generated by Github Actions from the release tab. THESE ARE UNVETTED DEVELOPMENT RELEASES_

Download a release from here (https://github.com/Zondax/ledger-ironfish/releases). You only need `installer.sh`
Download a release from here (<https://github.com/Zondax/ledger-ironfish/releases>). You only need `installer.sh`

If the file is not executable, run

```sh
chmod +x ./installer.sh
```
Expand All @@ -56,9 +57,10 @@ then run:
```

- Install Docker CE
- Instructions can be found here: https://docs.docker.com/install/
- Instructions can be found here: <https://docs.docker.com/install/>

- We only officially support Ubuntu. Install the following packages:

```
sudo apt update && apt-get -y install build-essential git wget cmake \
libssl-dev libgmp-dev autoconf libtool
Expand All @@ -67,12 +69,12 @@ then run:
- Install `node > v13.0`. We typically recommend using `n`

- You will need python 3 and then run
- `make deps`
- `make deps`

- This project requires Ledger firmware 2.0
- The current repository keeps track of Ledger's SDK but it is possible to override it by changing the git submodule.
- The current repository keeps track of Ledger's SDK but it is possible to override it by changing the git submodule.

*Warning*: Some IDEs may not use the same python interpreter or virtual enviroment as the one you used when running `pip`.
_Warning_: Some IDEs may not use the same python interpreter or virtual enviroment as the one you used when running `pip`.
If you see conan is not found, check that you installed the package in the same interpreter as the one that launches `cmake`.

## How to build ?
Expand All @@ -83,22 +85,27 @@ If you see conan is not found, check that you installed the package in the same
- Building the app itself

If you installed the what is described above, just run:

```bash
make
APP_TESTING=1 make
```

The APP_TESTING flag enables the use of specific test values during compilation, which is essential for testing with Zemu.

## Running tests

- Running rust tests (x64)

If you installed the what is described above, just run:

```bash
make rust_test
```

- Running C/C++ tests (x64)

If you installed the what is described above, just run:

```bash
make cpp_test
```
Expand All @@ -114,9 +121,9 @@ If you see conan is not found, check that you installed the package in the same
> What is Zemu?? Great you asked!!
> As part of this project, we are making public a beta version of our internal testing+emulation framework for Ledger apps.
>
> Npm Package here: https://www.npmjs.com/package/@zondax/zemu
> Npm Package here: <https://www.npmjs.com/package/@zondax/zemu>
>
> Repo here: https://github.com/Zondax/zemu
> Repo here: <https://github.com/Zondax/zemu>

Let's go! First install everything:
> At this moment, if you change the app you will need to run `make` before running the test again.
Expand All @@ -137,20 +144,21 @@ To run a single specific test:
## Using a real device
### How to prepare your DEVELOPMENT! device:
### How to prepare your DEVELOPMENT! device
> You can use an emulated device for development. This is only required if you are using a physical device
> You can use an emulated device for development. This is only required if you are using a physical device
>
> **Please do not use a Ledger device with funds for development purposes.**
> **Please do not use a Ledger device with funds for development purposes.**
>>
> **Have a separate and marked device that is used ONLY for development and testing**
> **Have a separate and marked device that is used ONLY for development and testing**
There are a few additional steps that increase reproducibility and simplify development:
**1 - Ensure your device works in your OS**
- In Linux hosts it might be necessary to adjust udev rules, etc.
Refer to Ledger documentation: https://support.ledger.com/hc/en-us/articles/115005165269-Fix-connection-issues
Refer to Ledger documentation: <https://support.ledger.com/hc/en-us/articles/115005165269-Fix-connection-issues>
**2 - Set a test mnemonic**
Expand Down Expand Up @@ -181,7 +189,6 @@ Many of our integration tests expect the device to be configured with a known te
- Run `make dev_ca`. The device will receive a development certificate to avoid constant manual confirmations.
### Loading into your development device
The Makefile will build the firmware in a docker container and leave the binary in the correct directory.
Expand All @@ -194,6 +201,7 @@ The Makefile will build the firmware in a docker container and leave the binary
- Upload to a device
The following command will upload the application to the ledger. _Warning: The application will be deleted before uploading._
```
make load # Builds and loads the app to the device
```
Expand Down
2 changes: 1 addition & 1 deletion app/Makefile.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ APPVERSION_M=0
# This is the minor version
APPVERSION_N=1
# This is the patch version
APPVERSION_P=0
APPVERSION_P=1
141 changes: 141 additions & 0 deletions app/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ crate-type = ["staticlib"]
[dependencies]
jubjub = { version = "0.10.0", default-features = false }
blake2b_simd = { version = "1.0.0", default-features = false }
chacha20poly1305 = { version = "0.10.1", default-features = false }

[target.thumbv6m-none-eabi.dev-dependencies]
panic-halt = "0.2.0"
Expand Down
6 changes: 4 additions & 2 deletions app/rust/include/rslib.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ parser_error_t scalar_multiplication(const uint8_t input[32], constant_key_t key
parser_error_t randomizeKey(const uint8_t key[KEY_LENGTH], const uint8_t randomness[KEY_LENGTH], uint8_t output[KEY_LENGTH]);
parser_error_t compute_sbar(const uint8_t s[KEY_LENGTH], const uint8_t r[KEY_LENGTH], const uint8_t rsk[KEY_LENGTH],
uint8_t sbar[32]);
parser_error_t shared_secret(uint8_t secret_key[32], uint8_t other_public_key[32], const uint8_t reference_public_key[32],
uint8_t output[32]);
parser_error_t decrypt_note(const uint8_t *note, uint8_t secret_key[32], uint8_t other_public_key[32],
const uint8_t reference_public_key[32], uint8_t output[32]);
parser_error_t decrypt_note_encryption_keys(const uint8_t *ovk, const uint8_t *note, uint8_t output[ENCRYPTED_SHARED_KEY_SIZE]);

#ifdef __cplusplus
}
#endif
Loading

0 comments on commit 2b19672

Please sign in to comment.