From 6ce30c568db87d36acb72f08062e595162f36cc0 Mon Sep 17 00:00:00 2001 From: benesjan Date: Tue, 1 Oct 2024 11:56:16 +0000 Subject: [PATCH] cleanup --- noir-projects/aztec-nr/aztec/src/macros/mod.nr | 2 +- noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr | 11 ++++++----- noir-projects/aztec-nr/aztec/src/note/note_field.nr | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/noir-projects/aztec-nr/aztec/src/macros/mod.nr b/noir-projects/aztec-nr/aztec/src/macros/mod.nr index 1b8f44e2315..257ce405cde 100644 --- a/noir-projects/aztec-nr/aztec/src/macros/mod.nr +++ b/noir-projects/aztec-nr/aztec/src/macros/mod.nr @@ -161,7 +161,7 @@ comptime fn generate_compute_note_hash_and_optionally_a_nullifier() -> Quoted { comptime fn generate_note_exports() -> Quoted { let notes = NOTES.values(); - // Second value in each tuple is `note_serialized_len` and that is ignored because it's only used when + // Second value in each tuple is `note_serialized_len` and that is ignored here because it's only used when // generating the `compute_note_hash_and_optionally_a_nullifier` function. notes.map( | (s, _, note_type_id, fields): (StructDefinition, u32, Field, [(Quoted, u32, bool)]) | { diff --git a/noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr b/noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr index d7e28f5d9f6..21a852b5604 100644 --- a/noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr +++ b/noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr @@ -7,9 +7,10 @@ use crate::note::{note_header::NoteHeader, note_getter_options::PropertySelector comptime global NOTE_HEADER_TYPE = type_of(NoteHeader::empty()); -// A map from note type to (note_struct_definition, serialized_note_length, note_type_id, fixed_fields, nullable_fields). -// The fixed and nullable fields contain the name of the struct member and the index of where it starts in -// the serialized note. +// A map from note type to (note_struct_definition, serialized_note_length, note_type_id, fields). +// `fields` is an array of tuples where each tuple contains the name of the field/struct member (e.g. `amount` +// in `TokenNote`), the index of where the serialized member starts in the serialized note and a flag indicating +// whether the field is nullable or not. comptime mut global NOTES: UHashMap> = UHashMap::default(); comptime fn compute_note_type_id(name: Quoted) -> Field { @@ -147,8 +148,8 @@ comptime fn generate_note_properties(s: StructDefinition) -> Quoted { } } -/// Generates note export for a given note struct. The export is a global variable that contains the note type id, -/// the note name and information about note fields. +/// Generates note export for a given note struct. The export is a global variable that contains note type id, +/// note name and information about note fields (field name, index and whether the field is nullable or not). pub(crate) comptime fn generate_note_export( s: StructDefinition, note_type_id: Field, diff --git a/noir-projects/aztec-nr/aztec/src/note/note_field.nr b/noir-projects/aztec-nr/aztec/src/note/note_field.nr index e5feb8e8105..35e7fbc282a 100644 --- a/noir-projects/aztec-nr/aztec/src/note/note_field.nr +++ b/noir-projects/aztec-nr/aztec/src/note/note_field.nr @@ -1,3 +1,4 @@ +// Used by macros when generating note export. pub struct NoteField { index: u32, nullable: bool