fix: refactor miden-bank tutorial test flow and init guard progression#184
Merged
Conversation
ecf42e8 to
e89bb9e
Compare
Contributor
|
Hey @Keinberger — quick one. The builder.add_existing_basic_faucet(Auth::BasicAuth, "TEST", 10_000_000, Some(10))?;Unit-variant form, but Auth::BasicAuth { auth_scheme: AuthSchemeId::Falcon512Poseidon2 }Plus |
Contributor
|
The cargo command at Either rename the prose to match shipped, or rename the shipped file. |
Collaborator
Author
|
Requesting re-review @BrianSeong99 |
BrianSeong99
approved these changes
May 11, 2026
Keinberger
added a commit
that referenced
this pull request
May 13, 2026
Brings in: - #184 fix: refactor miden-bank tutorial test flow and init guard progression - #196 docs: fix duplicate 'a' in oracle tutorial Conflict in docs/src/rust-client/oracle_tutorial.md: both sides applied the #196 typo fix (removing the duplicate 'a'). HEAD additionally ends the sentence with a period. Kept HEAD's version (typo fix + period) so both intents are preserved.
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.
Summary
Fixes security, correctness, and structural issues in the miden-bank tutorial (Parts 0-8) based on feedback from Dominik's review (miden-devrel#126), PhilippGackstatter's audit (docs#203), and internal testing. Rebased onto v14
mainafter #186 merged.Closes:#180, 0xMiden/docs#203
Changes
Security
withdraw(): useactive_note::get_sender()instead of acceptingdepositoras a parameter (prevents impersonation). The note script no longer passesdepositorto the bank; the bank derives it internally from the note's cryptographically-bound metadata.deposit(): validate balance overflow in integer space viachecked_addand aMAX_BALANCE(2^63 − 2^31) ceiling before storing asFelt(prevents modular wraparound at the Goldilocks prime).deposit()andwithdraw(): fungible-asset guard viaasset.value[1].as_canonical_u64() == 0before reading the amount. Non-fungible assets encode payload data intovalue[1..3], so this rejects them at the contract boundary.withdraw-request-note: enforce the expected v14 storage shape withassert!(storage.len() == 14, ...)(14 items: 4 for the asset encoding, 4 for the serial number, tag, note_type, and 4 for the P2ID script root at indices 10-13).Correctness
get_balance(): extend signature to(depositor, asset)so the composite key includes the faucet ID, matchingdeposit()/withdraw()key construction and isolating balances per depositor per asset type.miden-bank-accountnotmiden_bank-account).init_test.rscompanion test for Part 6 (verifies init flag flip 0 → 1 via the init transaction script).Tutorial structure
require_initialized()guard until Part 6 — commented out in Parts 0-5, enabled in Part 6 with an explicit teaching section.init_test.rs.Adapted feedback
Some original feedback items were adapted rather than implemented literally: