Skip to content

Commit

Permalink
UX: redisplay HWM by pushing both buttons
Browse files Browse the repository at this point in the history
To allow user to update the HWM screen
  • Loading branch information
spalmer25 committed Apr 3, 2024
1 parent 026cf59 commit ea70928
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ trust the computer. The current High Watermark (HWM) -- the highest level to
have been baked so far -- is displayed on the device's screen, and is also
persisted between runs of the device.

For performance reasons, the HWM screen is not updated dynamically.
On Nano devices, press both buttons to update.

The sign operation will be sent to the hardware wallet by the baking daemon when
configured to bake with a Ledger device key. The Ledger device uses the first byte of the
information to be signed -- the magic number -- to tell whether it is a block
Expand Down
17 changes: 16 additions & 1 deletion src/ui_bagl.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

#define G_display global.dynamic_display

static void ui_refresh_idle_hwm_screen(void);

/**
* @brief This structure represents a context needed for home screens navigation
*
Expand Down Expand Up @@ -66,7 +68,10 @@ UX_STEP_NOCB(ux_app_is_ready_step, nn, {"Application", "is ready"});
UX_STEP_NOCB(ux_version_step, bnnn_paging, {"Tezos Baking", APPVERSION});
UX_STEP_NOCB(ux_chain_id_step, bnnn_paging, {"Chain", home_context.chain_id});
UX_STEP_NOCB(ux_authorized_key_step, bnnn_paging, {"Public Key Hash", home_context.authorized_key});
UX_STEP_NOCB(ux_hwm_step, bnnn_paging, {"High Watermark", home_context.hwm});
UX_STEP_CB(ux_hwm_step,
bnnn_paging,
ui_refresh_idle_hwm_screen(),
{"High Watermark", home_context.hwm});
UX_STEP_CB(ux_idle_quit_step, pb, exit_app(), {&C_icon_dashboard_x, "Quit"});

UX_FLOW(ux_idle_flow,
Expand Down Expand Up @@ -154,6 +159,16 @@ void ui_initial_screen(void) {
TZ_EXC_PRINT(exc);
}

/**
* @brief Refreshes the idle HWM screen
*
* Used to update the HWM by pushing both buttons
*
*/
static void ui_refresh_idle_hwm_screen(void) {
ux_flow_init(0, ux_idle_flow, &ux_hwm_step);
}

void ux_prepare_confirm_callbacks(ui_callback_t ok_c, ui_callback_t cxl_c) {
if (ok_c) {
G_display.ok_callback = ok_c;
Expand Down
23 changes: 23 additions & 0 deletions test/test_instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@ def test_sign_preattestation(

tezos_navigator.assert_screen("hwm_before_sign", snap_path=snap_path)

if firmware.is_nano:
# No update for Stax
backend.both_click()
backend.wait_for_screen_change()
tezos_navigator.assert_screen("hwm_after_sign", snap_path=snap_path)

tezos_navigator.check_app_context(
account,
Expand Down Expand Up @@ -574,6 +579,12 @@ def test_sign_attestation(

tezos_navigator.assert_screen("hwm_before_sign", snap_path=snap_path)

if firmware.is_nano:
# No update for Stax
backend.both_click()
backend.wait_for_screen_change()
tezos_navigator.assert_screen("hwm_after_sign", snap_path=snap_path)

tezos_navigator.check_app_context(
account,
chain_id=main_chain_id,
Expand Down Expand Up @@ -625,6 +636,12 @@ def test_sign_attestation_dal(

tezos_navigator.assert_screen("hwm_before_sign", snap_path=snap_path)

if firmware.is_nano:
# No update for Stax
backend.both_click()
backend.wait_for_screen_change()
tezos_navigator.assert_screen("hwm_after_sign", snap_path=snap_path)

tezos_navigator.check_app_context(
account,
chain_id=main_chain_id,
Expand Down Expand Up @@ -676,6 +693,12 @@ def test_sign_block(

tezos_navigator.assert_screen("hwm_before_sign", snap_path=snap_path)

if firmware.is_nano:
# No update for Stax
backend.both_click()
backend.wait_for_screen_change()
tezos_navigator.assert_screen("hwm_after_sign", snap_path=snap_path)

tezos_navigator.check_app_context(
account,
chain_id=main_chain_id,
Expand Down

0 comments on commit ea70928

Please sign in to comment.