New compiler(next)breaks miden-client exec and call - "stack depth must be 16, was 17"
- Lingua principale
- Rust
- Stelle
- 115
- Fork
- 84
- Merge medio
- 1g 8h
- PR unite (30g)
- 15
Descrizione
### Packages versions
- Compiler (0xMiden/compiler): branch next
- miden-client: 0.15.0
- Example: examples/counter-contract
### Bug description
Any exported account-component method that returns a value (e.g. `-> Felt`) cannot be invoked cross-context. Both `miden-client call` and a `miden-client exect`. Affected methods (`src/lib.rs`), compiled signatures:
```
get-count() -> (Felt)
increment-count() -> (Felt)
```
### How can this be reproduced?
1. Build the compiler and the example:
```bash
# in compiler/
cargo build --release
# in examples/counter-contract/
cargo clean
/path/to/compiler/target/release/cargo-miden miden build
```
2. Deploy the account:
```bash
miden-client init --local --network http://localhost:57291
miden-client sync
miden-client new-account -t public \
-p target/midenc/miden/dev/counter-contract.masp --deploy
# -> account 0x908c4259e94950f14ace3b19e0fe0a
```
3. Invoke the method through either entry point:
**(a) via `call`:**
```bash
miden-client call \
--package target/midenc/miden/dev/counter-contract.masp \
0x908c4259e94950f14ace3b19e0fe0a:increment-count
```
**(b) via `exec` of a script that calls the proc root** (`incr.masm`):
```masm
begin
call.0x3a5910f020c0f330f819f4809513a4424ebb1db8f9d6db51f35554770d689513
end
```
```bash
miden-client exec --account 0x908c4259e94950f14ace3b19e0fe0a \
--script-path incr.masm
```
### Relevant log output
```shell
Error: cli::client_error
× client error
├─▶ transaction execution failed
╰─▶ failed to execute transaction kernel program:
x when returning from a call, stack depth must be 16, but was 17
,-[::$exec:2:5]
1 | begin
2 | call.0x3a5910f020c0f330f819f4809513a4424ebb1db8f9d6db51f35554770d689513
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 | end
`----
Non-fatal serialization errors also appear on every run (maybe a separate issue):
ERROR miden_core::mast::serialization: UntrustedMastForest expected HASHLESS input;
supplied artifact includes wire node hashes, and validation will recompute them and require them to match
ERROR miden_core::mast::serialization: UntrustedMastForest expected STRIPPED input;
supplied artifact includes DebugInfo and other optional payloads over the wire
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
The bug is in the compiler's next branch, affecting cross-context calls for exported account-component methods that return a value. Start by examining the compiler's code generation for function signatures and stack management, particularly around the call/return boundary. Look at the error location in the generated Miden Assembly (masm) and the stack depth validation. Run the provided reproduction steps with the counter-contract example to see the exact failure.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100