-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filter ABI supertrait methods from contract entry generation (#6402)
## Description This PR filters out ABI supertrait methods from being considered for contract function entry generation. Closes #6333. ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [x] I have added tests that prove my fix is effective or that my feature works. - [x] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers.
- Loading branch information
Showing
15 changed files
with
172 additions
and
24 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
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
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
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
13 changes: 13 additions & 0 deletions
13
test/src/e2e_vm_tests/test_programs/should_pass/superabi_supertrait_external_call/Forc.lock
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,13 @@ | ||
[[package]] | ||
name = "core" | ||
source = "path+from-root-6ECA11F8A7EF18BC" | ||
|
||
[[package]] | ||
name = "std" | ||
source = "path+from-root-6ECA11F8A7EF18BC" | ||
dependencies = ["core"] | ||
|
||
[[package]] | ||
name = "superabi_supertrait_external_call" | ||
source = "member" | ||
dependencies = ["std"] |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_pass/superabi_supertrait_external_call/Forc.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,8 @@ | ||
[project] | ||
name = "superabi_supertrait_external_call" | ||
authors = ["Fuel Labs <contact@fuel.sh>"] | ||
entry = "main.sw" | ||
license = "Apache-2.0" | ||
|
||
[dependencies] | ||
std = { path = "../../../reduced_std_libs/sway-lib-std-assert" } |
35 changes: 35 additions & 0 deletions
35
...vm_tests/test_programs/should_pass/superabi_supertrait_external_call/json_abi_oracle.json
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,35 @@ | ||
{ | ||
"configurables": [], | ||
"functions": [ | ||
{ | ||
"attributes": null, | ||
"inputs": [], | ||
"name": "method", | ||
"output": { | ||
"name": "", | ||
"type": 0, | ||
"typeArguments": null | ||
} | ||
}, | ||
{ | ||
"attributes": null, | ||
"inputs": [], | ||
"name": "method1", | ||
"output": { | ||
"name": "", | ||
"type": 0, | ||
"typeArguments": null | ||
} | ||
} | ||
], | ||
"loggedTypes": [], | ||
"messagesTypes": [], | ||
"types": [ | ||
{ | ||
"components": null, | ||
"type": "u64", | ||
"typeId": 0, | ||
"typeParameters": null | ||
} | ||
] | ||
} |
21 changes: 21 additions & 0 deletions
21
.../src/e2e_vm_tests/test_programs/should_pass/superabi_supertrait_external_call/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,21 @@ | ||
contract; | ||
|
||
trait MySuperTrait { | ||
fn method() -> u64; | ||
} | ||
|
||
abi MyAbi : MySuperTrait { | ||
//fn method() -> u64; | ||
} | ||
|
||
impl MySuperTrait for Contract { | ||
fn method() -> u64 { 42 } | ||
} | ||
|
||
impl MyAbi for Contract {} | ||
|
||
#[test] | ||
fn tests() { | ||
let caller = abi(MyAbi, CONTRACT_ID); | ||
assert(caller.method() == 0xBAD) | ||
} |
2 changes: 2 additions & 0 deletions
2
test/src/e2e_vm_tests/test_programs/should_pass/superabi_supertrait_external_call/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_new_encoding = { action = "revert", value = 123 } |
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
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