From f1e295f418dc977900f9a3810e9c348f5d128ded Mon Sep 17 00:00:00 2001 From: polydez <155382956+polydez@users.noreply.github.com> Date: Tue, 2 Jul 2024 19:46:43 +0500 Subject: [PATCH] refactor: migrate to the latest `miden-base` --- Cargo.lock | 6 +++--- .../block-producer/src/batch_builder/batch.rs | 20 +++++-------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8d0aa4ecc..9b3281f3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1563,7 +1563,7 @@ dependencies = [ [[package]] name = "miden-lib" version = "0.4.0" -source = "git+https://github.com/0xPolygonMiden/miden-base.git?branch=next#861837b2f5ce4771af3a627e7e06f8cdcb672e80" +source = "git+https://github.com/0xPolygonMiden/miden-base.git?branch=next#c29d1def0bca6a66115a6011df1171d836563b90" dependencies = [ "miden-assembly", "miden-objects", @@ -1710,7 +1710,7 @@ dependencies = [ [[package]] name = "miden-objects" version = "0.4.0" -source = "git+https://github.com/0xPolygonMiden/miden-base.git?branch=next#861837b2f5ce4771af3a627e7e06f8cdcb672e80" +source = "git+https://github.com/0xPolygonMiden/miden-base.git?branch=next#c29d1def0bca6a66115a6011df1171d836563b90" dependencies = [ "miden-assembly", "miden-core", @@ -1761,7 +1761,7 @@ dependencies = [ [[package]] name = "miden-tx" version = "0.4.0" -source = "git+https://github.com/0xPolygonMiden/miden-base.git?branch=next#861837b2f5ce4771af3a627e7e06f8cdcb672e80" +source = "git+https://github.com/0xPolygonMiden/miden-base.git?branch=next#c29d1def0bca6a66115a6011df1171d836563b90" dependencies = [ "miden-lib", "miden-objects", diff --git a/crates/block-producer/src/batch_builder/batch.rs b/crates/block-producer/src/batch_builder/batch.rs index be81a065e..e1736bded 100644 --- a/crates/block-producer/src/batch_builder/batch.rs +++ b/crates/block-producer/src/batch_builder/batch.rs @@ -63,13 +63,10 @@ impl TransactionBatch { } } // Check unauthenticated input notes for duplicates: - for note in tx.input_notes().iter() { - // Header is presented only for unauthenticated notes. - if let Some(header) = note.header() { - let id = header.id(); - if !unauthenticated_input_notes.insert(id) { - return Err(BuildBatchError::DuplicateUnauthenticatedNote(id, txs.clone())); - } + for note in tx.get_unauthenticated_notes() { + let id = note.id(); + if !unauthenticated_input_notes.insert(id) { + return Err(BuildBatchError::DuplicateUnauthenticatedNote(id, txs.clone())); } } } @@ -90,14 +87,7 @@ impl TransactionBatch { let id = input_note_header.id(); if let Some(output_note) = output_notes.remove(&id) { let input_hash = input_note_header.hash(); - - // TODO: substitute with just next line once [OutputNote::hash] is implemented - // let output_hash = output_note.hash(); - let OutputNote::Header(output_header) = output_note.shrink() else { - unreachable!() - }; - let output_hash = output_header.hash(); - + let output_hash = output_note.hash(); if output_hash != input_hash { return Err(BuildBatchError::NoteHashesMismatch { id,