Skip to content

fix(cargo-miden): materialize compiled dependency packages on disk#1216

Open
greenhat wants to merge 2 commits into
nextfrom
fix-masp-target-dir
Open

fix(cargo-miden): materialize compiled dependency packages on disk#1216
greenhat wants to merge 2 commits into
nextfrom
fix-masp-target-dir

Conversation

@greenhat

@greenhat greenhat commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Implement option 1 from #1214 to unblock the release.

When cargo miden build compiles a project that depends on another Miden
project, the dependency was only published to the in-memory package registry.
A dependent crate that imports such a dependency (e.g. via #[account(..)])
resolves the dependency's .masp from disk while expanding its own Rust macros,
in a separate cargo build process that cannot see the in-memory registry, so
those builds failed unless the package had been persisted by hand first.

Materialize each compiled source dependency to its own target/miden/<profile>/
right after it is published to the registry. Dependencies are built before the
dependent's cargo build runs, so the package is on disk in time for macro
expansion. The profile sub-directory mirrors the one the macro searches:
release for release builds and debug otherwise.

greenhat added 2 commits June 26, 2026 15:22
When `cargo miden build` compiles a project that depends on another Miden
project, the dependency was only published to the in-memory package registry.
A dependent crate that imports such a dependency (e.g. via `#[account(..)]`)
resolves the dependency's `.masp` from disk while expanding its own Rust macros,
in a separate `cargo build` process that cannot see the in-memory registry, so
those builds failed unless the package had been persisted by hand first.

Materialize each compiled source dependency to its own `target/miden/<profile>/`
right after it is published to the registry. Dependencies are built before the
dependent's `cargo build` runs, so the package is on disk in time for macro
expansion. The profile sub-directory mirrors the one the macro searches:
`release` for release builds and `debug` otherwise.

Add a cargo-miden integration test that builds the `p2id-note` example and
asserts its `basic-wallet` dependency is materialized under
`target/miden/release`.
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.

1 participant