Skip to content

feat: upgrade miden dependencies to v0.16.x#331

Open
zeljkoX wants to merge 4 commits into
mainfrom
329-upgrade-miden-016
Open

feat: upgrade miden dependencies to v0.16.x#331
zeljkoX wants to merge 4 commits into
mainfrom
329-upgrade-miden-016

Conversation

@zeljkoX

@zeljkoX zeljkoX commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added create_note procedure support across the multisig SDKs.
    • Improved account-state reconstruction and transaction finalization using updated patch handling.
    • Updated RPC bindings and network compatibility for the Miden v0.16 pre-release line.
  • Bug Fixes

    • Improved asset transfer construction and storage-map lookups.
    • Corrected account, vault, and delta projections for current protocol behavior.
  • Documentation

    • Updated installation, quickstart, local development, and troubleshooting guidance for v0.16.
    • Documented incompatibility between v0.15 and v0.16 accounts, stores, and networks.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The repository is upgraded to Miden 0.16 prerelease dependencies and Rust 1.96.1. Account deltas now use patch-based reconstruction, RPC bindings are generated during builds, MASM scripts use updated entry syntax, SDK procedure roots and payment APIs are refreshed, and compatibility documentation and package metadata are updated.

Changes

Miden 0.16 migration

Layer / File(s) Summary
Version baseline and build tooling
Cargo.toml, .github/workflows/*, rust-toolchain.toml, Dockerfile, package.json files
Workspace, package, dependency, CI, Docker, and toolchain versions are aligned with Miden 0.16 and Rust 1.96.1.
MASM contracts and assembly
crates/contracts/masm/*, crates/contracts/src/masm_builder.rs, packages/miden-multisig-client/masm/*
Account-procedure annotations, native-account reads, re-export syntax, and auth-linked assembly are updated.
Shared patch and RPC foundations
crates/shared/src/account_delta.rs, crates/server/src/network/miden/mod.rs, crates/miden-rpc-client/*
Account delta application uses storage patches, server delta merging is localized, and RPC bindings are generated at build time.
Multisig client and transaction migration
crates/miden-multisig-client/src/*, crates/contracts/tests/auth/multisig.rs, examples/*
Payment construction, transaction scripts, procedure roots, storage-map access, and post-execution account updates use the newer APIs.
Examples and SDK packaging
examples/*, packages/*, .agents/skills/*
Rust and web examples, SDK manifests, embedded MASM, and smoke-test instructions target the updated release.
Migration documentation and release metadata
README.md, docs/*, AGENTS.md
Compatibility, upgrade cleanup, network matching, troubleshooting, OpenAPI versions, and release instructions document Miden 0.16.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MidenRpcClient
  participant MidenAccountInspector
  participant guardian_shared_account_delta
  participant Account
  MidenRpcClient->>MidenAccountInspector: receive account delta
  MidenAccountInspector->>guardian_shared_account_delta: reconstruct account with storage patch
  guardian_shared_account_delta->>Account: apply AccountPatch
  Account-->>MidenRpcClient: updated account state
Loading

Possibly related PRs

Suggested reviewers: haseebrabbani, mcarlomagno

Poem

I’m a rabbit with patches, hopping through the code,
Miden sixteen lights the upgrade road.
Scripts bloom with roots, RPC bindings gleam,
Rust tools march onward in a faster stream.
Version pins align, the docs softly sing—
“Nibble the new APIs; spring is in everything!”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: upgrading Miden dependencies to the v0.16 line.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 329-upgrade-miden-016

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

codecov-commenter commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.73930% with 99 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.88%. Comparing base (2d94345) to head (cccd0b3).
⚠️ Report is 1 commits behind head on main.

❌ Your patch status has failed because the patch coverage (80.73%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #331      +/-   ##
==========================================
+ Coverage   77.76%   77.88%   +0.11%     
==========================================
  Files         167      168       +1     
  Lines       30778    31086     +308     
==========================================
+ Hits        23934    24210     +276     
- Misses       6844     6876      +32     

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2d94345...cccd0b3. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zeljkoX
zeljkoX marked this pull request as ready for review July 21, 2026 14:23
@zeljkoX
zeljkoX requested a review from haseebrabbani as a code owner July 21, 2026 14:23
@zeljkoX
zeljkoX requested a review from Copilot July 21, 2026 14:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Upgrades Guardian’s Rust workspace, TypeScript SDKs, and examples to the Miden v0.16 pre-release line, including the related protocol/API migrations (delta→patch, MASM authoring updates) and synchronized regenerated artifacts (procedure roots, kernel commitment, fixtures).

Changes:

  • Bump Rust toolchain/MSRV and pin Rust Miden dependencies to exact 0.16.0-alpha.* versions.
  • Migrate core runtime paths (server/network, multisig SDK, contracts) to Miden 0.16 semantics (AccountPatch, new tx-script/MASM patterns, updated storage patch handling).
  • Update TS packages/examples to @miden-sdk/miden-sdk 0.16.0-alpha.1, refresh procedure roots/MASM, and update docs/specs for the new baseline.

Reviewed changes

Copilot reviewed 108 out of 117 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
speckit/features/329-upgrade-miden-016/spec.md Migration feature spec (0.16 baseline, scenarios/requirements).
speckit/features/329-upgrade-miden-016/release-notes-draft.md Draft breaking-change notes for 0.16 line.
speckit/features/329-upgrade-miden-016/quickstart.md Execution/runbook for the migration + validation gates.
speckit/features/329-upgrade-miden-016/plan.md Implementation plan and propagation checklist.
speckit/features/329-upgrade-miden-016/data-model.md Pin matrix + artifact/state inventory for 0.16.
speckit/features/329-upgrade-miden-016/contracts/compatibility-contract.md Compatibility guarantees for wire/artifact/version behavior.
speckit/features/329-upgrade-miden-016/checklists/requirements.md Spec quality checklist for the feature.
rust-toolchain.toml Bump toolchain channel to 1.96.1.
README.md Document new Miden 0.16 baseline + interoperability note.
packages/miden-multisig-client/src/procedures.ts Update procedure roots + add create_note.
packages/miden-multisig-client/src/account/masm/auth.ts MASM updates for 0.16 (imports, account procedures).
packages/miden-multisig-client/src/account/masm/account-components/auth.ts MASM pub use syntax updates for 0.16.
packages/miden-multisig-client/README.md Document TS SDK now targeting Miden 0.16 pre-releases.
packages/miden-multisig-client/package.json Bump package version + pin @miden-sdk/miden-sdk 0.16 alpha.
packages/miden-multisig-client/package-lock.json Lockfile refresh for new TS dependency pins.
packages/miden-multisig-client/masm/auth/multisig.masm Vendored MASM updated to 0.16 syntax/ops.
packages/miden-multisig-client/masm/auth/multisig_ecdsa.masm Vendored MASM updated to 0.16 syntax/ops.
packages/miden-multisig-client/masm/auth/guardian.masm Vendored MASM updated to 0.16 syntax/ops.
packages/miden-multisig-client/masm/auth/guardian_ecdsa.masm Vendored MASM updated to 0.16 syntax/ops.
packages/miden-multisig-client/masm/account_components/auth/multisig.masm Vendored account-components MASM syntax update.
packages/miden-multisig-client/masm/account_components/auth/multisig_guardian.masm Vendored account-components MASM syntax update.
packages/miden-multisig-client/masm/account_components/auth/multisig_guardian_ecdsa.masm Vendored account-components MASM syntax update.
packages/miden-multisig-client/masm/account_components/auth/multisig_ecdsa.masm Vendored account-components MASM syntax update.
packages/guardian-operator-client/package.json Bump package version to 0.16.0.
packages/guardian-operator-client/package-lock.json Lockfile version bump for operator client.
packages/guardian-evm-client/package.json Bump package version to 0.16.0.
packages/guardian-evm-client/package-lock.json Lockfile version bump for EVM client.
packages/guardian-client/package.json Bump package version to 0.16.0.
packages/guardian-client/package-lock.json Lockfile version bump for guardian client.
examples/web/package.json Pin @miden-sdk/* to 0.16 alpha + overrides for Para deps.
examples/web/package-lock.json Lockfile refresh for web example dependency graph.
examples/smoke-web/package.json Pin @miden-sdk/* to 0.16 alpha + overrides for Para deps.
examples/smoke-web/package-lock.json Lockfile refresh for smoke-web dependency graph.
examples/rust/src/multisig.rs Update tx script syntax to 0.16 form.
examples/rust/src/main.rs Remove debug mode + switch to account_patch nonce output.
examples/rust/rust-toolchain.toml Align example toolchain to 1.96.1.
examples/operator-smoke-web/package.json Pin @miden-sdk/miden-sdk to 0.16 alpha.
examples/operator-smoke-web/package-lock.json Lockfile refresh for operator smoke example.
examples/demo/src/actions/proposal_management.rs Update build_transfer_asset call signature.
examples/_shared/multisig-browser/package.json Pin @miden-sdk/* to 0.16 alpha + overrides for Para deps.
examples/_shared/multisig-browser/package-lock.json Lockfile refresh for shared browser package.
docs/TROUBLESHOOTING.md Add 0.15↔0.16 mismatch/reset troubleshooting entries.
docs/QUICKSTART.md Update quickstart notes for 0.16 baseline + resets.
docs/openapi.json Bump OpenAPI doc version to 0.16.0.
docs/openapi-evm.json Bump OpenAPI doc version to 0.16.0.
docs/openapi-dashboard.json Bump OpenAPI doc version to 0.16.0.
docs/openapi-client.json Bump OpenAPI doc version to 0.16.0.
docs/MULTISIG_SDK.md Update install/version matrix + tagging for 0.16 line.
docs/LOCAL_DEV.md Note node/version-line compatibility requirement.
docs/guides/postgres-tls/.env.example Add 0.16 baseline/version mismatch note.
docs/guides/observability/.env.example Add 0.16 baseline/version mismatch note.
docs/guides/miden-dashboard/.env.example Add 0.16 baseline/version mismatch note.
docs/guides/horizontal-scaling/.env.example Add 0.16 baseline/version mismatch note.
docs/guides/aws-signers/.env.example Add 0.16 baseline/version mismatch note.
Dockerfile Bump Rust base image to 1.96.1.
crates/shared/src/lookup_auth_message.rs Update AccountId dummy ctor for new callback flag param.
crates/shared/src/lib.rs Export new shared delta/patch helper module + auth API updates.
crates/shared/src/auth_request_message.rs Update AccountId dummy ctor for new callback flag param.
crates/shared/src/account_delta.rs New helper to apply AccountDelta via AccountPatch in 0.16.
crates/shared/Cargo.toml Use workspace rand dependency.
crates/server/src/testing/integration/lookup_helpers.rs Update AccountId dummy ctor signature.
crates/server/src/testing/helpers.rs Update delta construction to AccountStoragePatch + code param.
crates/server/src/testing/generate_fixtures.rs Update fixture generation to patches + shared delta applier.
crates/server/src/testing/fixtures/delta_1.json Regenerated 0.16 fixture values.
crates/server/src/testing/fixtures/delta_2.json Regenerated 0.16 fixture values.
crates/server/src/testing/fixtures/delta_3.json Regenerated 0.16 fixture values.
crates/server/src/testing/fixtures/commitments.json Regenerated 0.16 fixture commitments.
crates/server/src/testing/e2e/switch_guardian_canonicalization.rs Update tx-script syntax + apply_patch usage.
crates/server/src/storage/filesystem.rs Sort deltas using Reverse key (style change).
crates/server/src/services/dashboard_account_snapshot.rs Use NF asset id (not vault_key) for dashboard snapshot.
crates/server/src/network/miden/mod.rs Apply deltas via patch model + custom delta-merge helper.
crates/server/src/network/miden/account_inspector.rs Update storage map key access API usage.
crates/server/src/metadata/auth/miden_falcon_rpo.rs Update AccountId dummy ctor signature.
crates/server/src/metadata/auth/miden_ecdsa.rs Update AccountId dummy ctor signature.
crates/server/src/evm/session.rs rand trait import adjustment for token generation.
crates/server/src/delta_summary/projection.rs Update note/tag handling + storage/vault projection for 0.16.
crates/server/src/delta_summary/build.rs Update note creation pattern for 0.16 builder API.
crates/server/src/dashboard/cursor.rs rand trait import adjustment for cursor secret generation.
crates/server/Cargo.toml Move miden-protocol testing feature to dev-deps; workspace rand.
crates/server/bench/loadgen/src/scenarios.rs Update delta construction for AccountStoragePatch + code param.
crates/miden-rpc-client/src/lib.rs Switch to miden-node-proto-build-generated bindings include!.
crates/miden-rpc-client/Cargo.toml Add build-deps for proto codegen; remove direct proto dep.
crates/miden-rpc-client/build.rs Generate tonic bindings wrapper for stable include path.
crates/miden-multisig-client/src/transaction/payment.rs Update P2ID note/send-script building for 0.16 APIs.
crates/miden-multisig-client/src/transaction/mod.rs Update salt RNG call + kernel commitment constant.
crates/miden-multisig-client/src/transaction/guardian.rs Update tx-script syntax to 0.16 form.
crates/miden-multisig-client/src/transaction/configuration/config.rs Update tx-script syntax to 0.16 form.
crates/miden-multisig-client/src/transaction/builder.rs Update asset builder signature + delta constructors in tests.
crates/miden-multisig-client/src/proposal.rs Update delta constructors in tests.
crates/miden-multisig-client/src/procedures.rs Add CreateNote procedure + updated roots and tests.
crates/miden-multisig-client/src/export.rs Update delta constructors in tests.
crates/miden-multisig-client/src/execution.rs Update asset transfer helper for 0.16 callback semantics.
crates/miden-multisig-client/src/client/proposals.rs Update delta constructors in tests.
crates/miden-multisig-client/src/client/helpers.rs Switch local account rebuild to account_patch apply path.
crates/miden-multisig-client/src/client/account.rs Update RNG fill + delta apply via shared helper.
crates/miden-multisig-client/src/builder.rs Remove debug-mode usage in client builder.
crates/miden-multisig-client/src/account.rs Update storage map key API usage.
crates/miden-multisig-client/examples/procedure_roots.rs Include create_note root mapping in generator output.
crates/miden-multisig-client/Cargo.toml Bump internal crate versions to =0.16.0.
crates/miden-keystore/src/keystore.rs Update rand trait bounds/imports for new rand line.
crates/miden-keystore/Cargo.toml Use workspace rand dependency.
crates/contracts/tests/auth/multisig.rs Update tx-script syntax + patch APIs in contract tests.
crates/contracts/src/multisig_guardian.rs Update parity assertions to new 0.16-derived identities.
crates/contracts/src/masm_builder.rs Migrate MASM compilation/linking to 0.16 assembler/code builder APIs.
crates/contracts/masm/auth/multisig.masm MASM 0.16 import/op updates + account procedure annotations.
crates/contracts/masm/auth/multisig_ecdsa.masm MASM 0.16 import/op updates + account procedure annotations.
crates/contracts/masm/auth/guardian.masm MASM 0.16 import/op updates + account procedure annotations.
crates/contracts/masm/auth/guardian_ecdsa.masm MASM 0.16 import/op updates + account procedure annotations.
crates/contracts/masm/account_components/auth/multisig.masm MASM 0.16 pub use syntax update.
crates/contracts/masm/account_components/auth/multisig_guardian.masm MASM 0.16 pub use syntax update.
crates/contracts/masm/account_components/auth/multisig_guardian_ecdsa.masm MASM 0.16 pub use syntax update.
crates/contracts/masm/account_components/auth/multisig_ecdsa.masm MASM 0.16 pub use syntax update.
crates/contracts/Cargo.toml Bump guardian-shared version pin to 0.16.0.
crates/client/src/transaction.rs Update delta constructor signature in tests.
crates/client/Cargo.toml Bump guardian-shared version pin to 0.16.0.
Cargo.toml Bump workspace version/MSRV + exact-pin Miden 0.16 alphas + rand 0.10.
benchmarks/prod-server/src/operations.rs Update delta construction for AccountStoragePatch + code param.
AGENTS.md Update repo baseline statement to Miden 0.16 pre-release line.
.github/workflows/ci.yml Bump CI toolchain to 1.96.1 + add shared crate check.
.agents/skills/smoke-test-ts-multisig-sdk/SKILL.md Update pinned versions for 0.16 testing.
.agents/skills/smoke-test-rust-multisig-sdk/SKILL.md Update pinned versions for 0.16 testing.
Files not reviewed (8)
  • examples/_shared/multisig-browser/package-lock.json: Generated file
  • examples/operator-smoke-web/package-lock.json: Generated file
  • examples/smoke-web/package-lock.json: Generated file
  • examples/web/package-lock.json: Generated file
  • packages/guardian-client/package-lock.json: Generated file
  • packages/guardian-evm-client/package-lock.json: Generated file
  • packages/guardian-operator-client/package-lock.json: Generated file
  • packages/miden-multisig-client/package-lock.json: Generated file
Comments suppressed due to low confidence (2)

packages/miden-multisig-client/package.json:34

  • @openzeppelin/miden-multisig-client is bumped to 0.16.0, but it still depends on @openzeppelin/guardian-client as ^0.15.0. This allows installing an older guardian-client alongside the 0.16 multisig client, which is very likely incompatible with the new baseline/versioning policy. Align the dependency range with the 0.16 line.
    packages/miden-multisig-client/package-lock.json:16
  • The lockfile still records @openzeppelin/guardian-client as ^0.15.0, which is inconsistent with this package being versioned to 0.16.0 and will allow/record installing an older guardian-client. After aligning package.json, regenerate/update the lockfile entry to match the 0.16 line.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +481 to +488
fn merge_account_deltas(
base: miden_protocol::account::AccountDelta,
next: miden_protocol::account::AccountDelta,
) -> Result<miden_protocol::account::AccountDelta, String> {
let account_id = base.id();
let (mut storage, mut vault, code, nonce_delta) = base.into_parts();
let (next_storage, next_vault, next_code, next_nonce_delta) = next.into_parts();

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (3)
crates/shared/src/account_delta.rs (1)

66-94: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add test coverage for the nonce-zero-to-one reconstruction branch.

account_patch_from_delta special-cases the transition from Felt::ZERO to Felt::ONE (first transaction on an undeployed account) by rebuilding a full-state patch from the account's current slots. Neither existing test (applies_create_update_and_remove_storage_operations, converts_relative_vault_delta_to_absolute_patch) exercises this branch — both start accounts at Felt::ONE. Given this path feeds directly into server/client commitment reconstruction, it's worth a dedicated test.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/shared/src/account_delta.rs` around lines 66 - 94, Add a focused test
for account_patch_from_delta covering an account with nonce Felt::ZERO and a
delta nonce of Felt::ONE. Verify the reconstructed patch includes the account’s
existing storage and vault state along with the delta changes, and confirms the
resulting nonce is Felt::ONE; leave the existing tests unchanged.
crates/miden-multisig-client/src/procedures.rs (1)

189-193: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add ECDSA root coverage to this test.

The test validates ordering and roots only for MultisigGuardianBuilder; it cannot catch scheme-specific root mismatches in ECDSA accounts. Add an ECDSA account assertion before relying on these constants.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/miden-multisig-client/src/procedures.rs` around lines 189 - 193, Add
ECDSA account root coverage to the test around the existing
MultisigGuardianBuilder assertions, using the appropriate ECDSA account builder
or procedure-root assertion before validating the hard-coded roots. Keep the
existing ordering checks intact and ensure the new assertion verifies the
scheme-specific root against the expected ECDSA value.
crates/miden-multisig-client/src/client/helpers.rs (1)

375-387: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for the Miden 0.16 state and asset migrations.

  • crates/miden-multisig-client/src/client/helpers.rs#L375-L387: cover both full-state reconstruction and incremental apply_patch(...), including an upstream finalize flow.
  • crates/miden-multisig-client/src/execution.rs#L88-L94: replace the removed callback tests with a P2ID asset construction/execution test and invalid-input coverage.

Based on learnings, update tests in the layer where behavior changes and at least one upstream consumer; run targeted tests before the broader suite.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/miden-multisig-client/src/client/helpers.rs` around lines 375 - 387,
Update tests in crates/miden-multisig-client/src/client/helpers.rs around the
account reconstruction flow to cover both full-state Account reconstruction and
incremental apply_patch, including an upstream finalize flow. In
crates/miden-multisig-client/src/execution.rs, replace the removed callback
tests with coverage for P2ID asset construction and execution plus invalid-input
cases, then run the targeted tests before the broader suite.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/contracts/src/masm_builder.rs`:
- Around line 137-154: Cache the auth-support library assembled by
assemble_with_auth_support, including the parsed auth modules, so repeated
get_multisig_library, get_multisig_ecdsa_library, and get_guardian_library calls
do not re-read and re-parse every file under auth_dir(). Use OnceLock or Lazy at
the shared library/support boundary, preserve the existing assembly result and
error behavior, and ensure each target-library accessor reuses the cached value
across transaction-script builds.

In `@crates/server/src/services/dashboard_account_snapshot.rs`:
- Line 138: Add a value-level assertion to the snapshot test around the key_word
assignment, constructing a known non-fungible asset and verifying that vault_key
equals the hexadecimal representation of a.id().to_word(). Ensure the test
executes with at least one NFT so it would fail under the previous vault_key
behavior.

In `@crates/server/src/testing/e2e/switch_guardian_canonicalization.rs`:
- Around line 205-208: Update the expect message on the apply_patch call for
executed_account so it says “executed patch applies” instead of referring to an
executed delta.

---

Nitpick comments:
In `@crates/miden-multisig-client/src/client/helpers.rs`:
- Around line 375-387: Update tests in
crates/miden-multisig-client/src/client/helpers.rs around the account
reconstruction flow to cover both full-state Account reconstruction and
incremental apply_patch, including an upstream finalize flow. In
crates/miden-multisig-client/src/execution.rs, replace the removed callback
tests with coverage for P2ID asset construction and execution plus invalid-input
cases, then run the targeted tests before the broader suite.

In `@crates/miden-multisig-client/src/procedures.rs`:
- Around line 189-193: Add ECDSA account root coverage to the test around the
existing MultisigGuardianBuilder assertions, using the appropriate ECDSA account
builder or procedure-root assertion before validating the hard-coded roots. Keep
the existing ordering checks intact and ensure the new assertion verifies the
scheme-specific root against the expected ECDSA value.

In `@crates/shared/src/account_delta.rs`:
- Around line 66-94: Add a focused test for account_patch_from_delta covering an
account with nonce Felt::ZERO and a delta nonce of Felt::ONE. Verify the
reconstructed patch includes the account’s existing storage and vault state
along with the delta changes, and confirms the resulting nonce is Felt::ONE;
leave the existing tests unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 11a8b5ba-e204-404d-9bfe-66ef565034bd

📥 Commits

Reviewing files that changed from the base of the PR and between 2d94345 and cccd0b3.

⛔ Files ignored due to path filters (9)
  • Cargo.lock is excluded by !**/*.lock
  • examples/_shared/multisig-browser/package-lock.json is excluded by !**/package-lock.json
  • examples/operator-smoke-web/package-lock.json is excluded by !**/package-lock.json
  • examples/smoke-web/package-lock.json is excluded by !**/package-lock.json
  • examples/web/package-lock.json is excluded by !**/package-lock.json
  • packages/guardian-client/package-lock.json is excluded by !**/package-lock.json
  • packages/guardian-evm-client/package-lock.json is excluded by !**/package-lock.json
  • packages/guardian-operator-client/package-lock.json is excluded by !**/package-lock.json
  • packages/miden-multisig-client/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (108)
  • .agents/skills/smoke-test-rust-multisig-sdk/SKILL.md
  • .agents/skills/smoke-test-ts-multisig-sdk/SKILL.md
  • .github/workflows/ci.yml
  • AGENTS.md
  • Cargo.toml
  • Dockerfile
  • README.md
  • benchmarks/prod-server/src/operations.rs
  • crates/client/Cargo.toml
  • crates/client/src/transaction.rs
  • crates/contracts/Cargo.toml
  • crates/contracts/masm/account_components/auth/multisig.masm
  • crates/contracts/masm/account_components/auth/multisig_ecdsa.masm
  • crates/contracts/masm/account_components/auth/multisig_guardian.masm
  • crates/contracts/masm/account_components/auth/multisig_guardian_ecdsa.masm
  • crates/contracts/masm/auth/guardian.masm
  • crates/contracts/masm/auth/guardian_ecdsa.masm
  • crates/contracts/masm/auth/multisig.masm
  • crates/contracts/masm/auth/multisig_ecdsa.masm
  • crates/contracts/src/masm_builder.rs
  • crates/contracts/src/multisig_guardian.rs
  • crates/contracts/tests/auth/multisig.rs
  • crates/miden-keystore/Cargo.toml
  • crates/miden-keystore/src/keystore.rs
  • crates/miden-multisig-client/Cargo.toml
  • crates/miden-multisig-client/examples/procedure_roots.rs
  • crates/miden-multisig-client/src/account.rs
  • crates/miden-multisig-client/src/builder.rs
  • crates/miden-multisig-client/src/client/account.rs
  • crates/miden-multisig-client/src/client/helpers.rs
  • crates/miden-multisig-client/src/client/proposals.rs
  • crates/miden-multisig-client/src/execution.rs
  • crates/miden-multisig-client/src/export.rs
  • crates/miden-multisig-client/src/procedures.rs
  • crates/miden-multisig-client/src/proposal.rs
  • crates/miden-multisig-client/src/transaction/builder.rs
  • crates/miden-multisig-client/src/transaction/configuration/config.rs
  • crates/miden-multisig-client/src/transaction/guardian.rs
  • crates/miden-multisig-client/src/transaction/mod.rs
  • crates/miden-multisig-client/src/transaction/payment.rs
  • crates/miden-rpc-client/Cargo.toml
  • crates/miden-rpc-client/build.rs
  • crates/miden-rpc-client/src/lib.rs
  • crates/server/Cargo.toml
  • crates/server/bench/loadgen/src/scenarios.rs
  • crates/server/src/dashboard/cursor.rs
  • crates/server/src/delta_summary/build.rs
  • crates/server/src/delta_summary/projection.rs
  • crates/server/src/evm/session.rs
  • crates/server/src/metadata/auth/miden_ecdsa.rs
  • crates/server/src/metadata/auth/miden_falcon_rpo.rs
  • crates/server/src/network/miden/account_inspector.rs
  • crates/server/src/network/miden/mod.rs
  • crates/server/src/services/dashboard_account_snapshot.rs
  • crates/server/src/storage/filesystem.rs
  • crates/server/src/testing/e2e/switch_guardian_canonicalization.rs
  • crates/server/src/testing/fixtures/account.json
  • crates/server/src/testing/fixtures/commitments.json
  • crates/server/src/testing/fixtures/delta_1.json
  • crates/server/src/testing/fixtures/delta_2.json
  • crates/server/src/testing/fixtures/delta_3.json
  • crates/server/src/testing/fixtures/keys.json
  • crates/server/src/testing/generate_fixtures.rs
  • crates/server/src/testing/helpers.rs
  • crates/server/src/testing/integration/lookup_helpers.rs
  • crates/shared/Cargo.toml
  • crates/shared/src/account_delta.rs
  • crates/shared/src/auth_request_message.rs
  • crates/shared/src/lib.rs
  • crates/shared/src/lookup_auth_message.rs
  • docs/LOCAL_DEV.md
  • docs/MULTISIG_SDK.md
  • docs/QUICKSTART.md
  • docs/TROUBLESHOOTING.md
  • docs/guides/aws-signers/.env.example
  • docs/guides/horizontal-scaling/.env.example
  • docs/guides/miden-dashboard/.env.example
  • docs/guides/observability/.env.example
  • docs/guides/postgres-tls/.env.example
  • docs/openapi-client.json
  • docs/openapi-dashboard.json
  • docs/openapi-evm.json
  • docs/openapi.json
  • examples/_shared/multisig-browser/package.json
  • examples/demo/src/actions/proposal_management.rs
  • examples/operator-smoke-web/package.json
  • examples/rust/rust-toolchain.toml
  • examples/rust/src/main.rs
  • examples/rust/src/multisig.rs
  • examples/smoke-web/package.json
  • examples/web/package.json
  • packages/guardian-client/package.json
  • packages/guardian-evm-client/package.json
  • packages/guardian-operator-client/package.json
  • packages/miden-multisig-client/README.md
  • packages/miden-multisig-client/masm/account_components/auth/multisig.masm
  • packages/miden-multisig-client/masm/account_components/auth/multisig_ecdsa.masm
  • packages/miden-multisig-client/masm/account_components/auth/multisig_guardian.masm
  • packages/miden-multisig-client/masm/account_components/auth/multisig_guardian_ecdsa.masm
  • packages/miden-multisig-client/masm/auth/guardian.masm
  • packages/miden-multisig-client/masm/auth/guardian_ecdsa.masm
  • packages/miden-multisig-client/masm/auth/multisig.masm
  • packages/miden-multisig-client/masm/auth/multisig_ecdsa.masm
  • packages/miden-multisig-client/package.json
  • packages/miden-multisig-client/src/account/masm/account-components/auth.ts
  • packages/miden-multisig-client/src/account/masm/auth.ts
  • packages/miden-multisig-client/src/procedures.ts
  • rust-toolchain.toml
💤 Files with no reviewable changes (1)
  • crates/miden-multisig-client/src/builder.rs

Comment on lines +137 to 154
/// Assembles a single-root library with the `openzeppelin::auth` modules available as support.
fn assemble_with_auth_support(
package_name: &str,
root_path: &str,
code: String,
) -> Result<Library> {
let source_manager: Arc<dyn SourceManagerSync> = Arc::new(DefaultSourceManager::default());
let assembler = kernel_assembler(source_manager.clone())?;

let root = parse_module(root_path, code, source_manager.clone())?;
let support = parse_auth_modules(source_manager)?;

let library = assembler
.clone()
.assemble_library(modules)
.map_err(|e| anyhow!("failed to assemble openzeppelin library: {e:?}"))?;
.assemble_library(package_name, root, support)
.map_err(|e| anyhow!("failed to assemble {package_name} library: {e:?}"))?;

Ok((*library).clone())
Ok(*library)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Every get_*_library() call now re-parses all auth-dir MASM files, not just the target one.

assemble_with_auth_support calls parse_auth_modules, which re-reads and re-parses every file under auth_dir() as "support" on each invocation. get_multisig_library/get_multisig_ecdsa_library/get_guardian_library are called from the multisig client's transaction-script builders (e.g. build_update_signers_script in crates/miden-multisig-client/src/transaction/configuration/config.rs), which run once per transaction request — a real per-transaction cost, whereas previously only the single requested module was parsed. Consider caching the parsed/assembled libraries (e.g. via OnceLock/Lazy) rather than reassembling from disk on every call.

Also applies to: 251-271

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/contracts/src/masm_builder.rs` around lines 137 - 154, Cache the
auth-support library assembled by assemble_with_auth_support, including the
parsed auth modules, so repeated get_multisig_library,
get_multisig_ecdsa_library, and get_guardian_library calls do not re-read and
re-parse every file under auth_dir(). Use OnceLock or Lazy at the shared
library/support boundary, preserve the existing assembly result and error
behavior, and ensure each target-library accessor reuses the cached value across
transaction-script builds.

}),
Asset::NonFungible(a) => {
let key_word = a.vault_key().to_word();
let key_word = a.id().to_word();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add a value-level NFT identifier test.

The current snapshot test only checks formatting and may iterate zero NFTs, so it would pass with the old vault_key() behavior. Build a known non-fungible asset and assert vault_key equals a.id().to_word() hex.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/server/src/services/dashboard_account_snapshot.rs` at line 138, Add a
value-level assertion to the snapshot test around the key_word assignment,
constructing a known non-fungible asset and verifying that vault_key equals the
hexadecimal representation of a.id().to_word(). Ensure the test executes with at
least one NFT so it would fail under the previous vault_key behavior.

Source: Learnings

Comment on lines 205 to 208
let mut executed_account = multisig_account.clone();
executed_account
.apply_delta(executed_tx.account_delta())
.apply_patch(executed_tx.account_patch())
.expect("executed delta applies");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the stale patch-application error message.

Line 207 applies an account patch, but Line 208 still reports “executed delta applies,” which will misdirect debugging when the patch application fails. Rename it to “executed patch applies.”

Proposed fix
     executed_account
         .apply_patch(executed_tx.account_patch())
-        .expect("executed delta applies");
+        .expect("executed patch applies");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let mut executed_account = multisig_account.clone();
executed_account
.apply_delta(executed_tx.account_delta())
.apply_patch(executed_tx.account_patch())
.expect("executed delta applies");
let mut executed_account = multisig_account.clone();
executed_account
.apply_patch(executed_tx.account_patch())
.expect("executed patch applies");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/server/src/testing/e2e/switch_guardian_canonicalization.rs` around
lines 205 - 208, Update the expect message on the apply_patch call for
executed_account so it says “executed patch applies” instead of referring to an
executed delta.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants