Repository: alephium/ledger-alephium
Pull request #35: Update ledger sdk to the latest version
Author: login: Lbqds
Created: 2025-03-12T13:39:54Z | Merged: 2025-03-13T10:41:30Z



Diff:
diff --git a/Makefile b/Makefile
index 17b718f3..34ae92de 100644
--- a/Makefile
+++ b/Makefile
@@ -26,10 +26,10 @@ check:
 			echo 'Cargo fmt' && \
 			cargo fmt --all -- --check && \
 			echo 'Cargo clippy' && \
-			cargo +nightly-2023-11-10 clippy --target=nanox && \
-			cargo +nightly-2023-11-10 clippy --target=stax && \
+			cargo +nightly-2024-12-01 clippy --target=nanox && \
+			cargo +nightly-2024-12-01 clippy --target=stax && \
 			cargo install cargo-audit && cargo audit && \
-			cargo install --locked cargo-deny && cargo +nightly-2023-11-10 deny check \
+			cargo install --locked cargo-deny@0.17.0 && cargo +nightly-2024-12-01 deny check \
 		"
 
 _run-speculos:
diff --git a/app/Cargo.lock b/app/Cargo.lock
index d98755cb..fda9e1bb 100644
--- a/app/Cargo.lock
+++ b/app/Cargo.lock
@@ -351,9 +351,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
 
 [[package]]
 name = "ledger_device_sdk"
-version = "1.18.0"
+version = "1.21.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d1a52c4e6cef230fb27439613a889b73b08413bd41511a1ccf140f532a23f4d"
+checksum = "edf2106eabafdfcab23c8c4518a63c4976113149e04272f91fc6102e32a5908a"
 dependencies = [
  "const-zero",
  "include_gif",
@@ -366,9 +366,9 @@ dependencies = [
 
 [[package]]
 name = "ledger_secure_sdk_sys"
-version = "1.5.1"
+version = "1.7.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dae67d1f69230aa9798ddf94b8fc0b6a21f3ea7206db813b9c12aa2f783fd396"
+checksum = "e695004d49e61dcccd7ef391a3c727c0ef0b6d6abe65903e68b1f9d6f940c040"
 dependencies = [
  "bindgen",
  "cc",
diff --git a/app/Cargo.toml b/app/Cargo.toml
index 132bfa78..76d5221e 100644
--- a/app/Cargo.toml
+++ b/app/Cargo.toml
@@ -6,8 +6,8 @@ edition = "2021"
 license = "MIT"
 
 [dependencies]
-ledger_device_sdk = "1.18.0"
-ledger_secure_sdk_sys = "1.5.1"
+ledger_device_sdk = "1.21.4"
+ledger_secure_sdk_sys = { version = "1.7.2", features = ["heap"]}
 utils= { path = "../utils" }
 numtoa = "=0.2.4"
 shlex = { version = "1.3.0", default-features = false } # patch for ledger_device_sdk dependency
@@ -40,3 +40,6 @@ icon = "alph_32x32.gif"
 
 [package.metadata.ledger.flex]
 icon = "alph_40x40.gif"
+
+[lints.rust]
+unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("stax", "flex", "nanox", "nanosplus"))'] }
diff --git a/app/src/main.rs b/app/src/main.rs
index cf95a065..73a6a453 100644
--- a/app/src/main.rs
+++ b/app/src/main.rs
@@ -47,6 +47,7 @@ extern "C" fn sample_main() {
         }
     }
 
+    #[allow(static_mut_refs)]
     #[cfg(any(target_os = "stax", target_os = "flex"))]
     {
         use crate::settings::SETTINGS_DATA;
@@ -55,10 +56,10 @@ extern "C" fn sample_main() {
         use ledger_device_sdk::nbgl::{NbglGlyph, NbglHomeAndSettings, PageIndex};
 
         const APP_ICON: NbglGlyph = NbglGlyph::from_include(include_gif!("alph_64x64.gif", NBGL));
-        let settings_strings: &[[&str; 2]] = &[["Blind signing", "Enable blind signing"]];
+        let settings_strings = [["Blind signing", "Enable blind signing"]];
         let mut home_and_settings = NbglHomeAndSettings::new()
             .glyph(&APP_ICON)
-            .settings(unsafe { SETTINGS_DATA.get_mut() }, settings_strings)
+            .settings(unsafe { SETTINGS_DATA.get_mut() }, &settings_strings)
             .infos(
                 "Alephium",
                 env!("CARGO_PKG_VERSION"),
diff --git a/app/src/nvm/swapping_buffer.rs b/app/src/nvm/swapping_buffer.rs
index e67fb381..cd747343 100644
--- a/app/src/nvm/swapping_buffer.rs
+++ b/app/src/nvm/swapping_buffer.rs
@@ -137,7 +137,7 @@ impl<'a, const RAM: usize, const FLASH: usize> SwappingBuffer<'a, RAM, FLASH> {
     }
 }
 
-impl<'a, const RAM: usize, const FLASH: usize> Writable for SwappingBuffer<'a, RAM, FLASH> {
+impl<const RAM: usize, const FLASH: usize> Writable for SwappingBuffer<'_, RAM, FLASH> {
     fn write(&mut self, bytes: &[u8]) -> bool {
         self.write(bytes).is_ok()
     }
diff --git a/app/src/settings.rs b/app/src/settings.rs
index 1377aa55..0ed764a5 100644
--- a/app/src/settings.rs
+++ b/app/src/settings.rs
@@ -7,11 +7,13 @@ pub const SETTINGS_SIZE: usize = 10;
 pub static mut SETTINGS_DATA: NVMData<AtomicStorage<[u8; SETTINGS_SIZE]>> =
     NVMData::new(AtomicStorage::new(&[0u8; SETTINGS_SIZE]));
 
+#[allow(static_mut_refs)]
 pub fn is_blind_signing_enabled() -> bool {
     let settings = unsafe { SETTINGS_DATA.get_mut() };
     settings.get_ref()[0] != 0
 }
 
+#[allow(static_mut_refs)]
 #[cfg(not(any(target_os = "stax", target_os = "flex")))]
 pub fn toggle_blind_signing_setting() {
     let settings = unsafe { SETTINGS_DATA.get_mut() };
diff --git a/app/src/sign_tx_context.rs b/app/src/sign_tx_context.rs
index d8209727..f10a9042 100644
--- a/app/src/sign_tx_context.rs
+++ b/app/src/sign_tx_context.rs
@@ -38,6 +38,7 @@ pub struct SignTxContext {
 }
 
 impl SignTxContext {
+    #[allow(static_mut_refs)]
     pub fn new() -> Self {
         SignTxContext {
             path: [0; PATH_LENGTH],
diff --git a/app/src/ui/tx_reviewer.rs b/app/src/ui/tx_reviewer.rs
index c947c880..0bc3ac45 100644
--- a/app/src/ui/tx_reviewer.rs
+++ b/app/src/ui/tx_reviewer.rs
@@ -44,6 +44,7 @@ pub struct TxReviewer {
 }
 
 impl TxReviewer {
+    #[allow(static_mut_refs)]
     pub fn new() -> Self {
         Self {
             buffer: unsafe { SwappingBuffer::new(&mut DATA) },
diff --git a/js/docker/docker-compose.yaml b/js/docker/docker-compose.yaml
index f1ab716b..913402cb 100644
--- a/js/docker/docker-compose.yaml
+++ b/js/docker/docker-compose.yaml
@@ -2,7 +2,7 @@ version: "3.3"
 
 services:
   alephium:
-    image: alephium/alephium:v3.3.0
+    image: alephium/alephium:v3.12.3
     restart: "no"
     ports:
       - 19973:19973/tcp
diff --git a/js/package-lock.json b/js/package-lock.json
index e8709d83..fa93a9a4 100644
--- a/js/package-lock.json
+++ b/js/package-lock.json
@@ -1,16 +1,16 @@
 {
   "name": "@alephium/ledger-app",
-  "version": "0.6.0",
+  "version": "0.6.1",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "@alephium/ledger-app",
-      "version": "0.6.0",
+      "version": "0.6.1",
       "license": "GPL",
       "dependencies": {
         "@alephium/web3": "^1.5.0",
-        "@ledgerhq/hw-transport": "6.31.0",
+        "@ledgerhq/hw-transport": "^6.31.4",
         "blakejs": "^1.2.1"
       },
       "devDependencies": {
@@ -1231,28 +1231,28 @@
       }
     },
     "node_modules/@ledgerhq/devices": {
-      "version": "8.4.0",
-      "resolved": "https://registry.npmjs.org/@ledgerhq/devices/-/devices-8.4.0.tgz",
-      "integrity": "sha512-TUrMlWZJ+5AFp2lWMw4rGQoU+WtjIqlFX5SzQDL9phaUHrt4TFierAGHsaj5+tUHudhD4JhIaLI2cn1NOyq5NQ==",
+      "version": "8.4.4",
+      "resolved": "https://registry.npmjs.org/@ledgerhq/devices/-/devices-8.4.4.tgz",
+      "integrity": "sha512-sz/ryhe/R687RHtevIE9RlKaV8kkKykUV4k29e7GAVwzHX1gqG+O75cu1NCJUHLbp3eABV5FdvZejqRUlLis9A==",
       "dependencies": {
-        "@ledgerhq/errors": "^6.17.0",
+        "@ledgerhq/errors": "^6.19.1",
         "@ledgerhq/logs": "^6.12.0",
         "rxjs": "^7.8.1",
         "semver": "^7.3.5"
       }
     },
     "node_modules/@ledgerhq/errors": {
-      "version": "6.17.0",
-      "resolved": "https://registry.npmjs.org/@ledgerhq/errors/-/errors-6.17.0.tgz",
-      "integrity": "sha512-xnOVpy/gUUkusEORdr2Qhw3Vd0MGfjyVGgkGR9Ck6FXE26OIdIQ3tNmG5BdZN+gwMMFJJVxxS4/hr0taQfZ43w=="
+      "version": "6.19.1",
+      "resolved": "https://registry.npmjs.org/@ledgerhq/errors/-/errors-6.19.1.tgz",
+      "integrity": "sha512-75yK7Nnit/Gp7gdrJAz0ipp31CCgncRp+evWt6QawQEtQKYEDfGo10QywgrrBBixeRxwnMy1DP6g2oCWRf1bjw=="
     },
     "node_modules/@ledgerhq/hw-transport": {
-      "version": "6.31.0",
-      "resolved": "https://registry.npmjs.org/@ledgerhq/hw-transport/-/hw-transport-6.31.0.tgz",
-      "integrity": "sha512-BY1poLk8vlJdIYngp8Zfaa/V9n14dqgt1G7iNetVRhJVFEKp9EYONeC3x6q/N7x81LUpzBk6M+T+s46Z4UiXHw==",
+      "version": "6.31.4",
+      "resolved": "https://registry.npmjs.org/@ledgerhq/hw-transport/-/hw-transport-6.31.4.tgz",
+      "integrity": "sha512-6c1ir/cXWJm5dCWdq55NPgCJ3UuKuuxRvf//Xs36Bq9BwkV2YaRQhZITAkads83l07NAdR16hkTWqqpwFMaI6A==",
       "dependencies": {
-        "@ledgerhq/devices": "^8.4.0",
-        "@ledgerhq/errors": "^6.17.0",
+        "@ledgerhq/devices": "^8.4.4",
+        "@ledgerhq/errors": "^6.19.1",
         "@ledgerhq/logs": "^6.12.0",
         "events": "^3.3.0"
       }
@@ -7778,28 +7778,28 @@
       }
     },
     "@ledgerhq/devices": {
-      "version": "8.4.0",
-      "resolved": "https://registry.npmjs.org/@ledgerhq/devices/-/devices-8.4.0.tgz",
-      "integrity": "sha512-TUrMlWZJ+5AFp2lWMw4rGQoU+WtjIqlFX5SzQDL9phaUHrt4TFierAGHsaj5+tUHudhD4JhIaLI2cn1NOyq5NQ==",
+      "version": "8.4.4",
+      "resolved": "https://registry.npmjs.org/@ledgerhq/devices/-/devices-8.4.4.tgz",
+      "integrity": "sha512-sz/ryhe/R687RHtevIE9RlKaV8kkKykUV4k29e7GAVwzHX1gqG+O75cu1NCJUHLbp3eABV5FdvZejqRUlLis9A==",
       "requires": {
-        "@ledgerhq/errors": "^6.17.0",
+        "@ledgerhq/errors": "^6.19.1",
         "@ledgerhq/logs": "^6.12.0",
         "rxjs": "^7.8.1",
         "semver": "^7.3.5"
       }
     },
     "@ledgerhq/errors": {
-      "version": "6.17.0",
-      "resolved": "https://registry.npmjs.org/@ledgerhq/errors/-/errors-6.17.0.tgz",
-      "integrity": "sha512-xnOVpy/gUUkusEORdr2Qhw3Vd0MGfjyVGgkGR9Ck6FXE26OIdIQ3tNmG5BdZN+gwMMFJJVxxS4/hr0taQfZ43w=="
+      "version": "6.19.1",
+      "resolved": "https://registry.npmjs.org/@ledgerhq/errors/-/errors-6.19.1.tgz",
+      "integrity": "sha512-75yK7Nnit/Gp7gdrJAz0ipp31CCgncRp+evWt6QawQEtQKYEDfGo10QywgrrBBixeRxwnMy1DP6g2oCWRf1bjw=="
     },
     "@ledgerhq/hw-transport": {
-      "version": "6.31.0",
-      "resolved": "https://registry.npmjs.org/@ledgerhq/hw-transport/-/hw-transport-6.31.0.tgz",
-      "integrity": "sha512-BY1poLk8vlJdIYngp8Zfaa/V9n14dqgt1G7iNetVRhJVFEKp9EYONeC3x6q/N7x81LUpzBk6M+T+s46Z4UiXHw==",
+      "version": "6.31.4",
+      "resolved": "https://registry.npmjs.org/@ledgerhq/hw-transport/-/hw-transport-6.31.4.tgz",
+      "integrity": "sha512-6c1ir/cXWJm5dCWdq55NPgCJ3UuKuuxRvf//Xs36Bq9BwkV2YaRQhZITAkads83l07NAdR16hkTWqqpwFMaI6A==",
       "requires": {
-        "@ledgerhq/devices": "^8.4.0",
-        "@ledgerhq/errors": "^6.17.0",
+        "@ledgerhq/devices": "^8.4.4",
+        "@ledgerhq/errors": "^6.19.1",
         "@ledgerhq/logs": "^6.12.0",
         "events": "^3.3.0"
       }
diff --git a/js/package.json b/js/package.json
index 4ef24548..780f0b48 100644
--- a/js/package.json
+++ b/js/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@alephium/ledger-app",
-  "version": "0.6.0",
+  "version": "0.6.1",
   "license": "GPL",
   "types": "dist/src/index.d.ts",
   "exports": {
@@ -28,7 +28,7 @@
   },
   "dependencies": {
     "@alephium/web3": "^1.5.0",
-    "@ledgerhq/hw-transport": "6.31.0",
+    "@ledgerhq/hw-transport": "^6.31.4",
     "blakejs": "^1.2.1"
   },
   "devDependencies": {


Reviews:
user: login: Lbqds
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-13T02:30:27Z
user: login: Lbqds
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-13T02:30:53Z
user: login: Lbqds
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-13T02:31:57Z
user: login: polarker
state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-13T10:16:54Z

Review comments:
diff_hunk: @@ -40,3 +40,6 @@ icon = "alph_32x32.gif"
 
 [package.metadata.ledger.flex]
 icon = "alph_40x40.gif"
+
+[lints.rust]
+unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("stax", "flex", "nanox", "nanosplus"))'] }
path: app/Cargo.toml
user: login: Lbqds
body: The official app demo has also introduced a similar config: https://github.com/LedgerHQ/app-starknet/blob/7ac60b8cc01b239d2053c2a552b44c876793bc9e/starknet/Cargo.toml#L38
created_at: 2025-03-13T02:30:27Z
author_association: MEMBER
diff_hunk: @@ -7,11 +7,13 @@ pub const SETTINGS_SIZE: usize = 10;
 pub static mut SETTINGS_DATA: NVMData<AtomicStorage<[u8; SETTINGS_SIZE]>> =
     NVMData::new(AtomicStorage::new(&[0u8; SETTINGS_SIZE]));
 
+#[allow(static_mut_refs)]
path: app/src/settings.rs
user: login: Lbqds
body: Same here: https://github.com/LedgerHQ/app-starknet/blob/7ac60b8cc01b239d2053c2a552b44c876793bc9e/starknet/src/settings.rs#L22
created_at: 2025-03-13T02:30:53Z
author_association: MEMBER
diff_hunk: @@ -26,10 +26,10 @@ check:
 			echo 'Cargo fmt' && \
 			cargo fmt --all -- --check && \
 			echo 'Cargo clippy' && \
-			cargo +nightly-2023-11-10 clippy --target=nanox && \
-			cargo +nightly-2023-11-10 clippy --target=stax && \
+			cargo +nightly-2024-12-01 clippy --target=nanox && \
+			cargo +nightly-2024-12-01 clippy --target=stax && \
 			cargo install cargo-audit && cargo audit && \
-			cargo install --locked cargo-deny && cargo +nightly-2023-11-10 deny check \
+			cargo install --locked cargo-deny@0.17.0 && cargo +nightly-2024-12-01 deny check \
path: Makefile
user: login: Lbqds
body: The latest version of `cargo-deny` requires rustc 1.85, but the latest ledger dev tools use rustc 1.83, so we can only use `cargo-deny` v0.17.0.
created_at: 2025-03-13T02:31:57Z
author_association: MEMBER

PR comments:
user: login: Lbqds
created_at: 2025-03-12T13:49:58Z
body: It seems that the app is not working with the latest ledger dev stack. I'll try to fix it later.
author_association: MEMBER
user: login: Lbqds
created_at: 2025-03-13T02:33:07Z
body: I'll create a PR in the ledger repo once this is merged.
author_association: MEMBER
user: login: polarker
created_at: 2025-03-13T10:15:48Z
body: @Lbqds Let's make sure the PR description is simple and Ledger devs could get it immediately!
author_association: MEMBER