Add a package first debug execution API
- 主要言語
- Rust
- スター
- 772
- フォーク
- 352
- 平均マージ
- 1日 12時間
- マージ済み PR(30日)
- 93
説明
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.
コントリビューションガイド
評価
この issue はまだ評価されていません。