You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The testing framework in Miden-base executes code directly from the kernel root context. Which should not be possible during "normal" execution of the virtual machine in the context of the Miden rollup.
This method makes some of the checks fail and forces us to use workarounds in the kernel code. One example is the following code:
// mock account method for testing from root context
// TODO: figure out if we can get rid of this
if proc_root == Digest::default(){
returnOk(255);
}
These pieces of code check if the caller is equal to [0,0,0,0] which would only happen if the call is being made directly from the kernel context and not from a user context, which should be the case in a general circumstances.
We need to remove this workaround by:
Reworking how we test code in Miden-base, without making calls from root context
Making sure that the caller is not equal to [0,0,0,0] the call having been made from a valid user context
I think I got some of this working but not sure if there is any alternative: Basically I'm exposing more calls through the account interface and calling instead of execing. And then of course assembling/running the code or transaction with the new account code. Does that sound OK or is there a better approach? Here's a rough draft, most tests pass except 2 or 3 for which the interface is not correctly set up I think.
Feature description
The testing framework in Miden-base executes code directly from the kernel root context. Which should not be possible during "normal" execution of the virtual machine in the context of the Miden rollup.
This method makes some of the checks fail and forces us to use workarounds in the kernel code. One example is the following code:
miden-base/miden-lib/asm/kernels/transaction/lib/account.masm
Lines 543 to 563 in e5f5101
miden-base/miden-lib/asm/kernels/transaction/lib/account.masm
Lines 507 to 525 in e5f5101
miden-base/miden-tx/src/host/account_procs.rs
Lines 92 to 96 in e5f5101
These pieces of code check if the caller is equal to
[0,0,0,0]
which would only happen if the call is being made directly from the kernel context and not from a user context, which should be the case in a general circumstances.We need to remove this workaround by:
[0,0,0,0]
the call having been made from a valid user contextaccount.masm
here and here and account_procs.rsWhy is this feature needed?
We need to make sure that we remove workarounds as soon as possible to keep the cleanest codebase possible.
The text was updated successfully, but these errors were encountered: