Skip to content

Nbgl migration for Nano devices#325

Merged
iartemov-ledger merged 10 commits intodevelopfrom
nbgl-on-nano
May 21, 2025
Merged

Nbgl migration for Nano devices#325
iartemov-ledger merged 10 commits intodevelopfrom
nbgl-on-nano

Conversation

@iartemov-ledger
Copy link
Contributor

@iartemov-ledger iartemov-ledger commented Mar 31, 2025

In this PR:

  • Code base migration to NBGL for Nano devices
  • Test adaptation
  • NanoX snapshots update (expected to be 💚)
  • NanoS+ snapshots update (so tests failures are expected so far) - will do later (after updated Product Guidance)
  • fix Tests on mainnet
  • fix Tests with the JS library - will do later (after updated Product Guidance)
  • remove dispatcher_context_t *context from io_ui_process() and all the callers ? - will not do in this PR, the context may be useful later, for other needs
  • App version update probably ? The versions in app-bitcoin-new are usually bumped in separate PRs on demand
  • Wait and address design update
  • to get, discuss and address feedback on https://ledgerhq.atlassian.net/wiki/spaces/FW/whiteboard/5704286287?atl_f=PAGETREE from stakeholders (eSW, Product, Design)
    • in yellow-background comments - the difference summary
    • in red-background comments - the things that seem weird
  • Snapshots for long tests (tests/test_sign_psbt.py::test_sign_psbt_singlesig_wpkh_512to256 fails with timeout (a several minutes one), even before present changes. Did it work recently ?)
    • Among SKIPPED tests non generates snapshots for Nano*:
      • tests/test_e2e_multisig.py::test_e2e_multisig_15keys
      • tests/test_e2e_musig2.py::test_e2e_musig2_5of5
      • tests/test_get_extended_pubkey.py::test_get_extended_pubkey_non_standard_reject_early
      • tests/test_sign_psbt.py::test_sign_psbt_singlesig_wpkh_512to256
  • to take https://ledgerhq.atlassian.net/browse/B2CA-2132 into account
  • to update the wiki sequences: https://ledgerhq.atlassian.net/wiki/spaces/FW/whiteboard/5797675260?atl_f=PAGETREE
  • to clean-up the git history

Later:

  • Refactoring to nbgl_useCaseAdvancedReview() or nbgl_useCaseReviewLight()
  • see if we can convert Stream uses case to normal one having introduced a memory limit

@codecov-commenter
Copy link

codecov-commenter commented Mar 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.69%. Comparing base (a3e7fe2) to head (da82509).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #325   +/-   ##
========================================
  Coverage    84.69%   84.69%           
========================================
  Files           17       17           
  Lines         2228     2228           
========================================
  Hits          1887     1887           
  Misses         341      341           
Flag Coverage Δ
unittests 84.69% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@iartemov-ledger iartemov-ledger force-pushed the nbgl-on-nano branch 3 times, most recently from b73ef55 to 0ab928a Compare March 31, 2025 14:35
@iartemov-ledger iartemov-ledger changed the title Nbgl on nano Nbgl migration for Nano devices Mar 31, 2025
Copy link
Collaborator

@bigspider bigspider left a comment

Choose a reason for hiding this comment

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

LGTM for the general structure, commented elsewhere for specific UX fine-tuning.

@iartemov-ledger iartemov-ledger force-pushed the nbgl-on-nano branch 2 times, most recently from 6f99e38 to 999f31a Compare April 1, 2025 16:20
@iartemov-ledger iartemov-ledger force-pushed the nbgl-on-nano branch 3 times, most recently from 5b873fd to 5219e1d Compare May 20, 2025 16:29
@iartemov-ledger iartemov-ledger marked this pull request as ready for review May 20, 2025 16:55
@cedelavergne-ledger
Copy link

Seems you have commit unwanted files:

- src/handler/.sign_psbt.c.swp
- src/ui/.display.c.swp
- src/ui/.display_nbgl.c.swp
- src/ui/.display_utils.c.swp

@bigspider bigspider requested a review from Copilot May 21, 2025 08:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the application’s UI functionality from BAGL to NBGL for Nano devices while updating tests and build configurations accordingly.

  • Migrates UI flows and string resources to the new NBGL API (e.g. “Sign transaction”, “Sign message”, “Register account”)
  • Removes legacy BAGL code and updates test automations and build flags for NBGL support
  • Updates documentation changelog and build settings to reflect the NBGL migration

Reviewed Changes

Copilot reviewed 2204 out of 2204 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/instructions.py Updated instruction texts to reflect the new NBGL UI flows.
src/ui/menu_nbgl.c Updated main menu flow and icon usage to conform to NBGL standards.
src/ui/menu_bagl.c Removed legacy BAGL menu implementation.
src/ui/display_utils.c Removed alternate formatting for Nano devices now using NBGL formatting.
src/ui/display_nbgl.c Updated NBGL display flows with new string constants and conditional styling.
src/ui/display.h Introduced new icon macros (ICON_APP_LOGO / ICON_APP_IMPORTANT) for NBGL UI consistency.
src/ui/display.c Removed BAGL code paths and standardized UI process logic; replaced with NBGL functions.
src/ui/bagl_custom_streaming.c Removed legacy BAGL streaming implementation.
src/main.c Replaced BAGL UX initialization with NBGL spinner usage.
src/handler/*.c Updated handler functions to use the UNUSED macro and revised NBGL UX flow functions.
src/boilerplate/io*.{h,c} Removed BAGL-specific functions and updated event handling for NBGL.
src/boilerplate/dispatcher.c Adjusted termination callback to reflect NBGL changes.
bitcoin_client_js automation tests Updated JSON test rules to match new NBGL UI labels.
Makefile Added flag for enabling NBGL support for Nano devices.
CHANGELOG.md Documented NBGL migration and related UI changes.
Comments suppressed due to low confidence (4)

src/ui/display_nbgl.c:133

  • Confirm that the usage of GA_SIGN_TRANSACTION is consistent with other instances of transaction-signing labels across the UI to avoid confusing users.
nbgl_useCaseReviewStreamingFinish(GA_SIGN_TRANSACTION, start_processing_transaction_callback);

src/ui/menu_bagl.c:1

  • [nitpick] Verify that the removal of the BAGL-based menu implementation is intentional and ensure that any legacy documentation or build references to BAGL are updated accordingly.
#ifdef HAVE_BAGL

src/boilerplate/dispatcher.c:173

  • [nitpick] Review the removal of BAGL-specific termination callbacks to confirm that dispatcher cleanup operates correctly for NBGL devices.
G_dispatcher_state.termination_cb();

tests/instructions.py:14

  • Verify that the updated instruction text "Sign message" aligns with the NBGL UI labels defined in display_nbgl.c to ensure consistency in user messaging.
instructions.same_request("Sign message", save_screenshot=save_screenshot)

Copy link
Collaborator

@bigspider bigspider left a comment

Choose a reason for hiding this comment

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

Only minor comments (except the graphical glitches, that are surely not caused by this PR).

@iartemov-ledger
Copy link
Contributor Author

Seems you have commit unwanted files:

- src/handler/.sign_psbt.c.swp
- src/ui/.display.c.swp
- src/ui/.display_nbgl.c.swp
- src/ui/.display_utils.c.swp

Fixed.

@iartemov-ledger
Copy link
Contributor Author

Copy link
Collaborator

@bigspider bigspider left a comment

Choose a reason for hiding this comment

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

LGTM.

@iartemov-ledger iartemov-ledger merged commit f644b21 into develop May 21, 2025
189 checks passed
@iartemov-ledger iartemov-ledger deleted the nbgl-on-nano branch May 21, 2025 16:15
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.

5 participants