-
Notifications
You must be signed in to change notification settings - Fork 55
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
Migrate to miden-vm
v0.10
#826
Conversation
This is not yet fully finished, but I'm opening it up for review because I got the |
I'm marking this as "ready for review" as I think most of the migration is complete. A few notes:
A few other things:
|
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.
LGTM - at least the parts that touch the changes to the VM
btw, I ended up wrapping all |
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.
LGTM, focused mainly on the MASM changes considering that @plafer focused on the VM side.
All tests passed locally, tests in CI are failing because of timeout ( should be fixed by updating the nextest timeout rules):
Increase of 121.39% in testing time with the new assembler or we could say a decrease of 54.84% in performance.
We should run make lint
to make sure we pass the fmt ci checks.
Left a few simple questions.
@@ -232,3 +232,58 @@ export.get_vault_commitment | |||
syscall.get_account_vault_commitment | |||
# => [COM] | |||
end | |||
|
|||
# PROCEDURES COPIED FROM KERNEL (TODO: get rid of this duplication) |
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.
Why did we need to copy paste some code from the Kernel?
@bobbinth I have tried reading about it throughout the repo (issues, pr's, discussions) could you clarify what is a "decorator" in the context of MASM and why we need them? |
As discussed offline, decorators are special instructions which do not affect the internal VM state (i.e., memory or stack). They are used primarily for two purposes:
|
refactor: implement compilation of miden-lib MASM files chore: fix miden-lib compilation chore: make miden-tx crate compile feat: add conversion for `NoteExecutionHint` (#827) * feat: Add conversion for NoteExecutionHint * Conversion and changelog * Conversion * Add test * Rectify comment chore: update miden-vm dependencies to crates.io versions chore: refactor execute_transaction() chore: remove unused TransactionCompiler
* refactor: use maps in storage and vault deltas * docs: update CHANGELOG.md * refactor: address review comments * tests: fix compilation errors * refactor: address review comments * refactor: address review comments
e78efd1
to
9631e8a
Compare
This PR migrates
miden-base
crates tomiden-vm
v0.10.Here is a high-level summary of changes:
miden-objects:
AccountCode
,NoteScript
, andTransactionScript
are now backed byMastForest
(i.e., compiled MASM code) and so, no longer need an assembler to be instantiated. I did addcompile()
constructors to these so that they can be instantiated from source code as well.ExecutedTransaction
andTransactionWitness
no longer need to have theProgram
field. This is because the program executed is the same for all transactions (it is themain
procedure of the transaction kernel).PreparedTransaction
as it is no longer needed.miden-lib
asm/miden/kernels/tx
have been moved toasm/kernels/transaction/lib
to indicate that these modules are relevant to the transaction kernel and notmiden-lib
itself. There were a couple of procedures that I had to duplicate because of this move. We'll figure out how to avoid this duplication in a future PR.push.<random value> drop
next to some advice injectors to make MAST nodes hash to unique values. This is a temporary workaround to avoid collisions of MAST nodes which differ only in their use of decorators. I'll create an issue inmiden-vm
for how this should be resolved properly.miden-tx
TransactionCompiler
has been replaced withTransactionMastStore
. I haven't deleted yet theTransactionCompiler
file because some logic still needs to be transferred to theTransactionMastStore
. And generally, I need to documentTransactionMastStore
and maybe refactor it a bit.TransactionExecutor
now loads note/tx script into the MAST store before executing a transaction. The MAST store is then passed to theTransactionHost
which serves requests from the VM for programs matching a given MAST root.TransactionProver
works in a similar way.DataStore::get_account_code()
method as we get all relevant info fromDataStore::get_transaction_inputs()
now.bench-tx
PreparedTransaction
struct. This will need to be refactored in a subsequent PR.