Skip to content

Commit

Permalink
fix: missed pr review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbinth committed Jun 27, 2024
1 parent fe6f096 commit 7aefa76
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
13 changes: 7 additions & 6 deletions miden-lib/asm/miden/kernels/tx/memory.masm
Original file line number Diff line number Diff line change
Expand Up @@ -916,16 +916,17 @@ export.get_consumed_note_metadata
mem_loadw
end

#! Returns a pointer to the memory address of the note's metadata.
#! Sets the metadata for a consumed note located at the specified memory address.
#!
#! Stack: [note_ptr]
#! Output: [metadata_ptr]
#! Stack: [note_ptr, NOTE_METADATA]
#! Output: [NOTE_METADATA]
#!
#! Where:
#! - note_ptr, the start memory address of the note.
#! - metadata_ptr, the memory address of the note's metadata.
export.get_consumed_note_metadata_ptr
#! - note_ptr, the memory address at which the consumed note data begins.
#! - NOTE_METADATA, the metadata of the consumed note.
export.set_consumed_note_metadata
push.CONSUMED_NOTE_METADATA_OFFSET add
mem_storew
end

#! Returns the note's args.
Expand Down
7 changes: 2 additions & 5 deletions miden-lib/asm/miden/kernels/tx/prologue.masm
Original file line number Diff line number Diff line change
Expand Up @@ -612,16 +612,13 @@ end
#!
#! Where:
#! - note_ptr, memory location for the input note.
#! - ARGS, user arguments passed to the note.
#! - NOTE_ARGS, user arguments passed to the note.
#! - NOTE_METADATA, note's metadata.
proc.process_note_args_and_metadata
padw adv_loadw dup.4 exec.memory::set_consumed_note_args
# => [note_ptr]

padw adv_loadw movup.4 exec.memory::get_consumed_note_metadata_ptr
# => [metadata_ptr, NOTE_METADATA]

mem_storew
padw adv_loadw movup.4 exec.memory::set_consumed_note_metadata
# => [NOTE_METADATA]
end

Expand Down
8 changes: 4 additions & 4 deletions objects/src/notes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ impl Note {
self.nullifier
}

/// Returns the note's authentication hash.
///
/// This value is used authenticate the note's presence in the note tree, it is computed as:
/// Returns a commitment to the note and its metadata.
///
/// > hash(NOTE_ID || NOTE_METADATA)
///
///
/// This value is used primarily for authenticating notes consumed when the are consumed
/// in a transaction.
pub fn hash(&self) -> Digest {
Hasher::merge(&[self.id().inner(), Word::from(self.metadata()).into()])
}
Expand Down

0 comments on commit 7aefa76

Please sign in to comment.