Skip to content
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

feat(core/ui): T3T1 success screens between shares #3992

Merged
merged 6 commits into from
Jul 31, 2024

Conversation

obrusvit
Copy link
Contributor

@obrusvit obrusvit commented Jul 2, 2024

Changes the instruction/success screens between shares during multi-share (shamir) recovery. It adds the information and also the menu button with an option to "Cancel recovery" or "Cancel backup check".
image

In case this flow is called between shares, the "Cancel recovery/backup check" button takes to a "long" cancel with explanation and "Tap to confirm" screen. This is not true for the first call of this flow (before any progress is made) where "Cance" button immediately cancels the flow.

In addition, this PR adds ability to rust components to send ButtonRequest repeatedly on every Event::Attach (7be9ed6).

Refactoring was needed in core/src/trezor/ui/layouts/mercury/recovery.py::homescreen_dialog. Namely, the "flow" logic was moved deeper into the layouts of individual models. This results in basically duplication of continue_recovery function in model_t and model_r, but for model_mercury, the function only awaits the new flow_continue_recovery.
The homescreen_dialog is a persistent workflow which endures device restart, that's why the repeated ButtonRequest is necessary.

TODO:

  • UI test cancel between shares
  • consider styling it as "Success" screen or using a success screen before the flow
    -> kept as is for now

@obrusvit obrusvit added the T3T1 Trezor Safe 5 label Jul 2, 2024
@obrusvit obrusvit self-assigned this Jul 2, 2024
@obrusvit obrusvit requested review from matejcik and prusnak as code owners July 2, 2024 20:08
@obrusvit obrusvit requested review from mmilata and removed request for prusnak July 2, 2024 20:08
Copy link

github-actions bot commented Jul 2, 2024

core UI changes device test click test persistence test
T2T1 Model T test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T2B1 Safe 3 test(screens) main(screens) test(screens) main(screens) 2724
T3T1 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
All main(screens)

@mmilata mmilata added the translations Put this label on a PR to run tests in all languages label Jul 2, 2024
mmilata
mmilata previously approved these changes Jul 2, 2024
@obrusvit
Copy link
Contributor Author

obrusvit commented Jul 3, 2024

On the 2nd thought, the new screens do not have the ability to cancel the flow, as discussed on Slack.
WDYT @Hannsek

@Hannsek
Copy link
Contributor

Hannsek commented Jul 3, 2024

Ah, yes, forgot about this. Let's wait with the merge, we do not rush anywhere now.

@obrusvit obrusvit added the blocked Blocked by external force. Third party inputs required. label Jul 3, 2024
@Hannsek
Copy link
Contributor

Hannsek commented Jul 13, 2024

Maybe should be rebased on #4023 ?

@obrusvit obrusvit marked this pull request as draft July 26, 2024 14:59
@obrusvit obrusvit added this to the T3T1 milestone Jul 26, 2024
@obrusvit obrusvit dismissed mmilata’s stale review July 26, 2024 15:00

The contribution will be reworked.

@obrusvit obrusvit force-pushed the obrusvit/ui-t3t1-recovery-success-screens branch 3 times, most recently from 4f30ef8 to 63602b6 Compare July 28, 2024 15:15
@obrusvit obrusvit removed blocked Blocked by external force. Third party inputs required. translations Put this label on a PR to run tests in all languages labels Jul 28, 2024
@obrusvit obrusvit force-pushed the obrusvit/ui-t3t1-recovery-success-screens branch 3 times, most recently from c5b236e to c491ea4 Compare July 29, 2024 12:41
@obrusvit obrusvit marked this pull request as ready for review July 29, 2024 15:44
@mmilata
Copy link
Member

mmilata commented Jul 30, 2024

This is necessary in recovery homescreen flow where we want to send ButtonRequest also after restarting the device.

Restarting device sounds like something where bootloader is involved but this is not the case right? Perhaps change "restarting the device" to "restarting python main loop"?

UI tests would be great but even without them this is big improvement. I still need to carefully review the python control flow changes but preliminary LGTM.

@Hannsek
Copy link
Contributor

Hannsek commented Jul 30, 2024

@obrusvit Please show the whole flow all the changes to @lapohoda so he can change it in Figma.

Copy link
Member

@mmilata mmilata left a comment

Choose a reason for hiding this comment

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

Code-wise LGTM, did not test.

match (self, msg) {
(Self::Main, FlowMsg::Info) => Self::Menu.transit(),
(Self::Menu, FlowMsg::Choice(0)) => Self::CancelIntro.swipe_left(),
(Self::Menu, FlowMsg::Cancelled) => Self::Main.swipe_right(),
Copy link
Member

Choose a reason for hiding this comment

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

This is gonna send ButtonRequest too right? Is Suite OK with it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it will send BR too.

Yes, I think Suite should be fine with it because sending BRs behaves in the same way as in the old implementation of homescreen_dialog, i.e. the success/instruction screen sends BR and the confirmation of flow cancellation also sends BR. These two screens are called in a loop (until you confirm the success/instruction screen) so they possibly send the BRs repeatedly. Anyway, I'll ask QA for thorough testing of these scenarios.

Comment on lines +109 to +112
# TODO: info_func should be changed to return data to be shown (and not show
# them) so that individual models can implement showing logic on their own.
# T3T1 should move the data to `flow_continue_recovery` and hide them
# in the context menu
Copy link
Member

Choose a reason for hiding this comment

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

So on T3T1 there's currently no way to show the remaining shares, also trezorui2.show_remaining_shares is never called, right?

I'd turn this comment into an issue since it sounds like a regression to me (minor as it only affects slip39 advanced).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, currently we never use show_remaining_shares. I'd like to use it also for regular shamir. But not for this release.

I added it here: #3748

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Btw. it's not used even on TS3... space-wise, it's more challening

@obrusvit
Copy link
Contributor Author

@lapohoda @Hannsek This new test shows the following scenario:

  • recovery of multi-share backup

  • you enter first share (20 words), then you see this instruction screen which is shown also if you turn the device off and then on again
    image

  • you decide to cancel the recovery process
    image

See the whole flow here: https://data.trezor.io/dev/firmware/ui_report/10164723283/T3T1-en-core_device_test/new/T3T1_en-device_tests-reset_recovery-test_recovery_slip39_basic.py%3A%3Atest_abort_between_shares.html

@obrusvit obrusvit added the translations Put this label on a PR to run tests in all languages label Jul 30, 2024
obrusvit added 6 commits July 31, 2024 10:37
Changes the content and visual appearance of the screens between shares
during multi-share (shamir) recovery. Context menu with the option to
cancel is added to the screen.
This commit allows creating a rust flow in which a component sends the
configured ButtonRequest repeatedly on every Event::Attach.

This is necessary in recovery homescreen flow where we want to send
ButtonRequest also after restarting the device.

[no changelog]
Update as a part of T3T1 recovery share success screens and adding a new
test of aborting the recovery process between shares for all models.

[no changelog]
@obrusvit obrusvit force-pushed the obrusvit/ui-t3t1-recovery-success-screens branch from fc2b0f4 to f94d6be Compare July 31, 2024 08:39
Copy link

legacy UI changes device test(screens) main(screens)

@obrusvit
Copy link
Contributor Author

obrusvit commented Jul 31, 2024

Rebased on main.

I expect conflicts in fr lang fixtures.json tests because of the conflicts with #4071
Edit: seems like conflicts were resolved correctly.

@obrusvit obrusvit merged commit ca46978 into main Jul 31, 2024
120 checks passed
@obrusvit obrusvit deleted the obrusvit/ui-t3t1-recovery-success-screens branch July 31, 2024 09:36
@bosomt
Copy link

bosomt commented Aug 1, 2024

Did this change made it to freeze ?
This is what i see when recovering 2 of 2 old shamir seed

  • Device: Trezor T3T1 2.8.1 regular (revision 55473a0)
Screenshot 2024-08-01 at 15 09 23

@bosomt
Copy link

bosomt commented Aug 2, 2024

QA OK

firmware-T3T1-2.8.1-5bba2e0aa.bin

@bosomt
Copy link

bosomt commented Aug 2, 2024

QA OK

T3T1

firmware-T3T1-2.8.1-5bba2e0aa.bin

first round

  • recovered one part of super shamir
image
  • reconnected
image
  • reconnected
  • cancelled recovery cancellation
  • cancelled recovery

second round

  • standard shamir
  • started recovery and cancelled recovery
  • web suite reported correctly that it was cancelled
  • cancelled cancellation of recovery after entered one share
  • reconnected device
  • finished recovery by entering 2of3 share
  • suite reported recovery as success

third round

  • 1 of 5 entered
  • reconnect
  • cancelled recovery
  • suite reported that recovery was cancelled
  • 2 of 5 entered
  • cancelled cancellation multiple times
  • 3 of 5 entered /enough to recover/
  • disconnected device during success screen
  • suite reports recovery success after reconnect

T2T1

firmware-T2T1-2.8.1-5bba2e0aa.bin

first round

  • start recovery and disconnect device
  • device and suite is tarted in recovery mode
  • 1 of 2 shares entered
  • reported on device: 1 of shares entereed + 1 more share needed
  • reconnect device
  • disconnected during entering second share
  • cancelled cancellation of recovery
  • cancelled recovery
  • recovered 2of2
  • disconnected during success screen
  • reovery went as expected

@obrusvit
Copy link
Contributor Author

obrusvit commented Aug 6, 2024

@bosomt thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T3T1 Trezor Safe 5 translations Put this label on a PR to run tests in all languages
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants