Skip to content

fix: defer precompile claims in LocalTransactionProver - #3851

Open
PhilippGackstatter wants to merge 3 commits into
nextfrom
pgackst-rm-precompile-proofs
Open

fix: defer precompile claims in LocalTransactionProver#3851
PhilippGackstatter wants to merge 3 commits into
nextfrom
pgackst-rm-precompile-proofs

Conversation

@PhilippGackstatter

Copy link
Copy Markdown
Contributor

Changes

LocalTransactionProver::prove called miden_prover::prove_sync, which proves the VM execution and settles the transaction's precompile claims. TransactionVerifier::verify rejects settled precompile work by design, so a locally proven ECDSA-authenticated transaction could never pass transaction verification, and the wasted precompile STARK dominated local prove time. Precompile claims now stay deferred: one proof per batch will cover the claims of all its transactions (in a follow-up).

  • miden-tx: the prover runs FastProcessor::execute_for_proving_sync and then Prover::prove, the deferred counterpart of prove_full that prove_sync uses. prove_partial_sync no longer exists in miden-prover 0.32.1; that free-function family collapsed onto Prover.
  • miden-protocol: ProposedBatch no longer rejects transactions whose precompile claims are outstanding, in new or on deserialization. As discussed on the issue, settling those claims belongs to the batch prover, which merges the witnesses of all transactions in the batch into a single precompile proof.

Closes #3835.

Performance

Measured locally with make bench-tx against origin/next: ECDSA execute-and-prove drops from 1.24 s to 561 ms for the single-P2ID scenario and from 1.23 s to 560 ms for the two-P2ID scenario. Falcon is unchanged for single-P2ID and 0.6% slower for two-P2ID, which is the cost of losing prove_sync's overlapped execution/trace-build path: Prover::prove_full_trace is private upstream and has no partial counterpart. That overlap should be fine not to expose as it is planned to avoid re-execution during proving (issue to be created).

Until batch-level settlement lands, a batch containing an ECDSA transaction is accepted by ProposedBatch but its precompile claims are never proven. The batch prover still rejects precompile work outright, and the batch kernel does not yet verify a merged precompile proof.

@PhilippGackstatter PhilippGackstatter added the pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority label Sep 11, 2026
@PhilippGackstatter
PhilippGackstatter force-pushed the pgackst-rm-precompile-proofs branch from 78e84d1 to c2b5508 Compare September 11, 2026 12:57
@PhilippGackstatter
PhilippGackstatter marked this pull request as ready for review September 11, 2026 13:13
Comment thread CHANGELOG.md
@huitseeker
huitseeker requested a review from adr1anh September 11, 2026 14:11

@huitseeker huitseeker 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 overall, raised a test gap, happy to otherwise stamp once we discuss it a bit.

///
/// Transactions whose precompile claims are still outstanding are accepted: verification checks
/// that their deferred witness matches their VM proof, and the batch prover settles the claims
/// of all transactions in the batch with a single precompile proof.

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.

nit: LocalBatchProver does not yet merge or prove transaction precompile wires, and the batch kernel still ignores transactions. Fine if we intend to merge before this goes in a release, otherwise we could describe this as planned settlement here and in the changelog.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm working on a follow-up PR that I intend to stack on this one that implements merging the precompiles during batch building, so I would skip describing the planned settlement here.

Comment thread crates/miden-protocol/src/batch/proposed_batch.rs

@bobbinth bobbinth 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! Thank you! I mostly focused on non-test code and left a couple of small comments inline.

Comment thread CHANGELOG.md
### Changes

- Added type signatures where missing throughout the protocol and standards Miden Assembly libraries
- `LocalTransactionProver` now leaves precompile claims deferred for the batch prover to settle, instead of proving them per transaction ([#3851](https://github.com/0xMiden/protocol/pull/3851)).

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.

nit: I'd put this into the "fixes" section.

Comment on lines 519 to 525
// Reconstruct structurally without verifying the transactions' proofs.
ProposedBatch::new_batch_inner(
transactions,
block_header,
partial_blockchain,
unauthenticated_note_proofs,
)

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.

Not from this PR, but I wonder if this is a good idea to have the deserialization path skip transaction proof verification as this technically allows constructing proposed batches from invalid transactions.

On the other hand, this serialization code is something we should be removing shortly anyway (in favor of the protobuf serialization) - so, maybe the important part is to check the protobuf serialization to make sure we uphold the invariants there.

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

Labels

pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LocalTransactionProver proves precompile claims locally (prove_sync) instead of deferring them (prove_partial_sync)

4 participants