-
Notifications
You must be signed in to change notification settings - Fork 299
WIP: Remove scrypt.js dependency (help wanted) #91
Conversation
A shorter-term option could be to implement a shim like this from PR #2938 for See also #2952. The warning message would just need
I'm happy to put up a PR, just let me know. I don't think there's an easy way around the memory exhaustion problem with Node's built-in Longer-term, I think having a unified |
Naive question: Is there a TL;DR someone can provide for why an Ethereum library needs scrypt in the first place? Normally it is used as a PoW algorithm, so I'm not sure what purpose it serves in an Ethereum library. Generally speaking, I hold a burning hatred for any library that has a node-gyp dependency as it causes no end of dev-time and build-time problems, especially when it is deep in a transitive dependency that you cannot easily change (like this one is in many projects). |
@MicahZoltu the scrypt function is used to derive the private key when unencrypting a wallet, and used also used when generating an encrypted wallet from one that's not encrypted. |
A few days ago I filed an issue with the Node.js maintainers: nodejs/node#28755. The initial response seems positive. |
An increased maxmem will be part of an upcoming Node.js release 🎉 : nodejs/node#28799. |
Hi! What's the status on removing the scrypt.js dep? Any way I can help move this forward? |
Has there been any further discussion surrounding either moving scrypt into this repo or removing it altogether? |
I'm running into this issue as well, would love to help get this resolved |
I created #108, which uses the same package used in Web3.js If anyone needs to use this package right now on Node 12, you can use @dmihal/ethereumjs-wallet |
This can be closed now that #108 has been merged |
I'm trying to remove scrypt.js, which is no longer maintained as a dependency. The primary reason is that scrypt.js isn't compatible with node12. A secondary benefit is that we can remove a dependency.
Deprecation
scrypt.js isn't compatible with node12, see:
npm install
fails with node 12 syscoin/sysethereum-contracts#1Testing errors
When testing these changes, I'm hitting out of memory errors:
For crypto.scrypt and scrypto.scryptSync, there is a
maxmem
optional argument that can be passed. I tried a couple different values but keep hitting "memory limit exceeded" errors. I'm not sure what the memory limit should be.callback?
One thing I noticed when reading the code was that was a mention in the comments about using a callback.
Note that the asynchonous version of the
crypto.scrypt
function requires a callback be passed.I don't know what the definition of the callback would be if we passed it. Suggestions welcome!
crypto.scrypt vs crypto.scryptSync?
Should these function calls be synchronous or async? I don't know what the callback defs should be, so I'm using the synchronous version at this point. But if the callback question is answered, perhaps we can switch to the asynch version?
cryptographic gotchas/concerns?
I'm not a cryptographer and I don't have a good understanding of these libraries. Obviously before merging someone with some background in cryptography should OK these changes.