0xMiden / 0xMiden/miden-vm

Track called procedures

Ouverte
#2,061 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Rust
Étoiles
772
Forks
352
Merge moyen
1 j 12 h
PR mergées (30 j)
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)_

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.