`new-wallet --extra-packages` silently adds a component with no procedures
- Lingua principale
- Rust
- Stelle
- 78
- Fork
- 129
- Merge medio
- 4g 14h
- PR unite (30g)
- 52
Descrizione
`AccountComponentCode::exports()` keeps only the procedure exports that carry `@account_procedure` or `@auth_script`. A package whose exports carry neither becomes a component with no procedures, and `new-wallet -e` writes the account without a word about it.
With `miden-client` from `next`, against testnet:
```
$ miden-client new-wallet -t private -e ajan.masp -i init.toml
Generated and stored Falcon512 authentication key in keystore.
Successfully created new wallet.
$ miden-client account --inspect 0x1467cb146fea9d4110a3c9eb8224bd
Account 0x1467cb146fea9d4110a3c9eb8224bd — 5 procedures (4 resolved, 1 unresolved)
```
Five procedures, the same as a plain wallet. The storage from the package is there: without `-i` the CLI asks for `ajan::ajan::rakip_son`, so the metadata section is read and only the procedures are dropped. A transaction script that calls into the component fails later, at execution:
```
account procedure with procedure root 0xda6406e7... is not in the account procedure index map
```
The package came out of `cargo miden build` for a `#[component]` whose trait methods I had not marked with `#[account_procedure]`. That was my own mistake, and marking them fixed it: the same wallet then came out with 8 procedures and the script ran.
Should `new-wallet` and `new-account` warn, or fail, when a package passed through `--extra-packages` contributes no procedures? A storage-only component may be legitimate, so I did not assume it should be an error. Happy to put up the patch.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Look at the `new-wallet` and `new-account` command implementations, likely in `miden-client/src/commands/`. Find where `--extra-packages` is processed and how `AccountComponentCode::exports()` filters procedures. Add a check for empty procedure contributions and decide whether to warn or fail based on the issue's discussion. Test by building a package without `#[account_procedure]` annotations and running the command.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- cli
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Attiva
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 70/100