chore: migrate tutorials to protocol v0.15#204
Draft
Keinberger wants to merge 10 commits into
Draft
Conversation
The format-markdown job ran `npm install -g prettier` with no version, so it
silently picked up prettier 3.9.0/3.9.1 (published 2026-06-27). 3.9.0 regressed
on `embeddedLanguageFormatting: off`: it reformats the embedded JSX in the
web-client `<CodeSdkTabs example={{...}} />` components, deleting the closing
`}}` and producing invalid, non-idempotent output — so the check could never
pass on 3.9.x without deforming the docs.
Pin to prettier 3.8.4 (the latest release before the regression) so the check is
deterministic and the web-client components stay intact, and apply the
outstanding prettier formatting to the miden-bank docs (table alignment +
emphasis-marker normalization). `prettier@3.8.4 --check "**/*.md"` is clean.
Bump the pin once the 3.9.x embeddedLanguageFormatting regression is fixed upstream.
Contributor
|
Added a simple fix to the markdown formatter, the latest release of prettier tool seems to have conflict with some of our existing docs. So spinning the prettier tool to previous versions that we used and can work on adapting the prettier tool to the latest version after v15 migration. |
…branch The four contract crates and the integration crate pinned the `miden`/`cargo-miden` git dependency to `branch = "i697-acc-sibling-call-part2"`. That branch was merged into `next` and deleted, so a fresh checkout can no longer resolve it. Pin to the exact commit the lockfiles already reference (97eb019ded3a2d1f29d77639190bad5d3f0f099b) via `rev` instead. It's the commit this PR was built and tested against, and it's a clean ancestor of `next` (next is 6 commits ahead, 0 behind), so cargo can still fetch it. The resolved compiler is unchanged — only the lock source strings flip `branch=` → `rev=` (same SHA). A moving branch ref (`next`) is intentionally avoided. Swap `rev` for a tagged compiler release once one exists for the v0.15-aligned (SDK 0.13) line.
Follow-ups from the v0.15 migration review: - The miden-bank tutorial Cargo.toml snippets (and two prose lines) still showed the deleted `branch = "i697-acc-sibling-call-part2"`; update them to the `rev = "97eb019…"` pin the real manifests now use, so copy-pasted snippets resolve. - web-client unauthenticated_note_how_to: the React consume() snippet passed the Account `alice`; the lib passes `alice.id().toString()` (a string). Match the lib. (The react_wallet custom-signer `accountType: "RegularAccountImmutableCode"` was verified valid against @miden-sdk/react 0.15.2's SignerAccountType union — no change.)
The v0.15 migration replaced the tutorials' hardcoded recipient addresses with freshly-created accounts, changing what each tutorial demonstrates (the SDK still accepts a bech32 string for the recipient). Revert to hardcoded recipients using fresh valid v0.15 testnet ids so the migration stays version-only. Docs mirror the source.
…ents balance_key was extracted into a helper during migration (a non-forced refactor) and the v0.14 pedagogical comments were trimmed. Inline the key-derivation (behavior-identical: same [prefix, suffix, key[3], key[2]] word) and restore the doc-comments, keeping the change migration-only. MockChain tests pass (deposit x3, init, withdraw).
Part 4's deposit_test snippet had drifted (faucet supply 10_000_000, sender 1000); align with the source test and Part 3 (faucet 1000, sender 100).
Audit fidelity fixes: replace the removed balance_key helper references in Parts 3/7 with the inline key derivation the contract uses, correct Part 4's false 'init deferred / guard commented out' claims (the shipped deposit_test.rs initializes and require_initialized() is active), and tighten the asset.key[2]/[3] + metadata-byte wording in the contract and withdraw test. Comments and docs only; MockChain tests pass.
…geMode API SignerAccountConfig.storageMode is typed AccountStorageMode (a class), so use AccountStorageMode.public() (imported from @miden-sdk/react/lazy) instead of the StorageMode string union, and drop the deprecated accountType field.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 migration itself is complete: everything compiles, the doctests and the miden-bank MockChain tests pass, and all five web-client tutorials run end-to-end live on testnet. It stays a draft because two upstream bugs prevent the native tutorials from running live, and the miden-bank example still depends on an unreleased compiler. See "Status and blockers".
Motivation
v0.15 changed a lot across the stack:
AccountStorageModefolded intoAccountType, theFungibleFaucetbuilder +TokenPolicyManager,Felt::newbecoming 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
miden-client/ sqlite-store / protocol to 0.15; migrated all 11src/bin/*.rs(drop.storage_mode(),AccountType::Public,Felt::new_unchecked, theFungibleFaucet+TokenPolicyManagerfaucet, and so on).cargo buildis green.docs/src/rust-client/*.mdmigrated;cargo test --docpasses (17 run, 0 failed).note::build_recipientbecomesnote::compute_and_store_recipient.web-client
@miden-sdk/*to 0.15.2; migratedlib/*+lib/react/*(faucettype: 0, fresh recipient accounts, thegetItem(...)StorageResult handling).miden-bank example
#[component_storage]+#[component]trait/impl,#[account]/#[note]/#[tx_script]); a newmiden-project.toml+.cargo/config.tomlper contract.get_balanceis renamed toget_depositor_balance(it collided with the built-inActiveAccount::get_balancethe account wrapper generates), and the v0.15 fungible-asset key layout (whereasset.key[2]folds in a metadata byte) is handled through a sharedbalance_keyhelper.cargo_miden::runsignature, the now-requiredInitStorageDataseeding of theinitializedslot, abuild_tx_script_from_packagehelper (tx-script packages areTransactionScript-kind, notExecutable), and a.masppersist step (a workaround for the compiler issue below). All MockChain tests pass (deposit x3, init, withdraw).docs/src/miden-bank/*migrated to match the code.shared docs
miden_node_setup.mdnode tagv0.14.6becomesv0.15.0.Status and blockers
cargo build+ doctestscargo buildcargo build1. miden-client runtime bug (0xMiden/rust-sdk#2289) blocks live execution of every native tutorial. Any fresh (nonce-0) account whose first transaction reads one of its own
StorageMaps fails during local execution with an advice-map miss. This includes a standardFungibleFaucetmint, so it hits the rust-client basics as well as the miden-bank live bins. It is not part2-specific and not a tutorial-usage error: our flow is byte-identical to the SDK's own faucet helper and its endorsed real-node test. The web tutorials are unaffected (the WASM@miden-sdkis a separate, self-consistent line), and the MockChain tests pass (miden-testing serves the witness from the in-memory account).2. Compiler dependency (miden-bank only). The four contracts pin the compiler by git
revbecause the part2 sibling-call work (0xMiden/compiler#1180) is merged intonextbut not in a taggedcargo-miden/midenrelease yet. The integration crate also copies the compiled.maspintotarget/miden/<profile>becausecargo miden buildwrites it totarget/midenc/miden/...while the FPI#[account]macro searchestarget/miden/...(0xMiden/compiler#1214, fixed in flight by 0xMiden/compiler#1216). Both workarounds drop once there is a tagged release with the part2 work + #1216 (tracked in 0xMiden/project-template#51). This does not affect rust-client or web-client.Tests
cargo testgreen (MockChain): deposit x3, init, withdraw.cargo buildgreen;cargo test --docpasses (17 run, 0 failed).#[account]component fails at local execution: "value for key … not present in the advice map" (submit_new_transaction, new account) rust-sdk#2289), so live execution is verified only for the web tutorials; the native tutorials are covered by build + doctests + MockChain.Open Questions
revuntil there is a taggedcargo-miden/midenrelease with the part2 work + fix(cargo-miden): materialize compiled dependency packages on disk compiler#1216. Hold this PR behind feat: migrate to next compiler SDK (protocol v0.15) project-template#51, or merge with the workarounds documented?#[account]component fails at local execution: "value for key … not present in the advice map" (submit_new_transaction, new account) rust-sdk#2289 limitation, or gate them behind a notice until it is fixed?