Skip to content

Commit

Permalink
nuking no-longer necessary compute_slotted_note_hiding_point_raw func
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Aug 2, 2024
1 parent 0e7b4ba commit cccbe91
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions noir-projects/aztec-nr/aztec/src/note/utils.nr
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@ use dep::protocol_types::{
};
use dep::std::{embedded_curve_ops::multi_scalar_mul, hash::from_field_unsafe};

pub fn compute_slotted_note_hiding_point_raw(storage_slot: Field, note_hiding_point: Point) -> Point {
pub fn compute_slotted_note_hash<Note, let N: u32, let M: u32>(note: Note) -> Field where Note: NoteInterface<N, M> {
let storage_slot = note.get_header().storage_slot;
let note_hiding_point = note.compute_note_hiding_point();

// 1. We derive the storage slot point by multiplying the storage slot with the generator G_slot.
// We use the unsafe version because the multi_scalar_mul will constrain the scalars.
let storage_slot_scalar = from_field_unsafe(storage_slot);
let storage_slot_point = multi_scalar_mul([G_slot], [storage_slot_scalar]);

// 2. Then we compute the slotted note hiding point by adding the storage slot point to the note hiding point.
storage_slot_point + note_hiding_point
}

pub fn compute_slotted_note_hash<Note, let N: u32, let M: u32>(note: Note) -> Field where Note: NoteInterface<N, M> {
let header = note.get_header();
let note_hiding_point = note.compute_note_hiding_point();
let slotted_note_hiding_point = storage_slot_point + note_hiding_point;

compute_slotted_note_hiding_point_raw(header.storage_slot, note_hiding_point).x
// 3. Finally, we return the slotted note hash which is the x-coordinate of the slotted note hiding point.
slotted_note_hiding_point.x
}

pub fn compute_siloed_nullifier<Note, let N: u32, let M: u32>(
Expand Down

0 comments on commit cccbe91

Please sign in to comment.