0xMiden / 0xMiden/tutorials

Issues with Rust tutorials

Abierto Apto para principiantes
#191 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
18
Forks
34
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Packages versions

0.14

### Bug description

# Not compiling due to not using @note_script
In tutorials 4 (iterative notes), 5 (hash preimage note), 11 (network accounts) compiling notes WILL panic because notes are not up to date with 0.14 version are are not using @note_script notation. The panic message does not convey that so users have no way of knowing that.

```asm
# Instead of

begin
# ...
end

# note script should use

@note_script
pub proc main
# ...
end
```

# Tutorial 1 - using create_library
`create_library` should not be used like that, it should use code builder from client or use a persisted source manager. Using it like this WILL lead to un-explainable and misformed errors down the line like from issue: https://github.com/0xMiden/miden-vm/issues/2778, also referenced here: https://github.com/0xMiden/tutorials/issues/188

# Tutorial 10 - pragma oracle
- does not compile, `StorageMapKey` referenced from `miden_client::rpc::domain::account` is a private struct. It should be referenced from `miden_client::account::StorageMapKey`
- When point 1 is fixed it still dies with: thread 'main' (44407) panicked at src/main.rs:156:10:
Usage: oracle_data_query , it would be better perhaps to just hardcode it into the code example or leave a comment at that line (156), we learn we need to pass it as an argument only at the end of the tutorial even though it asks us to run the code before that point
- It seems no pragma oracles are online on the current testnet, i couldnt find a live oracle address from their offish docs (which point to their github)

# Relative imports
Even though in tutorial we create the project, folders and files - masm imports in the code are relative to the directory one above root dir. Running the tutorial code will error out with: `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }. This might be confusing for some users. I would suggest creating separate crates for tutorial maybe and referencing `env!("CARGO_MANIFEST_DIR")` when loading paths, this way you can keep a monorepo of tutorials and it will still work with `--bin tutorial_name` if referenced in a workspace Cargo.toml as members.

# Nits / General

- `Cargo.toml` imports libs not needed in the tutorials: `serde`, `serde_json` and `rand_chacha`
- a lot of types are referenced in the long format like std::sync::Arc and std::Path even though they are imported in the header making code unnecessarily bloated
- imports could be compacted, they import from miden_client on multiple lines instead in one single import

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

The issue lists specific compilation errors in tutorials 1, 4, 5, 10, and 11. Start by checking the referenced tutorial source files in the repository. For each error, locate the exact code snippet (e.g., note script syntax, create_library usage, StorageMapKey import, pragma oracle argument, relative import paths) and update it to match the 0.14 API. Verify fixes by ensuring the tutorial code compiles. Also clean up unnecessary Cargo.toml dependencies and consolidate imports as noted.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust
Área
documentation
Tipo de issue
Documentación
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
65/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.