-
Notifications
You must be signed in to change notification settings - Fork 719
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 function attributes to JSON ABI #446
Labels
ABI
Contract ABI
Comments
This was referenced Dec 14, 2022
anton-trunov
added a commit
that referenced
this issue
Dec 14, 2022
This was referenced Dec 14, 2022
anton-trunov
added a commit
to FuelLabs/fuels-rs
that referenced
this issue
Dec 16, 2022
This is needed for FuelLabs/sway#3450 and for #742 eventually. Spec issue: FuelLabs/fuel-specs#446 Compiler change: FuelLabs/sway#3450
mohammadfawaz
added a commit
to FuelLabs/sway
that referenced
this issue
Dec 19, 2022
## Description The lack of this annotation implies the method is non-payable. When calling an ABI method that is non-payable, the compiler must emit an error if the amount of coins to forward is not guaranteed to be zero. The compiler also emits an error if the method signature and the method implementation have different `#[payable]` annotations. ## Assumptions Currently, the analysis of non-zero coins is very simple and only checks if the special `coins:` contract call parameter is the zero `u64` literal directly or can be reached through a chain of variable/constant definitions. ## Tests - [x] Must fail when scripts call non-payable methods with non-zero coins as a literal - [x] Must fail when scripts call non-payable methods with non-zero coins as a constant - [x] Must fail when scripts call non-payable methods with non-zero coins as a variable definition - [x] Must fail when contracts call non-payable methods with non-zero coins - [x] Must fail when there is an extra `#[payable]` annotation in method implementation (not mentioned in its signature) - [x] Must fail when the `#[payable]` annotation in method implementation is missing (but mentioned in its signature) close #1608 ## TODOs - [x] Fix `#[payable]` annotations for the standard library - [x] Fix the empty parens issue for formatting attributes: #3451 - [x] Parser should allow us write annotations like so: `#[storage(read, write), payable]`: #3452 - [x] Refactor `#[payable]` annotations in this PR in the style above - [x] Add more complex formatter unit tests with `payable` - [x] As pointed out by @mohammadfawaz, the SDK can bypass payable annotations and one option would be to add function attributes to the [JSON ABI schema](https://fuellabs.github.io/fuel-specs/master/protocol/abi/json_abi_format.html) and process it in the SDK (see these issues: FuelLabs/fuel-specs#446 and FuelLabs/fuels-rs#742) - [x] Bump `fuels-rs`'s version Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
anton-trunov
added a commit
that referenced
this issue
Dec 19, 2022
close #446 Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
iqdecay
pushed a commit
to FuelLabs/fuels-rs
that referenced
this issue
Dec 26, 2022
This is needed for FuelLabs/sway#3450 and for #742 eventually. Spec issue: FuelLabs/fuel-specs#446 Compiler change: FuelLabs/sway#3450
ak-tech007
added a commit
to ak-tech007/Rust-SDK
that referenced
this issue
Dec 6, 2024
This is needed for FuelLabs/sway#3450 and for #742 eventually. Spec issue: FuelLabs/fuel-specs#446 Compiler change: FuelLabs/sway#3450
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is needed to support the
#[payable]
annotation in the Fuel SDKs. See the PR introducing the payability analysis to Sway: FuelLabs/sway#3450.The text was updated successfully, but these errors were encountered: