-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add account new
command
#18
Conversation
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, thanks! I've left some comments - primarily around coding style.
I've opened the following issue #19 to discuss if we should consider using an ORM to manage our database models, migrations and queries. |
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 - thanks for clarification on the account id i64 representation. Added a few more comments.
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, thanks! Once we have changes the branch for miden-lib
and miden-objects
back to main we can merge. I've also added a comment regarding adding the relations to the accounts table - should we do that now or part of a follow up PR?
src/store/migrations.rs
Outdated
@@ -1,5 +1,6 @@ | |||
use lazy_static::lazy_static; | |||
use rusqlite::{params, Connection}; | |||
|
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.
we typically avoid spacing between imports.
storage_root BLOB NOT NULL, -- root of the account_storage Merkle tree. | ||
vault_root BLOB NOT NULL, -- root of the account_vault Merkle tree. | ||
nonce BIGINT NOT NULL, -- account nonce. | ||
committed BOOLEAN NOT NULL -- true if recorded, false if not. |
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.
should we define the relations to the account_vault, account_code and account_storage tables here?
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.
Creating a follow-up PR for this
Draft of account creation command and tables to store account data
Test with
cargo run --release --features testing -- account new fungible-faucet -t TEST -d 10 -m 10000
and thencargo run --release --features testing -- account list
TODO:
Add some tests mainly related to the new tables(added a simple test, adding more in future PRs)Add a way to define the fungible-faucet parameters (ticker, decimals, initial supply)Add a way to generically create wallets (with a local code file, etc.)(left for future work)Currently
ModuleAst
does not derive Serialize so we might have to add that in the corresponding repo if we want to store that as a serialized blob