-
Notifications
You must be signed in to change notification settings - Fork 42
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: rework memory layout #882
Conversation
de36edb
to
9b59f13
Compare
During the implementation I had a couple of proposals and questions:
|
9b59f13
to
9787fba
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 a few small comments inline.
I added the
NEW_CODE_ROOT
in addition toCODE_ROOT
since it was a part of the previous layout and is used by other components.
I added a comment about this inline: I think NEW_CODE_ROOT
should go into the bookkeeping section.
I removed the
current_account_id
variable from the bookkeeping section, I'm not sure that we need to store it there: we can get the account data using thecurrent_account_data_offset
and then get the ID from this data itself. It makes it more simple to keep the bookkeeping values updated and allows us to remove the associated procedures. This is a tradeoff, so I'm not sure what is the best solution.
I think that's fine. I'd probably add get_native_account_id
procedure that would return the ID of the native account.
I wonder what is the limit on the number of the foreign accounts which we can load? For now I set it to 64 accounts, but that is just my "feeling".
- Probably we should add a constant like
MAX_ACCOUNT_NUMBER
to track whether we can load another account.
I think 64 is fine. And yes, let's define MAX_NUM_FOREIGN_ACCOUNTS
constant.
I think we should also add the number of already loaded accounts to the bookkeeping section: that will help us to iterate over the loaded accounts to check whether the new one was already loaded, and also will help to get the next available offset for the new account.
I would leave this to the next PR. But also, I'm not sure we'll actually need this. I think figuring out whether we already have the account loaded or not may be handled by the host (via the advice provider).
Probably we should slightly update the docs and comments
I think we can leave this to #858.
This one is not directly connected to this PR, but we should add additional test to the
test_prologue.rs
to check the values stored in the kernel section (I forgot to do that in theDynamic kernel procedure invocation
PR).
Yes, we should do that but in a different PR. Should we create an issue for this?
I created an issue: #884 |
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 a few more small comments inline. Also, would be good to get a quick look from @phklive and/or @polydez.
In the next PR, we should add checks to make sure that methods that mutate account state or manipulate notes are only accessible if the current account is the native account.
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!
Sure, will finish my tasks at hand and look into it during my EOD. |
I think @Fumuran will be working on this. |
No I meant, I will review this PR by EOD, as you requested in the first part of your sentence. |
@Fumuran - could you resolve the merge conflict? |
b75e3c6
to
ec326ab
Compare
This PR reworks memory layout to create an account data section, described in the FPI issue: #847