Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Database is now created during bootstrap process instead of on first startup.
- Data directory is no longer created but is instead expected to exist.
- The genesis block can no longer be configured which also removes the `store dump-genesis` command.
- [BREAKING] Use `AccountTree` and update account witness proto definitions (#783).

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

Expand Down
63 changes: 31 additions & 32 deletions Cargo.lock

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

11 changes: 2 additions & 9 deletions crates/block-producer/src/block_builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,21 +309,14 @@ impl TelemetryInjectorExt for ProposedBlock {
u32::try_from(self.created_nullifiers().len())
.expect("should have less than u32::MAX created nullifiers"),
);
let num_block_created_notes = self
.output_note_batches()
.iter()
.fold(0, |acc, output_notes| acc + output_notes.len());
let num_block_created_notes = self.batches().num_created_notes();
span.set_attribute(
"block.output_notes.count",
u32::try_from(num_block_created_notes)
.expect("should have less than u32::MAX output notes"),
);

let num_batch_created_notes = self
.batches()
.as_slice()
.iter()
.fold(0, |acc, batch| acc + batch.output_notes().len());
let num_batch_created_notes = self.batches().num_created_notes();
Comment on lines +312 to +319
Copy link
Collaborator

@igamigo igamigo Apr 18, 2025

Choose a reason for hiding this comment

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

Is this right? Seems like there is no difference between num_block_created_notes and num_batch_created_notes and so num_erased_notes will always be 0

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah yeah nice catch. It looks like the block variant is incorrect now.

ProposedBlock::output_note_batches should be used there it seems, though the naming is a bit confusing :)

I'll create an issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch!

span.set_attribute(
"block.batches.output_notes.count",
u32::try_from(num_batch_created_notes)
Expand Down
17 changes: 10 additions & 7 deletions crates/block-producer/src/test_utils/block.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use miden_objects::{
ACCOUNT_TREE_DEPTH, Digest,
Digest,
batch::ProvenBatch,
block::{
BlockAccountUpdate, BlockHeader, BlockNoteIndex, BlockNoteTree, OutputNoteBatch,
ProvenBlock,
AccountTree, BlockAccountUpdate, BlockHeader, BlockNoteIndex, BlockNoteTree,
OutputNoteBatch, ProvenBlock,
},
crypto::merkle::{Mmr, SimpleSmt},
crypto::merkle::Mmr,
note::Nullifier,
transaction::{OrderedTransactionHeaders, OutputNote},
};
Expand Down Expand Up @@ -34,7 +34,9 @@ pub async fn build_expected_block_header(
let new_account_root = {
let mut store_accounts = store.accounts.read().await.clone();
for (&account_id, update) in updated_accounts {
store_accounts.insert(account_id.into(), update.final_state_commitment().into());
store_accounts
.insert(account_id, update.final_state_commitment())
.expect("account IDs should be unique");
}

store_accounts.root()
Expand Down Expand Up @@ -71,7 +73,7 @@ pub async fn build_expected_block_header(

#[derive(Debug)]
pub struct MockBlockBuilder {
store_accounts: SimpleSmt<ACCOUNT_TREE_DEPTH>,
store_accounts: AccountTree,
store_chain_mmr: Mmr,
last_block_header: BlockHeader,

Expand Down Expand Up @@ -105,7 +107,8 @@ impl MockBlockBuilder {
pub fn account_updates(mut self, updated_accounts: Vec<BlockAccountUpdate>) -> Self {
for update in &updated_accounts {
self.store_accounts
.insert(update.account_id().into(), update.final_state_commitment().into());
.insert(update.account_id(), update.final_state_commitment())
.expect("account IDs should be unique");
}

self.updated_accounts = Some(updated_accounts);
Expand Down
Loading