-
Notifications
You must be signed in to change notification settings - Fork 60
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: remove asset from create note #686
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,10 +39,14 @@ end | |
#! - The fungible asset is not found in the vault. | ||
#! - The amount of the fungible asset in the vault is less than the amount to be removed. | ||
#! - The non-fungible asset is not found in the vault. | ||
export.send_asset | ||
export.send_asset.1 | ||
exec.account::remove_asset | ||
# => [ASSET, tag, note_type, RECIPIENT, ...] | ||
|
||
# Store the ASSET for later | ||
loc_storew.0 dropw | ||
# => [tag, note_type, RECIPIENT, ...] | ||
|
||
# This procedure is written to be executed with `exec` or `call`. When this | ||
# procedure is `call`ed the stack has to be carefully manipulated to avoid | ||
# inserting unwanted elements between the user data. The convention is to | ||
|
@@ -53,9 +57,18 @@ export.send_asset | |
# is because the VM stack has a minimum size of 16 elements, trying to push | ||
# elements after the call to `create_note` would increase the stack in | ||
# addition to the minimum 16 elements. | ||
push.0.0 padw movdnw.3 padw movdnw.3 movdn.11 drop | ||
# => [ASSET, tag, note_type, RECIPIENT, ZERO, ZERO, 0, ...] | ||
push.0 movdn.6 push.0 movdn.6 padw movdnw.2 padw movdnw.2 | ||
# => [tag, note_type, RECIPIENT, 0, 0, ZERO, ZERO, ...] | ||
|
||
exec.tx::create_note | ||
# => [note_ptr, ZERO, ZERO, 0, ...] | ||
# => [note_ptr, 0, ZERO, ZERO, ...] | ||
|
||
padw loc_loadw.0 movup.4 | ||
# => [note_ptr, ASSET, 0, ZERO, ZERO, ...] | ||
|
||
exec.tx::add_asset_to_note | ||
# => [note_ptr, 0, ZERO, ZERO, ...] | ||
|
||
# prepare the stack for return - stack has 5 elements too many | ||
movupw.3 dropw swap drop | ||
Comment on lines
+72
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to do this now while previously we didn't have to? Separately, I wonder if a better approach here would be to call |
||
end |
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.
If we update the output stack as suggested in the previous comment, I don't think we'll need this.
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.
For all other procedures in this file, we do this kind of padding and return the stack as is in the subsequent procedures.
Should we discuss in the issue?