fuel-core
fuel-core copied to clipboard
chore: use Cow in scalars/HexString
Linked Issues/PRs
close https://github.com/FuelLabs/fuel-core/issues/2657
Description
Checklist
- [ ] Breaking changes are clearly marked as such in the PR description and changelog
- [x] New behavior is reflected in tests
- [ ] The specification matches the implemented behavior (link update PR if changes are needed)
Before requesting review
- [x] I have reviewed the code myself
- [ ] I have created follow-up issues caused by this PR and linked them here
After merging, notify other teams
[Add or remove entries as needed]
- [ ] Rust SDK
- [ ] Sway compiler
- [ ] Platform documentation (for out-of-organization contributors, the person merging the PR will do this)
- [ ] Someone else?
[!NOTE] Replaces owned HexString with Cow-backed HexString<'_> and updates GraphQL types/methods to borrow bytes where possible, reducing clones and adding required lifetimes.
- Scalars
- Replace
HexStringwithHexString<'a>backed byCow<[u8]>.- Add conversions:
From<Vec<u8>>,From<&[u8]>,From<HexString> for Vec<u8>; updateDisplay,ScalarType,CursorType,FromStr, andNonceconversions to support borrowing.- GraphQL Schema Updates
- Change return/input types from
HexStringtoHexString<'_>across schema:blob,contract,da_compressed,message,storage,tx(queries, mutations, subscriptions, types, receipts), andupgrades.- Introduce lifetimes in types and unions where needed (e.g.,
Input<'a>,InputCoin<'a>,InputMessage<'a>,UploadedBytecode<'a>, subscriptions).- Construct
HexStringvia borrowing (HexString::from(&[..])/.into()) and remove unnecessary clones in mappers (e.g., witnesses, scripts, predicate/data, storage slots, block/tx streams).- Adjust pagination and connection cursors to use
HexString<'_>where relevant.Written by Cursor Bugbot for commit ae7848d887620ce4be7ddc21a087ae86ccff2b12. This will update automatically on new commits. Configure here.