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

feat: support raw_slice returns from scripts and contracts #743

Merged
merged 36 commits into from
Jan 24, 2023

Conversation

iqdecay
Copy link
Contributor

@iqdecay iqdecay commented Dec 14, 2022

This PR closes #703 by adding support for raw untyped slice in scripts.
It adds the possibility of returning a vector from a script, as basically an array of u64.

@iqdecay iqdecay requested a review from digorithm as a code owner December 14, 2022 15:11
@iqdecay iqdecay requested a review from a team December 14, 2022 15:16
Copy link
Contributor

@segfault-magnet segfault-magnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't seen all the discussions around this, is this supported only by scripts, or can contract methods return raw_slice as well?

If so we should probably cover that with tests as well.

packages/fuels-core/src/abi_encoder.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/types/raw_slice.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/types/raw_slice.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/types/raw_slice.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/types/raw_slice.rs Outdated Show resolved Hide resolved
packages/fuels/tests/scripts/script_raw_slice/.gitignore Outdated Show resolved Hide resolved
packages/fuels/tests/scripts/script_raw_slice/src/main.sw Outdated Show resolved Hide resolved
packages/fuels/tests/scripts.rs Outdated Show resolved Hide resolved
@iqdecay iqdecay requested review from segfault-magnet, a team and mohammadfawaz December 15, 2022 21:04
@segfault-magnet segfault-magnet added the enhancement New feature or request label Dec 16, 2022
iqdecay and others added 9 commits December 26, 2022 15:40
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
This is needed for FuelLabs/sway#3450 and for
#742 eventually.

Spec issue: FuelLabs/fuel-specs#446
Compiler change: FuelLabs/sway#3450
The functions attributes feature for JSON ABI breaks compatibility with
0.32 for the Sway compiler because of the changes in `fuels-types`, so
the `fuels-rs` version should be corrected from 0.32.3 to 0.33.0.
Breaking changes:
- Predicate instantiation
- Sending funds to and receiving funds from predicates
@iqdecay iqdecay requested review from a team and removed request for a team January 17, 2023 22:00
hal3e
hal3e previously approved these changes Jan 19, 2023
Copy link
Contributor

@hal3e hal3e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Good work! Left a nit...

packages/fuels-core/src/traits/tokenizable.rs Outdated Show resolved Hide resolved
Copy link
Member

@digorithm digorithm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, very clean implementation!

@iqdecay iqdecay merged commit 18b196f into master Jan 24, 2023
@iqdecay iqdecay deleted the iqdecay/feat-scripts-raw-slice branch January 24, 2023 20:28
iqdecay added a commit that referenced this pull request Jan 24, 2023
- This PR closes #703 by adding support for returning a `raw untyped slice` in
scripts and contracts.
- This PR maps the Sway type `raw untyped slice` to the SDK type `RawSlice`.
- It only works with `u64` because the memory size of a `u64` is used to decode the returned `raw untyped slice`.
MujkicA pushed a commit that referenced this pull request Jan 24, 2023
- This PR closes #703 by adding support for returning a `raw untyped slice` in
scripts and contracts.
- This PR maps the Sway type `raw untyped slice` to the SDK type `RawSlice`.
- It only works with `u64` because the memory size of a `u64` is used to decode the returned `raw untyped slice`.
MujkicA pushed a commit that referenced this pull request Jan 24, 2023
This PR closes #703 by adding support for `raw untyped slice` in
scripts.
It adds the possibility of returning a vector from a script, as
basically an array of `u64`.

Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
Co-authored-by: Anton Trunov <anton.a.trunov@gmail.com>
Co-authored-by: Halil Beglerović <git@hal3e.io>
MujkicA pushed a commit that referenced this pull request Jan 25, 2023
- This PR closes #703 by adding support for returning a `raw untyped slice` in
scripts and contracts.
- This PR maps the Sway type `raw untyped slice` to the SDK type `RawSlice`.
- It only works with `u64` because the memory size of a `u64` is used to decode the returned `raw untyped slice`.
MujkicA pushed a commit that referenced this pull request Jan 25, 2023
This PR closes #703 by adding support for `raw untyped slice` in
scripts.
It adds the possibility of returning a vector from a script, as
basically an array of `u64`.

Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
Co-authored-by: Anton Trunov <anton.a.trunov@gmail.com>
Co-authored-by: Halil Beglerović <git@hal3e.io>
MujkicA pushed a commit that referenced this pull request Jan 25, 2023
This PR closes #703 by adding support for `raw untyped slice` in
scripts.
It adds the possibility of returning a vector from a script, as
basically an array of `u64`.

Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
Co-authored-by: Anton Trunov <anton.a.trunov@gmail.com>
Co-authored-by: Halil Beglerović <git@hal3e.io>
MujkicA pushed a commit that referenced this pull request Jan 25, 2023
This PR closes #703 by adding support for `raw untyped slice` in
scripts.
It adds the possibility of returning a vector from a script, as
basically an array of `u64`.

Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
Co-authored-by: Anton Trunov <anton.a.trunov@gmail.com>
Co-authored-by: Halil Beglerović <git@hal3e.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle raw_slice in the SDK
6 participants