Skip to content

Conversation

@bigspider
Copy link
Contributor

@bigspider bigspider commented Nov 12, 2025

Since many/most apps using the ledger_device_sdk crate use it, it is easier to just include it as a module, incidentally removing the risk of version conflicts with the version of the crate used in the sdk itself.

ADDENDUM:
The same is done for the ledger_secure_sdk_sys crate, exported as the sys module - but only if the sys feature is enabled. The rationale for gating it in a feature is that most apps don't need to use the low-level binding, so this is considered an advanced/more risky feature and should be avoided whenever possible.

@bigspider bigspider requested a review from yogh333 November 12, 2025 09:30

// re-export include_gif crate as an sdk module
pub use include_gif;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is a pretty good idea but it means that include_gif is no more an independent package published on crates.io right?
And for all existing apps, after updating to this version of the Rust SDK which includes the include_gif as a module the include_gif dependency shall be removed?
Also all cargo update include_gif (in GitHub workflow, deployment workflow) shall be removed then.

Copy link
Contributor Author

@bigspider bigspider Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still exported as an independent package; this incrementally makes it available to apps.

And for all existing apps, after updating to this version of the Rust SDK which includes the include_gif as a module the include_gif dependency shall be removed?

Yes, I think it should be removed from the boilerplate (and can be removed from existing apps, after making sure the import is fixed accordingly).
It always makes more sense for apps to use the same version the sdk is using, or you end up with two versions if there's a mismatch.

Good point about the workflows, but I guess it should be only removed once the dependency is removed from existing apps?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After checking, include_gif should not be used in the Rust SDK: all internal glyphs are retrieved from the C SDK (any update of those glyphs in the C SDK will be seamlessly inherited by the Rust apps). The only reason include_gifis used by the Rust SDK is for 2 BAGL glyphs used by few Rust apps:

Those icons are used on Nano X/S+ by Radix, MobileCoin, Alephium, Sui while they should use the C SDK corresponding glyphs (VALIDATE_14_ICON and CROSS_MARK_ICON) but it triggers UI modifications.

include_gif should be only used by apps and thus there is no need/reason to make this package as a Rust SDK module. Once all the apps running on BAGL will be migrated on NBGL, all BAGL glyphs will be removed and the include_gifdependency for the Rust SDK will be removed as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't all apps need to use it at least once for the icon show in NbglHomeAndSettings?

Also, the possibility of showing other icons in custom UX flows seems potentially useful.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes all apps need to include include_gif as a dependency, but to me it is a separate package from the Rust SDK. Same conclusion if custom UI/UX is needed at application level. Actually, I do not see why we should make this package linked with the Rust SDK, it is just an additional package that Ledger provides to build Rust applications. The fact that nowadays the Rust SDK is using include_gif is to me temporary.
The only reason I see to use include_gif in the Rust SDK could be to define new UX flows in the Rust SDK, different from the ones already proposed by the C SDK (and Rust SDK leverages). But, from the embedded apps point of view, this is not what we want, as the UI/UX in between C and Rust apps shall be strictly the same (that's unfortunate but it is a very hard requirement 😢 )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include_gif is already not really standalone, as it's tightly coupled with how Ledger devices (BAGL/NBGL) represents images in-memory. In fact it was changed just 2 months ago for NBGL support - which wouldn't happen if it was an independent package.

The rationale for including it as a feature of ledger_device_sdk is that it would be nice for developers if by just including ledger_device_sdk they get all they need to build Ledger apps. Even if the Rust SDK later stops using include_gif, it's still less hassle for developers and simplifies app dependencies.

It also has impact on the build pipeline, as exemplified by the various crate patches in the CI (which is ugly and footgun-prone, and we should try to remove ASAP).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I think I see what you mean, and I agree. I need to make further tests to evaluate the impacts of this modification.
Thank you!

@bigspider
Copy link
Contributor Author

Since the include_gif! macro is the only public member of the include_gif crate, I modified it so that the just the macro is re-exported.

(Rebased)

@bigspider
Copy link
Contributor Author

55de6b8 also exports the ledger_secure_sdk_sys as the sys module - only if the sys feature is enabled (which is not by default).

Tested in Vanadium in this PR, for both include_gif and the sys crate.

@bigspider bigspider changed the title Re-export include_gif crate as a module Re-export include_gif and ledger_secure_sdk_sys crates as modules Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants