Skip to content

Commit

Permalink
Merge pull request #74 from Zondax/dev
Browse files Browse the repository at this point in the history
New Release
  • Loading branch information
emmanuelm41 authored Oct 8, 2024
2 parents 14f7220 + 7b0547d commit ebf0adf
Show file tree
Hide file tree
Showing 119 changed files with 203 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coding_style_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
check_linting:
name: Check linting using the reusable workflow
uses: Zondax/ledger-app-workflows/.github/workflows/reusable_lint.yml@v1
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_lint.yml@v1
with:
source: './app'

24 changes: 24 additions & 0 deletions .github/workflows/guidelines_enforcer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Ensure compliance with Ledger guidelines

# This workflow is mandatory in all applications
# It calls a reusable workflow guidelines_enforcer developed by Ledger's internal developer team.
# The successful completion of the reusable workflow is a mandatory step for an app to be available on the Ledger
# application store.
#
# More information on the guidelines can be found in the repository:
# LedgerHQ/ledger-app-workflows/

on:
workflow_dispatch:
push:
branches:
- master
- main
- develop
- dev # for safety reasons
pull_request:

jobs:
guidelines_enforcer:
name: Call Ledger guidelines_enforcer
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2023-11-10
toolchain: stable
components: rust-src
- name: Checkout
uses: actions/checkout@v4
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ copy-files:

.PHONY: rust_tests
rust_tests:
cd app && cargo test --no-default-features
cd app && cargo +stable test --no-default-features


.PHONY: try_device
try_device:
cd tests_zemu && yarn try
64 changes: 32 additions & 32 deletions app/Cargo.lock

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

12 changes: 6 additions & 6 deletions app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
name = "ledger-ironfish-dkg"
name = "ironfish-dkg"
version = "0.0.0" # The version is being taken from Makefile.version file
edition = "2021"

[[bin]]
name = "ledger-ironfish-dkg"
name = "ironfish-dkg"
test = false
path = "bin-app/app.rs"

[dependencies]
# ledger_device_sdk = { git = "https://github.com/Zondax/ledger-device-rust-sdk", rev = "923e5cf53d09e0e81c64eecc92c26800fad4bf45", optional = true }
ledger_device_sdk = { version = "1.17.1", optional = true }
# ledger_device_sdk = { path="../../ledger-device-rust-sdk/ledger_device_sdk" , optional = true}
# ledger_device_sdk = { git = "https://github.com/Zondax/ledger-device-rust-sdk", rev = "0f07d2b2afae6e9b194573e84f99f68f8755084e", optional = true }
ledger_device_sdk = { version = "1.17.3", optional = true }
#ledger_device_sdk = { path="../ledger-device-rust-sdk/ledger_device_sdk" , optional = true}
include_gif = "1.2.0"
serde = { version = "1.0.192", default_features = false, features = ["derive"] }
serde-json-core = { git = "https://github.com/rust-embedded-community/serde-json-core" }
Expand Down Expand Up @@ -91,7 +91,7 @@ icon = "nanox_icon.gif"
icon = "stax_icon.gif"

[package.metadata.ledger.flex]
icon = "stax_icon.gif"
icon = "flex_icon.gif"

# TODO: This change shouldn't be necessary, the ledger targets clearly define atomics as only supporting 32 not 64 (as seen in /opt/rustup/toolchains/1.75.0-aarch64-unknown-linux-musl/lib/rustlib/nanosplus/target.json)
# solve why this is happening rather than using modified radium
Expand Down
18 changes: 9 additions & 9 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ endif
include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.app_testing

ifndef COIN
COIN=IRON
COIN=IRON_DKG
endif

include $(CURDIR)/Makefile.version

$(info COIN = [$(COIN)])

ifeq ($(COIN),IRON)
ifeq ($(COIN),IRON_DKG)
# Main app configuration
APPNAME = "Ironfish DKG"
APPPATH = "44'/1338'"
Expand Down Expand Up @@ -88,23 +88,23 @@ include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.side_loading

.PHONY: buildX
buildX:
BOLOS_SDK= APPVERSION_STR=$(APPVERSION_STR) PRODUCTION_BUILD=$(PRODUCTION_BUILD) RUSTFLAGS="-C opt-level=s" cargo +nightly-2023-11-10 ledger build nanox
BOLOS_SDK= APPVERSION_STR=$(APPVERSION_STR) PRODUCTION_BUILD=$(PRODUCTION_BUILD) RUSTFLAGS="-C opt-level=s" cargo ledger build nanox
FOLDER=nanox make post-build

.PHONY: buildS2
buildS2:
BOLOS_SDK= APPVERSION_STR=$(APPVERSION_STR) PRODUCTION_BUILD=$(PRODUCTION_BUILD) RUSTFLAGS="-C opt-level=s" cargo +nightly-2023-11-10 ledger build nanosplus
BOLOS_SDK= APPVERSION_STR=$(APPVERSION_STR) PRODUCTION_BUILD=$(PRODUCTION_BUILD) RUSTFLAGS="-C opt-level=s" cargo ledger build nanosplus
FOLDER=nanosplus make post-build

.PHONY: buildST
buildST:
BOLOS_SDK= APPVERSION_STR=$(APPVERSION_STR) PRODUCTION_BUILD=$(PRODUCTION_BUILD) RUSTFLAGS="-C opt-level=z" cargo +nightly-2023-11-10 ledger build stax
BOLOS_SDK= APPVERSION_STR=$(APPVERSION_STR) PRODUCTION_BUILD=$(PRODUCTION_BUILD) RUSTFLAGS="-C opt-level=z" cargo ledger build stax
FOLDER=stax make post-build


.PHONY: buildFL
buildFL:
BOLOS_SDK= APPVERSION_STR=$(APPVERSION_STR) PRODUCTION_BUILD=$(PRODUCTION_BUILD) RUSTFLAGS="-C opt-level=z" cargo +nightly-2023-11-10 ledger build flex
BOLOS_SDK= APPVERSION_STR=$(APPVERSION_STR) PRODUCTION_BUILD=$(PRODUCTION_BUILD) RUSTFLAGS="-C opt-level=z" cargo ledger build flex
FOLDER=flex make post-build


Expand Down Expand Up @@ -170,9 +170,9 @@ post-build: move-files-to-output read-params-from-json get-icon-hex create-insta

.PHONY: move-files-to-output
move-files-to-output:
cp target/$(FOLDER)/release/ledger-ironfish-dkg bin/app.elf
cp target/$(FOLDER)/release/ledger-ironfish-dkg.hex bin/app.hex
cp target/$(FOLDER)/release/ledger-ironfish-dkg.apdu bin/app.apdu
cp target/$(FOLDER)/release/ironfish-dkg bin/app.elf
cp target/$(FOLDER)/release/ironfish-dkg.hex bin/app.hex
cp target/$(FOLDER)/release/ironfish-dkg.apdu bin/app.apdu

.PHONY: read-params-from-json
read-params-from-json:
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=5
# This is the patch version
APPVERSION_P=3
APPVERSION_P=4
4 changes: 2 additions & 2 deletions app/bin-app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#![no_std]
#![no_main]

use ironfish_dkg::{context::TxContext, AppSW};
use ledger_device_sdk::io::{Comm, Event};
use ledger_ironfish_dkg::{context::TxContext, AppSW};

use ledger_ironfish_dkg::ledger::*;
use ironfish_dkg::ledger::*;

#[cfg(any(target_os = "stax", target_os = "flex"))]
use ledger_device_sdk::nbgl::init_comm;
Expand Down
4 changes: 2 additions & 2 deletions app/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
# channel = "nightly-2023-11-10"
channel = "stable"
channel = "nightly-2023-11-10"
#channel = "stable"
21 changes: 13 additions & 8 deletions app/src/app_ui/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,18 @@ pub fn ui_menu_main(comm: &mut Comm) -> Event<Instruction> {

let mut _first_page_label: [&str; 2];

if env!("PRODUCTION_BUILD") == "0" {
let production_build = option_env!("PRODUCTION_BUILD").unwrap_or("1");
let app_version = option_env!("APPVERSION_STR").unwrap_or("v0.0.0");

if production_build == "0" {
_first_page_label = ["Ironfish DKG DEMO", "DO NOT USE"];
} else {
_first_page_label = ["Ironfish DKG", "Ready"];
}

let pages = [
&Page::from((_first_page_label, &APP_ICON)),
&Page::from((["Ironfish DKG", env!("APPVERSION_STR")], true, true)),
&Page::from((["Ironfish DKG", app_version], true, true)),
&Page::from((["Developed by", "Zondax.ch"], true, true)),
&Page::from((["License", "Apache 2.0"], true, true)),
&Page::from(("Quit", &DASHBOARD)),
Expand All @@ -67,16 +70,18 @@ pub fn ui_menu_main(_: &mut Comm) -> Event<Instruction> {
#[cfg(target_os = "flex")]
const FERRIS: NbglGlyph = NbglGlyph::from_include(include_gif!("flex_icon.gif", NBGL));

let name: &str;
if env!("PRODUCTION_BUILD") == "0" {
name = "Ironfish DKG DEMO";
let production_build = option_env!("PRODUCTION_BUILD").unwrap_or("1");
let app_version = option_env!("APPVERSION_STR").unwrap_or("v0.0.0");

let name: &str = if production_build == "0" {
"Ironfish DKG DEMO"
} else {
name = "Ironfish DKG";
}
"Ironfish DKG"
};

// Display the home screen.
NbglHomeAndSettings::new()
.glyph(&FERRIS)
.infos(name, env!("APPVERSION_STR"), "Zondax AG")
.infos(name, app_version, "Zondax AG")
.show()
}
22 changes: 9 additions & 13 deletions app/src/app_ui/run_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub fn ui_review_transaction<'a>(
}

#[inline(never)]
pub fn ui_review_get_identity<'a>(i_index: u8) -> Result<bool, AppSW> {
pub fn ui_review_get_identity(i_index: u8) -> Result<bool, AppSW> {
zlog_stack("s review_get_identity\0");
app_canary();

Expand All @@ -112,7 +112,7 @@ pub fn ui_review_get_identity<'a>(i_index: u8) -> Result<bool, AppSW> {
}

#[inline(never)]
pub fn ui_review_get_keys<'a>(data: &Vec<u8>, key_type: u8) -> Result<bool, AppSW> {
pub fn ui_review_get_keys(data: &Vec<u8>, key_type: u8) -> Result<bool, AppSW> {
zlog_stack("s ui_review_get_keys\0");
app_canary();

Expand Down Expand Up @@ -178,7 +178,7 @@ pub fn ui_review_get_keys<'a>(data: &Vec<u8>, key_type: u8) -> Result<bool, AppS
}

#[inline(never)]
pub fn ui_review_get_current_identity<'a>(i_index: u8) -> Result<bool, AppSW> {
pub fn ui_review_get_current_identity(i_index: u8) -> Result<bool, AppSW> {
zlog_stack("s review_current_identity\0");
app_canary();

Expand All @@ -199,11 +199,7 @@ pub fn ui_review_get_current_identity<'a>(i_index: u8) -> Result<bool, AppSW> {
}

#[inline(never)]
pub fn ui_review_dkg_round1<'a>(
i_index: u8,
min_signers: u8,
participants: u8,
) -> Result<bool, AppSW> {
pub fn ui_review_dkg_round1(i_index: u8, min_signers: u8, participants: u8) -> Result<bool, AppSW> {
zlog_stack("s review_dkg_round1\0");

let i_index_str = int_to_str(i_index);
Expand All @@ -229,7 +225,7 @@ pub fn ui_review_dkg_round1<'a>(
}

#[inline(never)]
pub fn ui_review_dkg_round2<'a>(i_index: u8, round1_public_package_len: u8) -> Result<bool, AppSW> {
pub fn ui_review_dkg_round2(i_index: u8, round1_public_package_len: u8) -> Result<bool, AppSW> {
zlog_stack("s review_dkg_round2\0");
app_canary();

Expand All @@ -251,7 +247,7 @@ pub fn ui_review_dkg_round2<'a>(i_index: u8, round1_public_package_len: u8) -> R
}

#[inline(never)]
pub fn ui_review_backup_keys<'a>(
pub fn ui_review_backup_keys(
public_address: Vec<u8>,
participants: u8,
min_signers: u8,
Expand Down Expand Up @@ -283,7 +279,7 @@ pub fn ui_review_backup_keys<'a>(
}

#[inline(never)]
pub fn ui_review_dkg_round3<'a>(
pub fn ui_review_dkg_round3(
i_index: u8,
round1_public_package_len: u8,
round2_public_package_len: u8,
Expand Down Expand Up @@ -326,7 +322,7 @@ pub fn ui_review_dkg_round3<'a>(
}

#[inline(never)]
pub fn ui_review_restore_keys<'a>(
pub fn ui_review_restore_keys(
public_address: Vec<u8>,
participants: u8,
min_signers: u8,
Expand Down Expand Up @@ -397,6 +393,6 @@ pub fn ui_review<'a>(
.titles(title, _subtitle, _finish_title)
.glyph(&ICON);

Ok(review.show(&fields))
Ok(review.show(fields))
}
}
6 changes: 6 additions & 0 deletions app/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ impl TxContext {
self.done = false;
}
}

impl Default for TxContext {
fn default() -> Self {
Self::new()
}
}
Loading

0 comments on commit ebf0adf

Please sign in to comment.