Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## v0.9.0 (TBD)


- Adapt to the use of `TransactionHeader` in batches and blocks (#781).

## v0.8.0 (2025-03-26)

Expand Down
30 changes: 12 additions & 18 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ assert_matches = { version = "1.5" }
http = { version = "1.3" }
itertools = { version = "0.14" }
miden-air = { version = "0.13" }
miden-lib = { version = "0.8" }
miden-lib = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-verified-tx" }
miden-node-block-producer = { path = "crates/block-producer", version = "0.9" }
miden-node-proto = { path = "crates/proto", version = "0.9" }
miden-node-proto-build = { path = "proto", version = "0.9" }
miden-node-rpc = { path = "crates/rpc", version = "0.9" }
miden-node-store = { path = "crates/store", version = "0.9" }
miden-node-test-macro = { path = "crates/test-macro" }
miden-node-utils = { path = "crates/utils", version = "0.9" }
miden-objects = { version = "0.8" }
miden-objects = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-verified-tx" }
miden-processor = { version = "0.13" }
miden-tx = { version = "0.8" }
miden-tx = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-verified-tx" }
prost = { version = "0.13" }
rand = { version = "0.9" }
thiserror = { version = "2.0", default-features = false }
Expand Down
30 changes: 16 additions & 14 deletions bin/stress-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ version.workspace = true
workspace = true

[dependencies]
anyhow = { workspace = true }
clap = { version = "4.5", features = ["derive", "string"] }
miden-air = { workspace = true }
miden-block-prover = { version = "0.8", features = ["testing"] }
miden-lib = { workspace = true }
anyhow = { workspace = true }
clap = { version = "4.5", features = ["derive", "string"] }
miden-air = { workspace = true }
miden-block-prover = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-verified-tx", features = [
"testing",
] }
miden-lib = { workspace = true }
miden-node-block-producer = { workspace = true }
miden-node-proto = { workspace = true }
miden-node-store = { workspace = true }
miden-node-utils = { workspace = true }
miden-objects = { workspace = true, features = ["testing"] }
rand = { version = "0.9" }
rayon = { version = "1.5" }
tokio = { workspace = true, features = ["macros", "net", "rt-multi-thread", "sync", "time"] }
tonic = { workspace = true }
winterfell = { version = "0.12" }
miden-node-proto = { workspace = true }
miden-node-store = { workspace = true }
miden-node-utils = { workspace = true }
miden-objects = { workspace = true, features = ["testing"] }
rand = { version = "0.9" }
rayon = { version = "1.5" }
tokio = { workspace = true, features = ["macros", "net", "rt-multi-thread", "sync", "time"] }
tonic = { workspace = true }
winterfell = { version = "0.12" }
6 changes: 5 additions & 1 deletion bin/stress-test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ use miden_objects::{
rand::RpoRandomCoin,
},
note::{Note, NoteHeader, NoteId, NoteInclusionProof},
transaction::{InputNote, InputNotes, OutputNote, ProvenTransaction, ProvenTransactionBuilder},
transaction::{
InputNote, InputNotes, OutputNote, ProvenTransaction, ProvenTransactionBuilder,
TransactionHeader,
},
vm::ExecutionProof,
};
use rand::Rng;
Expand Down Expand Up @@ -359,6 +362,7 @@ fn create_batch(txs: &[ProvenTransaction], block_ref: &BlockHeader) -> ProvenBat
InputNotes::new(input_notes).unwrap(),
output_notes,
BlockNumber::from(u32::MAX),
txs.iter().map(TransactionHeader::from).collect(),
)
}

Expand Down
43 changes: 23 additions & 20 deletions crates/block-producer/Cargo.toml
Copy link
Collaborator

@Mirko-von-Leipzig Mirko-von-Leipzig Apr 1, 2025

Choose a reason for hiding this comment

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

Hmm. How are these toml changes passing the taplo lint check?

Are the lines too long and it gave up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was wondering about that too but I just ran make lint. I guess they're too long and that's what it fell back to.

Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,29 @@ workspace = true
tracing-forest = ["miden-node-utils/tracing-forest"]

[dependencies]
async-trait = { version = "0.1" }
futures = { version = "0.3" }
itertools = { workspace = true }
miden-block-prover = { version = "0.8" }
miden-lib = { workspace = true }
miden-node-proto = { workspace = true }
miden-node-utils = { workspace = true }
miden-objects = { workspace = true }
miden-processor = { workspace = true }
miden-proving-service-client = { version = "0.8", features = ["batch-prover", "block-prover"] }
miden-tx = { workspace = true }
miden-tx-batch-prover = { version = "0.8" }
rand = { version = "0.9" }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["macros", "net", "rt-multi-thread", "sync", "time"] }
tokio-stream = { workspace = true, features = ["net"] }
tonic = { workspace = true, features = ["transport"] }
tower-http = { workspace = true, features = ["util"] }
tracing = { workspace = true }
url = { workspace = true }
async-trait = { version = "0.1" }
futures = { version = "0.3" }
itertools = { workspace = true }
miden-block-prover = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-verified-tx" }
miden-lib = { workspace = true }
miden-node-proto = { workspace = true }
miden-node-utils = { workspace = true }
miden-objects = { workspace = true }
miden-processor = { workspace = true }
miden-proving-service-client = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-verified-tx", features = [
"batch-prover",
"block-prover",
] }
miden-tx = { workspace = true }
miden-tx-batch-prover = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-verified-tx" }
rand = { version = "0.9" }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["macros", "net", "rt-multi-thread", "sync", "time"] }
tokio-stream = { workspace = true, features = ["net"] }
tonic = { workspace = true, features = ["transport"] }
tower-http = { workspace = true, features = ["util"] }
tracing = { workspace = true }
url = { workspace = true }

[dev-dependencies]
assert_matches = { workspace = true }
Expand Down
8 changes: 4 additions & 4 deletions crates/block-producer/src/domain/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl AuthenticatedTransaction {
inputs: TransactionInputs,
) -> Result<AuthenticatedTransaction, VerifyTxError> {
let nullifiers_already_spent = tx
.get_nullifiers()
.nullifiers()
.filter(|nullifier| inputs.nullifiers.get(nullifier).copied().flatten().is_some())
.collect::<Vec<_>>();
if !nullifiers_already_spent.is_empty() {
Expand Down Expand Up @@ -86,7 +86,7 @@ impl AuthenticatedTransaction {
}

pub fn nullifiers(&self) -> impl Iterator<Item = Nullifier> + '_ {
self.inner.get_nullifiers()
self.inner.nullifiers()
}

pub fn output_notes(&self) -> impl Iterator<Item = NoteId> + '_ {
Expand All @@ -109,7 +109,7 @@ impl AuthenticatedTransaction {
/// not authenticated by the store inputs.
pub fn unauthenticated_notes(&self) -> impl Iterator<Item = NoteId> + '_ {
self.inner
.get_unauthenticated_notes()
.unauthenticated_notes()
.copied()
.map(|header| header.id())
.filter(|note_id| !self.notes_authenticated_by_store.contains(note_id))
Expand Down Expand Up @@ -143,7 +143,7 @@ impl AuthenticatedTransaction {
let inputs = TransactionInputs {
account_id: inner.account_id(),
account_commitment: store_account_state,
nullifiers: inner.get_nullifiers().map(|nullifier| (nullifier, None)).collect(),
nullifiers: inner.nullifiers().map(|nullifier| (nullifier, None)).collect(),
found_unauthenticated_notes: BTreeSet::default(),
current_block_height: 0.into(),
};
Expand Down
4 changes: 2 additions & 2 deletions crates/block-producer/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ impl StoreClient {
) -> Result<TransactionInputs, StoreError> {
let message = GetTransactionInputsRequest {
account_id: Some(proven_tx.account_id().into()),
nullifiers: proven_tx.get_nullifiers().map(Into::into).collect(),
nullifiers: proven_tx.nullifiers().map(Into::into).collect(),
unauthenticated_notes: proven_tx
.get_unauthenticated_notes()
.unauthenticated_notes()
.map(|note| note.id().into())
.collect(),
};
Expand Down
5 changes: 3 additions & 2 deletions crates/block-producer/src/test_utils/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use miden_objects::{
Digest,
batch::{BatchAccountUpdate, BatchId, ProvenBatch},
block::BlockNumber,
transaction::{InputNotes, ProvenTransaction},
transaction::{InputNotes, ProvenTransaction, TransactionHeader},
};

use crate::test_utils::MockProvenTxBuilder;
Expand Down Expand Up @@ -57,13 +57,14 @@ impl TransactionBatchConstructor for ProvenBatch {
}

ProvenBatch::new_unchecked(
BatchId::from_transactions(txs.into_iter()),
BatchId::from_transactions(txs.iter().copied()),
Digest::default(),
BlockNumber::GENESIS,
account_updates,
InputNotes::new_unchecked(input_notes),
output_notes,
BlockNumber::from(u32::MAX),
txs.into_iter().map(TransactionHeader::from).collect(),
)
}

Expand Down
1 change: 1 addition & 0 deletions crates/block-producer/src/test_utils/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ impl MockBlockBuilder {
self.updated_accounts.unwrap_or_default(),
created_notes,
self.produced_nullifiers.unwrap_or_default(),
vec![],
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/block-producer/src/test_utils/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ impl MockStoreSuccess {

let locked_notes = self.notes.read().await;
let found_unauthenticated_notes = proven_tx
.get_unauthenticated_notes()
.unauthenticated_notes()
.filter_map(|header| {
let id = header.id();
locked_notes.contains_key(&id).then_some(id)
Expand Down
2 changes: 2 additions & 0 deletions crates/store/src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ impl Db {
&notes,
block.created_nullifiers(),
block.updated_accounts(),
block.transactions(),
)?;

let _ = allow_acquire.send(());
Expand Down Expand Up @@ -626,6 +627,7 @@ impl Db {
&[],
&[],
genesis_block.updated_accounts(),
&[],
)?;

block_store.save_block_blocking(0.into(), &genesis_block.to_bytes())?;
Expand Down
22 changes: 10 additions & 12 deletions crates/store/src/db/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use miden_objects::{
block::{BlockAccountUpdate, BlockHeader, BlockNoteIndex, BlockNumber},
crypto::{hash::rpo::RpoDigest, merkle::MerklePath},
note::{NoteExecutionMode, NoteId, NoteInclusionProof, NoteMetadata, NoteType, Nullifier},
transaction::TransactionId,
transaction::{TransactionHeader, TransactionId},
utils::serde::{Deserializable, Serializable},
};
use rusqlite::{params, types::Value};
Expand Down Expand Up @@ -1084,23 +1084,20 @@ pub fn select_all_block_headers(transaction: &Transaction) -> Result<Vec<BlockHe
pub fn insert_transactions(
transaction: &Transaction,
block_num: BlockNumber,
accounts: &[BlockAccountUpdate],
transactions: &[TransactionHeader],
) -> Result<usize> {
let mut stmt = transaction.prepare_cached(insert_sql!(transactions {
transaction_id,
account_id,
block_num
}))?;
let mut count = 0;
for update in accounts {
let account_id = update.account_id();
for transaction_id in update.transactions() {
count += stmt.execute(params![
transaction_id.to_bytes(),
account_id.to_bytes(),
block_num.as_u32()
])?;
}
for tx in transactions {
count += stmt.execute(params![
tx.id().to_bytes(),
tx.account_id().to_bytes(),
block_num.as_u32()
])?;
}
Ok(count)
}
Expand Down Expand Up @@ -1231,13 +1228,14 @@ pub fn apply_block(
notes: &[(NoteRecord, Option<Nullifier>)],
nullifiers: &[Nullifier],
accounts: &[BlockAccountUpdate],
transactions: &[TransactionHeader],
) -> Result<usize> {
let mut count = 0;
// Note: ordering here is important as the relevant tables have FK dependencies.
count += insert_block_header(transaction, block_header)?;
count += upsert_accounts(transaction, accounts, block_header.block_num())?;
count += insert_notes(transaction, notes)?;
count += insert_transactions(transaction, block_header.block_num(), accounts)?;
count += insert_transactions(transaction, block_header.block_num(), transactions)?;
count += insert_nullifiers_for_block(transaction, nullifiers, block_header.block_num())?;
Ok(count)
}
Loading