Skip to content

chore: switch back protocol dep to git next#2282

Merged
igamigo merged 23 commits into
nextfrom
jmunoz-update-miden-protocol
Jul 7, 2026
Merged

chore: switch back protocol dep to git next#2282
igamigo merged 23 commits into
nextfrom
jmunoz-update-miden-protocol

Conversation

@juan518munoz

Copy link
Copy Markdown
Collaborator

Summary

Switch back miden protocol dependency from crates.io to github's next branch. Unsure if this is something to have addressed now, the main goal of the PR is to apply most recent changes of protocol as soon as possible on the miden-client.

Changelog

Most notable changes are Delta storages being replaced by Patch, and the removal of the fee field from transactions (to be replaced by batched fees).

[[entry]]
scope       = "protocol"
impact      = "breaking"
description = "Updated `miden-protocol` dependencies to use the `next` branch (v0.16). Block and transaction account updates now use the absolute `AccountPatch` representation instead of the relative `AccountDelta`, and the `miden-tx-batch-prover` crate was renamed to `miden-tx-batch`. The per-transaction fee was also removed following its removal from the protocol transaction kernel (https://github.com/0xMiden/protocol/pull/3108), so the `fee` field was dropped from the `TransactionHeader` gRPC message and from the store and validator transaction tables, and `ProvenTransaction` and `TransactionId` construction no longer take a fee."

Comment thread crates/store/src/db/migrations/001_initial.sql
@juan518munoz juan518munoz marked this pull request as ready for review June 24, 2026 22:00
@Mirko-von-Leipzig

Copy link
Copy Markdown
Collaborator

Thanks! Will begin reviewing. There are a handful of open PRs that I would like to squeeze in before merging this one.

@igamigo

igamigo commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Thanks! Will begin reviewing. There are a handful of open PRs that I would like to squeeze in before merging this one.

No hurries, I'm also planning on taking a look soon. Thanks!

@igamigo igamigo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not a full review, but I got through most of the non-test code

Comment thread bin/ntx-builder/src/actor/execute.rs Outdated
Comment thread bin/remote-prover/src/server/prover.rs
Comment thread bin/remote-prover/src/server/prover.rs
Comment thread crates/block-producer/src/batch_builder/mod.rs
Comment thread crates/rpc/src/server/api/submit_proven_tx_batch.rs Outdated
Comment thread crates/store/src/account_state_forest/mod.rs Outdated
Comment thread crates/store/src/account_state_forest/mod.rs
Comment thread crates/store/src/account_state_forest/mod.rs Outdated
Comment thread crates/store/src/account_state_forest/mod.rs
Comment thread crates/store/src/account_state_forest/mod.rs Outdated
@igamigo igamigo requested a review from SantiagoPittella July 3, 2026 15:30

@igamigo igamigo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks! I left some comments, most of which are quite minor. I think the only real question I have is related to how we fetch (and potentially reconstruct to insert to cache) the account vault details.

Comment thread bin/network-monitor/src/counter.rs Outdated
.expect("wallet tx only writes existing value slots");
}
let new_nonce = wallet.nonce() + account_delta.nonce_delta();
let new_nonce = account_patch.final_nonce().unwrap_or_else(|| wallet.nonce());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we could expect() here, instead of defaulting to the preivous nonce. If the transaction succeeded, the nonce should have been updated and if it's not, it'd be signaling a problem.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Marking as resolved as it was superseeded by the other comment

Comment thread bin/network-monitor/src/counter.rs Outdated
Comment on lines 213 to 222

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Actually looking at this could we not do wallet.apply_patch() directly?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You are correct, addressed in 05e49d5

Comment thread bin/network-monitor/src/counter.rs Outdated
storage_update: Option<(BenchmarkStorageUpdate, usize)>,
) -> AccountDelta {
let mut vault_delta = AccountVaultDelta::default();
) -> AccountPatch {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we can do AccountPatch::try_from here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure I'm following correctly, but building an AccountPatch from the received Account would imply converting the full account into a patch (note that it also requires cloning it), when in reality we only want to create a patch with a subset of its vault/storage, only the modified ones.

Comment thread bin/validator/src/tx_validation/mod.rs Outdated
},
#[error("transaction proof verification failed")]
ProofVerificationFailed(#[from] miden_tx::TransactionVerifierError),
ProofVerificationFailed(#[from] miden_protocol::errors::TransactionVerifierError),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: We can import the TransactionVerifierError

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added the error as an import in 05e49d5

Comment thread crates/store/src/db/models/queries/accounts/delta.rs
Comment thread crates/store/src/db/models/queries/accounts/delta.rs

/// Process wallet assets and return them as a fungible asset delta. Track the negative adjustments
/// for the respective faucets.
fn prepare_fungible_asset_update(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I could be wrong but it seems some of this setup could potentially be simplified with the delta to patch migration

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in 4d249bc

Comment thread crates/store/src/state/account.rs Outdated
Comment on lines +153 to +156
self.forest
.write()
.await
.cache_vault_keys(assets.iter().map(miden_protocol::asset::Asset::vault_key));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we may only want to cache here if the details are not in the "too many entries" category (this is what the storage map flow does, AFAIK)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall though, I may be missing something but these functions (both the new one and the previously-existing one related to storage maps) seem to be doing unnecessary work: they may be reading the whole set of key/values to just return LimitExceeded. cc @Mirko-von-Leipzig

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Somewhat addressed in 4d249bc

The query now runs with a LIMIT of AccountVaultDetails::MAX_RETURN_ENTRIES + 1 so then we can simply check with:

if assets.len() > AccountVaultDetails::MAX_RETURN_ENTRIES {
    return Ok(AccountVaultDetails::LimitExceeded);
}

This way we prevent fetching an excesive amount of entries in cases we now we will end up returning that enum variant.

Comment thread crates/store/src/account_state_forest/mod.rs

@SantiagoPittella SantiagoPittella left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's looking good in general. Added some nits. Also lets ensure addressing Ignacio's comments + a search of "delta" throughout the repository since I think there are a couple places that still reference the old name

Comment thread bin/network-monitor/src/counter.rs Outdated
Comment thread bin/ntx-builder/src/actor/mod.rs Outdated
Comment thread bin/ntx-builder/src/db/models/queries/mod.rs Outdated
@igamigo igamigo requested a review from Mirko-von-Leipzig July 4, 2026 20:20
Comment thread proto/build.rs Outdated
Comment on lines +15 to +16
// build_rs::output::rerun_if_changed("./proto");
// build_rs::output::rerun_if_changed("Cargo.toml");

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.

Is the removal of these intentional?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reverted in 315edbd, see the other comment for details.

Comment thread crates/store/src/account_state_forest/mod.rs Outdated
Comment thread crates/store/src/db/models/queries/accounts/delta.rs
Comment thread crates/store/src/db/models/queries/accounts/delta.rs

@kkovaacs kkovaacs 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.

Looks good to me, thank you!

@igamigo igamigo merged commit ad3b1f8 into next Jul 7, 2026
23 checks passed
@igamigo igamigo deleted the jmunoz-update-miden-protocol branch July 7, 2026 14:30
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.

5 participants