Skip to content
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

Merged
merged 20 commits into from
Feb 4, 2025

Conversation

bbyalcinkaya
Copy link
Member

@bbyalcinkaya bbyalcinkaya commented Feb 1, 2025

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 a Symbol object.

Also refactored the bytes_new_from_linear_memory and bytes_len host functions using hostCallAux and added property tests.

@bbyalcinkaya bbyalcinkaya changed the title Add host functions Bytes operations Add host functions for Bytes operations Feb 2, 2025
@bbyalcinkaya bbyalcinkaya mentioned this pull request Feb 2, 2025
@bbyalcinkaya bbyalcinkaya marked this pull request as ready for review February 3, 2025 17:27
Copy link
Contributor

@gtrepta gtrepta left a 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.

Copy link
Contributor

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.

@automergerpr-permission-manager automergerpr-permission-manager bot merged commit 12c938f into master Feb 4, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants