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: speed up secp256k1 keygen #551

Merged
merged 1 commit into from
Jun 7, 2021
Merged

Conversation

mirceanis
Copy link
Member

fixes #549

Since #529 got merged, secp256k1 key generation is very slow on react-native (tested on android).
The culprit seems to be the pbkdf2 method that gets called by @ethersproject/wallet#Wallet.createRandom()

This fix instantiates a SigningKey directly instead of deriving from a mnemonic, therefore sidestepping the call to pbkdf2

@mirceanis mirceanis requested a review from awoie June 7, 2021 13:28
@codecov
Copy link

codecov bot commented Jun 7, 2021

Codecov Report

Merging #551 (522e3d8) into next (0bf7b24) will increase coverage by 9.62%.
The diff coverage is 67.00%.

@@            Coverage Diff             @@
##             next     #551      +/-   ##
==========================================
+ Coverage   67.58%   77.20%   +9.62%     
==========================================
  Files          62       71       +9     
  Lines        1530     1869     +339     
  Branches      247      314      +67     
==========================================
+ Hits         1034     1443     +409     
- Misses        400      424      +24     
+ Partials       96        2      -94     

Copy link
Member

@awoie awoie left a comment

Choose a reason for hiding this comment

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

lgtm

@mirceanis mirceanis merged commit 75e356c into next Jun 7, 2021
@mirceanis mirceanis deleted the 549-secp256k1-keygen-react-native branch June 7, 2021 14:44
@mirceanis mirceanis mentioned this pull request Jul 13, 2021
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.

secp256k1 key generation is too slow on react-native
2 participants