web3.js: use Uint8Array instead of Buffer for Transaction.addSignature#27861
web3.js: use Uint8Array instead of Buffer for Transaction.addSignature#27861macalinao wants to merge 1 commit intosolana-labs:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #27861 +/- ##
=======================================
Coverage 77.3% 77.4%
=======================================
Files 55 55
Lines 2889 2910 +21
Branches 402 404 +2
=======================================
+ Hits 2234 2253 +19
- Misses 514 515 +1
- Partials 141 142 +1 |
|
This looks fine to me, but this will fail commitlint, along with all the other PRs. I have a few asks --
|
Sure
Sure, will use conventional commits here
What grouping would give the PRs the highest probability of being accepted? |
Well... it's hard to say without looking at all of them! I'd say maybe start by grouping the ones having to do with Buffer -> Uint8Array together, especially any that are breaking. There are some non-obvious ways a change like this can be breaking: #27700 In principle, I think we're all for getting away from Buffer, but I think we have to see if ultimately it's going to mean shipping web3.js v2.0 just for this. |
steveluscher
left a comment
There was a problem hiding this comment.
Begone, typed array!
| const signature = byteArray.slice(0, SIGNATURE_LENGTH_IN_BYTES); | ||
| byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES); | ||
| signatures.push(bs58.encode(Buffer.from(signature))); | ||
| signatures.push(bs58.encode(Uint8Array.from(signature))); |
There was a problem hiding this comment.
We can go straight into bs58.encode() as an array of numbers!
| signatures.push(bs58.encode(Uint8Array.from(signature))); | |
| signatures.push(bs58.encode(signature)); |
Problem
Bufferis used whereUint8Arrayis sufficient, making Browserify required for simple libraries.See: https://twitter.com/armaniferrante/status/1569871757687029761