Skip to content

Commit

Permalink
Merge pull request #23 from Zondax/dev
Browse files Browse the repository at this point in the history
New Release
  • Loading branch information
emmanuelm41 authored Sep 18, 2024
2 parents f8f7e25 + 21c11d6 commit a557c70
Show file tree
Hide file tree
Showing 147 changed files with 589 additions and 241 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/coding_style_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:
jobs:
check_linting:
name: Check linting using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_lint.yml@v1
uses: Zondax/ledger-app-workflows/.github/workflows/reusable_lint.yml@v1
with:
source: './src'
source: './app'

170 changes: 168 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- id: get-user
run: echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT

build_ledger:
build_and_test:
runs-on: ${{ github.repository_owner == 'zondax' && 'zondax-runners' || 'ubuntu-latest' }}
steps:
- name: Install dependencies
Expand Down Expand Up @@ -55,8 +55,174 @@ jobs:
- name: Build app
run: |
export PATH=/home/runner/.local/bin:$PATH
make build
make all
- name: Install zemu deps
run: make zemu_install
- name: Run tests
run: make zemu_test


build_package_nanosp:
needs: [configure, build_and_test]
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ${{ github.repository_owner == 'zondax' && 'zondax-runners' || 'ubuntu-latest' }}
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y curl protobuf-compiler build-essential git wget unzip python3 python3-pip \
libssl-dev libffi-dev libreadline-dev zlib1g-dev libbz2-dev libsqlite3-dev libncurses5-dev \
libgdbm-dev libnss3-dev liblzma-dev libxml2-dev libxmlsec1-dev libffi-dev libyaml-dev \
clang gcc-arm-none-eabi gcc-multilib llvm-dev llvm
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2023-11-10
components: rust-src
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install yarn
run: |
npm install -g yarn
- name: Install ledger deps
run: |
cargo install cargo-ledger
cargo ledger setup
pip install ledgerwallet
- name: Build app
run: |
export PATH=/home/runner/.local/bin:$PATH
PRODUCTION_BUILD=0 make buildS2
mv ./app/pkg/installer_s2.sh ./app/pkg/installer_nanos_plus.sh
- name: Set tag
id: nanosp
run: echo "tag_name=$(./app/pkg/installer_nanos_plus.sh version)" >> $GITHUB_OUTPUT
- name: Update Release
id: update_release_2
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
files: ./app/pkg/installer_nanos_plus.sh
tag_name: ${{ steps.nanosp.outputs.tag_name }}
draft: false
prerelease: false

build_package_stax:
needs: [configure, build_and_test]
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ${{ github.repository_owner == 'zondax' && 'zondax-runners' || 'ubuntu-latest' }}
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y curl protobuf-compiler build-essential git wget unzip python3 python3-pip \
libssl-dev libffi-dev libreadline-dev zlib1g-dev libbz2-dev libsqlite3-dev libncurses5-dev \
libgdbm-dev libnss3-dev liblzma-dev libxml2-dev libxmlsec1-dev libffi-dev libyaml-dev \
clang gcc-arm-none-eabi gcc-multilib llvm-dev llvm
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2023-11-10
components: rust-src
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install yarn
run: |
npm install -g yarn
- name: Install ledger deps
run: |
cargo install cargo-ledger
cargo ledger setup
pip install ledgerwallet
- name: Build app
run: |
export PATH=/home/runner/.local/bin:$PATH
PRODUCTION_BUILD=0 make buildST
- name: Set tag
id: stax
run: echo "tag_name=$(./app/pkg/installer_stax.sh version)" >> $GITHUB_OUTPUT
- name: Update Release
id: update_release_2
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
files: |
./app/pkg/installer_stax.sh
tag_name: ${{ steps.stax.outputs.tag_name }}
draft: false
prerelease: false

build_package_flex:
needs: [configure, build_and_test]
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ${{ github.repository_owner == 'zondax' && 'zondax-runners' || 'ubuntu-latest' }}
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y curl protobuf-compiler build-essential git wget unzip python3 python3-pip \
libssl-dev libffi-dev libreadline-dev zlib1g-dev libbz2-dev libsqlite3-dev libncurses5-dev \
libgdbm-dev libnss3-dev liblzma-dev libxml2-dev libxmlsec1-dev libffi-dev libyaml-dev \
clang gcc-arm-none-eabi gcc-multilib llvm-dev llvm
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2023-11-10
components: rust-src
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install yarn
run: |
npm install -g yarn
- name: Install ledger deps
run: |
cargo install cargo-ledger
cargo ledger setup
pip install ledgerwallet
- name: Build app
run: |
export PATH=/home/runner/.local/bin:$PATH
PRODUCTION_BUILD=0 make buildFL
- name: Set tag
id: flex
run: echo "tag_name=$(./app/pkg/installer_flex.sh version)" >> $GITHUB_OUTPUT
- name: Update Release
id: update_release_2
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
files: |
./app/pkg/installer_flex.sh
tag_name: ${{ steps.flex.outputs.tag_name }}
draft: false
prerelease: false
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "ironfish"]
path = ironfish
url = https://github.com/iron-fish/ironfish
[submodule "deps/ledger-zxlib"]
path = deps/ledger-zxlib
url = https://github.com/Zondax/ledger-zxlib
74 changes: 20 additions & 54 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,74 +1,40 @@
TESTS_ZEMU_DIR?=$(CURDIR)/tests_zemu
TESTS_JS_PACKAGE = "@zondax/ledger-ironfish"
TESTS_JS_DIR = $(CURDIR)/js

.PHONY: build
build:
cargo ledger build nanosplus
cargo ledger build stax
cargo ledger build flex

.PHONY: setup
setup:
cargo ledger setup
ifeq ($(BOLOS_SDK),)
# In this case, there is not predefined SDK and we run dockerized
# When not using the SDK, we override and build the XL complete app
PRODUCTION_BUILD ?= 1
include $(CURDIR)/deps/ledger-zxlib/dockerized_build.mk

.PHONY: format
format:
cargo fmt --all

# To be run on linux only
.PHONY: lint-all
lint-all: lint-nanosplus lint-flex lint-stax lint-nanox

.PHONY: lint-nanosplus
lint-nanosplus:
cargo clippy --target nanosplus -- -Dwarnings

.PHONY: lint-nanox
lint-nanox:
cargo clippy --target nanox -- -Dwarnings

.PHONY: lint-flex
lint-flex:
cargo clippy --target flex -- -Dwarnings

.PHONY: lint-stax
lint-stax:
cargo clippy --target stax -- -Dwarnings


.PHONY: zemu_install_js_link
ifeq ($(TESTS_JS_DIR),)
zemu_install_js_link:
@echo "No local package defined"
else
zemu_install_js_link:
# First unlink everything
cd $(TESTS_JS_DIR) && yarn unlink || true
cd $(TESTS_ZEMU_DIR) && yarn unlink $(TESTS_JS_PACKAGE) || true
# Now build and link
cd $(TESTS_JS_DIR) && yarn install && yarn build && yarn link || true
cd $(TESTS_ZEMU_DIR) && yarn link $(TESTS_JS_PACKAGE) && yarn install || true
@echo
# List linked packages
@echo
@cd $(TESTS_ZEMU_DIR) && ( ls -l node_modules ; ls -l node_modules/@* ) | grep ^l || true
@echo
default:
$(MAKE) -C app
%:
$(info "Calling app Makefile for target $@")
COIN=$(COIN) $(MAKE) -C app $@
endif



zemu_install_ironfish_link:
cd ironfish && yarn unlink || true
cd $(TESTS_ZEMU_DIR) && yarn unlink @ironfish/rust-nodejs || true
# Now build and link
cd ironfish && yarn install && cd ironfish-rust-nodejs && yarn link || true
cd $(TESTS_ZEMU_DIR) && yarn link @ironfish/rust-nodejs || true

# Redefine zemu_install, as we still need to compile the ironfish package locally
.PHONY: zemu_install
zemu_install: zemu_install_ironfish_link zemu_install_js_link
# and now install everything
cd $(TESTS_ZEMU_DIR) && yarn install


.PHONY: zemu_test
zemu_test:
cd $(TESTS_ZEMU_DIR) && yarn test
# Copy files quickly from a source to a folder with a regular expresions
# In some cases, when something change in the screens for some command, it changes for each participant.
# This makes it hard and tedious to update each participant snapshots (one per test run).
# This allows to quickly update the other images from the first run
.PHONY: copy-files
copy-files:
find . -type d -name "*sp-*" -exec cp ../snapshots-tmp/sp-dkg-p2-m2-0-identity/00003.png {} \;
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# Ledger Ironfish DKG
[![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-dkg/actions/workflows/main.yml/badge.svg)](https://github.com/Zondax/ledger-ironfish-dkg/blob/master/.github/workflows/main.yaml)

---

![zondax_light](docs/zondax_light.png#gh-light-mode-only)
![zondax_dark](docs/zondax_dark.png#gh-dark-mode-only)

_Please visit our website at [zondax.ch](https://www.zondax.ch)_

---

## Compilation and load

Expand Down
2 changes: 0 additions & 2 deletions .cargo/config.toml → app/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ runner = "speculos -a=1 --model=nanosp"

[env]
HEAP_SIZE = "16300"
CARGO_PKG_AUTHORS="Zondax AG"
CARGO_PKG_VERSION="0.1.0"

[unstable]
build-std = ["core", "alloc"]
Expand Down
38 changes: 38 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
target
app.json
app_nanos.json
app_nanosplus.json
app_nanox.json
app_stax.json
app_flex.json

# Temporary directory with snapshots taken during test runs
tests/snapshots-tmp/

# Python
*.pyc[cod]
*.egg
__pycache__/
*.egg-info/
.eggs/
.python-version

# Related to the Ledger VSCode extension
# Virtual env for sideload (macOS and Windows)
ledger/
# Build directory
build/

.idea
.vscode
tmp
.DS_Store

bin/*.elf
bin/*.apdu
bin/*.hex

pkg/*.sh
output/*.elf
output/*.apdu
output/*.hex
8 changes: 4 additions & 4 deletions Cargo.lock → app/Cargo.lock

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

Loading

0 comments on commit a557c70

Please sign in to comment.