Issues with Rust tutorials

Open Beginner friendly
#191 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Quiet
Domain
documentation

Research direction

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.

Written by the indexing model from the issue text.

Description

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.

# 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 <ORACLE_BECH32_ID>, 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
Dominant language
Rust
Stars
18
Forks
34
Avg merge
4d 18h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from 0xMiden/tutorials

All issues in 0xMiden/tutorials

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.