-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: Bye bye bcrypto #302
base: master
Are you sure you want to change the base?
Conversation
@wemeetagain Here's the initial draft. I haven't implemented the |
Note, the CI is failing because of a quirk in |
@wemeetagain would you be open to bumping CI to run on node 20 or do you want me to apply the shim that |
Other than the CI nodejs environment question, this should be ready for review. |
This is a redo of #197 and fixes #301.
Problem:
discv5
usesbcrypto
dependency for performantsecp256k1
andsha256
functions. This library causes occasional CI failures in ultralight due to in explicable OOMs and other indecipherable C++ errorsSolution: Replace
bcrypto
usage with adiscv5Crypto
interface similar to thev4Crypto
interface exposed by theenr
package. As currently stands, this PR implements adefaultCrypto
object usingnoble/hashes
andnoble/secp256k1
that are pure javascript implementation and are somewhat slower than thebcrypto
equivalents but can easily be replaced with WASM compiled alternatives such asas-sha256
orpolkadot/wasm-crypto
.Sidequest 1: Replace
bcrypto
AES cipher functionality with nodejs builtins that are overall 5-10% faster.Sidequest 2: Replace
bcrypto
randomBytes
function withnoble
equivalent