Skip to content

Commit e1f7fea

Browse files
authored
feat: bump dependencies and fix warnings (#33)
* fix: bump dependencies and fix warnings * fix: clippy warnings * fix: update version in test * Address review comments
1 parent fff39fd commit e1f7fea

File tree

9 files changed

+108
-40
lines changed

9 files changed

+108
-40
lines changed

dep/alamgu/github.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"repo": "alamgu",
44
"branch": "develop",
55
"private": false,
6-
"rev": "f41eb60cb2b5145b4948c51898062911c342db6b",
7-
"sha256": "16n2b0irpkgjzp5mrl6vxza0bw7p5c6bmgbfmynbzbcyij5arhnh"
6+
"rev": "7cb39c91dfc9af8c9bc499712df68efb49f694f3",
7+
"sha256": "1b6ndhk24dj6vmyg3qvggfx4zyd90lfdda2qq4g4nf26wi85k6zn"
88
}

run-docker-build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -eu
33

44
export APP_NAME=`grep name rust-app/Cargo.toml | cut -d '"' -f2 | head -n1`
5-
export RUST_NANOS_SDK_REV="3c22c1c1b5e2d909e34409fc92cfeed775541a63"
5+
export RUST_NANOS_SDK_REV="ad901b54e3178659fa6cac2885a3081afbf9c9bb"
66
export RUST_NANOS_SDK_GIT="https://github.com/LedgerHQ/ledger-device-rust-sdk.git"
77

88
OUT_DIR="./docker-outputs"

rust-app/Cargo.lock

+40-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust-app/Cargo.toml

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "iota_rebased"
3-
version = "0.9.0"
3+
version = "0.9.1"
44
authors = ["IOTA Foundation <[email protected]>"]
55
edition = "2018"
66
autobins = false
@@ -30,14 +30,15 @@ speculos = [
3030
"ledger-parser-combinators/logging",
3131
]
3232
extra_debug = ["ledger-log/log_trace"]
33+
pending_review_screen = []
3334

3435
[target.'cfg(target_family = "bolos")'.dependencies]
35-
ledger_device_sdk = "1.7.1"
36-
ledger_secure_sdk_sys = "1.2.0"
36+
ledger_device_sdk = "1.20.4"
37+
ledger_secure_sdk_sys = "1.6.7"
3738
ledger-prompts-ui = { git = "https://github.com/alamgu/ledger-prompts-ui" }
3839

3940
[target.'cfg(target_family = "bolos")'.dev-dependencies.ledger_device_sdk]
40-
version = "1.7.1"
41+
version = "1.20.4"
4142
features = ["speculos"]
4243

4344
[[bin]]
@@ -55,6 +56,11 @@ overflow-checks = false
5556
opt-level = 3
5657
overflow-checks = false
5758

59+
[lints.rust]
60+
unexpected_cfgs = { level = "warn", check-cfg = [
61+
'cfg(target_os, values("nanos"))',
62+
] }
63+
5864
[package.metadata.ledger]
5965
name = "IOTA Rebased"
6066
# Testnet, IOTA

rust-app/src/implementation.rs

+35-17
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use core::future::Future;
2626

2727
type IotaAddressRaw = [u8; IOTA_ADDRESS_LENGTH];
2828

29+
#[expect(dead_code)]
2930
pub struct IotaPubKeyAddress(ledger_device_sdk::ecc::ECPublicKey<65, 'E'>, IotaAddressRaw);
3031

3132
impl Address<IotaPubKeyAddress, ledger_device_sdk::ecc::ECPublicKey<65, 'E'>>
@@ -51,8 +52,7 @@ impl core::fmt::Display for IotaPubKeyAddress {
5152
}
5253
}
5354

54-
pub type BipParserImplT =
55-
impl AsyncParser<Bip32Key, ByteStream> + HasOutput<Bip32Key, Output = ArrayVec<u32, 10>>;
55+
pub type BipParserImplT = impl AsyncParser<Bip32Key, ByteStream, Output = ArrayVec<u32, 10>>;
5656
pub const BIP_PATH_PARSER: BipParserImplT = SubInterp(DefaultInterp);
5757

5858
// Need a path of length 5, as make_bip32_path panics with smaller paths
@@ -119,7 +119,10 @@ impl HasOutput<CallArgSchema> for DefaultInterp {
119119
}
120120

121121
impl<BS: Clone + Readable> AsyncParser<CallArgSchema, BS> for DefaultInterp {
122-
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
122+
type State<'c>
123+
= impl Future<Output = Self::Output> + 'c
124+
where
125+
BS: 'c;
123126
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
124127
async move {
125128
let enum_variant =
@@ -210,7 +213,10 @@ impl HasOutput<CommandSchema> for DefaultInterp {
210213
}
211214

212215
impl<BS: Clone + Readable> AsyncParser<CommandSchema, BS> for DefaultInterp {
213-
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
216+
type State<'c>
217+
= impl Future<Output = Self::Output> + 'c
218+
where
219+
BS: 'c;
214220
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
215221
async move {
216222
let enum_variant =
@@ -270,7 +276,10 @@ impl HasOutput<ArgumentSchema> for DefaultInterp {
270276
}
271277

272278
impl<BS: Clone + Readable> AsyncParser<ArgumentSchema, BS> for DefaultInterp {
273-
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
279+
type State<'c>
280+
= impl Future<Output = Self::Output> + 'c
281+
where
282+
BS: 'c;
274283
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
275284
async move {
276285
let enum_variant =
@@ -325,7 +334,10 @@ impl<const PROMPT: bool> HasOutput<ProgrammableTransaction<PROMPT>>
325334
impl<BS: Clone + Readable, const PROMPT: bool> AsyncParser<ProgrammableTransaction<PROMPT>, BS>
326335
for ProgrammableTransaction<PROMPT>
327336
{
328-
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
337+
type State<'c>
338+
= impl Future<Output = Self::Output> + 'c
339+
where
340+
BS: 'c;
329341
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
330342
async move {
331343
let mut recipient = None;
@@ -522,7 +534,10 @@ impl<const PROMPT: bool> HasOutput<TransactionKind<PROMPT>> for TransactionKind<
522534
impl<BS: Clone + Readable, const PROMPT: bool> AsyncParser<TransactionKind<PROMPT>, BS>
523535
for TransactionKind<PROMPT>
524536
{
525-
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
537+
type State<'c>
538+
= impl Future<Output = Self::Output> + 'c
539+
where
540+
BS: 'c;
526541
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
527542
async move {
528543
let enum_variant =
@@ -578,7 +593,10 @@ impl HasOutput<TransactionExpiration> for DefaultInterp {
578593
}
579594

580595
impl<BS: Clone + Readable> AsyncParser<TransactionExpiration, BS> for DefaultInterp {
581-
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
596+
type State<'c>
597+
= impl Future<Output = Self::Output> + 'c
598+
where
599+
BS: 'c;
582600
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
583601
async move {
584602
let enum_variant =
@@ -605,7 +623,7 @@ impl<BS: Clone + Readable> AsyncParser<TransactionExpiration, BS> for DefaultInt
605623
}
606624

607625
const fn gas_data_parser<BS: Clone + Readable, const PROMPT: bool>(
608-
) -> impl AsyncParser<GasData<PROMPT>, BS> + HasOutput<GasData<PROMPT>, Output = ()> {
626+
) -> impl AsyncParser<GasData<PROMPT>, BS, Output = ()> {
609627
Action(
610628
(
611629
SubInterp(object_ref_parser()),
@@ -630,22 +648,19 @@ const fn gas_data_parser<BS: Clone + Readable, const PROMPT: bool>(
630648
)
631649
}
632650

633-
const fn object_ref_parser<BS: Readable>(
634-
) -> impl AsyncParser<ObjectRef, BS> + HasOutput<ObjectRef, Output = ()> {
651+
const fn object_ref_parser<BS: Readable>() -> impl AsyncParser<ObjectRef, BS, Output = ()> {
635652
Action((DefaultInterp, DefaultInterp, DefaultInterp), |_| Some(()))
636653
}
637654

638-
const fn intent_parser<BS: Readable>(
639-
) -> impl AsyncParser<Intent, BS> + HasOutput<Intent, Output = ()> {
655+
const fn intent_parser<BS: Readable>() -> impl AsyncParser<Intent, BS, Output = ()> {
640656
Action((DefaultInterp, DefaultInterp, DefaultInterp), |_| {
641657
trace!("Intent Ok");
642658
Some(())
643659
})
644660
}
645661

646662
const fn transaction_data_v1_parser<BS: Clone + Readable, const PROMPT: bool>(
647-
) -> impl AsyncParser<TransactionDataV1<PROMPT>, BS> + HasOutput<TransactionDataV1<PROMPT>, Output = ()>
648-
{
663+
) -> impl AsyncParser<TransactionDataV1<PROMPT>, BS, Output = ()> {
649664
Action(
650665
(
651666
TransactionKind::<PROMPT>,
@@ -664,7 +679,10 @@ impl<const PROMPT: bool> HasOutput<TransactionData<PROMPT>> for TransactionData<
664679
impl<BS: Clone + Readable, const PROMPT: bool> AsyncParser<TransactionData<PROMPT>, BS>
665680
for TransactionData<PROMPT>
666681
{
667-
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
682+
type State<'c>
683+
= impl Future<Output = Self::Output> + 'c
684+
where
685+
BS: 'c;
668686
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
669687
async move {
670688
let enum_variant =
@@ -688,7 +706,7 @@ impl<BS: Clone + Readable, const PROMPT: bool> AsyncParser<TransactionData<PROMP
688706
}
689707

690708
const fn tx_parser<BS: Clone + Readable, const PROMPT: bool>(
691-
) -> impl AsyncParser<IntentMessage<PROMPT>, BS> + HasOutput<IntentMessage<PROMPT>, Output = ()> {
709+
) -> impl AsyncParser<IntentMessage<PROMPT>, BS, Output = ()> {
692710
Action((intent_parser(), TransactionData::<PROMPT>), |_| Some(()))
693711
}
694712

rust-app/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#![allow(incomplete_features)]
33
#![feature(stmt_expr_attributes)]
44
#![feature(adt_const_params)]
5-
#![feature(str_internals)]
65
#![feature(type_alias_impl_trait)]
7-
#![feature(const_mut_refs)]
6+
#![cfg_attr(not(version("1.83")), feature(const_mut_refs))]
7+
#![cfg_attr(version("1.84"), feature(generic_const_exprs))]
88
#![feature(try_blocks)]
99
#![cfg_attr(all(target_family = "bolos", test), no_main)]
1010
#![cfg_attr(target_family = "bolos", feature(custom_test_frameworks))]

rust-app/src/main_nanos.rs

+14-4
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,25 @@ pub fn app_main() {
2020

2121
let hostio_state: SingleThreaded<RefCell<HostIOState>> =
2222
SingleThreaded(RefCell::new(HostIOState::new(unsafe {
23-
core::mem::transmute(&comm.0)
23+
core::mem::transmute::<
24+
&core::cell::RefCell<ledger_device_sdk::io::Comm>,
25+
&core::cell::RefCell<ledger_device_sdk::io::Comm>,
26+
>(&comm.0)
2427
})));
25-
let hostio: SingleThreaded<HostIO> =
26-
SingleThreaded(HostIO(unsafe { core::mem::transmute(&hostio_state.0) }));
28+
let hostio: SingleThreaded<HostIO> = SingleThreaded(HostIO(unsafe {
29+
core::mem::transmute::<
30+
&core::cell::RefCell<alamgu_async_block::HostIOState>,
31+
&core::cell::RefCell<alamgu_async_block::HostIOState>,
32+
>(&hostio_state.0)
33+
}));
2734
let states_backing: SingleThreaded<PinCell<Option<APDUsFuture>>> =
2835
SingleThreaded(PinCell::new(None));
2936
let states: SingleThreaded<Pin<&PinCell<Option<APDUsFuture>>>> =
3037
SingleThreaded(Pin::static_ref(unsafe {
31-
core::mem::transmute(&states_backing.0)
38+
core::mem::transmute::<
39+
&pin_cell::PinCell<core::option::Option<APDUsFuture>>,
40+
&pin_cell::PinCell<core::option::Option<APDUsFuture>>,
41+
>(&states_backing.0)
3242
}));
3343

3444
let mut idle_menu = IdleMenuWithSettings {

rust-app/src/settings.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ impl Default for Settings {
1717
impl Settings {
1818
#[inline(never)]
1919
pub fn get(&self) -> u8 {
20+
#[allow(static_mut_refs)]
2021
let settings = unsafe { SETTINGS.get_mut() };
21-
return *settings.get_ref();
22+
*settings.get_ref()
2223
}
2324

2425
// The inline(never) is important. Otherwise weird segmentation faults happen on speculos.
2526
#[inline(never)]
2627
pub fn set(&mut self, v: &u8) {
28+
#[allow(static_mut_refs)]
2729
let settings = unsafe { SETTINGS.get_mut() };
2830
settings.update(v);
2931
}

ts-tests/common.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const TESTNET_BIP_PATH = "44'/1'/0'/0'/0'";
99
export const VERSION = {
1010
major: 0,
1111
minor: 9,
12-
patch: 0,
12+
patch: 1,
1313
};
1414

1515
const ignoredScreens = ["", "Cancel", "Working...", "Quit", "Version"

0 commit comments

Comments
 (0)