-
-
Notifications
You must be signed in to change notification settings - Fork 317
Refactor: entropy thunks cleanup #22382
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
Conversation
|
||
const isEntropyCheckEnabled = useSelector((state: MessageSystemRootState) => | ||
selectIsFeatureEnabled(state, Feature.entropyCheckMobile, 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.
extracting .navigate
side-effect from the thunk to React means that I have to duplicate the condition for isEntropyCheckEnabled
but that's acceptable I guess.
0350a85
to
d38b037
Compare
suite-native/module-device-onboarding/src/screens/WalletCreationScreen.tsx
Outdated
Show resolved
Hide resolved
✅ Previously successful run of [Test] PR Suite Desktop e2e tests workflow has been found. |
✅ Previously successful run of [Test] PR Suite Web e2e tests workflow has been found. |
dispatch(failEntropyCheckThunk({ device, error: result.payload })); | ||
} | ||
}, | ||
); |
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 copied the implementation from suite
.
Unifying it will lower the surface for future human mistakes 🙂
d38b037
to
40dbbc0
Compare
73feaa6
to
c0c5f83
Compare
) { | ||
const { code } = responsePayload.payload; | ||
if (code && DEFINITIVE_ERRORS.includes(code)) { | ||
if (isEntropyCheckEnabled && code === 'Failure_EntropyCheck') { |
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.
nitpick: I think what's not ideal is that we could simply return the value of failEntropyCheckThunk
all the way to the result of createAndBackupWalletThunk
and by doing that, we wouldn't have to store it in the state and select it here and just look at the type of return value to see whether it's the "correct" error. Again, out of scope for this PR for sure.
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.
Good idea. Together with your comment above it's a good followup for a next PR in future.
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.
Overall LGTM, just some nitpick comments for discussion that shouldn't be blockers.
Mobile success works as expected. Tested error on branch FW-check-UI-testing-branch
where I "succesfully" get redirected to DeviceCompromisedModal screen 💪
c0c5f83
to
f4eaba4
Compare
Description
createAndBackupWalletThunk
suite-common
QA instructions
Test the happy path:
If possible, test both with a device that does not pass entropy check.
Screenshots:
ℹ️ entropy check failure tested with the testing branch
mobile entropy success.webm
mobile entropy fail.webm
mobile entropy check disabled.webm (via local message system)
mobile initiating backup.webm (device needs backup after partial onboarding in suite)
desktop entropy success.webm
desktop entropy fail.webm
desktop entropy disabled.webm
🔍🖥️ Suite web test results: View in Currents
🔍🖥️ Suite desktop test results: View in Currents
🔍🖥️ Suite native android test results: View in Currents