-
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
FPI: foreign account data loader #896
Conversation
#### | ||
# This two chunks of code bellow are essentially doing the same thing, the problem why I | ||
# can't create a dedicated procedure for them is that they're using different memory | ||
# procedures. I can create two new procedures in memory and move the corresponding code | ||
# there, although I'm not sure which approach will be better. | ||
#### |
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 don't mind these being separate - but a coupe of comments:
- I would probably create two separate procedures - e.g., something like
load_account_storage_data
andload_account_procedure_data
. - This code is probably very similar to what we do in the prologue for the native account. Is there a way to use these procedures in both places?
- Why do we use
exec.mem::pipe_words_to_memory
rather thanexec.mem::pipe_double_words_to_memory
here? As far as I know, both storage slots and procedures are take up 2 words.
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 think the best option will be to move the validate_account_procedures
and validate_account_storage_slots
procedures from the prologue to the memory and use them in both places: in prologue and in api. That will solve the highlighted problems.
For some reason |
#[rustfmt::skip]
pub mod generated; |
I was thinking about it, It was just strange to me that current version of this module in |
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.
Thank you! Looks good! Not a full review, but I left some comments inline.
Well, it turned out that implementation of the foreign account verification took only a few more lines, so I included it in this PR. |
If you force a rebuild of that file on |
Yeah - for auto-generated files I think we should skip the formatting so that they don't change as rustfmt rules get updated. |
828b32c
to
9f29675
Compare
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 good! Thank you! I left some more comments inline - most of them are very minor.
#! Advice map: { | ||
#! CODE_COMMITMENT: [num_procs, [ACCOUNT_PROCEDURE_DATA]], | ||
#! } |
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.
After this PR is merged, let's make a small follow-up PR to make this consistent with the storage loader (e.g., not pass num_procs
via the advice map).
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.
Now that this PR is merged, @Fumuran, could you make a small PR to address the above comment?
Also, should we close the original FPI issue and create a new one which describes what changes need to be made after handling of dynamic procedure invocation is fixed in miden-vm
?
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.
Yep, sure.
Yes, I think it will be better. I'll create an issue for that.
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.
Created the #922 issue.
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 good! Thank you! I left one optional nit inline.
WiP
TODO: