Skip to content

Rust #[tx_script] cannot be executed in 0.15.0 — .masp rejected by exec, and --emit masm output is component-model annotated #1349

Description

@Mustdzyl

Environment

  • toolchain 0.15.0 (midenup install stable)
  • account component + transaction script both authored in Rust, built with cargo miden build --release

What works

Deploying a Rust account component works end to end:

miden client new-account -p my_component.masp -i init.toml --deploy

The account is created, and miden client call <account_id>:my_proc <arg> returns exactly the
storage delta I expect. So the component side of the toolchain is fine.

The problem

call only previews the delta — it never commits (repeated calls always start from the same
committed state, nonce does not advance). To persist state a transaction script is needed.

I wrote one in Rust:

#[account(my_pkg::MyIface)]
pub struct NativeAccount;

#[tx_script]
fn run(arg: Word, account: &mut NativeAccount) {
    account.my_proc(arg.a);
}

It builds successfully into my_script.masp.

1. exec rejects the compiled package.

$ miden client exec -a <account_id> -s target/miden/release/my_script.masp
Error: cli::script_builder_error
  x failed to build script: failed to parse transaction script:
    source manager is unable to load file
    `-> stream did not contain valid UTF-8

So --script-path wants MASM source, not the package.

2. --emit masm produces MASM the script parser cannot accept.

$ cargo miden build --release --emit masm=./masm_out
$ miden client exec -a <account_id> -s ./masm_out/my_script.masm
Error: cli::script_builder_error
  x invalid syntax
     ,-[my_script.masm:4:14]
   3 | @callconv("component-model")
   4 | pub proc run(struct { a: struct { inner: felt }, b: struct {
     :              ^^^|^^
     :                 `-- found a struct here
   5 |     inner: felt
     `----
  help: expected ")", or identifier

The emitted MASM carries component-model type signatures (@callconv("component-model"),
struct { ... } parameters), which the transaction-script parser does not understand.

Note: --emit masm only produces output when the compiler actually re-runs — with a warm cargo
cache the directory is created but stays empty, which is a little confusing.

Question

Is there a supported path from a Rust-authored #[tx_script] to something miden client exec
accepts in 0.15.0?

If transaction scripts must currently be hand-written in plain MASM, they would need to call the
account procedure by MAST root — but I could not find the per-procedure roots exposed anywhere
(miden client account -s shows only the Code Commitment, and the .masp exposes the export
name "miden:my_pkg/my_iface@0.1.0#my_proc" but not its digest). Is there a command to dump
procedure roots from a package?

Minor, possibly separate

miden deploy (top-level alias) fails before parsing any arguments:

$ miden deploy
error: unexpected argument '-s' found
Usage: miden client [OPTIONS] <COMMAND>

miden simulate resolves to miden client exec, which looks intentional, but deploy appears
to inject a stray -s.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions