-
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
Invoke send_asset
from call
and exec
#234
Comments
I would be hesitant to support diverging from the standard of wrapping the kernel methods and dropping the padding for just I wonder if an alternative would be to extract common code into a procedure (
Good catch. |
Addressed documentation issue in #235 |
I generally agree that we shouldn't make one-off exceptions and try to follow the general approach as much as possible. But I think there are some considerations here worth thinking through more. I'm somewhat hesitant to have procedures which work correctly only when invoked in specific contexts (especially, if these are procedures users may want to interact with). There are two ways to address this:
Approach 1If we go with the first approach, we could even adopt a convention that all procedures exported from an account module should be callable without issues both with Without changing the interface of
This should work and I think the extra performance cost is negligible. I am a little worried, however, about the extra complexity we encounter here for just using Approach 2To support the second approach, we'd need to introduce a new feature in the assembler - either some kind of procedure attribute. For example, something like:
Then, if This type of a feature requires much more thinking, and is probably still a bit more brittle than making sure that a procedure can work in any context, but it could be also very useful for other purposes (e.g., describing shapes of parameters for auto-generation of Rust wrappers). |
Nice, I went to Approach 1. One thing to note: I had to get rid of the 17th elements, so I added a |
Superseded by #685. |
We are assuming that
send_asset
will always be invoked via acall
instruction. This should be the case most of the time, but it may also be invoked via anexec
instruction if called from the account context. In such a case, the above code would result in an error.So, I wonder if a better solution is to modify tx::create_note to return
[ptr, 0, 0, 0, 0, 0, 0, 0, 0]
rather than just[ptr]
(would actually maketx::create_note
simpler). @frisitano - what do you think?Also, noticed that there is a small documentation error here - the return type should be
[ptr, 0, 0, 0, 0, 0, 0, 0, 0]
, I believe.Originally posted by @bobbinth in #233 (comment)
The text was updated successfully, but these errors were encountered: