Skip to content

feat: bump dependencies and fix warnings #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dep/alamgu/github.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"repo": "alamgu",
"branch": "develop",
"private": false,
"rev": "f41eb60cb2b5145b4948c51898062911c342db6b",
"sha256": "16n2b0irpkgjzp5mrl6vxza0bw7p5c6bmgbfmynbzbcyij5arhnh"
"rev": "7cb39c91dfc9af8c9bc499712df68efb49f694f3",
"sha256": "1b6ndhk24dj6vmyg3qvggfx4zyd90lfdda2qq4g4nf26wi85k6zn"
}
2 changes: 1 addition & 1 deletion run-docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -eu

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

OUT_DIR="./docker-outputs"
Expand Down
48 changes: 40 additions & 8 deletions rust-app/Cargo.lock

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

14 changes: 10 additions & 4 deletions rust-app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iota_rebased"
version = "0.9.0"
version = "0.9.1"
authors = ["IOTA Foundation <[email protected]>"]
edition = "2018"
autobins = false
Expand Down Expand Up @@ -30,14 +30,15 @@ speculos = [
"ledger-parser-combinators/logging",
]
extra_debug = ["ledger-log/log_trace"]
pending_review_screen = []

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

[target.'cfg(target_family = "bolos")'.dev-dependencies.ledger_device_sdk]
version = "1.7.1"
version = "1.20.4"
features = ["speculos"]

[[bin]]
Expand All @@ -55,6 +56,11 @@ overflow-checks = false
opt-level = 3
overflow-checks = false

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(target_os, values("nanos"))',
] }

[package.metadata.ledger]
name = "IOTA Rebased"
# Testnet, IOTA
Expand Down
52 changes: 35 additions & 17 deletions rust-app/src/implementation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use core::future::Future;

type IotaAddressRaw = [u8; IOTA_ADDRESS_LENGTH];

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

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

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

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

impl<BS: Clone + Readable> AsyncParser<CallArgSchema, BS> for DefaultInterp {
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
type State<'c>
= impl Future<Output = Self::Output> + 'c
where
BS: 'c;
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
async move {
let enum_variant =
Expand Down Expand Up @@ -210,7 +213,10 @@ impl HasOutput<CommandSchema> for DefaultInterp {
}

impl<BS: Clone + Readable> AsyncParser<CommandSchema, BS> for DefaultInterp {
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
type State<'c>
= impl Future<Output = Self::Output> + 'c
where
BS: 'c;
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
async move {
let enum_variant =
Expand Down Expand Up @@ -270,7 +276,10 @@ impl HasOutput<ArgumentSchema> for DefaultInterp {
}

impl<BS: Clone + Readable> AsyncParser<ArgumentSchema, BS> for DefaultInterp {
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
type State<'c>
= impl Future<Output = Self::Output> + 'c
where
BS: 'c;
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
async move {
let enum_variant =
Expand Down Expand Up @@ -325,7 +334,10 @@ impl<const PROMPT: bool> HasOutput<ProgrammableTransaction<PROMPT>>
impl<BS: Clone + Readable, const PROMPT: bool> AsyncParser<ProgrammableTransaction<PROMPT>, BS>
for ProgrammableTransaction<PROMPT>
{
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
type State<'c>
= impl Future<Output = Self::Output> + 'c
where
BS: 'c;
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
async move {
let mut recipient = None;
Expand Down Expand Up @@ -522,7 +534,10 @@ impl<const PROMPT: bool> HasOutput<TransactionKind<PROMPT>> for TransactionKind<
impl<BS: Clone + Readable, const PROMPT: bool> AsyncParser<TransactionKind<PROMPT>, BS>
for TransactionKind<PROMPT>
{
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
type State<'c>
= impl Future<Output = Self::Output> + 'c
where
BS: 'c;
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
async move {
let enum_variant =
Expand Down Expand Up @@ -578,7 +593,10 @@ impl HasOutput<TransactionExpiration> for DefaultInterp {
}

impl<BS: Clone + Readable> AsyncParser<TransactionExpiration, BS> for DefaultInterp {
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
type State<'c>
= impl Future<Output = Self::Output> + 'c
where
BS: 'c;
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
async move {
let enum_variant =
Expand All @@ -605,7 +623,7 @@ impl<BS: Clone + Readable> AsyncParser<TransactionExpiration, BS> for DefaultInt
}

const fn gas_data_parser<BS: Clone + Readable, const PROMPT: bool>(
) -> impl AsyncParser<GasData<PROMPT>, BS> + HasOutput<GasData<PROMPT>, Output = ()> {
) -> impl AsyncParser<GasData<PROMPT>, BS, Output = ()> {
Action(
(
SubInterp(object_ref_parser()),
Expand All @@ -630,22 +648,19 @@ const fn gas_data_parser<BS: Clone + Readable, const PROMPT: bool>(
)
}

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

const fn intent_parser<BS: Readable>(
) -> impl AsyncParser<Intent, BS> + HasOutput<Intent, Output = ()> {
const fn intent_parser<BS: Readable>() -> impl AsyncParser<Intent, BS, Output = ()> {
Action((DefaultInterp, DefaultInterp, DefaultInterp), |_| {
trace!("Intent Ok");
Some(())
})
}

const fn transaction_data_v1_parser<BS: Clone + Readable, const PROMPT: bool>(
) -> impl AsyncParser<TransactionDataV1<PROMPT>, BS> + HasOutput<TransactionDataV1<PROMPT>, Output = ()>
{
) -> impl AsyncParser<TransactionDataV1<PROMPT>, BS, Output = ()> {
Action(
(
TransactionKind::<PROMPT>,
Expand All @@ -664,7 +679,10 @@ impl<const PROMPT: bool> HasOutput<TransactionData<PROMPT>> for TransactionData<
impl<BS: Clone + Readable, const PROMPT: bool> AsyncParser<TransactionData<PROMPT>, BS>
for TransactionData<PROMPT>
{
type State<'c> = impl Future<Output = Self::Output> + 'c where BS: 'c;
type State<'c>
= impl Future<Output = Self::Output> + 'c
where
BS: 'c;
fn parse<'a: 'c, 'b: 'c, 'c>(&'b self, input: &'a mut BS) -> Self::State<'c> {
async move {
let enum_variant =
Expand All @@ -688,7 +706,7 @@ impl<BS: Clone + Readable, const PROMPT: bool> AsyncParser<TransactionData<PROMP
}

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

Expand Down
4 changes: 2 additions & 2 deletions rust-app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#![allow(incomplete_features)]
#![feature(stmt_expr_attributes)]
#![feature(adt_const_params)]
#![feature(str_internals)]
#![feature(type_alias_impl_trait)]
#![feature(const_mut_refs)]
#![cfg_attr(not(version("1.83")), feature(const_mut_refs))]
#![cfg_attr(version("1.84"), feature(generic_const_exprs))]
#![feature(try_blocks)]
#![cfg_attr(all(target_family = "bolos", test), no_main)]
#![cfg_attr(target_family = "bolos", feature(custom_test_frameworks))]
Expand Down
18 changes: 14 additions & 4 deletions rust-app/src/main_nanos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,25 @@ pub fn app_main() {

let hostio_state: SingleThreaded<RefCell<HostIOState>> =
SingleThreaded(RefCell::new(HostIOState::new(unsafe {
core::mem::transmute(&comm.0)
core::mem::transmute::<
&core::cell::RefCell<ledger_device_sdk::io::Comm>,
&core::cell::RefCell<ledger_device_sdk::io::Comm>,
>(&comm.0)
})));
let hostio: SingleThreaded<HostIO> =
SingleThreaded(HostIO(unsafe { core::mem::transmute(&hostio_state.0) }));
let hostio: SingleThreaded<HostIO> = SingleThreaded(HostIO(unsafe {
core::mem::transmute::<
&core::cell::RefCell<alamgu_async_block::HostIOState>,
&core::cell::RefCell<alamgu_async_block::HostIOState>,
>(&hostio_state.0)
}));
let states_backing: SingleThreaded<PinCell<Option<APDUsFuture>>> =
SingleThreaded(PinCell::new(None));
let states: SingleThreaded<Pin<&PinCell<Option<APDUsFuture>>>> =
SingleThreaded(Pin::static_ref(unsafe {
core::mem::transmute(&states_backing.0)
core::mem::transmute::<
&pin_cell::PinCell<core::option::Option<APDUsFuture>>,
&pin_cell::PinCell<core::option::Option<APDUsFuture>>,
>(&states_backing.0)
}));

let mut idle_menu = IdleMenuWithSettings {
Expand Down
4 changes: 3 additions & 1 deletion rust-app/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ impl Default for Settings {
impl Settings {
#[inline(never)]
pub fn get(&self) -> u8 {
#[allow(static_mut_refs)]
let settings = unsafe { SETTINGS.get_mut() };
return *settings.get_ref();
*settings.get_ref()
}

// The inline(never) is important. Otherwise weird segmentation faults happen on speculos.
#[inline(never)]
pub fn set(&mut self, v: &u8) {
#[allow(static_mut_refs)]
let settings = unsafe { SETTINGS.get_mut() };
settings.update(v);
}
Expand Down
2 changes: 1 addition & 1 deletion ts-tests/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const TESTNET_BIP_PATH = "44'/1'/0'/0'/0'";
export const VERSION = {
major: 0,
minor: 9,
patch: 0,
patch: 1,
};

const ignoredScreens = ["", "Cancel", "Working...", "Quit", "Version"
Expand Down
Loading