0xMiden / 0xMiden/miden-vm

Add a package first debug execution API

Aperta
#3,321 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
debugging processor
Lingua principale
Rust
Stelle
772
Fork
352
Merge medio
1g 12h
PR unite (30g)
93

Descrizione

0xMiden/protocol#3146 kept debug execution working after package debug info moved out of `MastForest`.

Motivating PR comments:

- https://github.com/0xMiden/protocol/pull/3146#discussion_r3516187337
- https://github.com/0xMiden/protocol/pull/3146#discussion_r3516234508
- https://github.com/0xMiden/protocol/pull/3146#discussion_r3516281492
- https://github.com/0xMiden/protocol/pull/3146#discussion_r3516306676
- https://github.com/0xMiden/protocol/pull/3146#discussion_r3516316240
- https://github.com/0xMiden/protocol/pull/3146#discussion_r3516323938

The VM already has these pieces:

- [`HostLibrary`](https://github.com/0xMiden/miden-vm/blob/9631e12d8f9939d9ed8bf89f2da8733be986e56a/processor/src/host/default.rs#L185-L216) can load a package MAST forest and package debug info.
- [`DefaultHost::load_library`](https://github.com/0xMiden/miden-vm/blob/9631e12d8f9939d9ed8bf89f2da8733be986e56a/processor/src/host/default.rs#L55-L67) stores a `HostLibrary` as a `LoadedMastForest`.
- [`LoadedMastForest`](https://github.com/0xMiden/miden-vm/blob/9631e12d8f9939d9ed8bf89f2da8733be986e56a/processor/src/host/mast_forest_store.rs#L6-L43) carries the loaded forest and package debug info.
- [`FastProcessor`](https://github.com/0xMiden/miden-vm/blob/9631e12d8f9939d9ed8bf89f2da8733be986e56a/processor/src/fast/execution_api.rs#L1018-L1060) loads package debug info from the host path.

Protocol still has to split packages by hand:

- [`crates/miden-protocol/src/package.rs`](https://github.com/0xMiden/protocol/blob/2432a082e53c7e16b2885c8ee42e05489480358c/crates/miden-protocol/src/package.rs#L9-L37) has temporary helpers for `PackageDebugInfo` and `LoadedMastForest`. This file is new in 0xMiden/protocol#3146, so this permalink points at the PR head.
- [`crates/miden-tx/src/executor/program_executor.rs`](https://github.com/0xMiden/protocol/blob/2432a082e53c7e16b2885c8ee42e05489480358c/crates/miden-tx/src/executor/program_executor.rs#L36-L103) has a local `execute_with_package_debug_info` bridge. This code is new in 0xMiden/protocol#3146, so this permalink points at the PR head.
- [`crates/miden-tx/src/executor/mod.rs`](https://github.com/0xMiden/protocol/blob/2432a082e53c7e16b2885c8ee42e05489480358c/crates/miden-tx/src/executor/mod.rs#L202-L266) passes the program, debug info, and entrypoint source node as separate values. This code is new in 0xMiden/protocol#3146, so this permalink points at the PR head.

Please add a package first API in `miden-vm` so callers can load and execute package backed code without this local bridge.

The API should cover both the root program and dynamically loaded packages. Package debug info should stay with the loaded package. Protocol script and account types should not need to carry it.

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.