Skip to content

Commit

Permalink
fix: Implement correct nullifier root calculation in build_expected_b…
Browse files Browse the repository at this point in the history
…lock_header
  • Loading branch information
VolodymyrBg authored Mar 1, 2025
1 parent 67eb223 commit 9a2154b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions crates/block-producer/src/test_utils/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,25 @@ pub async fn build_expected_block_header(

let note_created_smt = note_created_smt_from_note_batches(block_output_notes(batches.iter()));

// Compute new nullifier root
let produced_nullifiers: Vec<Nullifier> =
batches.iter().flat_map(TransactionBatch::produced_nullifiers).collect();
let new_nullifier_root = {
let mut store_nullifiers = store.produced_nullifiers.read().await.clone();
for nullifier in produced_nullifiers {
store_nullifiers.insert(nullifier.inner(), []);
}
store_nullifiers.root()
};

// Build header
BlockHeader::new(
0,
last_block_header.hash(),
last_block_header.block_num() + 1,
new_chain_mmr_root,
new_account_root,
// FIXME: FILL IN CORRECT NULLIFIER ROOT
Digest::default(),
new_nullifier_root,
note_created_smt.root(),
Digest::default(),
Digest::default(),
Expand Down

0 comments on commit 9a2154b

Please sign in to comment.