Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Dec 12, 2023
1 parent ac1edc1 commit 5a21842
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions yarn-project/aztec-nr/aztec/src/history/note_inclusion.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use crate::{

context::PrivateContext,

pub fn prove_note_commitment_inclusion(
note_commitment: Fr,
block_number: u32, // The block at which we'll prove that the note exists
context: PrivateContext
) {
// 1) Get block header from oracle and ensure that the block is included in the archive.
let block_header = context.get_block_header(block_number);

// 4) Get the membership witness of the note in the note hash tree
let note_hash_tree_id = 2; // TODO(#3443)
let witness: MembershipWitness<NOTE_HASH_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT + 1> =
get_membership_witness(block_number, note_hash_tree_id, note_commitment);

// 5) Prove that the commitment is in the note hash tree
assert(
block_header.note_hash_tree_root == compute_merkle_root(note_commitment, witness.index, witness.path),
"Proving note inclusion failed"
);

// --> Now we have traversed the trees all the way up to blocks tree root.
}

pub fn prove_note_inclusion<Note, N>(
note_interface: NoteInterface<Note, N>,
note_with_header: Note,
block_number: u32, // The block at which we'll prove that the note exists
context: PrivateContext
) {
let note_commitment = note_utils::compute_unique_siloed_note_hash(ValueNoteMethods, note_with_header)

prove_note_commitment_inclusion(note_commitment, block_number, context);
}
Empty file.
Empty file.
Empty file.

0 comments on commit 5a21842

Please sign in to comment.