-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 returning Vec<>
types from contracts
#848
Conversation
packages/fuels-code-gen/src/program_bindings/abigen/bindings/function_generator.rs
Show resolved
Hide resolved
Review done alongside @hal3e Is returning Vectors from scripts planned as well @digorithm @iqdecay ? |
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
Tracking in #866 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed alongside @segfault-magnet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed with @hal3e
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
- 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.
This PR closes #746 by allowing the user to return a vector containing any type
from a smart contract.
It relies on one main change:
CALL
opcode on the contract now needs the outputtype of the contract call to work properly. Indeed, to know how many bytes
the vector takes in VM memory and return all these bytes, you need to know
the encoding width of the inner type of the vector.