-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Introduce __smo
intrinsic
#3564
Conversation
This is needed for FuelLabs/sway#3409. Basically, we want to be able to decode the data sent via `smo`, just like logs, so messages need to store information in the JSON ABI. Doesn't look like this impacts anything at the moment as everything compiles fine. Spec change: FuelLabs/fuel-specs#444 Compiler change: FuelLabs/sway#3564 that needs this (currently using a local copy of `fuels-rs`)
- IR + asm unit test - E2E test to check the JSON ABI - Enhance IR verifier - Documentation of __smo in the Sway Book
816cdc4
to
af776ee
Compare
Sorry for the trivial JSON ABI file diffs, again |
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.
Do we need to add an SDK test to make sure the message actually gets through correctly? Is that possible?
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.
Looks fine to me (after Toby's comments). So approving in advance.
Co-authored-by: Toby Hutton <toby@grusly.com>
Likely better to do it here so I did. I originally thought it can be done in #3577 but might as well get it done. |
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.
I just left 1 question but looks great overall!
7ecdf8e
to
1e99b2b
Compare
Closes #3457
Following how
__log
works for the most part.Tasks:
messagesTypes
to the JSON ABI fuel-specs#444)__smo
Nothing particularly special about this change except for IR gen. The new intrinsic has the following signature:
while the IR instruction has the following signature:
which matches the
smo
opcode. IR gen buildsrecipient_and_message
by creating a new struct where the first field is the recipient (ab256
), the second field is thesmo
ID (just like log IDs, but we don't have a special register to use here so we need to use the message data), and the third field is the actual user data passed in via the intrinsic:The
smo_id
above is the same as the one used in the JSON ABI for eachsmo
.Assembly builder simply convert the IR instruction into an
smo
opcode directly.Finally, add a
send_typed_message
to the standard library that allows sending arbitrary types and added an SDK test for it. The SDK can't decode the types yet so I had to check for raw bytes.