-
Notifications
You must be signed in to change notification settings - Fork 189
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
[Bugfix] Verification Views after transcribing SeedQR fixes, refactors, test, screenshots #677
[Bugfix] Verification Views after transcribing SeedQR fixes, refactors, test, screenshots #677
Conversation
Hi @kdmukai , when I scan compact (with standard export) or standard (with compact export) results on success, too. I presume that is because of same seed case: Pytested on 3.10 and 3.12, Kali Linux. |
return Destination(SeedOptionsView, view_args={"seed_num": self.seed_num}) | ||
else: | ||
# Will this case ever happen? Will trigger if a different kind of QR code is scanned | ||
return Destination(SeedTranscribeSeedQRConfirmInvalidQRView, skip_current_view=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can only get this to trigger if I scan a valid QR that SeedSigner doesn't support decoding the contents of (for example an encoded web url). If I scan a valid QR that SeedSigner is able to decode (and isn't a SeedQR) than I get the "Not Yet Implemented" warning and get kicked to the Main Menu (even using the back button). I don't think this PR needs to address this outlier edge case. I just wanted to mention it since the question "Will this case ever happen?" was asked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to get to the InvalidQRView if I scanned an xpub from Sparrow or a generic text ("I like cheese") QR.
But an animated PSBT QR got me to NotYetImplementedView.
Oh, actually I get it now. The else
on line 1664 should have been omitted. The final return
condition should be a catch-all for ALL remaining possibilities. But as it's written it's missing the case where:
decoder.is_complete == True and decoder.is_seed == False
I'll log it as an Issue / TODO, but I don't think it's worth holding up this release.
ACK, reviewed and tested. I was able to recreate the bug and see that this PR resolved it. Great catch in finding and fixing this bug. I appreciate you going the extra mile to create the test flow to prevent the same or similar bug from happening in the future. |
@fedebuyito, yes, it's a bit of an unintended edge case that the verification step doesn't care if the SeedQR format matches (Standard vs Compact). For the intended use case I don't think it matters though. |
Right, Keith. It makes sense. Thank you for the reply. Great fixs and refactors! |
Description
Expected sequence:
Transcribe a SeedQR, choose to verify your results. After your SeedQR is scanned, see either success (the SeedQR that was just scanned matched the SeedQR you just transcribed) or error (did not match or the QR code you just scanned is a completely unexpected type).
BUG: An Exception is raised after scanning the SeedQR due to bad
button_data
.Outdated implementation hiding an l10n bug
SeedTranscribeSeedQRConfirmScanView
was an outdated implementation that violated our "1View
instantiates 1Screen
" rule; after scanning back the transcribed SeedQR it was calling its own collection of follow up sub-Screen
s.Also these sub-
Screen
s had outdatedbutton_data
that weren'tButtonOption
lists. Which, by design in the l10n refactor, now throws an Exception.But a proper
FlowTest
couldn't be written for each of theseScreen
s because they were improperly nested inside that one bigView
(my fault; I wrote all that original code). And so none of our automated tests could alert of us of this Exception.The fixes in this PR
Screen
calls into their own individualView
s to match the conventions used everywhere else.button_list
items asButtonOption
s.FlowTest
to hit each failure condition when verifying the transcribed SeedQR with eventual success.View
s: SeedSigner/seedsigner-screenshots@c157f6eFlowTest.run_screen
(in tests/base.py) to check for any badbutton_list
inputs (i.e. they all must beButtonOption
s).FlowTest
will catch badbutton_list
input.Note: The edits in
SeedTranscribeSeedQRConfirmScanView
to pull out the three newView
s are almost entirely just copy-paste. As is often the case, the web diff here looks more dramatic than it actually is.Misc:
FlowTest
.This pull request is categorized as a:
Checklist
pytest
and made sure all unit tests pass before sumbitting the PRIf you modified or added functionality/workflow, did you add new unit tests?
I have tested this PR on the following platforms/os: