0xMiden / 0xMiden/protocol

Consider adding `exec`-wrappers for `call`-able procedures in `miden::standards`

Aperta
#3,229 3 commenti 2 reazioni 0 assegnatari Vedi su GitHub
standards
Lingua principale
Rust
Stelle
132
Fork
167
Merge medio
1g 23h
PR unite (30g)
110

Descrizione

Since we decided that all account component procedures should be `call`-ed (https://github.com/0xMiden/protocol/issues/2862), it would be a nice ergonomics improvement to implement `exec`-utable wrappers around procedures that should be `call`-ed (discussed also in https://github.com/0xMiden/protocol/issues/2862#issuecomment-4378313052). For example, after https://github.com/0xMiden/protocol/pull/3222 the MINT and BURN notes manually call `code_inspection::has_procedure`. This could be made nicer with an "adapter" that pads and truncates the stack, just like `miden::protocol` procedures wrap kernel procedures.

```
#! Defined in miden::standards::inspection::code_inspection::adapter
#!
#! Inputs: [PROC_ROOT]
#! Outputs: [has_procedure]
#!
#! Invocation: exec
proc has_procedure
# pad the stack to 16
call.code_inspection::has_procedure
# truncate the stack
end
```

These procedures could be defined in an `adapter` sub-module of the procedures that they wrap. The alternative is to define them in the same module, but then the procedure name would have to be different, which seems less desirable.

This is a larger mechanical project that would be nice to do eventually, though not very important now.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.