-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add host functions for Bytes
operations
#61
Conversation
Bytes
operationsBytes
operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I don't have time to comb through the tests so I'm trusting that you are making sure everything gets covered. Remember that there should be plenty of tests already made by the Soroban team and integrating those gives us the most assurance that we're conforming to the standard.
deps/soroban-examples
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember, are we using some tests in here on our CI? We definitely want to be covering as many of them as possible.
This PR introduces a set of host functions for
Bytes
objects and corresponding wast and komet tests.bytes_new
: Creates a new byte array.bytes_put
: Updates byte data at a given index.bytes_get
: Retrieves a byte at a specified index.bytes_del
: Removes a byte at a given index.bytes_insert
: Inserts bytes at a given index (now allows 0-length insertions).bytes_append
: Appends bytes to the end.bytes_slice
: Extracts a subrange of bytes.bytes_push
: Adds a byte to the end.bytes_pop
: Removes and returns the last byte.bytes_front
,bytes_back
: Retrieves the first and last bytes.bytes_copy_from_linear_memory
: Copies data from linear memory.symbol_len
: Returns the length of aSymbol
object.Also refactored the
bytes_new_from_linear_memory
andbytes_len
host functions usinghostCallAux
and added property tests.