0xMiden / 0xMiden/miden-vm

Track called procedures

Open
#2,061 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
772
Forks
352
Avg merge
1d 12h
Merged PRs (30d)
93

Description

As a user of the feature I implemented (tracked procedures), I realized that calling `auth_noop` instead of `auth__basic` in https://github.com/0xMiden/miden-base/pull/1622 would NOT have resulted in the expected error (`ERR_AUTH_PROCEDURE_CALLED_FROM_WRONG_CONTEXT`) due to how tracking is implemented.

More generally, just because we "call" an account procedure doesn't mean it will get tracked. For tracking to come into effect, the procedure must call into some "authenticateable" instruction (anything that checks either `authenticate_account_origin` or `assert_auth_procedure_origin`). If the procedure executes some "local" MASM instructions, and doesn't call into miden-lib (like the noop auth that does `push.0 drop`), it will not get tracked even if it was actually invoked. This is not a problem per-se, since such "local MASM" procedures are innocuous, but I think this should be documented better. And it makes me realize that the current approach of procedure tracking of https://github.com/0xMiden/miden-base/issues/1489, while it was relatively quick to implement, might be a little fragile. A better approach would probably be introducing procedure tracking at the VM level, which would:
a) not rely on `authenticate_account_origin` or `assert_auth_procedure_origin`, but instead unequivocally track account procedure calls "natively",
b) allow for tracking the actual count of invocations, not just the `was_called` bool flag.

_Originally posted by @mmagician in [#1623](https://github.com/0xMiden/miden-base/issues/1623#issuecomment-3104815042)_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.