[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)? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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
String
host 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 usealloc
at all.The issue is really an oversight in the initial Soroban host API design
StringObject
andBytesObject
are essentially the same data type (modulo semantic annotation), but onlyBytesObject
has 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.
Beta Was this translation helpful? Give feedback.
All reactions