ChainSafe / lodestar

🌟 TypeScript Implementation of Ethereum Consensus
https://lodestar.chainsafe.io
Apache License 2.0
1.17k stars 289 forks source link

Error when creating wallet - TypeError: Cannot perform %TypedArray%.prototype.set on a detached ArrayBuffer #1320

Closed larry0x closed 4 years ago

larry0x commented 4 years ago

Describe the bug

Lodestar throws the following error when attempting to create a wallet using the yarn run cli account wallet create command:

TypeError: Cannot perform %TypedArray%.prototype.set on a detached ArrayBuffer

Expected behavior

A wallet should be successfully created

Steps to Reproduce

  1. Install yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt upgrade
sudo apt install yarn
  1. Compile Lodestar
git clone https://github.com/chainsafe/lodestar.git
cd lodestar
yarn install
yarn run build
  1. Attempt to create wallet
yarn run cli account wallet create --name myLodestarWallet --passphraseFile ~/eth2/myLodestarWallet.pass --rootDir ~/.lodestar

This gives the following error:

yarn run v1.22.4
$ node --trace-deprecation ./packages/lodestar-cli/bin/lodestar account wallet create --name myLodestarWallet --passphraseFile /home/larry/eth2/myLodestarWallet.pass --rootDir /home/larry/.lodestar
 ✖ TypeError: Cannot perform %TypedArray%.prototype.set on a detached ArrayBuffer
    at Buffer.set (<anonymous>)
    at _copyActual (buffer.js:261:10)
    at Function.concat (buffer.js:573:12)
    at Function.encrypt (/home/larry/eth2/lodestar/node_modules/@chainsafe/bls-keystore/lib/keystore.js:73:38)
    at Function.fromMnemonic (/home/larry/eth2/lodestar/packages/lodestar-cli/lib/wallet/Wallet.js:59:25)
    at WalletManager.createWallet (/home/larry/eth2/lodestar/packages/lodestar-cli/lib/wallet/WalletManager.js:109:35)
    at Object.handler (/home/larry/eth2/lodestar/packages/lodestar-cli/lib/cmds/account/cmds/wallet/create.js:83:32)
    at Object.runCommand (/home/larry/eth2/lodestar/packages/lodestar-cli/node_modules/yargs/lib/command.js:240:40)
    at Object.parseArgs [as _parseArgs] (/home/larry/eth2/lodestar/packages/lodestar-cli/node_modules/yargs/yargs.js:1154:41)
    at Object.runCommand (/home/larry/eth2/lodestar/packages/lodestar-cli/node_modules/yargs/lib/command.js:198:30)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Screenshots

error screenshot

Desktop (please complete the following information):

Software versions:

larry@bacon:~$ uname -a
Linux bacon 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
larry@bacon:~$ nvm --version
0.35.3
larry@bacon:~$ node --version
v14.7.0
larry@bacon:~$ npm --version
6.14.7
larry@bacon:~$ yarn --version
1.22.4
larry0x commented 4 years ago

Update: this issue is resolved by downgrading Node.js to v12.18.3 and re-compile Lodestar.

dapplion commented 4 years ago

@wemeetagain The error comes from @chainsafe/bls-keystore. We should make sure Lodestar is using it's latest version. Also, it would be nice to add a broad NodeJS version matrix in @chainsafe/bls-keystore tests to be sure.

wemeetagain commented 4 years ago

Closing in favor of #1370