0xMiden / 0xMiden/miden-vm

Track called procedures

未关闭
#2,061 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
772
派生
352
平均合并
1 天 12 小时
30 天内合并 PR
93

描述

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)_

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。