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

[v5] Invalid arrayify value on HDNode.fromMnemonic() #530

Closed
Mrtenz opened this issue May 28, 2019 · 9 comments
Closed

[v5] Invalid arrayify value on HDNode.fromMnemonic() #530

Mrtenz opened this issue May 28, 2019 · 9 comments
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.

Comments

@Mrtenz
Copy link

Mrtenz commented May 28, 2019

Using HDNode.fromMnemonic(mnemonic); results in this error:

Error: invalid arrayify value (
  argument="value",
  value="0x236,23,43,189,...",
  version=@TODO
)
    at makeError (index.js?74fe:105)
    at throwError (index.js?74fe:116)
    at Object.throwArgumentError (index.js?74fe:120)
    at Object.arrayify (index.js?c5c4:87)
    at Object.pbkdf2 (browser.js?f1df:23)
    at mnemonicToSeed (index.js?64df:234)

I tried HDNode.fromSeed(mnemonicToSeed(mnemonic)); too, but got the same result.

Sorry for making so many issues. 😅

@ricmoo
Copy link
Member

ricmoo commented May 28, 2019

No worries, I am glad for the help finding issues. :)

That said, I cannot reproduce this. Can you include a code snippet? :)

let node = ethers.utils.HDNode.fromMnemonic("jewel engage bread festival exclude armor insect motor print cup vague private");
console.log(node);
/*
HDNode {
  privateKey:
   '0x77637873dd4ef4f08a79e3a3c1d6af910ff6514d249d0d85cb4f9b286f5c203f',
  publicKey:
   '0x0341f80a43bac79a4cc1c818d59f53cceecc0f35105ca99614bb76a9d9e3528987',
  parentFingerprint: '0x00000000',
  fingerprint: '0xf8f327e9',
  address: '0xb61EE527816262CDDEaee3FDc08a55B1051A2978',
  chainCode:
   '0xb65b8621e2776659d4526cce7c5ce8f4aa7984f9408756305a1d8645fcb58d40',
  index: 0,
  depth: 0,
  mnemonic:
   'jewel engage bread festival exclude armor insect motor print cup vague private',
  path: 'm' }
*/

@ricmoo ricmoo added discussion Questions, feedback and general information. next version labels May 28, 2019
@Mrtenz
Copy link
Author

Mrtenz commented May 29, 2019

It seems to be an issue in browser and/or Webpack environments only. I did some testing and in a Node.js environment I had no issues, but running it in Webpack results in the error above. I had no issues with it in v4.

@Mrtenz
Copy link
Author

Mrtenz commented May 29, 2019

I made a small repo where I was able to reproduce the issue:

https://github.com/Mrtenz/ethers-issue

To test it:

  • yarn
  • yarn run build
  • Open dist/index.html in your browser
  • Have a look at the browser console

@Mrtenz
Copy link
Author

Mrtenz commented Jun 1, 2019

@ricmoo Have you had time yet to look into this?

@ricmoo
Copy link
Member

ricmoo commented Jun 1, 2019

Ah! Sorry, no I haven't had a chance, this weekend is the CryptoChicks hackathon and I'm a mentor.

I just verified you are correct though and am looking into it now. :)

@Mrtenz
Copy link
Author

Mrtenz commented Jun 1, 2019

No problem, thank you!

And good luck with the hackathon stuff!

@ricmoo
Copy link
Member

ricmoo commented Jun 1, 2019

I've found the problem and have added a fix. I'll push it and publish it once the build is complete. :)

@ricmoo
Copy link
Member

ricmoo commented Jun 1, 2019

Ok. Fixed, I think. You will have to blow away your node_modules folder, and redo an npm install if you are bundling it yourself (because the beta version doesn't peg dependency versions to reduce the turmoil in package versions). Or if you are just grabbing the /dist folder version, the 5.0.0-beta-137 is what you will want to pull. :)

Let me know if you are still having any problems.

@ricmoo ricmoo added bug Verified to be an issue. and removed discussion Questions, feedback and general information. labels Jun 1, 2019
@Mrtenz
Copy link
Author

Mrtenz commented Jun 1, 2019

Awesome, just tested it and it seems to work now. I had to delete/regenerate my yarn.lock for the dependencies to update though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

No branches or pull requests

2 participants