[CAP-69] String/Bytes conversion host functions #1633
dmkozh
started this conversation in
Core Advancement Proposals
Replies: 1 comment 1 reply
|
Can you expand on what is broken if this CAP does not get implemented/quantify impact on the network (as it seems to be an optimization CAP)? |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This is a discussion thread for CAP-69 - String/Bytes conversion host functions
CAP-69
It has been noticed by the contract developers that it's currently impossible to get a character from a
Stringhost object without allocating a vector on a guest side and copying the string into it (for that worth host only provides a way to get a string length and copy it to/from the linear memory). That increases the cost of the contract unnecessarily, as it otherwise didn't need to useallocat all.The issue is really an oversight in the initial Soroban host API design
StringObjectandBytesObjectare essentially the same data type (modulo semantic annotation), but onlyBytesObjecthas a rich set of host functions available.The solution proposed here introduces only the conversion host functions in order to provide a way to perform all the operations on the host side without bloating the host interface with duplicate functions.
All reactions