Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate batch kernel parts from miden-node #1112

Open
wants to merge 40 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6a696fd
feat: Add miden-batch-prover crate
PhilippGackstatter Jan 23, 2025
2b44b45
feat: Add `BatchId`
PhilippGackstatter Jan 24, 2025
71b5be9
Introduce `AccountUpdateError`
PhilippGackstatter Jan 24, 2025
792369a
feat: Add `ProposedBatch`
PhilippGackstatter Jan 24, 2025
4ca86ef
feat: Add `LocalBatchProver`
PhilippGackstatter Jan 24, 2025
206e47f
feat: Add `ProvenBatch`
PhilippGackstatter Jan 24, 2025
cf580af
feat: Migrate `LocalBatchProver` from node
PhilippGackstatter Jan 24, 2025
f28aa6f
chore: Rename `NoteAuthenticationInfo`
PhilippGackstatter Jan 27, 2025
4cc4453
feat:Add batch expiration block num
PhilippGackstatter Jan 27, 2025
53970f5
chore: Use core instead of std for `Display`
PhilippGackstatter Jan 27, 2025
5f50946
feat: Migrate `MockProvenTxBuilder`
PhilippGackstatter Jan 27, 2025
d961a78
feat: Test tx ordering in batches
PhilippGackstatter Jan 27, 2025
c3b3fe2
feat: Add `BatchAccountUpdate`
PhilippGackstatter Jan 27, 2025
43cbb81
chore: Extend test assertions
PhilippGackstatter Jan 28, 2025
c014be8
feat: Refactor and document batch output note tracker
PhilippGackstatter Jan 28, 2025
9f1be8b
feat: Add input/output notes commitment test
PhilippGackstatter Jan 28, 2025
5887560
feat: Remove `BlockNumber::from_usize`
PhilippGackstatter Jan 28, 2025
e8b4be4
feat: Check for duplicate input notes
PhilippGackstatter Jan 28, 2025
45dfa3f
feat: Add unauthenticated/authenticated scenario tests
PhilippGackstatter Jan 28, 2025
a7a9be2
chore: Misc doc fixes
PhilippGackstatter Jan 28, 2025
8ca80cd
feat: Move `ProposedBatch` and `ProvenBatch` to objects
PhilippGackstatter Jan 28, 2025
921c6d9
chore: Add changelog entry
PhilippGackstatter Jan 28, 2025
a4d4b1e
feat: Use MockChain for batch tests (partially)
PhilippGackstatter Jan 29, 2025
fda5530
chore: Move most validation to `ProposedBatch`
PhilippGackstatter Jan 29, 2025
18817bf
feat: Use MockChain for all tests
PhilippGackstatter Jan 29, 2025
63c0e08
feat: Implement note authentication and tests for it
PhilippGackstatter Jan 29, 2025
94d7382
feat: Verify transactions in batch
PhilippGackstatter Jan 29, 2025
46d01b0
chore: Document error conditions on proposed batch
PhilippGackstatter Jan 29, 2025
44d0330
feat: Check max input/output notes and account updates in batch
PhilippGackstatter Jan 29, 2025
5191aa5
feat: Check for duplicate transactions in batch
PhilippGackstatter Jan 30, 2025
fe51a24
feat: Add tests with a circular note dependency
PhilippGackstatter Jan 30, 2025
85d6ef5
feat: Rename batch prover crate
PhilippGackstatter Jan 30, 2025
4d6948b
chore: Address review comments
PhilippGackstatter Jan 30, 2025
8c01b15
chore: Unbox the `BlockHeader`
PhilippGackstatter Jan 30, 2025
81b3975
chore: Remove unused dependencies
PhilippGackstatter Jan 30, 2025
7dadd00
feat: Use `InputNotes` rather than `Vec`
PhilippGackstatter Jan 30, 2025
eefb495
feat: Compute batch ID as sequential hash over tx ID and account ID
PhilippGackstatter Jan 30, 2025
ec0ddd5
chore: Remove `BlockInclusionProof` and `NoteInclusionProofs`
PhilippGackstatter Jan 30, 2025
77bfc92
chore: Address more review comments
PhilippGackstatter Jan 30, 2025
d519962
chore: Move tests into dedicated file
PhilippGackstatter Jan 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- [BREAKING] Incremented minimum supported Rust version to 1.84.
- [BREAKING] Moved `generated` module from `miden-proving-service-client` crate to `tx_prover::generated` hierarchy (#1102).
- Implement transaction batch prover in Rust (#1112).

## 0.7.1 (2025-01-24) - `miden-objects` crate only

Expand Down
28 changes: 28 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ resolver = "2"
members = [
"bin/bench-tx",
"bin/proving-service",
"crates/miden-batch-prover",
"crates/miden-lib",
"crates/miden-objects",
"crates/miden-proving-service-client",
Expand Down
37 changes: 37 additions & 0 deletions crates/miden-batch-prover/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "miden-batch-prover"
PhilippGackstatter marked this conversation as resolved.
Show resolved Hide resolved
version = "0.8.0"
description = "Miden rollup batch executor and prover"
readme = "README.md"
categories = ["no-std"]
keywords = ["miden", "batch", "prover"]
license.workspace = true
authors.workspace = true
homepage.workspace = true
repository.workspace = true
rust-version.workspace = true
edition.workspace = true

[lib]
bench = false

[features]
default = ["std"]
std = ["assembly/std", "miden-objects/std", "miden-crypto/std", "miden-verifier/std", "vm-core/std", "vm-processor/std"]
testing = ["dep:rand", "dep:miden-lib", "dep:winterfell", "dep:anyhow"]

[dependencies]
anyhow = { version = "1.0", default-features = false, optional = true }
assembly = { workspace = true }
miden-crypto = { workspace = true }
miden-lib = { workspace = true, optional = true, features = ["testing"]}
miden-objects = { workspace = true }
miden-verifier = { workspace = true }
rand = { workspace = true, optional = true, features = ["small_rng"]}
thiserror = { workspace = true }
vm-core = { workspace = true }
vm-processor = { workspace = true }
winterfell = { version = "0.11", optional = true }

[dev-dependencies]
anyhow = { version = "1.0", features = ["std", "backtrace"] }
7 changes: 7 additions & 0 deletions crates/miden-batch-prover/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Miden Batch Prover

This crate contains tools for executing and proving Miden rollup transaction batches.

## License

This project is [MIT licensed](../LICENSE).
43 changes: 43 additions & 0 deletions crates/miden-batch-prover/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
use miden_objects::{
account::AccountId,
block::BlockNumber,
note::{NoteId, Nullifier},
transaction::TransactionId,
BatchAccountUpdateError,
};
use thiserror::Error;
use vm_processor::Digest;

/// Errors encountered while building a transaction batch.
#[derive(Debug, Error)]
pub enum BatchError {
#[error("transaction {second_transaction_id} consumes the note with nullifier {note_nullifier} that is also consumed by another transaction {first_transaction_id} in the batch")]
DuplicateInputNote {
note_nullifier: Nullifier,
first_transaction_id: TransactionId,
second_transaction_id: TransactionId,
},

#[error("transaction {second_transaction_id} creates the note with id {note_id} that is also created by another transaction {first_transaction_id} in the batch")]
DuplicateOutputNote {
note_id: NoteId,
first_transaction_id: TransactionId,
second_transaction_id: TransactionId,
},

#[error("note hashes mismatch for note {id}: (input: {input_hash}, output: {output_hash})")]
NoteHashesMismatch {
id: NoteId,
input_hash: Digest,
output_hash: Digest,
},

#[error("failed to merge transaction delta into account {account_id}")]
AccountUpdateError {
account_id: AccountId,
source: BatchAccountUpdateError,
},

#[error("unauthenticated input note with id {note_id} for which an inclusion proof was provided was not created in block {block_num}")]
UnauthenticatedNoteAuthenticationFailed { note_id: NoteId, block_num: BlockNumber },
}
16 changes: 16 additions & 0 deletions crates/miden-batch-prover/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#![no_std]

#[macro_use]
extern crate alloc;

#[cfg(feature = "std")]
extern crate std;

mod error;
pub use error::BatchError;

mod local_batch_prover;
pub use local_batch_prover::LocalBatchProver;

#[cfg(test)]
pub mod testing;
Loading
Loading