feat: Use Uint8Array instead of Buffer to adopt widely available API#801
feat: Use Uint8Array instead of Buffer to adopt widely available API#801rogaldh wants to merge 39 commits intosolana-foundation:masterfrom
Uint8Array instead of Buffer to adopt widely available API#801Conversation
|
@rogaldh is attempting to deploy a commit to the Solana Foundation Team on Vercel. A member of the Team first needs to authorize it. |
1f8afe4 to
396b413
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR replaces Key observations:
Confidence Score: 5/5PR is safe to merge; all previous round concerns are addressed and no P0/P1 issues were found. All remaining findings are P2 style/quality suggestions (duplicate function pairs in bytes.ts). The migration logic is correct throughout, the toBase64 overflow and fromHex odd-length inconsistency from prior review rounds are both fixed, and the isValidBase64 change is a genuine bug fix. No correctness or data-integrity issues found. app/shared/lib/bytes.ts — minor API surface cleanup opportunity (readU8 vs readUint8, concat vs concatBytes) Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Callers across 42 files] -->|string / ArrayLike / ArrayBuffer| B["bytes() constructor"]
A -->|hex string| C[fromHex]
A -->|base64 string| D[fromBase64]
A -->|UTF-8 string| E[fromUtf8]
B --> F[Uint8Array]
C --> F
D --> F
E --> F
F -->|encode output| G[toHex]
F -->|encode output| H[toBase64]
F -->|decode output| I[toUtf8]
F -->|external lib boundary| J[toBuffer → Buffer]
J --> K["@solana/web3.js\n@coral-xyz/anchor\n@solana/spl-account-compression"]
style J fill:#f9e4b7,stroke:#c9a227
style K fill:#fce8e8,stroke:#c0392b
Reviews (2): Last reviewed commit: "fix: improve implementations for fromHex..." | Re-trigger Greptile |
|
@greptile-apps check again |
…-buffer-with-uint8array
Description
Replace
Bufferusage withUint8Arrayacross the codebase for browser compatibility. Introduces a comprehensive byte-helper library (app/shared/lib/bytes.ts) that providesUint8Array-native equivalents for all commonBufferoperations: base64, hex, UTF-8 encoding/decoding, integer reads/writes (u8, u16LE, u32LE), concat, equals, alloc, and a polymorphicbytes()constructor.toBuffer()is retained solely as an adapter for external libraries (@solana/web3.js,@coral-xyz/anchor,@solana/spl-account-compression) that still requireBuffer.Type of change
Screenshots
n/a
Testing
Regression testing (preview deployment)
Address pages
SAS attestation
Transaction pages
Inspector and search
Quick checklist (from regression)
Base64
Hex
UTF-8
Buffer.alloc
Related Issues
n/a
Checklist
build:infoscript to update build information