Skip to content

fix: build the network-transactions counter as a v0.15 network account#206

Merged
Keinberger merged 2 commits into
mainfrom
kbg/fix/205-network-account-allowlist
Jul 10, 2026
Merged

fix: build the network-transactions counter as a v0.15 network account#206
Keinberger merged 2 commits into
mainfrom
kbg/fix/205-network-account-allowlist

Conversation

@Keinberger

Copy link
Copy Markdown
Collaborator

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::Network marker anymore; an account is a network account if and only if it is public and carries the new AuthNetworkAccount component with a non-empty note-script allowlist. The tutorial built the contract with auth::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 public AuthNetworkAccount that allowlists both roots (with_allowed_notes([note_script.root()]) plus with_allowed_tx_scripts([tx_script.root()])) instead of NoAuth. 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 a NetworkAccountTarget attachment 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: the miden-node bundled subcommands 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 the miden-ntx-builder network 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 --doc passes 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

@Keinberger

Copy link
Copy Markdown
Collaborator Author

Merging as per off-Github approval from @Dominik1999

@Keinberger Keinberger merged commit 09d071d into main Jul 10, 2026
6 checks passed
@Keinberger Keinberger deleted the kbg/fix/205-network-account-allowlist branch July 10, 2026 10:24
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.

Rust client network notes tutorial doesn't complete

1 participant