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

[Wallet] Improve error handling around account creation and keystore ops #1497

Merged
merged 6 commits into from
Oct 31, 2019

Conversation

jmrossy
Copy link
Contributor

@jmrossy jmrossy commented Oct 28, 2019

Description

  • Improve error handling around account
  • Better error message on invite screen when account creation fails
  • Improve logging in keystore utils
  • Send keystore errors to Sentry

Tested

Ran through invite flow and import flow, no regressions

Issues

Backwards compatibility

Yes

Improve logging in keystore utils
Send keystore errors to Sentry
@codecov
Copy link

codecov bot commented Oct 28, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@c9a870a). Click here to learn what that means.
The diff coverage is 24.39%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1497   +/-   ##
=========================================
  Coverage          ?   73.69%           
=========================================
  Files             ?      277           
  Lines             ?     7432           
  Branches          ?      660           
=========================================
  Hits              ?     5477           
  Misses            ?     1843           
  Partials          ?      112
Flag Coverage Δ
#mobile 73.69% <24.39%> (?)
Impacted Files Coverage Δ
packages/mobile/src/import/saga.ts 84.78% <ø> (ø)
packages/mobile/src/app/ErrorMessages.ts 100% <100%> (ø)
packages/mobile/src/utils/keyStore.ts 40% <33.33%> (ø)
packages/mobile/src/web3/saga.ts 40.1% <4.76%> (ø)
packages/mobile/src/identity/verification.ts 65.19% <50%> (ø)
packages/mobile/src/invite/saga.ts 79.02% <50%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c9a870a...cb3be64. Read the comment docs.

Copy link
Contributor

@jeanregisser jeanregisser left a comment

Choose a reason for hiding this comment

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

Looks good! 👍
I've left 2 questions.

} else {
Logger.error(TAG + '@assignAccountFromPrivateKey', 'Error importing raw key')
throw e
}
}
yield call(web3.eth.personal.unlockAccount, account, pincode, UNLOCK_DURATION)
web3.eth.defaultAccount = account
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why this was previously done only when !zeroSyncMode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's still only done in !zerosyncmode, I just improved the organization.
It's think it's because we don't use web3 to sign txs in zero sync mode, not 100% sure tho

Copy link
Contributor

Choose a reason for hiding this comment

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

ok 👍

try {
Logger.debug(TAG, `Setting key ${key} in keystore`)
await RNSecureKeyStore.set(key, value, {
accessible: ACCESSIBLE.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why changing the accessible option now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just experimenting before I realized this only affects iOS. This option seems right to me, WDYT?

Copy link
Contributor

@jeanregisser jeanregisser Oct 29, 2019

Choose a reason for hiding this comment

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

This has a subtle implication when restoring the phone from a backup.

If using one of the options with the _THIS_DEVICE_ONLY suffix, the keychain item won't be backed up. Which means users will lose their mnemonic if they restore their phone (though I know they should have manually backed up their key). But the AsyncStorage content will be restored.

This doesn't sound right to me as is and we should make a careful consideration about this (and same for the geth data folder and AsyncStorage content).

More about this:
https://developer.apple.com/documentation/security/ksecattraccessibleafterfirstunlockthisdeviceonly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep that was intentional, I felt that the backup key should not be synced to Apple's servers.

Copy link
Contributor

Choose a reason for hiding this comment

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

Will circle back on this directly on Slack.

@jmrossy jmrossy added automerge Have PR merge automatically when checks pass and removed automerge Have PR merge automatically when checks pass labels Oct 29, 2019
@jmrossy jmrossy force-pushed the rossy/wa-improve-accout-error-handling branch from cf31f06 to a7bcef9 Compare October 30, 2019 10:05
@jmrossy jmrossy force-pushed the rossy/wa-improve-accout-error-handling branch from 59f8546 to cb3be64 Compare October 31, 2019 18:29
@jmrossy jmrossy merged commit 7310ab8 into master Oct 31, 2019
@jmrossy jmrossy deleted the rossy/wa-improve-accout-error-handling branch October 31, 2019 18:35
aaronmgdr added a commit that referenced this pull request Nov 2, 2019
* master: (62 commits)
  Fix e2e on CI (#1537)
  Allow a specified address to disable/enable the Exchange  (#1467)
  Avoid re-encrypting key files with yarn keys:encrypt command (#1560)
  Support protocol hotfixing (#613)
  Point e2e tests back (#1562)
  Refactor to Accounts.sol (#1392)
  Add selectIssuers Transaction (#1327)
  [Wallet] Get React Native Hot Reloading Working (#1551)
  Unify to prefix messages for signing (#1473)
  [Wallet] Improve error handling around account creation and keystore ops (#1497)
  Add CI test for checking licenses and misc package.json cleanup (#1550)
  [Wallet] Implement SMS invite on iOS (#1541)
  CI: brings back to master (#1554)
  Validators: uses Ethereum address for proof of possession (#1494)
  Validate Attestation Requests (#1468)
  Rename hosted node references to forno (#1511)
  Bump rubyzip from 1.2.3 to 1.3.0 in /packages/mobile (#1508)
  Added txpool family to geth apis. Sorted geth cmd options (#1462)
  [Wallet] Fix yarn dev command for running android (#1534)
  [Wallet] iOS info plist changes and version bump (#1539)
  ...

# Conflicts:
#	yarn.lock
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.

Improve error handling around account creation and keystore retrieval
5 participants