Skip to content

chore: migrate tutorials to protocol v0.15#204

Draft
Keinberger wants to merge 2 commits into
mainfrom
kbg/chore/v15-migration
Draft

chore: migrate tutorials to protocol v0.15#204
Keinberger wants to merge 2 commits into
mainfrom
kbg/chore/v15-migration

Conversation

@Keinberger

Copy link
Copy Markdown
Collaborator

Overview

This PR migrates all of the Miden tutorials (rust-client, web-client, and the miden-bank example) from protocol v0.14 to v0.15. The rust-client and web-client tutorials target the released v0.15 SDKs; the miden-bank example targets the v0.15 protocol plus the in-flight next compiler (the sibling-call branch), so this is a draft until those land (see "Why this is a draft").

Motivation

v0.15 changed a lot across the stack: AccountStorageMode folded into AccountType, the FungibleFaucet builder + TokenPolicyManager, Felt::new becoming fallible, the fungible-asset vault-key layout, PartialNoteMetadata, the MAST wire format, and the cargo-miden #[component]/#[account]/#[note]/#[tx_script] redesign. Every tutorial needed source-verified updates, not just a version bump.

Changes

rust-client

  • Bumped miden-client / sqlite-store / protocol to 0.15; migrated all 11 src/bin/*.rs (drop .storage_mode(), AccountType::Public, Felt::new_unchecked, the FungibleFaucet + TokenPolicyManager faucet, and so on). cargo build is green.
  • docs/src/rust-client/*.md migrated; cargo test --doc passes the no_run blocks.
  • MASM: note::build_recipient becomes note::compute_and_store_recipient.

web-client

  • Bumped @miden-sdk/* to 0.15.2; migrated lib/* + lib/react/* (faucet type: 0, fresh recipient accounts, the getItem(...) StorageResult handling).
  • All five browser tutorials verified live on testnet via Playwright; see Tests.

miden-bank example

  • The four cargo-miden contracts migrated to the next compiler model (#[component_storage] + #[component] trait/impl, #[account]/#[note]/#[tx_script]); a new miden-project.toml + .cargo/config.toml per contract. get_balance is renamed to get_depositor_balance (it collided with the built-in ActiveAccount::get_balance the account wrapper generates), and the v0.15 fungible-asset key layout (where asset.key[2] now folds in a metadata byte) is handled through a shared balance_key helper.
  • Integration crate migrated: the new cargo_miden::run signature, a .masp persist step (the FPI #[account] macro searches target/miden/<profile> while the compiler writes target/midenc/miden/...), a build_tx_script_from_package helper (tx-script packages are TransactionScript-kind, not Executable), and the now-required InitStorageData seeding of the initialized slot. All MockChain tests pass (deposit x3, init, withdraw).
  • docs/src/miden-bank/* migrated to match the code.

shared docs

  • miden_node_setup.md node tag v0.14.6 becomes v0.15.0.

Why this is a draft

  1. Compiler dependency: the miden-bank contracts build on the unmerged next compiler branch (i697-acc-sibling-call-part2), pinned by git in the contract Cargo.tomls. This needs a tagged compiler release before merge, and it tracks the project-template migration in feat: migrate to next compiler SDK (protocol v0.15) project-template#51.
  2. Live-network bin limitation: the miden-bank initialize/deposit bins compile but currently fail to deploy a fresh account on testnet under the part2 toolchain. submit_new_transaction aborts during local execution with an advice-map miss, because miden-client cannot supply a lazily-requested witness/foreign-account advice entry for a fresh, uncommitted account. The identical flow passes under miden-testing's MockChain, so it is an upstream miden-client/part2 gap, not a tutorial bug. I filed it at Deploying a part2-compiled #[account] component fails at local execution: "value for key … not present in the advice map" (submit_new_transaction, new account) rust-sdk#2289, and the docs flag it as a known limitation with the MockChain tests as the verification path.

Tests

Open Questions

  1. Compiler pin: the contract Cargo.tomls pin the next branch by git. Once there is a tagged compiler release I will switch the pin. Happy to hold this PR behind feat: migrate to next compiler SDK (protocol v0.15) project-template#51 if you would rather align the template first.
  2. miden-bank live bins: keep initialize/deposit in the repo with the documented limitation + the upstream issue link, or gate them behind a notice until Deploying a part2-compiled #[account] component fails at local execution: "value for key … not present in the advice map" (submit_new_transaction, new account) rust-sdk#2289 is resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant