Skip to content

chore: switch back protocol dep to git next#2282

Open
juan518munoz wants to merge 4 commits into
nextfrom
jmunoz-update-miden-protocol
Open

chore: switch back protocol dep to git next#2282
juan518munoz wants to merge 4 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."

@juan518munoz juan518munoz Jun 24, 2026

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.

Should we make db changes like this (breaking)? Or rather remove throught a migration?

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.

In the future we will have to do this via migrations, and we do have the framework in place for such a situation.

However, this one would be particularly painful since (iiuc) it would require running through every public account's delta and calculating the absolute value instead.

This might be good practice but its also a waste of time since we would never apply this migration to any active network.

So this would just be an additional breaking change entry e.g.

[[entry]]
scope = "node"
impact = "breaking"
description = "Backwards incompatible database schema changes to align with new protocol."

@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

let account_patch = executed_tx.account_patch().clone();

// Prove transaction.
let tx_inputs: TransactionInputs = executed_tx.into();

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: (I think) you can do executed_tx.into_parts() and avoid cloning here

Comment on lines +30 to 31
ProofKind::Batch => Self::Batch(LocalBatchProver::new()),
ProofKind::Block => Self::Block(LocalBlockProver::new(MIN_PROOF_SECURITY_LEVEL)),

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.

Mostly just curious but do we know why only the batch prover's security level parameter was removed?

let prover = self.clone();

spawn_blocking_in_current_span(move || {
let executed_batch = BatchExecutor::new().execute(input).map_err(|e| {

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.

Is there a lot of overhead in creating a BatchExecutor? If so, might make sense to do something about it

Comment on lines +272 to +274
let executed_batch = BatchExecutor::new()
.execute(proposed_batch)
.map_err(BuildBatchError::ProveBatchError)?;

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.

Same here about instantiating a BatchExecutor

Comment on lines +123 to +124
let executed_batch =
BatchExecutor::new().execute(proposed_batch).map_err(|err| {

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.

Same here (and below with LocalBatchProver)

@@ -563,23 +601,8 @@

let mut entries: Vec<(Word, Word)> = Vec::new();

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.

We can type this better and make it Vec<(AssetVaultKey, Word)>

let lineage = Self::vault_lineage_id(account_id);
let prev_tree =
self.forest.latest_version(lineage).map(|version| TreeId::new(lineage, version));
assert!(!vault_patch.is_empty(), "expected the patch not to be empty");

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.

Let's add a sentence or section in the doc comments mentioning that this expects a non-empty patch and it panics otherwise

self.forest.latest_version(lineage).map(|version| TreeId::new(lineage, version));
assert!(!vault_patch.is_empty(), "expected the patch not to be empty");

let mut entries: Vec<(Word, Word)> = Vec::new();

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.

Same here about typing this better

Comment on lines 581 to 585
assert_eq!(prev_root, empty_smt_root(), "account should not be in the forest");
assert!(
self.forest.latest_version(lineage).is_none(),
"account should not be in the forest"
);

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 would also mention the panics in teh docs of this function


/// Inserts asset vault data into the forest for the specified account. Assumes that asset vault
/// for this account does not yet exist in the forest.
#[expect(clippy::unnecessary_wraps)]

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 remove Result<> from this function now, and this should propagate (I think) to some of the code that calls this

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.

3 participants