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

fix(keychain): fix private key missing error #5277

Merged
merged 2 commits into from
Apr 19, 2024
Merged

Conversation

kathaypacific
Copy link
Collaborator

Description

As the title. I've done a detailed writeup here.

Test plan

As a user who knows their pincode, I should always be able to perform a transaction and see my recovery phrase.

Related issues

Backwards compatibility

Y

Network scalability

Y

Copy link

codecov bot commented Apr 18, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 86.00%. Comparing base (e07c16b) to head (0c30441).
Report is 9 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5277      +/-   ##
==========================================
+ Coverage   85.91%   86.00%   +0.09%     
==========================================
  Files         745      745              
  Lines       30487    30498      +11     
  Branches     5288     5289       +1     
==========================================
+ Hits        26192    26229      +37     
+ Misses       4059     4037      -22     
+ Partials      236      232       -4     
Files Coverage Δ
src/identity/actions.ts 84.84% <100.00%> (+0.47%) ⬆️
src/identity/selectors.ts 100.00% <100.00%> (ø)
src/pincode/authentication.ts 87.68% <100.00%> (+12.40%) ⬆️
src/redux/migrations.ts 97.01% <100.00%> (+<0.01%) ⬆️
src/redux/store.ts 78.68% <ø> (ø)
src/web3/contracts.ts 38.75% <100.00%> (ø)
test/schemas.ts 90.21% <100.00%> (+0.03%) ⬆️
src/identity/reducer.ts 29.85% <0.00%> (-0.92%) ⬇️

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

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

@@ -135,7 +135,7 @@ export function* getViemWallet(chain: Chain) {
if (!account) {
throw new Error(`Account ${walletAddress} not found in Keychain`)
}
const password = yield* call(getPasswordSaga, walletAddress, false, true)
const password = yield* call(getPasswordSaga, walletAddress, true, false)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is the fix for new users. everything else is fixing the bad leftover state for existing users.

Copy link
Contributor

Choose a reason for hiding this comment

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

could be in a follow up, but should we change the arg type of getPasswordSaga to an object, so its explicit on what booleans are set?. E.g.,

const password = yield* call(getPasswordSaga, { account: walletAddress, withVerification: true })

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes absolutely (although i'd prefer to refactor that function to remove these arguments / code paths altogether, they should be in separate functions that are called predictably) but wanted to keep this fix isolated here

@kathaypacific kathaypacific changed the title fix(keychain): require pincode authentication and fix incorrectly stored password fix(keychain): fix private key missing error Apr 18, 2024
Copy link
Member

@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.

Great! Thanks so much for digging all the details. :shipit: 🚀

Like Satish mentionned, I'm sure we all have a few ideas to make this part of the code base more robust given its importance.
Silas was asking if we should maybe do a small post mortem to learn from this and agree on next steps.

@kathaypacific kathaypacific added this pull request to the merge queue Apr 19, 2024
Copy link
Contributor

@bakoushin bakoushin left a comment

Choose a reason for hiding this comment

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

💫 Amazing job!

I agree that we have to refactor this to make it as dumb as possible, avoiding side effects and obscure params like this withVerification one. I guess part of the problem is not only the form in which it's supplied to the function but the reason for its very existence.

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Apr 19, 2024
@kathaypacific kathaypacific merged commit 2370ad8 into main Apr 19, 2024
17 checks passed
@kathaypacific kathaypacific deleted the kathy/fix-private-key branch April 19, 2024 11:34
MuckT pushed a commit that referenced this pull request Apr 19, 2024
### Description

As the title. I've done a detailed writeup
[here](https://linear.app/valora/issue/RET-1067/error-while-swapping-private-key-not-found#comment-3729279a).

### Test plan

As a user who knows their pincode, I should always be able to perform a
transaction and see my recovery phrase.

### Related issues

- Fixes RET-1067

### Backwards compatibility

Y

### Network scalability

Y
shottah pushed a commit to zed-io/kolektivo that referenced this pull request May 15, 2024
### Description

As the title. I've done a detailed writeup
[here](https://linear.app/valora/issue/RET-1067/error-while-swapping-private-key-not-found#comment-3729279a).

### Test plan

As a user who knows their pincode, I should always be able to perform a
transaction and see my recovery phrase.

### Related issues

- Fixes RET-1067

### Backwards compatibility

Y

### Network scalability

Y
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.

None yet

4 participants