-
Notifications
You must be signed in to change notification settings - Fork 54
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
Instantiate accounts from account components #935
Comments
So say we have two components:
All
All
But judging from this comment it seems the we'd want to specify not only the offest but also the size for a procedure? Can you clarify which one of these models we need?
The
miden-base/miden-tx/src/tests/kernel_tests/test_account.rs Lines 470 to 475 in 0d28607
Then they would have the same MAST root. And during MAST Forest merging, we would deduplicate them and we'd only be able to set one storage offset/size for this procedure and one component would access the wrong slot as a consequence.
|
The description in this issue supersedes the approach with procedure decorators. So, the description you have with components
Yep - I'm fine with this approach too.
This should not be a problem as only procedures in the public interface would get the offset (helper procedures do not get their own There could be a problem, however, if two components expose exactly the same public procedure. But I think this should probably be detected and treated as an error. |
Sounds good! With |
I think where "storage initializers" should go is still an open question. I don't have a great solution for this yet. |
Closed by #941. |
Currently, new accounts are crated using
Account::new()
constructor which looks like so:Here, the assumption is that
AccountCode
andAccountStorage
have been constructed to be in-sync with each other. This creates some complications. For example, when constructingAccountCode
, we need to know how to assign storage offsets to procedures - and currently, we don't have a way to do this (so, right now the we just have placeholder code).One way to improve the structure is to instantiate accounts from
AccountComponent
's (initially discussed in 0xPolygonMiden/compiler#333 (reply in thread)). This could look like so:The
AccountCode
constructor can then be modified to look like so:In the above, when initializing regular account code,
storage_offset
would be set to0
, but for faucets, it would be set to1
.Once the above is implemented, we would also be able to remove some temporary code from the transaction kernel (e.g., here).
This change will also cover most of #550.
The text was updated successfully, but these errors were encountered: