-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Use Buffer.from for NodeJS fromHexString #283
Comments
Another and much simpler solution could be to just check if packages/utils/src/base64.ts#L1 const hasBufferFrom = typeof Buffer !== "undefined" && typeof Buffer.from === "function"; However, if there are more functions that are affected, exports might be a more scalable / robust solution |
No longer a priority, fixed in Lodestar |
@nflaig noted that SSZ uses a browser compatible but slow implementation for fromHexString
ssz/packages/ssz/src/util/byteArray.ts
Lines 32 to 35 in d030130
We may use platform specific exports to get around it or have some logic to pick between implementations depending on platform.
Important to note that many consumers of SSZ assume everything is a Uint8Array. Buffer.slice() has different behaviour than Uint8Array.slice, so we must audit all downstream code to prevent surprises.
The text was updated successfully, but these errors were encountered: