0xMiden / 0xMiden/miden-vm

compile writes a .masb artifact that no other CLI command can read

Ouverte
#3,660 6 commentaires 0 réactions 1 personne assignée Réclamée par @Ruzzgar Voir sur GitHub
Langage dominant
Rust
Étoiles
772
Forks
352
Merge moyen
1 j 12 h
PR mergées (30 j)
93

Description

### Packages versions

miden-vm: 0.30.0 (`next`, 5d9716449)

### Bug description

`miden-vm compile` writes its output with a `.masb` extension, and nothing else in the CLI reads that. Both `run` and `prove` accept only `.masm` and `.masp`, so the compiled artifact is turned away on the extension alone.

Renaming it doesn't help either. `compile` serializes a `Program`, whose magic is `MAST\0`, while the `.masp` path deserializes a `Package`, whose magic is `MASP\0`, so the rename just moves the failure from the extension check to the magic-byte check.

The result is that `compile` succeeds, prints a program hash, and leaves behind a file no other subcommand can consume.

https://github.com/0xMiden/miden-vm/blob/5d97164493d2c441c306b9b2dbb1ad2fa67a2a3a/miden-vm/src/cli/compile.rs#L45-L49

`masb` appears nowhere else in the tree apart from those two lines and one 2024 changelog entry, so the extension looks left over from before packages replaced raw serialized programs — `run` and `prove` were moved to `.masp`, `compile` wasn't.

### How can this be reproduced?

```sh
printf 'begin\n push.1 push.2 add\nend\n' > prog.masm

miden-vm compile -a prog.masm # writes prog.masb
miden-vm run prog.masb # rejected on the extension
cp prog.masb prog.masp
miden-vm run prog.masp # rejected on the magic bytes
```

`prove` behaves the same way as `run` for both steps.

### Relevant log output

```shell
$ miden-vm compile -a prog.masm
program hash is 2cc8f31f945a01207647f2790c386f5d3a98ea9979a7645e8ce372b1b9b213db

$ ls prog.*
prog.inputs prog.masb prog.masm

$ miden-vm run prog.masb
Error: x The provided file must have a .masm or .masp extension

$ miden-vm run prog.masp
Error: x Failed to deserialize package
`-> invalid value: invalid magic bytes. Expected '[77, 65, 83, 80, 0]', got
'[77, 65, 83, 84, 0]'
```

I'd be happy to take this on and submit a PR to fix the serialization/extension mismatch. Could you please assign this issue to me?

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.