forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable raw pointer return from scripts (FuelLabs#4341)
- This PR enables returning heap types from scripts. - In FuelLabs/fuels-rs#848, support was added for returning vectors from smart contracts in the SDK, this safeguard can now be removed so the same can happen with scripts.
- Loading branch information
Showing
14 changed files
with
24 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
test/src/e2e_vm_tests/test_programs/should_fail/raw_ptr/raw_ptr_ret/src/main.sw
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
test/src/e2e_vm_tests/test_programs/should_fail/raw_ptr/raw_ptr_ret/test.toml
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
test/src/e2e_vm_tests/test_programs/should_fail/raw_ptr/vec_ret/src/main.sw
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
test/src/e2e_vm_tests/test_programs/should_fail/raw_ptr/vec_ret/test.toml
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
test/src/e2e_vm_tests/test_programs/should_pass/language/raw_ptr/raw_ptr_ret/src/main.sw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
script; | ||
|
||
use std::vec::Vec; | ||
|
||
fn main() -> raw_ptr { | ||
let mut a : Vec<u64> = Vec::new(); | ||
a.push(1234); | ||
a.buf.ptr | ||
} |
2 changes: 2 additions & 0 deletions
2
test/src/e2e_vm_tests/test_programs/should_pass/language/raw_ptr/raw_ptr_ret/test.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
category = "run" | ||
expected_result = { action = "return", value = 67108854 } |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
test/src/e2e_vm_tests/test_programs/should_pass/language/raw_ptr/vec_ret/src/main.sw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
script; | ||
|
||
fn main() -> Vec<u64> { | ||
let mut vec = Vec::new(); | ||
vec.push(124); | ||
vec.push(124); | ||
vec.push(124); | ||
vec | ||
} |
2 changes: 2 additions & 0 deletions
2
test/src/e2e_vm_tests/test_programs/should_pass/language/raw_ptr/vec_ret/test.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
category = "run" | ||
expected_result = { action = "return_data", value = "0000000003ffffc400000000000000040000000000000003" } |