0xMiden / 0xMiden/miden-vm

bug: prove --proof writes the outputs file where verify will not look for it

未关闭 适合新手
#3,737 0 条评论 0 个 reaction 已指派 1 人 已被 @rayasa07 认领 在 GitHub 查看
主要语言
Rust
星标
772
派生
352
平均合并
1 天 7 小时
30 天内合并 PR
84

描述

miden-vm 0.31.0 on `next`, the code is in `miden-vm/src/cli/prove.rs`.

`prove` writes two files: the proof itself, and an outputs file that only exists so `verify` can read it back. If you pass `--proof`, those two end up in different places. The proof goes where you asked, but the outputs file still gets written next to the program (`prove.rs:192`). `verify` works out where the outputs are by taking the proof path and swapping the extension (`verify.rs:109-116`), so it looks in a directory the file was never written to.

Proving to a path of your choosing and then verifying that proof doesn't work, and the error points at a file you never made:

```
$ miden-vm prove prog.masm --proof out/custom.proof
Program proved in 1298 ms

$ miden-vm verify -p out/custom.proof -x 8992a530f0d7...
Error: x Failed to open input file out/custom.inputs
```

You can see this yourself by proving any program with `--proof out/custom.proof` and then listing the files. The proof is in `out/`, the outputs are sitting next to the program. If you point verify at them by hand with `-o prog.outputs` it verifies at 96 bits, so there's nothing wrong with the proof, just where the file was put. Without `--proof` both paths come out the same and you never notice.

The inputs file is a different case, since you write that one yourself rather than the CLI generating it, so having to pass `-i` to verify seems reasonable and I haven't touched it.

I'd open a PR that takes the default outputs path from the proof path rather than the program path, with tests, if someone assigns this to me. Without `--proof` the proof path already falls back to the program path, so nothing changes for anyone not using the flag.

贡献指南

打开贡献指南

调研方向

The bug is in `miden-vm/src/cli/prove.rs` line 192, where the outputs file path is derived from the program path instead of the proof path when `--proof` is used. Compare with `verify.rs` lines 109-116 to see how the verification path is constructed. Write a test that proves with `--proof` to a custom location and verifies the proof without manually specifying the outputs file. Running the existing CLI tests should confirm the fix.

由索引模型根据 Issue 内容生成。

评估

技术栈
rust
领域
cli
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
活跃
描述清晰度
描述清楚
新手友好度
75/100

把新 issue 发到你的邮箱

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