fix: build the network-transactions counter as a v0.15 network account#206
Merged
Conversation
Collaborator
Author
|
Merging as per off-Github approval from @Dominik1999 |
This was referenced Jul 11, 2026
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 fixes #205: the Rust network-transactions tutorial never completes on testnet. The network increment note commits fine, but the network transaction builder (NTB) never consumes it, so the counter stays at 1 and the binary exits with
Counter did not reach the expected value 2.The root cause is the counter contract's auth component. In v0.15 there is no
AccountStorageMode::Networkmarker anymore; an account is a network account if and only if it is public and carries the newAuthNetworkAccountcomponent with a non-empty note-script allowlist. The tutorial built the contract withauth::NoAuth, so it had no allowlist slot, the node never classified it as a network account, and the committed note was silently orphaned. Nothing surfaces an error (not the client, not the node), which is what made this hard to spot.Key Changes
rust-client/src/bin/network_notes_counter_contract.rs: compile the note script and the deploy tx script before building the account, then build the counter as a publicAuthNetworkAccountthat allowlists both roots (with_allowed_notes([note_script.root()])pluswith_allowed_tx_scripts([tx_script.root()])) instead ofNoAuth. The tx-script allowlist is required because the deploy sends a custom tx script and the network auth procedure rejects any tx script whose root is not allowlisted.docs/src/rust-client/network_transactions_tutorial.md: fix the prose that claimed a plain public account plus aNetworkAccountTargetattachment is enough, align every code block with the fixed binary, link the account changes migration guide, and refresh the expected-output transcript from a real run.docs/src/miden_node_setup.md: themiden-node bundledsubcommands no longer exist in v0.15, so I replaced the step-by-step local-node section with a short pointer to the node's local-network docs (that setup also provisions themiden-ntx-buildernetwork transactions need). Testnet stays the default path.Rationale
The two allowlists are fixed at account creation, so the note and tx scripts have to be compiled up front and their MAST roots fed into the account before it is built. I kept the deploy as a custom tx script to match the existing tutorial flow, which is why both allowlists get populated rather than just the note one.
Tests
Ran the fixed binary against testnet end to end: the deploy tx committed, the NTB consumed the network note within seconds, and it printed
Final counter value: 2(exit 0).cargo test --docpasses and prettier is clean.Worth flagging: CI does not run this (or any) tutorial binary against a live network, which is how the regression slipped through the v0.15 migration; the only Rust job is compile-only doctests. Closing that gap is out of scope here.
Closes #205